Skip to main content

Order Details

This API is used for order detail query

SDK Links

Python
longport.openapi.TradeContext.order_detail
Rust
longport::trade::TradeContext#order_detail
Go
TradeContext.OrderDetail
Node.js
TradeContext#orderDetail

Request

HTTP MethodGET
HTTP URL/v1/trade/order

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
order_idstringYESOrder ID for specifying order ID query, for example: 701276261045858304

Request Example

from longport.openapi import TradeContext, Config

config = Config.from_env()
ctx = TradeContext(config)

resp = ctx.order_detail(
order_id = "701276261045858304",
)
print(resp)

Response

Response Headers

  • Content-Type: application/json

Response Example

{
"code": 0,
"message": "success",
"data": {
"order_id": "828940451093708800",
"status": "FilledStatus",
"stock_name": "Apple",
"quantity": "10",
"executed_quantity": "10",
"price": "200.000",
"executed_price": "164.660",
"submitted_at": "1680863604",
"side": "Buy",
"symbol": "AAPL.US",
"order_type": "LO",
"last_done": "164.660",
"trigger_price": "0.0000",
"msg": "",
"tag": "Normal",
"time_in_force": "Day",
"expire_date": "2023-04-10",
"updated_at": "1681113000",
"trigger_at": "0",
"trailing_amount": "",
"trailing_percent": "",
"limit_offset": "",
"trigger_status": "NOT_USED",
"outside_rth": "ANY_TIME",
"currency": "USD",
"remark": "1680863603.927165",
"free_status": "None",
"free_amount": "",
"free_currency": "",
"deductions_status": "NONE",
"deductions_amount": "",
"deductions_currency": "",
"platform_deducted_status": "NONE",
"platform_deducted_amount": "",
"platform_deducted_currency": "",
"history": [
{
"price": "164.6600",
"quantity": "10",
"status": "FilledStatus",
"msg": "Execution of 10",
"time": "1681113000"
},
{
"price": "200.0000",
"quantity": "10",
"status": "NewStatus",
"msg": "",
"time": "1681113000"
}
],
"charge_detail": {
"items": [
{
"code": "BROKER_FEES",
"name": "Broker Fees",
"fees": []
},
{
"code": "THIRD_FEES",
"name": "Third-party Fees",
"fees": []
}
],
"total_amount": "0",
"currency": "USD"
}
}
}

Response Status

StatusDescriptionSchema
200Order detail query successfulorder_detail_rsp
400Query failed, request parameter error.None

Schemas

order_detail_rsp

Order Information

NameTypeRequiredDescription
order_idstringtrueOrder ID
statusstringtrueOrder Status
stock_namestringtrueStock Name
quantitystringtrueOrder Quantity
executed_quantitystringtrueExecuted Quantity

When the order is not executed, it is 0
pricestringtrueOrder Price

When the market price conditional order is not triggered, it is an empty string
executed_pricestringtrueExecution Price

When the order is not executed, it is 0
submitted_atstringtrueSubmitted Time
sidestringtrueOrder Side

Enum Value:
Buy
Sell
symbolstringtrueStock symbol, use ticker.region format, example: AAPL.US
order_typestringtrueOrder Type
last_donestringtrueLast done.

when the order is not filled, value is empty string
trigger_pricestringtrueLIT / MIT Order Trigger Price.

When the order is not LIT / MIT order, value is empty string
msgstringtrueRejected message or remark, default value is empty string.
tagstringtrueOrder tag

Enum Value
Normal - Normal Order
GTC - Long term Order
Grey - Grey Order
time_in_forcestringtrueTime in force Type

Enum Value:
Day - Day Order
GTC - Good Til Canceled Order
GTD - Good Til Date Order
expire_datestringtrueLong term order expire date, format: YYYY-MM-DD, example: 2022-12-05.

When not a long term order, default value is empty string
updated_atstringtrueLast updated time, formatted as a timestamp (second)
trigger_atstringtrueConditional order trigger time. formatted as a timestamp (second)
trailing_amountstringtrueTSLPAMT order trailing amount.

When the order is not TSLPAMT order, value is empty string
trailing_percentstringtrueTSLPPCT order trailing percent.

When the order is not TSLPPCT order, value is empty string
limit_offsetstringtrueTSLPPCT order limit offset amount.

When the order is not TSLPPCT order, value is empty string
trigger_statusstringtrueConditional Order Trigger Status
When an order is not a conditional order or a conditional order is not triggered, the trigger status is NOT_USED

Enum Value
NOT_USED
DEACTIVE
ACTIVE
RELEASED
currencystringtrueCurrency
outside_rthstringtrueEnable or disable outside regular trading hours
Default is UnknownOutsideRth when the order is not a US stock

Enum Value:
RTH_ONLY - Regular trading hour only
ANY_TIME - Any time
OVERNIGHT - Overnight"
remarkstringtrueRemark
free_statusstringtrueCommission-free Status, default value is None

Enum Value:
None - None
Calculated - Commission-free amount to be calculated
Pending - Pending commission-free
Ready - Commission-free applied
free_amountstringtrueCommission-free amount, default value is empty string.
free_currencystringtrueCommission-free currency, default value is empty string.
deductions_statusstringtrueDeduction status/Cashback Status, default value is NONE

Enum Value:
NONE - Pending Settlement
NO_DATA - Settled with no data
PENDING - Settled and pending distribution
DONE - Settled and distributed
deductions_amountstringtrueDeduction amount, default value is empty string.
deductions_currencystringtrueDeduction currency, default value is empty string.
platform_deducted_statusstringtruePlatform fee deduction status/Cashback Status, default value is NONE

Enum Value:
NONE - Pending Settlement
NO_DATA - Settled with no data
PENDING - Settled and pending distribution
DONE - Settled and distributed
platform_deducted_amountstringtruePlatform fee deduction amount, default value is empty string.
platform_deducted_currencystringtruePlatform fee deduction currency, default value is empty string.
historyobject[]trueOrder history details
∟ pricestringtrueExecuted price for executed orders, submitted price for expired, canceled, rejected orders, etc.
∟ quantitystringtrueExecuted quantity for executed orders, remaining quantity for expired, canceled, rejected orders, etc.
∟ statusstringtrueOrder status
∟ msgstringtrueExecution or error message
∟ timestringtrueOccurrence time
charge_detailobjecttrueOrder charges
∟ total_amountstringtrueTotal charges amount
∟ currencystringtrueSettlement currency
∟ itemsobject[]trueOrder charge details
∟∟ codestringtrueCharge category code

Enum Value:
UNKNOWN
BROKER_FEES
THIRD_FEES
∟∟ namestringtrueCharge category name
∟∟ feesobject[]trueCharge details
∟∟∟ codestringtrueCharge code
∟∟∟ namestringtrueCharge name
∟∟∟ amountstringtrueCharge amount
∟∟∟ currencystringtrueCharge currency