Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created September 15, 2020 04:06
Show Gist options
  • Save yuyasugano/e55dfb2771454da3e96cf9edd7645547 to your computer and use it in GitHub Desktop.
Save yuyasugano/e55dfb2771454da3e96cf9edd7645547 to your computer and use it in GitHub Desktop.
ccxt library in Python to fetch OHLCV data
#!/usr/bin/python
import ccxt
import time
binance = ccxt.binance()
if binance.has['fetchOHLCV']:
for symbol in binance.load_markets():
time.sleep (binance.rateLimit / 1000) # time.sleep wants seconds
print(symbol, binance.fetch_ohlcv(symbol, '1d')) # one day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment