Getting the data from kite positions is lagging, is there any fix?

aman007
Hi Everyone,

I am just trying to place an order based on the positional P/L, but when I am fetching data from kite.positions(), it's lagging too much(5-10) seconds and for those seconds giving the same answer. I am just trying to make my code based on P/L. and used kite.positions()['net'][x]['last_price'] or kite.positions()['net'][x]['m2m], and both of them are lagging. Is there any solution you suggest?
  • sujith
    You can check out this thread.
  • aman007
    Hi Sujith,
    I am not able to understand what you are trying to say, I just want to place orders based on current positions P/L. but in positions 'last_price' is not updating frequently. One more way I could think of is to get the data from the live ticker but that too is a infinite loop, so not able to stop that ltp in a variable and update it frequently.
  • sujith
    One shouldn't poll positions API to get the latest P&L, that is a bad practice. You need to use either Quote API or Websockets to fetch live market data and calculate P&L at your end.
  • aman007
    got it, thanks sujith :)
This discussion has been closed.