Skip to main content

Get Report Meta Data

Request

curl -X 'GET'
'https://api.upstox.com/v2/trade/profit-loss/metadata?start_date=01-04-2022&emd_date=30-03-2023&segment=EQ&financial_year=2223'
-H 'Content-Type: application/json'
-H 'accept: application/json'
-H 'Authorization: Bearer access_token'

Additional samples in various languages are available in the Sample Code section on this page.

Query Parameters

NameRequiredTypeDescription
from_datefalsestringDate from which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format
to_datefalsestringDate till which data needs to be fetched. from_date and to_date should fall under the same financial year as mentioned in financial_year attribute. Date in dd-mm-yyyy format
segmenttruestringSegment for which data is requested can be from the following options EQ - Equity, FO - Futures and Options, COM - Commodity, CD - Currency Derivatives
financial_yeartruestringFinancial year for which data has been requested. Concatenation of last 2 digits of from year and to year Sample:for 2021-2022, financial_year will be 2122. For the regex pattern applicable to this field, see the Field Pattern Appendix.
Responses

Response Body

{
"status": "success",
"data": {
"trades_count": 10,
"page_size_limit": 5000
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request. Typically success for successful operations.
dataobjectResponse data for brokerage
data.trades_countintegerTotal count of trades in the trade wise P and L report
data.page_size_limitintegerMaximum number of trades in a page of the trade wise P and L report API

Sample Code

A comprehensive set of examples is provided to illustrate various use cases and implementation scenarios for this API.

import requests

url = 'https://api.upstox.com/v2/trade/profit-loss/metadata'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}

params = {
'from_date': '05-11-2023',
'to_date': '19-12-2023',
'segment': 'EQ',
'financial_year': '2324'
}

response = requests.get(url, headers=headers, params=params)

print(response.status_code)
print(response.json())
Loading...