查询历史委托

/sapi/v1/trade/order/history

请求类型: GET

是否验签: 是

接口权限: 读取

限频: 每个account 3秒最多 144 次请求(交易接口3秒最多 72 次请求,查询接口3秒最多 72 次请求) (该account的所有币种和不同到期日的合约的所有私有接口共享该限制) 。

接口描述: 此接口用于查询历史委托的合约订单。

请求地址

环境
地址

线上环境(aws客户首选)

请求参数

参数
数据类型
是否必填
描述
取值范围
默认值

contract_code

String

true

合约代码,必填项,查询永续合约和交割合约时,需使用指定合约代码

“BTC-USDT” “BTC-USDT-251103”...

margin_mode

String

true

保证金模式 cross:全仓 ;

states

String

false

订单状态

可以查多个状态,使用逗号分隔。“filled“:”已成交”, ”partially_canceled”:””部分成交已撤销, “canceled“:”已撤销”

type

String

false

订单类型

"market": 市价,"limit":限价,"post_only":只做maker单

price_match

String

false

最优档位

最优档位,opponent-对手价、"optimal_5":最优5档,"optimal_10":最优10档,"optimal_20":最优20档

time_in_force

String

false

生效时间

start_time

String

false

查询开始时间, 以数据按创建时间进行查询,UNIX时间戳,以毫秒为单位。

取值范围 [((end-time) – 48h), (end-time)] ,查询窗口最大为48小时,窗口平移范围为最近90天。 默认值 (now) – 48h

end_time

String

false

查询结束时间, 以数据按创建时间进行查询,UNIX时间戳,以毫秒为单位。

取值范围 [(present-90d), present] ,查询窗口最大为48小时,窗口平移范围为最近90天。 默认值:now

from

Long

false

查询的起始id,默认从0开始

limit

Integer

false

分页页面大小,默认为10,最大为100。

direct

String

false

翻页方向

prev, next,默认next

响应参数

参数
数据类型
是否必填
描述
取值范围

id

String

true

查询id

contract_code

String

true

合约代码

永续:"BTC-USDT"... ,交割:"BTC-USDT-210625"...

side

String

true

买卖方向

buy:买 "sell":卖

position_side

String

true

仓位方向

"long":多 "short":空 “both”:单向持仓

type

String

true

订单类型;枚举

"market": 市价,"limit":限价, "post_only":只挂单

price_match

String

false

最优档位

opponent-对手价、"optimal_5":最优5档,"optimal_10":最优10档,"optimal_20":最优20档

order_id

String

true

订单id

client_order_id

String

true

用户自定义订单ID

margin_mode

String

true

保证金模式

枚举 cross

price

String

true

委托价格

volume

String

true

委托数量

lever_rate

Long

true

杠杆等级

state

String

true

订单状态

filled, partially_canceled, canceled

order_source

String

true

订单来源

system:系统、web:用户网页、api:用户API、m:用户M站、risk:风控系统、settlement:交割结算、ios:ios客户端、android:安卓客户端、windows:windows客户端、mac:mac客户端、trigger:计划委托触发、tpsl:止盈止损触发、ADL: adl订单)

reduce_only

boolean

true

只减仓

False、True

time_in_force

String

true

枚举fok, ioc, gtc,非必填,默认是gtc

tp_trigger_price

String

true

止盈触发价格

tp_order_price

String

true

止盈委托价格(最优N档委托类型时无需填写价格)

tp_type

String

true

止盈委托类型,不填默认为market: 市价,maket: 限价:limit ,最优5档: optimal_5,最优10档:optimal_10,最优20档:optimal_20

tp_trigger_price_type

String

false

止盈价格触发类型,默认是最新价

"last":最新价,"mark":标记价格

sl_trigger_price

String

true

止损触发价格

sl_order_price

String

true

止损委托价格(最优N档委托类型时无需填写价格)

sl_type

String

true

止损委托类型,不填默认为 市价,maket: 限价:limit ,最优5档: optimal_5,最优10档:optimal_10,最优20档:optimal_20

sl_trigger_price_type

String

false

止损价格触发类型,默认是最新价

"last":最新价,"mark":标记价格

trade_avg_price

String

true

成交均价

trade_volume

String

true

成交数量

trade_turnover

String

true

成交总金额

fee_currency

String

true

手续费币种,多个则使用","分隔

fee

String

true

总手续费(U

price_protect

boolean

false

价差保护,默认为false。仅当设置止盈/止损需要该参数

false 或者 true

profit

String

true

平仓盈亏(使用持仓均价计算,不包含仓位跨结算的已实现盈亏。)

contract_type

String

true

合约类型

swap(永续)、this_week(当周)、next_week(次周)、quarter(当季)、next_quarter(次季)

cancel_reason

String

true

撤单原因

"Limit order cancelation by the client":"用户主动撤销普通限价订单","Order cancelation by system":"系统撤单","Market order circuit-breaker":"市价单熔断","Bankruptcy price of market order":"市价单破产价","Order cancelation due to no matching orders":"没有对手盘导致撤单"," Self trading prevention":"防自成交撤单","Number of maker orders matched with your taker orders exceeding limit":"成交笔数超过最大限制","Order cancelation due to API timeout":"API超时撤单"

created_time

String

true

订单创建时间, UTC时间戳(MS)

updated_time

String

true

订单更新时间, UTC时间戳(MS)

self_match_prevent

String

true

防自成交

cancel_taker: 撤销taker单 cancel_maker:撤销maker单 cancel_both:撤销全部订单

备注: 下列行为,都属于"Order cancelation by system":"系统撤单"的范围。 FOK order cancelation-- fok撤单 IOC order cancelation-- ioc撤单 Order cancelation by the management system-- MGT撤单 Limit maker order cancelation--limit-maker撤单 Order cancelation due to API timeout–api超时撤单 Order cancelation due to forced liquidation--强平撤单 Order cancelation due to ADL--adl撤单 Order cancelation due to delivery futures expiration--交割合约到期

请求示例

响应示例

最后更新于