Skip to content

Instantly share code, notes, and snippets.

@matteoantoci
Created March 20, 2018 19:51
Show Gist options
  • Save matteoantoci/36cd36372802185b0a5a73dfe9563ea0 to your computer and use it in GitHub Desktop.
Save matteoantoci/36cd36372802185b0a5a73dfe9563ea0 to your computer and use it in GitHub Desktop.
Get top 50 coins on TradingView (Base: BTC, Exchange: Binance)
window
.fetch('https://scanner.tradingview.com/crypto/scan', {
body:
'{"filter":[{"left":"volume|60","operation":"nempty"},{"left":"exchange","operation":"equal","right":"BINANCE"},{"left":"name","operation":"match","right":"btc"}],"symbols":{"query":{"types":[]}},"columns":["name","change_abs|60","volume|60","name","subtype","pricescale","minmov","fractional","minmove2"],"sort":{"sortBy":"volume|60","sortOrder":"desc"},"options":{"lang":"en"},"range":[0,150]}',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
},
method: 'POST',
})
.then((res) => res.json())
.then(({ data }) => {
const top50 = data.slice(0, 50);
const coins = top50.map(({ d: item }) => {
const [name] = item;
const symbol = name.replace('BTC', '');
return symbol;
});
console.log(coins);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment