Created
January 5, 2018 05:24
-
-
Save kakopappa/e4b5fce3de4285eaaaa523a186a1c964 to your computer and use it in GitHub Desktop.
Scan coinmarketcap and find good coins to buy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scan coinmarketcap and find good coins to buy | |
const CoinMarketCap = require('coinmarketcap-api') | |
const client = new CoinMarketCap() | |
client.getTicker({limit: 1000}).then( pairs => { | |
let filteredResult = pairs.filter(function(key) { | |
return (key.available_supply < 1500000); | |
}); | |
var fr = filteredResult.reduce(function (r, a) { | |
//r.push({symbol: a.symbol, rank: a.rank, supply: a.available_supply, price: a.price_usd}); | |
r.push({symbol: a.symbol, price: a.price_usd}); | |
return r; | |
}, []); | |
var sorted = fr.sort(function(a, b) { | |
return (a.rank > b.rank) ? 1 : ((b.rank > a.rank) ? -1 : 0) | |
//return (a.price > b.price) ? 1 : ((b.price > a.price) ? -1 : 0) | |
}); | |
console.log(sorted); | |
}).catch(console.error) | |
//client.getGlobal().then(console.log).catch(console.error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment