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.