api/functions/history.js
function getLumenPrice() {
  return Promise.all([
    rp('https://poloniex.com/public?command=returnTicker')
      .then(data => {
        return parseFloat(JSON.parse(data).BTC_STR.last);
      })
      .catch(() => {
        return null;
      })
    ,
    rp('https://bittrex.com/api/v1.1/public/getticker?market=BTC-XLM')
      .then(data => {
        return parseFloat(JSON.parse(data).result.Last);
      })
      .catch(() => {
        return null;
      })
    ,
    rp('https://api.kraken.com/0/public/Ticker?pair=XLMXBT')
      .then(data => {
        return parseFloat(JSON.parse(data).result.XXLMXXBT.c[0]);
      })
      .catch(() => {
        return null;
      })
  ])
  .then(allPrices => {
    return _.round(_.mean(_.filter(allPrices, price => price !== null)), 8);
  })
}
function getLumenPrice() {
  return Promise.all([
    rp('https://poloniex.com/public?command=returnTicker')
      .then(data => {
        return parseFloat(JSON.parse(data).BTC_STR.last);
      })
      .catch(() => {
        return null;
      })
    ,
    rp('https://bittrex.com/api/v1.1/public/getticker?market=BTC-XLM')
      .then(data => {
        return parseFloat(JSON.parse(data).result.Last);
      })
      .catch(() => {
        return null;
      })
    ,
    rp('https://api.kraken.com/0/public/Ticker?pair=XLMXBT')
      .then(data => {
        return parseFloat(JSON.parse(data).result.XXLMXXBT.c[0]);
      })
      .catch(() => {
        return null;
      })
  ])
  .then(allPrices => {
    return _.round(_.mean(_.filter(allPrices, price => price !== null)), 8);
  })
}
function getLumenPrice ( ) { return Promise . all ( [ rp ( 'https://poloniex.com/public?command=returnTicker' ) . then ( data => { return parseFloat ( JSON . parse ( data ) . BTC_STR . last ) ; } ) . catch ( ( ) => { return null ; } ) , rp ( 'https://bittrex.com/api/v1.1/public/getticker?market=BTC-XLM' ) . then ( data => { return parseFloat ( JSON . parse ( data ) . result . Last ) ; } ) . catch ( ( ) => { return null ; } ) , rp ( 'https://api.kraken.com/0/public/Ticker?pair=XLMXBT' ) . then ( data => { return parseFloat ( JSON . parse ( data ) . result . XXLMXXBT . c [ 0 ] ) ; } ) . catch ( ( ) => { return null ; } ) ] ) . then ( allPrices => { return _ . round ( _ . mean ( _ . filter ( allPrices , price => price !== null ) ) , 8 ) ; } ) }
Get lumen price in terms of btc
Get lumen price in terms of btc