Skip to main content

Get Trade History

The Trade History API provides users with access to their historical trade and transaction data, allowing them to retrieve details of orders executed through Upstox platform. This API enables various use cases, including reviewing past month's trade activity, maintaining records for compliance or analysis, and other potential use case.

NOTE

Currently this API will give you data only for last 3 financial years.

Header Parameters

NameRequiredTypeDescription
AuthorizationtruestringRequires the format Bearer access_token where access_token is obtained from the Token API.
AccepttruestringDefines the content format the client expects, which should be set to application/json.

Query Parameters

NameRequiredTypeDescription
segmentfalsestringSegment for which data is requested can be from the following options, If not provide, will consider all the segment.
EQ - Equity
FO - Futures and Options
COM - Commodity
CD - Currency Derivatives
MF - Mutual funds
start_datetruestringDate from which data needs to be fetched. it should be within the last 3 financial years. Date format: YYYY-mm-dd.
end_datetruestringDate till data needs to be fetched. it should be within the last 3 financial years. Date format: YYYY-mm-dd.
page_numbertrueintegerPage number, the pages are starting from 1.
page_sizetrueintegerPage size for pagination.
Responses

Response Body

{
"status": "success",
"data": [
{
"exchange": "NSE",
"segment": "EQ",
"option_type": "",
"quantity": 1,
"amount": 2252.35,
"trade_id": "75217259",
"trade_date": "2023-03-28",
"transaction_type": "BUY",
"scrip_name": "RELIANCE",
"strike_price": "0.0",
"expiry": "",
"price": 2252.35,
"isin": "INE002A01018",
"symbol": "RELIANCE",
"instrument_token": "NSE_EQ|INE002A01018"
}
],
"errors": null,
"meta_data": {
"page": {
"page_number": 1,
"page_size": 15,
"total_records": 15,
"total_pages": 1
}
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request. Typically success for successful operations.
dataobject[]Response data for historical trade reports
data[].exchangestringExchange to which the order is associated. Valid exchanges can be found in the Exchange Appendix
data[].segmentstringSegment to which the order is associated.
Possible values: EQ, FO, CD, COM, MF.
data[].option_typestringOption type of the option contracts. Possible values: CE, PE.
Option type is available only in case of FO and CD segment.
data[].quantityintegerQuantity with which the order was placed.
data[].amountfloatTotal amount at which order is bought/sold.
data[].trade_idstringTrade ID generated from exchange towards traded transaction
data[].trade_datestringThe date on which the order was bought/sold
data[].transaction_typestringIndicates whether its a buy or sell order.
Possible values: BUY, SELL.
data[].scrip_namestringName of the scrip traded
data[].strike_pricefloatThe strike price for the option.
data[].expirystringExpiry date (for derivatives). Data format is YYYY-mm-dd.
data[].pricefloatPrice at which the traded quantity is traded.
data[].isinstringThis represents the standard ISIN for stocks listed on multiple exchanges.
ISIN is available in case of EQ and MF segment.
data[].symbolstringShows the trading symbol of the instrument.
Symbol is available in case of EQ and FO segment.
data[].instrument_tokenstringKey of the instrument. For the regex pattern applicable to this field, see the Field Pattern Appendix.
Instrument token is available in case of EQ and MF segment.
metadataobjectMeta data for historical trade data
metadata.pageobjectMeta data for page.
metadata.page.page_numberintegerPage number for pagination
metadata.page.page_sizeintegerPage size

Examples

A comprehensive set of examples is provided to illustrate various use cases and implementation scenarios for this API. To view detailed examples and access sample code, please refer to: API Examples.

Loading...