sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.98k stars 2.2k forks source link

get_historical_klines, futures #1202

Open localcreator opened 2 years ago

localcreator commented 2 years ago

how get_historical_klines for futures? I tried to do client=Client(apiKey,apiSec) candles = client.get_historical_klines('BNBUSDT', Client.KLINE_INTERVAL_2HOUR, "10 day ago UTC",klines_type=HistoricalKlinesType.FUTURES) but it doesn't work.

tom634 commented 2 years ago

bump, I have the same problem

noahverner1995 commented 2 years ago

Declare client = Client(api_key= api_key, api_secret= secret_key, tld= "com") Then run client.futures_klines(symbol="XRPBUSD", interval="5m", start_str = "30 minutes ago UTC").

However, there's a problem with futures_klines(**params) and that is the fact that it DOES NOT understand the start date string in UTC format, when it should just as get_historical_klines(**params) does

noahverner1995 commented 2 years ago

Declare client = Client(api_key= api_key, api_secret= secret_key, tld= "com") Then run client.futures_klines(symbol="XRPBUSD", interval="5m", start_str = "30 minutes ago UTC").

However, there's a problem with futures_klines(**params) and that is the fact that it DOES NOT understand the start date string in UTC format, when it should just as get_historical_klines(**params) does

Actually, I just realized that the right method to use in my case is futures_historical_klines(**params), so it should be run client.futures_historical_klines(symbol="XRPBUSD", interval="5m", start_str= "30 minutes ago UTC") instead.

The sentence above will return the corresponding OHLC prices of the last 6 5m candlesticks of the symbol "XRPBUSD" from Binance futures market