1. I want to calculate PNL like in Kite positions page.. I was your post on this.. pnl = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier); what is multiplier here?
2. What is the formula to calculate Avg price provided there are multiple buy and sell order intraday on same instrument?
Average Price is available in Positions payload only for Open Positions, right? If the position is currently closed (buy quantity = sell quantity and quantity = 0) then the payload carries average_price = 0 as per documentation page sample JSON payloads.
Why you guys are not able to give the exact equation for PNL computation as per Positions page. I see various post with people are struggling for the same PNL calculation. Why cannot exact logic be give from Zerodha Side.
Moreever, free API providers like Fyers are giving live PNL in the positions API. We are paying 2000 rs here, why this simple things cannot be taken seriously.
Most of the traders will want to set an Exit/Close all positions if PNL crosses certain value (eg. - 5000) we also dont have Exit Positions API ! You guyz are asking to place the reverse orders for each open position. What if we exit the order from terminal and at the same time our code also places the reverse order.
These very simple and basic requirements needs to be understood by such a big broker.
This is the formula and everything is available in the API. Latest LTP is available on Quote API or Websocket API. pnl = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier);
@sujith Do you guys send PNL directly when the position is still open? Or do we have to always calculate it using the formula you mentioned above? And why you can not provide it directly?
Average Price is available in Positions payload only for Open Positions, right? If the position is currently closed (buy quantity = sell quantity and quantity = 0) then the payload carries average_price = 0 as per documentation page sample JSON payloads.
Yes, you are right. However, you should be able to compute the average using the day buy and sell values still part of the positions struct.
Why cannot exact logic be give from Zerodha Side.
Moreever, free API providers like Fyers are giving live PNL in the positions API.
We are paying 2000 rs here, why this simple things cannot be taken seriously.
Most of the traders will want to set an Exit/Close all positions if PNL crosses certain value (eg. - 5000) we also dont have Exit Positions API !
You guyz are asking to place the reverse orders for each open position. What if we exit the order from terminal and at the same time our code also places the reverse order.
These very simple and basic requirements needs to be understood by such a big broker.
API team not working actively is what i feel.
@ZerodhaAPI @sujith @ZerodhaAlgoTrading
I am wondering if I am missing something and not understanding your query.
pnl = (sellValue - buyValue) + (netQuantity * lastPrice * multiplier);