简体   繁体   中英

Retrieve all data for specific coin pair (Python-Binance API)

I have a bit of code that will download minute to minute data historically from binance, and combine it all into their own CSV. EG: BCHUSDT-1m-data.csv , BTCUSDT-1m-data.csv , etc for whatever pairs I want. However, I keep getting a requests.exceptions.ChunkedEncodingError connectionreset error 10054 (closed by remote host) .

Is there a better way to go about getting this information than using the client.get_historical_klines(interval) method? Ideally I would want even more granular data (30s, 15, or even 1s if at all possible historically). Thanks in advance!

Link to API: Python-Binance API

For less than 1m trades you need to use

trades = client.get_historical_trades(symbol='BNBBTC') 

or

trades = client.get_aggregate_trades(symbol='BNBBTC') 

The last one is better it cost less weight and contains more information Then if you want to combine it to candles/klines you can use pandas resample or ohlc function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM