It looks like you're new here. If you want to get involved, click one of these buttons!
def Export_Entire_Data(from_date, symbol,instrument):
data = pd.DataFrame(columns=['Date', 'Open', 'High', 'Low', 'Close', 'Volume'])
days = 100
interval = 'day'
k=0
entry = 0
while entry<days:
try:
tt__=pd.DataFrame()
tt__.iloc[0:0]
tt__=pd.DataFrame(kite.historical_data(instrument,from_date,from_date,interval))
tt_= tt__.head(1)
data.loc[k,"Date"] = tt_.loc[0, "date"]
data.loc[k,"Open"] = tt_.loc[0, "open"]
data.loc[k,"High"] = tt_.loc[0, "high"]
data.loc[k,"Low"] = tt_.loc[0, "low"]
data.loc[k,"Close"] = tt_.loc[0, "close"]
data.loc[k,"Volume"] = tt_.loc[0, "volume"]
from_date = from_date-timedelta(days=1)
k=k+1
entry=entry+1
except:
time.sleep(1)
#data.set_index("date",inplace=True)
return data
testdate = dt.datetime(2024, 1, 5)
Test_Token = df[df.tradingsymbol == "INFY"].index[0]
Hd_DF = Export_Entire_Data(testdate,"INFY",Test_Token)
print(Hd_DF)
Can you try increasing sleep time for example
You can refer to the FAQs to know more about the API rate limits.