☰
Login
Signup
Home
›
Python client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.8K
All Categories
0
Incidents
153
Node JS client
40
Go client
793
.Net API client
378
Kite Publisher
537
.Net / VBA / Excel (3rd party)
457
Algorithms and Strategies
993
Java client
1.1K
API clients
404
PHP client
4K
Python client
346
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
April 2021
premjit
How can I get historical data of the last 100 open market(working days) days.
Vipul7779
April 2021
in
Python client
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)
#
Tagged:
kiteapi
Zerodha
Help
#python developer
premjit
April 2021
Include the list of holidays as given by exchange as well
Sign In
or
Register
to comment.