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 Method | GET |
| HTTP URL | /v1/trade/order |
Parameters
Content-Type: application/json; charset=utf-8
| Name | Type | Required | Description |
|---|---|---|---|
| order_id | string | YES | Order ID for specifying order ID query, for example: 701276261045858304 |
Request Example
python
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
json
{
"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
| Status | Description | Schema |
|---|---|---|
| 200 | Order detail query successful | order_detail_rsp |
| 400 | Query failed, request parameter error. | None |
Schemas
order_detail_rsp
Order Information
| Name | Type | Required | Description |
|---|---|---|---|
| order_id | string | true | Order ID |
| status | string | true | Order Status |
| stock_name | string | true | Stock Name |
| quantity | string | true | Order Quantity |
| executed_quantity | string | true | Executed Quantity When the order is not executed, it is 0 |
| price | string | true | Order Price When the market price conditional order is not triggered, it is an empty string |
| executed_price | string | true | Execution Price When the order is not executed, it is 0 |
| submitted_at | string | true | Submitted Time |
| side | string | true | Order Side Enum Value: BuySell |
| symbol | string | true | Stock symbol, use ticker.region format, example: AAPL.US |
| order_type | string | true | Order Type |
| last_done | string | true | Last done. when the order is not filled, value is empty string |
| trigger_price | string | true | LIT / MIT Order Trigger Price.When the order is not LIT / MIT order, value is empty string |
| msg | string | true | Rejected message or remark, default value is empty string. |
| tag | string | true | Order tag Enum Value Normal - Normal OrderGTC - Long term OrderGrey - Grey Order |
| time_in_force | string | true | Time in force Type Enum Value: Day - Day OrderGTC - Good Til Canceled OrderGTD - Good Til Date Order |
| expire_date | string | true | Long term order expire date, format: YYYY-MM-DD, example: 2022-12-05.When not a long term order, default value is empty string |
| updated_at | string | true | Last updated time, formatted as a timestamp (second) |
| trigger_at | string | true | Conditional order trigger time. formatted as a timestamp (second) |
| trailing_amount | string | true | TSLPAMT order trailing amount.When the order is not TSLPAMT order, value is empty string |
| trailing_percent | string | true | TSLPPCT order trailing percent.When the order is not TSLPPCT order, value is empty string |
| limit_offset | string | true | TSLPPCT order limit offset amount.When the order is not TSLPPCT order, value is empty string |
| trigger_status | string | true | Conditional 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_USEDDEACTIVEACTIVERELEASED |
| currency | string | true | Currency |
| outside_rth | string | true | Enable or disable outside regular trading hours Default is UnknownOutsideRth when the order is not a US stockEnum Value: RTH_ONLY - Regular trading hour onlyANY_TIME - Any timeOVERNIGHT - Overnight" |
| remark | string | true | Remark |
| free_status | string | true | Commission-free Status, default value is None Enum Value: None - NoneCalculated - Commission-free amount to be calculatedPending - Pending commission-freeReady - Commission-free applied |
| free_amount | string | true | Commission-free amount, default value is empty string. |
| free_currency | string | true | Commission-free currency, default value is empty string. |
| deductions_status | string | true | Deduction status/Cashback Status, default value is NONE Enum Value: NONE - Pending Settlement NO_DATA - Settled with no dataPENDING - Settled and pending distributionDONE - Settled and distributed |
| deductions_amount | string | true | Deduction amount, default value is empty string. |
| deductions_currency | string | true | Deduction currency, default value is empty string. |
| platform_deducted_status | string | true | Platform fee deduction status/Cashback Status, default value is NONE Enum Value: NONE - Pending Settlement NO_DATA - Settled with no dataPENDING - Settled and pending distributionDONE - Settled and distributed |
| platform_deducted_amount | string | true | Platform fee deduction amount, default value is empty string. |
| platform_deducted_currency | string | true | Platform fee deduction currency, default value is empty string. |
| history | object[] | true | Order history details |
| ∟ price | string | true | Executed price for executed orders, submitted price for expired, canceled, rejected orders, etc. |
| ∟ quantity | string | true | Executed quantity for executed orders, remaining quantity for expired, canceled, rejected orders, etc. |
| ∟ status | string | true | Order status |
| ∟ msg | string | true | Execution or error message |
| ∟ time | string | true | Occurrence time |
| charge_detail | object | true | Order charges |
| ∟ total_amount | string | true | Total charges amount |
| ∟ currency | string | true | Settlement currency |
| ∟ items | object[] | true | Order charge details |
| ∟∟ code | string | true | Charge category code Enum Value: UNKNOWNBROKER_FEESTHIRD_FEES |
| ∟∟ name | string | true | Charge category name |
| ∟∟ fees | object[] | true | Charge details |
| ∟∟∟ code | string | true | Charge code |
| ∟∟∟ name | string | true | Charge name |
| ∟∟∟ amount | string | true | Charge amount |
| ∟∟∟ currency | string | true | Charge currency |