简体   繁体   English

检索特定硬币对的所有数据(Python-Binance API)

[英]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.我有一些代码可以从 binance 下载历史上每分钟的数据,并将它们全部组合到他们自己的 CSV 中。 EG: BCHUSDT-1m-data.csv , BTCUSDT-1m-data.csv , etc for whatever pairs I want.例如: BCHUSDT-1m-data.csvBTCUSDT-1m-data.csv等我想要的任何对。 However, I keep getting a requests.exceptions.ChunkedEncodingError connectionreset error 10054 (closed by remote host) .但是,我不断收到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?有没有比使用client.get_historical_klines(interval)方法更好的方法来获取此信息? Ideally I would want even more granular data (30s, 15, or even 1s if at all possible historically).理想情况下,我想要更细粒度的数据(30 秒、15 秒甚至 1 秒,如果在历史上可能的话)。 Thanks in advance!提前致谢!

Link to API: Python-Binance API链接到 API: Python-Binance API

For less than 1m trades you need to use对于少于 100 万笔交易,您需要使用

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.最后一个更好,它的重量更轻,包含更多信息如果你想将它结合到蜡烛/klines,你可以使用 pandas resample 或 ohlc function。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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