PnL of a Call or Put

I was trying to get PnL by Order ID, but if I have ordered same strike price (Same instrument Key) again. Then it was unable to provide the individual PnL of recent order. By PnL I was getting combine PnL of the order. The By which variable I could get the individual PnL? Please Help. Thank you.

Hi @RupiKaro,

Please note that we combine multiple orders into one gross P&L calculation. We don’t support breakdown.

can you please share the code to get gross PNL for options.

Tried this :

def check_pnl():
    url = "https://api.upstox.com/v2/portfolio/short-term-positions"
    payload = {}
    headers = {
        'Accept': 'application/json',
        'Authorization': f'Bearer {your_access_token}'
    }
    response = requests.request("GET", url, headers=headers, data=payload)
    print(response.text)


check_pnl()

Output :
{"status":"success","data":[]}

there is nothing inside data. I’m trying to code the PNL check before executing the trade, if PNL<max day loss then not to execute new order, so I need 0 when no trades done.

I have subtracted it from previous pnl. Problem solved. Thank you.