How can I render my PnL from upstox, is it possible to fetch PnL or how do you guys usually fetch/record it?
Yes, you can obtain profit and loss information through the API.
To get profit and loss for the current trading day, refer to the Get Positions API. When you call this API, you’ll receive a pnl
field that represents the profit and loss for a specific stock.
For historical profit and loss, refer to the Profit and Loss Report API. This API provides buy_amount
and sell_amount
for each trade, which you can use to calculate your overall profit and loss.
Additionally, you can check the Example Codes | Profit Loss Report and Example Codes | Get Positions for more detailed examples.
Thank you.