如何从 Python 获取币安未来币数据

时间:2021-04-27 12:59:37

标签: python cryptocurrency binance

我应该使用 binance.client 的什么函数来获取历史未来硬币数据?此脚本适用于现金符号,但不适用于未来的硬币。 “client.get_historical_klines”函数似乎无法下载未来的硬币数据,但我在Binance包中找不到正确的函数。

from binance.client import Client
from datetime import datetime

binance_api_key = '...'
binance_api_secret = '...'
symbol = 'BTCUSD_210924' #with 'BTCUSDT' for example works perfectly...
kline_size = '1h'
date_beg = datetime.strptime('1 Jan 2021', '%d %b %Y')
date_end = datetime.strptime('25 Apr 2021', '%d %b %Y')

client = Client(api_key=binance_api_key, api_secret=binance_api_secret)
raw = client.get_historical_klines(symbol, kline_size, date_beg.strftime("%d %b %Y %H:%M:%S"), date_end.strftime("%d %b %Y %H:%M:%S"))

0 个答案:

没有答案