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.
@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?
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.
@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.
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?