Does the "last_price" data in kite.positions() reflect the updated LTP of the corresponding scrips?

Amitrajit
Amitrajit edited September 2022 in Python client
With reference to this thread: https://kite.trade/forum/discussion/3166/getposition-is-not-having-updated-value, @sujith wrote that
It is not recommended to poll positions for updated P&L. You need to calculate that at your end using this formula:-
pnl = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier);
.
In that regard, is it okay to use the "last_price" that we get from kite.positions() to calculate PnL ? or should we use websocket data only?
  • rakeshr
    is it okay to use the "last_price" that we get from kite.positions() to calculate PnL ?
    The last price field in positions APIs is not updated in real-time, as it's designed to prioritize quantity and acquired average price fields. So, if you are looking for a real-time P&L update, you will have to use the last_price field from the websocket stream.
  • Amitrajit
    Thanks a lot!!
This discussion has been closed.