Last active
January 11, 2021 20:34
-
-
Save lvthillo/34ea19db6cd37be886fc43ff3f36b6be to your computer and use it in GitHub Desktop.
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
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