Skip to content

Instantly share code, notes, and snippets.

View matteoantoci's full-sized avatar

Matteo Antoci matteoantoci

View GitHub Profile
@matteoantoci
matteoantoci / tvTop50Coins.js
Created March 20, 2018 19:51
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())
@matteoantoci
matteoantoci / selectCoins.js
Created March 20, 2018 18:17
Select coins on CH
(function(win) {
const $ = win.jQuery;
const symbolsToSelect = ['ETH', 'XMR', 'LTC']; // <-- CUSTOMIZE THIS!!
const $selectableCoins = $('.ms-selectable .ms-list li');
const $selectedCoins = $('.ms-selection .ms-list li');
$selectedCoins.click();
const getCoinSelector = (symbol) =>
$selectableCoins.filter(function() {
const text = $(this).text();
return text.endsWith(`(${symbol})`);