Developer API-Get Profit Loss Report Endpoint

I am working on Get Profit Loss Report for EQ segement.
My code-
def get_swing_pnl():
url =base_url+ f"trade/profit-loss/data"
end_date = (datetime.today().date())
start_date = end_date - timedelta(days=2)
data={
‘from_date’: ‘18-03-2025’,
‘to_date’: ‘19-03-2025’,
‘segment’: “EQ”,
‘financial_year’: ‘2425’,
‘page_number’: ‘1’,
‘page_size’: ‘4’
}
print(data)
headers = {
‘Accept’: ‘application/json’,
‘Authorization’: f’Bearer {access_token}’
}

response = requests.request("GET", url, headers=headers, data=data)

print(response.text)

Response–
{“status”:“error”,“errors”:[{“errorCode”:“”,“message”:“Required String parameter ‘segment’ is not present”,“propertyPath”:“segment”,“invalidValue”:null,“error_code”:“”,“property_path”:“segment”,“invalid_value”:null}]}

What am I missing here?

i want to add in uopstox in algorooms so pls guide me ..

Hi,

Please send the data in query parameters in URL.

Refer to: Get Trade-wise Profit and Loss Report Data | Upstox Developer API

Hope it helps!

Thanks & Regards

Hi,

Please watch this: https://www.youtube.com/watch?v=ugwLNtnw8aY