☰
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
14.1K
All Categories
0
Incidents
158
Node JS client
43
Go client
801
.Net API client
386
Kite Publisher
537
.Net / VBA / Excel (3rd party)
465
Algorithms and Strategies
1K
Java client
1.1K
API clients
408
PHP client
4.1K
Python client
349
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.4K
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.