跳到主要內容

订单详情

该接口用于订单详情查询

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收费货币