Upstox Pro website shows correct pnl of -87.50. API showing different value ("pnl": 435.0)?
Upstox Pro website shows correct unrealised pnl of -87.50. API showing very large number ("unrealised": -969387.5)?
Upstox Pro website shows correct overnight buy amount (50 * 10.45 = 522.50). API showing something else ("overnight_buy_amount": 969822.5)?
Upstox Pro website shows correct overnight buy price (10.45). API showing something else ("buy_price": 19396.45)?
These are very basic fields & I expect them to be correct. So I am not sure whether it is a bug or my lack of understanding of what these numbers mean???
Please note that intraday position pnl is correct. However, all pnl values seem to be calculated on a little delayed LTP. This is just by a visual comparison of pnls.
If possible, please use the latest ltp for pnl calc.
Understood. We appreciate you bringing this matter to our notice.
As previously mentioned, we are actively addressing this issue with our technical team as a top priority. We will provide you with an update as soon as possible.
At the moment, PnL numbers are calculated using the LTP cache, which has a 1-minute delay. We are planning to decrease this cache duration, with the ultimate goal of bringing it much closer to real-time.
We will be prioritizing this with our internal team and be assured that once we implement this adjustment, we will promptly notify you and continue to provide timely updates based on priority.
First of all, thank you your patience and brining this to our attention.
We had released updates to our Positions API a couple of weeks back, which we would recommend you to test again at your end.
However, having said that we would like to address the point that there will be a cache of upto 1 minute for response from Positions API so you might see a slightly outdated P&L for your positions
To get the current and real-time P&L, you can get LTP of the instrument via websockets and use the below formula to compute your current P&L pnl = (buy_value - sell_value) + (quantity * multiplier * ltp)
(All fields are available in the response of the API)
Hope this helps.
Let us know in case of any other queries or if you would like to connect with our team.
Any update on this? I am noticing it even now and just came across this thread. It’s been more than 8 months now and it’s hard time there should be a timeline to fix this critical issue.