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.
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?
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.
@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.
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.
The last price must be fetched from the Quote API or websockets API, you are doing the same right?
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.
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.