Skip to main content

Get Trades

API to retrieve the list of all trades executed for the day. An order, initially submitted as one entity, can be executed in smaller segments based on market situation. Each of these partial executions constitutes a trade, and a single order may consist of several such trades.

Request

curl --location 'https://api.upstox.com/v2/order/trades/get-trades-for-day' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'

For additional samples in various languages, please refer to the Sample code section on this page.

Responses

Response Body

{
"status": "success",
"data": [
{
"exchange": "NSE",
"product": "D",
"trading_symbol": "GMRINFRA-EQ",
"tradingsymbol": "GMRINFRA-EQ",
"instrument_token": "151064324",
"order_type": "MARKET",
"transaction_type": "BUY",
"quantity": 1,
"exchange_order_id": "221013001021540",
"order_id": "221013001021539",
"exchange_timestamp": "03-Aug-2017 15:03:42",
"average_price": 299.4,
"trade_id": "50091502",
"order_ref_id": "udapi-aqwsed14356",
"order_timestamp": "23-Apr-2021 14:22:06"
}
]
}
NameTypeDescription
statusstringA string indicating the outcome of the request. Typically success for successful operations.
dataobject[]Response data for trades
data[].exchangestringExchange to which the order is associated. Valid exchanges can be found in the Exchange Appendix
data[].productstringSignifies if the order was either Intraday, Delivery or CO.
Possible values: I, D, CO, MTF.
data[].trading_symbolstringShows the trading symbol which could be a combination of symbol name, instrument, expiry date etc
data[].instrument_tokenstringKey of the instrument. For the regex pattern applicable to this field, see the Field Pattern Appendix.
data[].order_typestringType of order. It can be one of the following MARKET refers to market order LIMIT refers to Limit Order SL refers to Stop Loss Limit SL-M refers to Stop Loss Market.
Possible values: MARKET, LIMIT, SL, SL-M.
data[].transaction_typestringIndicates whether its a buy or sell order.
Possible values: BUY, SELL.
data[].quantityint32The total quantity traded from this particular order
data[].exchange_order_idstringUnique order ID assigned by the exchange for the order placed
data[].order_idstringUnique order ID assigned internally for the order placed
data[].exchange_timestampstringUser readable time at when the trade occurred
data[].average_pricefloatPrice at which the traded quantity is traded
data[].trade_idstringTrade ID generated from exchange towards traded transaction
data[].order_ref_idstringUniquely identifies an order for internal usage.
data[].order_timestampstringUser readable timestamp at which the order was placed

Sample Code

Get all trades for the day

import requests

url = 'https://api.upstox.com/v2/order/trades/get-trades-for-day'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}

response = requests.get(url, headers=headers)
print(response.text)
Loading...