简体   繁体   English

使用python循环从binance获取更多数据

[英]Fetching more data from binance using python loop

I am trying to fetch more than 500 rows of historical data from Binance website but I want more than 500 rows, how do i loop through it and fetch more?我正在尝试从 Binance 网站获取超过 500 行的历史数据,但我想要超过 500 行,我如何遍历它并获取更多?

The code i tried:我试过的代码:

candles= client.get_klines(symbol='ADABTC',interval=Client.KLINE_INTERVAL_1MINUTE)
    candles_data_frame=df(candles)

This code fetches 500 rows but i would expect more than 10000 rows of historical data.此代码获取 500 行,但我希望有超过 10000 行的历史数据。 Please let me know how should i get it.请让我知道我应该如何得到它。

Thanks谢谢

Add the startTime parameter to /api/v1/klines call.将 startTime 参数添加到 /api/v1/klines 调用。 Decrease it with each iteration by chosen interval and concat the results into one common array.每次迭代按选定的间隔减少它,并将结果连接到一个公共数组中。

https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#klinecandlestick-data the API documentation specifie the limit max at 1000. So in your case you can't get more than 1000 rows https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#klinecandlestick-data API 文档将限制最大值指定为 1000。所以在你的情况下你可以t 得到超过 1000 行

candles = client.get_klines(
    symbol='ADABTC',
    interval=Client.KLINE_INTERVAL_1MINUTE,
    limit=1000)
candles_data_frame = df(candles)

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

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