How can I get historical data of the last 100 open market(working days) days.

Vipul7779
I am trying to get historical data for the last 100 working days If you have any suggestions or solutions please comment.

# Python code
if time_frame_type=="minute":
time_frame_duration = 10
period = 200
pastDays= ((int(time_frame_duration,0)*int(period,0))/375) + 1
#calculate saturday and sunday
if pastDays <= 7:
pastDays=pastDays+3
else:
pastDays = pastDays + ((pastDays/7) * 3)
from_date=current_date - timedelta(days=pastDays)
from_date_string=from_date.strftime("%Y-%m-%d %H:%M:%S")
historical_data=get_historical_data(instrument_token,time_frame,from_date_string,to_date_string)

#
  • premjit
    Include the list of holidays as given by exchange as well
Sign In or Register to comment.