Current Close from kite.historical_data()

Snehan
How to find 15 minutes current candle close from historical data
Code:z=kite.historical_data(11350786, "2020-08-01", "2020-08-13","15minute",0)
za=pd.DataFrame(z)
  • rakeshr
    We don't recommend using Historical data for live computation. Go through this thread.
  • Snehan
    Then what is use of kite.historical_data function?
  • ganeshv02
    @Snehan - I had the same question earlier too. Websockets give tick data and you have to construct the candle at your end. Not sure why the algo traders have to do all the coding themselves for the deficiencies in kiteConnect API. But this is what Zerodha provides. I continue to use historical data api for live market as it gives me the formed bar chart which is what I need.
  • kiteapi
    @ganeshv02 @Snehan

    :'( just subscribed (couple of hours back) to Historical Data and saw this! We pay higher to Zerodha for API and historical data compared to any other brokers in the industry, I still do not understand why there are so many short falls? The API team rather than making an effort to make API's better/improve and fix these short comings, all we see is references and pointers to other threads, where the work around is usually for us to fix with additional code + hefty code processing on our end slowing up entire thing.

    After I subscribed to API (couple of weeks back), I started seeing the short comings for the API like short falls/throttling/restrictions etc and now same with historical data :s :s
  • Snehan
    Any sample code for how to calculate RSI,Triangular MA,PSAR with tick data.

    Pleas let me kow
  • Snehan
    How to get multiple instruments data with kite.historical api ?
  • rakeshr
    rakeshr edited August 2020
    @Snehan @ganeshv02 @kiteapi
    Then what is use of kite.historical_data function?
    Historical data APIs as the name says suggest is designed for backtesting/fetching older data, not live candles. Though you can use it for the live candle, expect some delay in last candle formation for the reason stated here. As it's a data-heavy operation, continuous live polling of Historical data APIs can render a few Time-out instances as well. You need to handle those at your end.
    As for the above-stated reason, we better recommend using Websocket Streaming to form a candle at your end. If you want to go ahead for the live-polling of Historical Data, then you need to keep the factor of the above short-coming.
  • ganeshv02
    Thanks @rakeshr. Completely aware that historical api may have timeouts and may not be as fast as websocket streaming but you know our limitations too. I have added exception handling so program does not support in between.I am monitoring historical api timing in elasticsearch and grafana dashboard and I am happy with the performance so far. Thanks for your help as always.
  • ganeshv02
    @rakeshr - however I have a request. If the historical api can provide 5 minute candle for a period of 6 months then it will be really great. Currently I am able to query only 15 minute candle if the period is more than 2 months. 15 minute candle will be of no use if we want to back test for intraday algos.
  • sujith
    We don't store 5minute candles. We make those candles using minute candles on the fly.
    If we increase the number of candles then it may result in more frequent timeouts.
  • sujith
    All the restriction numbers are thought through and put there.
  • ganeshv02
    Thanks @sujith. In that case if you have minute candle for longer period (I don't know how long) then can you extend the 5 minute candle query interval for more than 100 days? Understand that historical api performance may slow down but at least it meets the purpose of back testing. Let me know your thoughts.
  • sujith
    The historical data API is provided not only for API users but also for all the platforms that use historical data like charting.
    I am afraid we can't make modifications to the historical data API. You can dump all the data at your end aftermarket hours and use that as the source for your strategies.
  • Snehan
    Thanks sujith,
    Can you please provide Any sample code for how to calculate RSI,Triangular MA,PSAR with tick data on 15 minute cadle
  • Snehan
    Thank you Ganesh,
    But is dont know how to built RSI for 15 minutes time frame with ticks data..should u get ticks data and store somewhere and built candle?
    Thanks
  • ganeshv02
    hi Snehan, Not sure I understand fully. You can use historical API to query for 15minute candle and store them in pandas dataframe and then calculate the RSI using the function in the github page. This is what I am doing.

  • Snehan
    Ganesh, If you dont mind can i have your number please
  • Snehan
    Hi Ganesh, I have to call Historical Api for very instrument its taking long time
Sign In or Register to comment.