Getting All Coin Data with Binance API
This is how it works:
import requests
import json
import pandas as pd
binance_data = json.loads(requests.get('https://api.binance.com/api/v3/ticker/24hr').text)
binance_symbols = [_['symbol'] for _ in binance_data]
binance_symbols = pd.Series(binance_symbols)
mask = binance_symbols.str.contains('.*USDT')
binance_symbols = binance_symbols[mask]
selected_symbols = binance_symbols[:10] # Select symbols for api request
all_coins, interval, limit = [], '1d', 90 # last 90 (limit) days
for symbol in selected_symbols:
coin = json.loads(requests.get(f'https://api.binance.com/api/v3/klines?symbol={symbol}&interval={interval}&limit={limit}').text)
all_coins.append([float(_[4]) for _ in coin])
coins = pd.DataFrame(all_coins).T
coins.columns = selected_symbols