holdings() function not sending latest price

Rekha
I noticed that holdings() has some time lag. It doesn't send the latest price during trading hours. Its unreliable since data is not updated.

Is it designed this way or it is a bug?
  • sujith
    Polling holdings API is not the correct way to check P&L. You need fetch the latest LTP from Websocket API or Quote API and use that for calculating P&L.
  • Rekha
    @sujith following your suggestion slowed the script. after a single holdings() call, I have to call quote API for each stock in holding.
    Any particular reason, why kite is not sending latest price data in holdings API? Can you take it to zerodha as a feedback and fix it?
  • sujith
    This is the design decision. Why do you have to call holdings multiple times. It will only change anyways when an order is placed or executed. Otherwise just updating P&L using live market data should be fine.
  • Rekha
    @sujith thats what I am doing. using holdings() once to get the holdings and then calling quote() on each holding to get the last traded price. this is what has slowed down the application by about 2 seconds.
Sign In or Register to comment.