I am comparing some values from an overnight option long position “API Response vs Upstox pro” platform.
Many parameters look just way too off? Could you please take a look.
Response from (portfolio/short-term-positions) API:
- Upstox Pro website shows correct pnl of -87.50. API showing different value (
- Upstox Pro website shows correct unrealised pnl of -87.50. API showing very large number (
- Upstox Pro website shows correct overnight buy amount (50 * 10.45 = 522.50). API showing something else (
- Upstox Pro website shows correct overnight buy price (10.45). API showing something else (
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???
Any update? This pnl fields are critical.
I have passed on your query to the concerned team and will get back to you soon.
Thank you so much @Pradeep_Jaiswar
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.
realized_pnl value is also wrong for overnight positions.
We were planning to add Upstox in our system & this one issue affecting many of our Upstox users to switch to the APIs.
Having wrong pnl is extremely critical issue & needs to be addressed on priority.
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.
@Pradeep_Jaiswar Any expected timeline for this? How come such a basic bug remained unnoticed for so long & why is this not being taken on priority?
I hope the team understands the importance of PnL numbers?
We understand the significance of PnL figures.
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.
@Pradeep_Jaiswar It is okay, take your own time…
Looks like I am the only one pushing for this. None of my clients even bothered to put a comment on this.
It is not affecting me, it is only affecting the clients using our app & they do not seem to care !
We assure you that our team is actively working on a resolution for this.
However, we request a bit of patience as this will take a reasonable amount of time to fix it.
Almost 2 months & you still expect me to keep patience.
I am putting this on social media now, this is absolute unprofessionalism.
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.