Downloading Historical data

akabrboghani
akabrboghani edited August 2017 in Python client
Hi,

I have few queries on the historical data.
1) Is it possible to download last 2 year data in multiple time frames (15 min to 1 day)
2) Is commodity data available for download?
3) Finally, does zerodha provide any script for downloading the data?

Thank you for your help.

Regards
  • sujith
    Hi @akabrboghani,
    1) Is it possible to download last 2 year data in multiple time frames (15 min to 1 day)
    You can download 2 year data in 15 min to 1 day interval for equity segment.
    2) Is commodity data available for download?
    Kite Connect supports historical data fetch only based on instrument token. Exchange re-uses instrument token once it is expired. Hence as of now, you can't fetch historical data for expired contracts. We are planning to come up with a feasible solution for this in future.
    3) Finally, does zerodha provide any script for downloading the data?
    Fetching historical data is just one API call. You can check out example here.
  • Dileep
    Hi @sujith is it possible to fetch multiple tokens historical data at once.? if i use the below code "records= kite.historical_data(instrument_token, from_date, to_date, interval)" .I need to put time. sleep(1) to avoid rate limit error.(i.e. 3 hits per second) for fetching one more token.If i subscribed for 200 instruments in the kite ticker then i need to wait 200 seconds for fetching the historical data for a instrument token.How to avoid this? can you guide me the best possible solution
  • rakeshr
    rakeshr edited June 2018
    @Dileep
    It is not possible to fetch historical data for multiple instruments in a single request.Historical data is provided for backtesting purpose only and not suitable for live strategies.
    What possibly, you can do is, generate candles by using tick data from websocket and store it at your end for how much ever period you want. You can fetch it from your database and do any operations you want.
    Go through this thread to know, about forming candles at your end from websocket.
  • shivadasharathi
    Hi,
    I am trying to download the historical data for SBI. I have subscription for historicl data as well.

    I am using the below code to fetch the data. It says invalid token,
    please let me know if anything is wrong in the code.


    from_ = "2018-01-03 12:00:00"
    to_ = "2018-01-05 12:00:00"
    df = kite.historical_data("SBIN", from_, to_, '30minute', True)

    Thanks
  • sujith
    You need to send the instrument token and not the trading symbol.
    You can find the instrument token from the instrument master dump.
  • itjockey
    Hi Team, i just need to know how do i download Nifty 50 Stocks 1 min historical data in excel with one click as it is time-consuming to go one by one 50 symbols. i am not tech guy i am trader so please help me out.
  • sujith
    You can check out HowUTrade. This is a third-party developers team who have built a wrapper around the Kite Connect APIs.

    Maybe @HowUTrade can help you out here.
  • rehmankhans
    how to download 15 min candle stick data of NSE stocks for a period of last 1 year
  • sujith
    You can check out the documentation here.
  • vikassaini09
    Hi Sujit,
    I know it will be very basic thing and silly query, but i am not a techie and nned your help further. As i have seen in above posts that you have given some code to download the data from kite chart. but i do not know how to use this code in order to download the data from kite chart. It will be of great help if you may provide a step by step guide or youtube video how to use this code. It will be of great help to me and others too.

    Also just wish to confirm that is this still valid as over a period of time, software and sites do changes their things..
  • sujith
    This is a historical data API and Kite charts use the same API to populate data.
    One needs a live Kite Connect and historical data subscription to fetch the data. If you are not aware of the programming then I would suggest hiring one of the freelancers who often hangout here.
    We don't provide support or solutions for writing strategies, it is outside the scope of the forum.
Sign In or Register to comment.