Skip to content

Instantly share code, notes, and snippets.

@lvthillo
Last active January 11, 2021 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lvthillo/34ea19db6cd37be886fc43ff3f36b6be to your computer and use it in GitHub Desktop.
Save lvthillo/34ea19db6cd37be886fc43ff3f36b6be to your computer and use it in GitHub Desktop.
import ccxt
import os
import re
# configure exchange
exchange = getattr(ccxt, 'binance')({
'apiKey': os.environ['APIKEY'],
'secret': os.environ['SECRET'],
'timeout': 10000,
'enableRateLimit': True
})
# load markets and all coin_pairs
exchange.load_markets()
coin_pairs = exchange.symbols
# list of coin pairs which are active and use BTC as base coin
valid_coin_pairs = []
# load only coin_pairs which match regex and are active
regex = '^.*/BTC'
for coin_pair in coin_pairs:
if re.match(regex, coin_pair) and exchange.markets[coin_pair]['active']:
valid_coin_pairs.append(coin_pair)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment