Position_book is not getting updated

maheshsolanke
is there any issue, while calling position book by a kite. positions() it's not getting updated.
Tagged:
  • sujith
    Can you elaborate what you field you are checking?
  • maheshsolanke
    thank you for your response, you were mentioned one formula to calculate pnl
    pnl = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier);

    I was checking the last_price, sell value buy value, pnl.
    we can calculate pnl from the above formula but as the position book is not getting updated we cant figure out which stocks make a position at that time.
  • sujith
    we can calculate pnl from the above formula but as the position book is not getting updated we cant figure out which stocks make a position at that time.
    We didn't understand, can you elaborate this?

    The last price must be fetched from the Quote API or websockets API, you are doing the same right?
  • maheshsolanke
    Actually. position book is not updating on the function call - kite.positions()
    so even if I have any positions in my trading account so that is not reflecting in my position book when I call positions through API.
    so the issue here is even if I call websocket API or quote API that won't be of any use because I'm not getting the information of updated positions made.
  • sujith
    It will update after a trade happens. You can add a 500ms delay and then pull positions.
  • maheshsolanke
    okay, but i'm calling kite. position() after every 30sec.
  • sujith
    That is weird. Are you saying the new position is not showing up or quantity is not updated after a trade?
  • maheshsolanke
    yes, the new position is not showing.
  • rakeshr
    @maheshsolanke
    We just tried reproducing the same scenario at our end. Place SBIN MIS and CNC MARKET order with different quantities added a few seconds delay and fetched positions. It's correctly showing the recently generated position of SBIN. You need to re-check your code/flow. If still facing the issue, you can paste your complete code here.
  • maheshsolanke
    okay will check, thanks @rakeshr and @sujith
  • SAPANKHUNTIA
    Regarding the delay, kindly suggest how to delay the callback from the websocket ?
  • rakeshr
    kindly suggest how to delay the callback from the websocket
    You can't delay the stream, it's a WebSocket stream. Didn't get you. Can you let us know, what are trying to do here?
Sign In or Register to comment.