how i can replace get_historical_klines with futures_klines in two codes
get_historical_klines
`from binance.client import Client
import pandas as pd
import talib as ta
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
from datetime import timedelta, date
import datetime
how i can replace
get_historical_klines
withfutures_klines
in two codesget_historical_klines
`from binance.client import Client import pandas as pd import talib as ta import matplotlib.pyplot as plt import numpy as np from datetime import datetime from datetime import timedelta, date import datetime
----------------------------------------------------------------
api_key = "" api_secret = "" client = Client(api_key, api_secret)
----------------------------------------------------------------
----------------------------------------------------------------
def GetHistoricalData(symbol, interval, fromDate, toDate): klines = client.get_historical_klines(symbol, interval, fromDate, toDate) df = pd.DataFrame(klines, columns=['dateTime', 'open', 'high', 'low', 'close', 'volume', 'closeTime', 'quoteAssetVolume', 'numberOfTrades', 'takerBuyBaseVol', 'takerBuyQuoteVol', 'ignore']) df.dateTime = pd.to_datetime(df.dateTime, unit='ms')# datetime avali be datetime jadval nesbat dade df['date'] = df.dateTime.dt.strftime("%d/%m/%Y")# دو ستون اضافه کرده با استفاده از dateTime و به عنوان رشتهه df['time'] = df.dateTime.dt.strftime("%H:%M:%S")
--------------------------------
interval = Client.KLINE_INTERVAL_1DAY
fromDate = str(datetime.datetime.strptime('20/06/2020', '%d/%m/%Y'))
toDate = str(datetime.datetime.strptime('02/01/2022', '%d/%m/%Y'))
symbol = "MKRUSDT"
df = GetHistoricalData(symbol, interval, toDate, toDate) df=df.astype({'open': 'float', 'high': 'float', 'low': 'float', 'close': 'float', 'volume': 'float'}) df.round({'open': 3, 'high': 3, 'low': 3, 'close': 3, 'volume': 3}) df['date'] = pd.to_datetime(df['date']) pd.set_option('display.max_rows', df.shape[0]+1)
----------------------------------------------------------------
----------------------------------------------------------------
df.set_index('date',drop=True, inplace=True)
df = df.drop([ 'time'], axis=1)
rng = pd.date_range(start=fromDate, periods=len(df), freq='D') rng= pd.DataFrame({'date':rng}) df.set_index(rng['date'],drop=True, inplace=True)
df['year'] = df.index.year df['month'] = df.index.month df['day'] = df.index.day df['hour'] = df.index.hour df['Day_of_week'] = df.index.dayofweek
test=df df`
futures_klines
`from binance.client import Client
import pandas as pd import datetime as dt from dateutil import parser import math import os.path import time from datetime import datetime
binance_api_key = ''
binance_api_secret = ''
binsizes = {"1m": 1, "5m": 5, "1h": 60, "1d": 1440} batch_size = 750 binance = Client(api_key=binance_api_key, api_secret=binance_api_secret,)
def binanceklines(symbol='ETHUSDT',interval='1m',limit=500,since="1 day ago UTC"): klines = binance.futures_klines(symbol='ETHUSDT',interval={'1m':Client.KLINE_INTERVAL_1MINUTE,'5m':Client.KLINE_INTERVAL_5MINUTE}[interval],since=since,limit=limit) data = pd.DataFrame(klines, columns = ['ts', 'o', 'h', 'l', 'c', 'v', 'close_time', 'quote_av', 'trades', 'tb_base_av', 'tb_quote_av', 'ignore' ]) data=data.apply(pd.to_numeric) data['ts'] = pd.to_datetime(data['ts'], unit='ms') data=data.set_index('ts') return data
df=binanceklines(limit=None)`