import requests
import pandas as pd
from binance.client import Client
from datetime import datetime
import datetime as dt
apikey=**my api
secret=**my api
startDT=dt.datetime(2022,9,1,00,00,00)
endDT=dt.datetime(2022,9,20,00,00,00)
#historical price data from binance api
symbol="BTCUSDT"
period="5m"
limit="500"
startTime=int(datetime.timestamp(startDT))
endTime=int(datetime.timestamp(endDT))
oi_data=requests.get(f'https://www.binance.com/futures/data/openInterestHist?symbol={symbol}&period={period}&limit={limit}&startTime=1663692242&endTime=1663695902')
oi_json=oi_data.json()
print(oi_json)
every time how much I tried using different startTime and endTime formats it returns the error
{'msg': "parameter 'startTime' is invalid.", 'code': -1130}
<Response [400]>
But if I remove the startTime and endTime parameters it returns the latest open interest values for the given limit