I want to calculate the pnl for a particular instrument (similar to what is shown in kite web positions tab). If I place multiple orders of same instrument throughout the day, each executed at different "average_price" (which I get from websocket order update). how to calculate the final average price for that instrument.
I went through multiple discussions like getposition-is-not-having-updated-value in the forum where it was suggested to calculate pnl our own instead of abusing order api every few seconds.
also went throughpnl calculation discussion but not clear how to get average of the day. giving an example/formula will help
https://kite.trade/docs/connect/v3/portfolio/#response-attributes_1