node-coinmarketcap icon indicating copy to clipboard operation
node-coinmarketcap copied to clipboard

How can I get a specific object key from getTop(100)? Or even get a specific object key from every listed coin?

Open steviecs opened this issue 7 years ago • 1 comments

steviecs avatar Feb 09 '18 18:02 steviecs

just get the coins and select the property from each object eg; if we want to get the top 100 coins;

coinmarketcap.multi(coins => {
    var coins = coins.getTop(100);
   console.log(coins)
}

we get the logs of 100 top coins now you can select each object by using the array.forEach() loop function;

properties we have: eg neo ``` { id: 'gas', name: 'Gas', symbol: 'GAS', rank: '77', price_usd: '17.7026', price_btc: '0.00244626', '24h_volume_usd': '4074580.0', market_cap_usd: '179298573.0', available_supply: '10128375.0', total_supply: '17190378.0', max_supply: '100000000.0', percent_change_1h: '0.03', percent_change_24h: '-4.53', percent_change_7d: '-26.58', last_updated: '1527498853' },


coins.forEach((coin)=>{ console.log(coin.id); })

cptiwari20 avatar May 28 '18 10:05 cptiwari20