跳到主要內容

訂單詳情

該接口用於訂單詳情查詢

Request

HTTP MethodGET
HTTP URL/v1/trade/order

Parameters

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

NameTypeRequiredDescription
order_idstringYES訂單 ID,用於指定訂單 ID 查詢,例如: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": "蘋果",
"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": "收費明細",
"fees": []
},
{
"code": "THIRD_FEES",
"name": "第三方收費明細",
"fees": []
}
],
"total_amount": "0",
"currency": "USD"
}
}
}

Response Status

StatusDescriptionSchema
200訂單詳情查詢成功order_detail_rsp
400查詢失敗,請求參數錯誤。None

Schemas

order_detail_rsp

訂單信息

NameTypeRequiredDescription
order_idstringtrue訂單 ID
statusstringtrue訂單狀態
stock_namestringtrue股票名稱
quantitystringtrue下單數量
executed_quantitystringtrue成交數量。

當訂單未成交時為 0
pricestringtrue下單價格。

當市價條件單未觸發時為空字符串
executed_pricestringtrue成交價。

當訂單未成交時為 0
submitted_atstringtrue下單時間
sidestringtrue買賣方向

可選值:
Buy - 買入
Sell - 賣出
symbolstringtrue股票代碼,使用 ticker.region 格式,例如:AAPL.US
order_typestringtrue訂單類型
last_donestringtrue最近成交價格。

當訂單未成交時為空字符串
trigger_pricestringtrueLIT / MIT 訂單觸發價格。

當訂單不是 LIT / MIT 訂單為空字符串
msgstringtrue拒絕信息或備註,默認為空字符串。
tagstringtrue訂單標記

可選值:
Normal - 普通訂單
GTC - 長期單
Grey - 暗盤單
time_in_forcestringtrue訂單有效期類型

可選值:
Day - 當日有效
GTC - 撤單前有效
GTD - 到期前有效
expire_datestringtrue長期單過期時間,格式為 YYYY-MM-DD, 例如:`2022-12-05。

不是長期單時,默認為空字符串。
updated_atstringtrue最近更新時間,格式為時間戳 (秒),默認為 0。
trigger_atstringtrue條件單觸發時間,格式為時間戳 (秒),默認為 0。
trailing_amountstringtrueTSLPAMT 訂單跟蹤金額。

當訂單不是 TSLPAMT 訂單時為空字符串。
trailing_percentstringtrueTSLPPCT 訂單跟蹤漲跌幅。

當訂單不是 TSLPPCT 訂單時為空字符串。
limit_offsetstringtrueTSLPAMT / TSLPPCT 訂單指定價差。

當訂單不是 TSLPAMT / TSLPPCT 訂單時為空字符串。
trigger_statusstringtrue條件單觸發狀態
當訂單不是條件單或條件單未觸發時, 觸發狀態為 NOT_USED

可選值:
NOT_USED - 未激活
DEACTIVE - 已失效
ACTIVE - 已激活
RELEASED - 已觸發
currencystringtrue結算貨幣
outside_rthstringtrue是否允許盤前盤後
當訂單不是美股時, 默認為 UnknownOutsideRth

可選值:
RTH_ONLY - 不允許盤前盤後
ANY_TIME - 允許盤前盤後
remarkstringtrue備註
free_statusstringtrue免傭狀態,默認為 None

可選值:
None - 無
Calculated - 免傭額待計算
Pending - 待免傭
Ready - 已免傭
free_amountstringtrue免佣金額,默認為空字符串
free_currencystringtrue免傭貨幣,默認為空字符串
deductions_statusstringtrue抵扣狀態/返現狀態,默認為 NONE

可選值:
NONE - 待結算
NO_DATA - 已結算無數據
PENDING - 已結算待發放
DONE - 已結算已發放
deductions_amountstringtrue抵扣金額,默認為空字符串
deductions_currencystringtrue抵扣貨幣,默認為空字符串
platform_deducted_statusstringtrue平臺費抵扣狀態/返現狀態,默認為 NONE

可選值:
NONE - 待結算
NO_DATA - 已結算無數據
PENDING - 已結算待發放
DONE - 已結算已發放
platform_deducted_amountstringtrue平臺費抵扣金額,默認為空字符串
platform_deducted_currencystringtrue平臺費抵扣貨幣,默認為空字符串
historyobject[]true訂單歷史明細
∟ pricestringtrue成交展示成交價格,過期、撤單、拒絕等狀態展示提交價格
∟ quantitystringtrue成交展示成交數量,過期、撤單、拒絕等狀態展示剩餘數量
∟ statusstringtrue訂單狀態
∟ msgstringtrue成交或錯誤信息
∟ timestringtrue發生時間
charge_detailobjecttrue訂單費用
∟ total_amountstringtrue全部費用
∟ currencystringtrue結算貨幣
∟ itemsobject[]true訂單費用明細
∟∟ codestringtrue收費類別代碼

可選值:
UNKNOWN
BROKER_FEES
THIRD_FEES
∟∟ namestringtrue收費類別名稱
∟∟ feesobject[]true收費明細
∟∟∟ codestringtrue收費代碼
∟∟∟ namestringtrue收費名稱
∟∟∟ amountstringtrue單項收費金額
∟∟∟ currencystringtrue收費貨幣