下单接口
普通单下单
POST /api/v1/perpetual/products/{contractCode}/order
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 |
Body(json)
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | |
|---|---|---|---|---|---|---|
| type | y | string | 类型 | 10 限价 11 市价 | ||
| side | y | string | 方向 | open_long 开多 open_short 开空 close_long 平多 close_short 平空 | ||
| price | n | string | 价格 | |||
| amount | y | int | 数量 | |||
| beMaker | n | int | 时间戳 | 0 | 被动委托:0:不被动委托 1:被动委托 | |
| positionId | n | long | 持仓id | 分仓模式平仓必传,加仓也可以传 |
Response
{
"id": "1237893454356"
}
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| id | y | long | 订单id |
条件单下单
POST /api/v1/perpetual/products/{contractCode}/order
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 |
Body(json)
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| positionId | n | long | 持仓id | 分仓模式平仓必传,加仓也可以传 | |
| type | y | string | 订单类型 | 12: 条件单 | |
| triggerBy | y | string | 触发类型 | 默认mark,标记价格:mark,最新价格:last | |
| triggerPrice | y | string | 触发价 | 触发价格 | |
| side | y | string | 方向 | open_long 开多 open_short 开空 close_long 平多 close_short 平空 | |
| price | n | string | 委托价格 | 触发后下单价格(限价单price必传) | |
| currentPrice | n | string | 当前标记价格 | 计划委托时不传;止盈止损时传当前合约价格, 用于判断止盈止损方向 | |
| algoType | y | int | 委托类型 | 10-限价,11-市价 | |
| amount | y | int | 数量 | 委托数量 |
//计划委托下单
{
"positionId": 12, //持仓id
"type": 12, //type:订单类型,12:条件单
"side": "open_long", //side:触发后开仓方向
"triggerBy": "last", //触发类型:指数价格:index,标记价格:mark,最新价格:last
"triggerPrice": "500", //触发价格
"price": "600.000000", //触发后下单价格(限价单price必传)
"amount": "10", //触发后下单数量
"algoType": 10 //条件单下单类型 10:限价单 11:市价单
}
//止盈止损下单
{
"positionId": 12, //持仓id
"type": 12, //type:订单类型,12:条件单
"amount": 12, //触发后下单数量
"side": "close_long", //side:触发后开仓方向
"triggerBy": "last", //触发类型:指数价格:index,标记价格:mark,最新价格:last
"triggerPrice": "12", //触发价格
"currentPrice": "600.000000", //当前合约价格, 判断止盈止损方向
"algoType": 10, //条件单下单类型 10:限价单 11:市价单
"price": "600.000000", //触发后下单价格(限价单price必传)
}
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| id | y | long | 订单id |
Response
{
"id": "1237893454356"
}
批量下单
POST /api/v1/perpetual/products/{contractCode}/batch-order
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 |
[
{
"amount": 1,
"lang": "zh_CN",
"platform": 1,
"price": "2.94",
"side": "open_long",
"type": 10,
"tag": 1
}
]
Body(list-json)
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | |
|---|---|---|---|---|---|---|
| positionId | n | long | 持仓id | 分仓模式平仓必传,加仓也可以传 | ||
| type | y | string | 类型 | 10:限价 11:市价 12:条件单 | ||
| side | y | string | 方向 | open_long 开多 open_short 开空 close_long 平多 close_short 平空 | ||
| amount | y | int | 数量 | 委托数量 | ||
| beMaker | n | int | 时间戳 | 0 | 被动委托:0:不被动委托 1:被动委托 | |
| ioc | n | int | 订单若不能立即成交则未成交的部分立即取消 | 0 | 0: 关闭,1: 开启 | |
| tag | n | string | 标签 | 下单时用户所定义的标签,下单后返回 | ||
| triggerBy | y | string | 触发类型 | 默认mark,标记价格:mark,最新价格:last | ||
| triggerPrice | y | string | 触发价 | 触发价格 | ||
| price | n | string | 委托价格 | 触发后下单价格(限价单price必传) | ||
| currentPrice | n | string | 当前标记价格 | 计划委托时不传;止盈止损时传当前合约价格, 用于判断止盈止损方向 | ||
| algoType | y | int | 委托类型 | 10-限价,11-市价 |
Response
[
{
"orderId": 80742077438016,
"tag": "1"
}
]
返回(list-json):
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| id | y | long | 订单id |
订单列表
GET /api/v1/perpetual/products/{contractCode}/list
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 |
Response
[
{
"allType": 0,
"amount": "1",
"avgPrice": "0",
"base": "usdt",
"baseDisplayName": "USDT",
"beforeClosePositionPrice": "",
"bizType": "",
"brokerId": 0,
"contractCode": "btcusdt",
"contractCodeDisplayName": "BTCUSDT",
"contractDirection": 0,
"contractType": "",
"createdDate": 1746610727659,
"dealAmount": "0",
"dealMarket": 0,
"deductedFee": "",
"detailSide": "open_long",
"direction": "",
"donationFee": "",
"donationOpenMargin": "",
"donationProfit": "",
"dualPosition": 0,
"env": 0,
"fastTradeTime": 0,
"fee": "0",
"growthType": 0,
"guaranteedStopLossRate": "",
"guaranteedStopLossStatus": 0,
"id": 3799035537965136,
"indexBase": "btc",
"indexBaseDisplayName": "BTC",
"ioc": 0,
"isNftPhoto": 0,
"lever": "20",
"liquidatePrice": "",
"liquidationDate": 0,
"marginDigit": 0,
"marketPriceDigit": 0,
"maxOrderAmount": 0,
"merge": 0,
"mergeId": 0,
"minOrderAmount": 0,
"mode": 0,
"modifyDate": 0,
"mustMaker": 0,
"openMargin": "",
"orderDonationFee": "",
"orderFee": "",
"orderPriceType": 0,
"orderSize": "80.001",
"orderType": 0,
"positionId": 0,
"positionType": 0,
"price": "80001",
"principalFee": "",
"principalOpenMargin": "",
"profit": "0",
"quote": "usdt",
"quoteDisplayName": "USDT",
"reason": 0,
"reduceOnly": 0,
"refConditionOrderId": 0,
"refOrderCondition": null,
"refUserId": 0,
"selectedMode": 0,
"shadowAmount": "",
"shadowOpenMargin": "",
"side": "long",
"skill": 0,
"sortDate": 0,
"source": "",
"status": 0,
"stopLimitType": "",
"stopLoss": null,
"stopProfit": null,
"systemType": 10,
"tag": "",
"tracingCallback": "",
"tracingDirection": "",
"tracingOrderPriceType": 0,
"tracingPrice": "",
"traderNickname": "",
"traderPhoto": "",
"triggerBy": "",
"triggerDate": 0,
"triggerPrice": "",
"unitAmount": "",
"userId": 0
}
]
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| allType | y | string | 0:部分 1:全部 | ||
| amount | y | string | 数量 | ||
| avgPrice | y | string | 平均成交价 | ||
| base | y | string | 基础货币名,如btc、fbtc | ||
| baseDisplayName | y | string | 基础货币显示名,如BTC | ||
| contractCode | y | string | 是Base和Quote之间的组合 P_BTC_USDT,R_BTC_USDT | ||
| contractCodeDisplayName | y | string | 交易对的显示名称,如:BTCUSDT | ||
| contractDirection | y | int | 合约方向 0:正向,1:反向 | ||
| createdDate | y | string | 创建时间 | ||
| dealAmount | y | string | 已成交数量 | ||
| deductedFee | y | string | 手续费减免 | ||
| dealMarket | y | int | 0:普通单 1:带单 2:跟单 | ||
| detailSide | y | string | 订单方向 1.开多open_long 2.开空open_short 3.平多close_long 4.平空close_short | ||
| direction | y | string | 条件单:触发方向,greater大于,less小于 | ||
| donationFee | y | string | 赠金手续费 | ||
| donationOpenMargin | y | string | 赠金开仓保证金 | ||
| donationProfit | y | string | 赠金盈亏 | ||
| fee | y | string | 该笔订单成交后交的手续费: 正表示得手续费,负表示付手续费 | ||
| growthType | y | string | 持仓增长类型:1:开仓单 2:平仓单 0:无法确定 | ||
| guaranteedStopLossRate | y | string | 保价止损费率 | ||
| guaranteedStopLossStatus | y | string | 是否开启保价止损 | ||
| id | y | long | 订单id | ||
| indexBase | y | string | 指数货币 | ||
| indexBaseDisplayName | y | string | 指数货币显示名 | ||
| lever | y | string | 杠杆 | ||
| liquidatePrice | y | string | 强平价格 | ||
| liquidateDate | y | long | 强平时间,时间戳 | ||
| marginDigit | y | int | 标记价格小数位 | ||
| marketPriceDigit | y | int | 标记价格小数位 | ||
| maxOrderAmount | y | int | 每笔最大挂单张数 | ||
| merge | y | int | 是否合并止盈止损 0:不合并 1:合并 | ||
| mergeId | y | int | 合并ID | ||
| minOrderAmount | y | int | 每笔最小挂单张数 | ||
| maxOrderAmount | y | int | 最大委托数量 | ||
| maxOrderAmount | y | int | 最大委托数量 | ||
| mode | y | int | 持仓模式 0:合仓 1:分仓 | ||
| modifyDate | y | int | 修改时间 | ||
| mustMaker | y | long | 被动委托:0:不care 1:只做maker,如何是taker就撤单 | ||
| orderDonationFee | y | string | 赠金手续费 | ||
| orderFee | y | string | 手续费 | ||
| orderPriceType | y | string | 下单价格类型,对手价:opponent,最优20档:optimal_20,最优10档:optimal_10,最优5档:optimal_5 | ||
| orderSize | y | string | 订单价值 | ||
| orderType | y | int | 订单类型 0:普通单,1:止盈止损,2:计划委托 | ||
| positionId | y | long | 仓位ID | ||
| positionType | y | int | 仓位类型 | ||
| price | y | string | 委托价格 | ||
| principalFee | y | string | 下单冻结的本金手续费 | ||
| principalOpenMargin | y | string | 下单冻结的本金开仓保证金 | ||
| profit | y | string | 该笔订单成交后对应的盈亏: 正表示盈利,负表示亏损 | ||
| quote | y | string | 计价货币名,usd,cny,usdt | ||
| quoteDisplayName | y | string | 计价货币显示名 | ||
| reason | y | int | 该笔订单取消的理由,0是默认值,没有理由 | ||
| reduceOnly | y | int | 是否只减仓 | ||
| refConditionOrderId | y | long | 条件单id | ||
| refOrderCondition | y | object | 条件单详情 | ||
| side | y | string | 订单方向,long多,short空 | ||
| source | y | string | 来源 | ||
| stopLimitType | y | string | 止盈止损类型 | ||
| stopLoss | n | string | 止损价格 | ||
| stopProfit | n | string | 止盈价格 | ||
| systemType | y | int | 10:限价 11:市价 13:强平单 14:爆仓单 15:穿仓 16:强减 | ||
| triggerBy | y | string | 条件单触发类型,指数价格:index,标记价格:mark,最新价格:last | ||
| triggerPrice | y | string | 条件单触发价格 |
撤单
DELETE /api/v1/perpetual/products/{contractCode}/order/{id}
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code | ||
| id | y | long | 订单id |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 |
Response
{
"code": 200,
"msg": "success",
"data": null
}
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| code | y | int | 状态,200:成功 | ||
| msg | y | string | 提示 | ||
| data | y | object |
批量撤单
DELETE /api/v1/perpetual/products/{contractCode}/orders
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 |
Response
{
"code": 200,
"msg": "success",
"data": null
}
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| code | y | int | 状态,200:成功 | ||
| msg | y | string | 提示 | ||
| data | y | object |
根据订单号批量撤单
DELETE /api/v1/perpetual/products/{contractCode}/batch-delete-order
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 |
[
80581909355536,
80581909355537
]
Body(list)
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| id | y | string | 订单号 |
Response
{
"code": 200,
"msg": "success",
"data": null
}
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| code | y | int | 状态,200:成功 | ||
| msg | y | string | 提示 | ||
| data | y | object |
根据订单id获取当前订单信息
GET /api/v1/perpetual/products/{contractCode}/{id}
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code | ||
| id | y | long | 订单id |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 |
Response
{
"amount": "300.0000000000000000",
"avgPrice": "0E-16",
"base": "",
"contractCode": "fbtcusd",
"contractDirection": 0,
"createdDate": 1582225542000,
"dealAmount": "0E-16",
"detailSide": "open_long",
"direction": "",
"fee": "0E-16",
"id": 69109290623152,
"orderSize": "0.32258064",
"price": "9300.0000000000000000",
"profit": "0E-16",
"quote": "",
"reason": 0,
"refConditionOrderId": 0,
"refOrderCondition": null,
"side": "long",
"source": "",
"status": 0,
"systemType": 10,
"triggerBy": "",
"triggerPrice": ""
}
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| amount | y | string | 数量 | ||
| avgPrice | y | string | 平均成交价 | ||
| base | y | string | 基础货币名,如btc、fbtc | ||
| contractCode | y | string | 是Base和Quote之间的组合 P_BTC_USDT,R_BTC_USDT | ||
| contractDirection | y | int | 合约方向 0:正向,1:反向 | ||
| createdDate | y | string | 创建时间 | ||
| dealAmount | y | string | 已成交数量 | ||
| detailSide | y | string | 订单方向 1.开多open_long 2.开空open_short 3.平多close_long 4.平空close_short | ||
| direction | y | string | 条件单:触发方向,greater大于,less小于 | ||
| fee | y | string | 该笔订单成交后交的手续费: 正表示得手续费,负表示付手续费 | ||
| id | y | long | 订单id | ||
| orderSize | y | string | 订单价值 | ||
| price | y | string | 委托价格 | ||
| profit | y | string | 该笔订单成交后对应的盈亏: 正表示盈利,负表示亏损 | ||
| quote | y | string | 计价货币名,usd,cny,usdt | ||
| reason | y | int | 该笔订单取消的理由,0是默认值,没有理由 | ||
| refConditionOrderId | y | long | 条件单id | ||
| refOrderCondition | y | object | 条件单详情 | ||
| side | y | string | 订单方向,long多,short空 | ||
| source | y | string | 来源 | ||
| status | y | int | 状态 0:等待成交 1:部分成交 2:已经成交 -1:已经撤销 | ||
| systemType | y | int | 10:限价 11:市价 13:强平单 14:爆仓单 15:穿仓 16:强减 | ||
| triggerBy | y | string | 条件单触发类型,指数价格:index,标记价格:mark,最新价格:last | ||
| triggerPrice | y | string | 条件单触发价格 |
市价全平
POST /api/v1/perpetual/products/{contractCode}/{side}/closePosition
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code | ||
| side | y | string | 方向 | long 多仓 short 空仓 |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 |
Response
{
"code": 200,
"data": [
{
"orderId": 3800020524236880,
"price": 98644.7,
"refConditionOrderId": null,
"tag": null
}
],
"msg": "success"
}
返回:
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| code | y | int | 状态,200:成功 | ||
| msg | y | string | 提示 | ||
| orderId | y | long | 委托ID | ||
| price | y | number | 平仓均价 | ||
| refConditionOrderId | y | long | 关联条件单ID | ||
| tag | y | long | 标签 |
历史委托
GET /api/v1/perpetual/products/{contractCode}/history-list
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 | ||
| base | n | string | 基础币 | ||
| detailSide | n | string | 仓位方向 (open_long/open_short/close_long/close_short) | ||
| status | n | int | 0 等待成交 1 部分成交 2 已经成交 -1 已经撤销 | ||
| type | n | int | 合约方向 0:正向,1:反向 | ||
| systemType | n | string | 下单类型:10:限价 11:市价 13:强平单 14:爆仓单 15:穿仓 16:强减;多个条件过滤用","分隔 | ||
| startDate | n | int | 开始时间 | ||
| endTime | n | int | 结束时间 | ||
| page | n | int | 第几页 | 1 | |
| pageSize | n | int | 页面大小 | 20 | |
| stopLimitType | n | int | 计划类型:0 -止盈 1-止损 2-计划委托 |
Response
返回
{
"code": 0,
"msg": "",
"data": {
"total": 0,
"rows": [
{
"id": 0,
"contractCode": "",
"base": "",
"quote": "",
"indexBase": "",
"contractDirection": 0,
"side": "",
"detailSide": "",
"amount": "",
"dealAmount": "",
"avgPrice": "",
"price": "",
"orderSize": "",
"status": 0,
"systemType": 0,
"direction": "",
"profit": "",
"fee": "",
"reason": 0,
"triggerBy": "",
"triggerPrice": "",
"triggerDate": 0,
"modifyDate": 0,
"createdDate": "2022-04-18 16:07:49",
"source": "",
"refConditionOrderId": 0,
"refOrderCondition": {
"id": 0,
"contractCode": "",
"base": "",
"quote": "",
"indexBase": "",
"contractDirection": 0,
"type": "",
"direction": "",
"triggerPrice": "",
"triggerBy": "",
"price": "",
"side": "",
"detailSide": "",
"amount": "",
"avgPrice": "",
"dealAmount": "",
"orderSize": "",
"dealSize": "",
"status": 0,
"reason": 0,
"systemType": 0,
"createdDate": "2022-04-18 16:07:49",
"source": "",
"orderPriceType": 0,
"positionType": 0,
"stopLimitType": 0,
"refOrderId": 0,
"lever": 0,
"unitAmount": "",
"marginDigit": 0,
"marketPriceDigit": 0,
"triggerDate": 0,
"modifyDate": 0,
"tiggerOrderDetail": {
"id": 0,
"price": ""
}
},
"stopLimitType": "",
"lever": "",
"orderPriceType": 0,
"positionType": 0,
"unitAmount": "",
"marginDigit": 0,
"marketPriceDigit": 0,
"stopLoss": {
"id": 0,
"contractCode": "",
"base": "",
"quote": "",
"indexBase": "",
"contractDirection": 0,
"type": "",
"direction": "",
"triggerPrice": "",
"triggerBy": "",
"price": "",
"side": "",
"detailSide": "",
"amount": "",
"avgPrice": "",
"dealAmount": "",
"orderSize": "",
"dealSize": "",
"status": 0,
"reason": 0,
"systemType": 0,
"createdDate": "2022-04-18 16:07:49",
"source": "",
"orderPriceType": 0,
"positionType": 0,
"stopLimitType": 0,
"refOrderId": 0,
"lever": 0,
"unitAmount": "",
"marginDigit": 0,
"marketPriceDigit": 0,
"triggerDate": 0,
"modifyDate": 0,
"tiggerOrderDetail": {
"id": 0,
"price": ""
}
},
"stopProfit": {
"id": 0,
"contractCode": "",
"base": "",
"quote": "",
"indexBase": "",
"contractDirection": 0,
"type": "",
"direction": "",
"triggerPrice": "",
"triggerBy": "",
"price": "",
"side": "",
"detailSide": "",
"amount": "",
"avgPrice": "",
"dealAmount": "",
"orderSize": "",
"dealSize": "",
"status": 0,
"reason": 0,
"systemType": 0,
"createdDate": "2022-04-18 16:07:49",
"source": "",
"orderPriceType": 0,
"positionType": 0,
"stopLimitType": 0,
"refOrderId": 0,
"lever": 0,
"unitAmount": "",
"marginDigit": 0,
"marketPriceDigit": 0,
"triggerDate": 0,
"modifyDate": 0,
"tiggerOrderDetail": {
"id": 0,
"price": ""
}
}
}
]
}
}
Object-data
| 名称 | 类型 | 描述 | 默认值 | 备注 |
|---|---|---|---|---|
| id | number | ID | ||
| contractCode | string | 合约Code | ||
| base | string | 基础货币名,如btc | ||
| quote | string | 计价货币名,usd,cny,usdt | ||
| indexBase | string | 指数货币 | ||
| contractDirection | number | 方向 0:正向,1:反向 | ||
| side | string | 仓位方向,long多,short空 | ||
| detailSide | string | 仓位方向 1.开多open_long 2.开空open_short 3.平多close_long 4.平空close_short | ||
| amount | string | 委托数量 | ||
| dealAmount | string | 已成交数量 | ||
| avgPrice | string | 平均成交价格 | ||
| price | string | 委托价格 | ||
| orderSize | string | 委托价值 | ||
| status | number | 0 等待成交 1 部分成交 2 已经成交 -1 已经撤销 | ||
| systemType | number | 10:限价 11:市价 13:强平单 14:爆仓单 15:穿仓 16:强减 | ||
| direction | string | 触发方向,greater大于,less小于 | ||
| profit | string | 该笔订单成交后对应的盈亏: 正表示盈利,负表示亏损 | ||
| fee | string | 该笔订单成交后交的手续费: 正表示得手续费,负表示付手续费 | ||
| reason | number | 该笔订单取消的理由,0是默认值,1 系统撤销,2 用户取消 其他-委托失败 | ||
| triggerBy | string | 计划委托类型: index-指数价格market/mark-标记价格mark/last-最新价格last | ||
| triggerPrice | string | 触发价格 | ||
| triggerDate | number | 触发时间 | ||
| modifyDate | number | 最后操作时间 | ||
| createdDate | string | 创建时间 | ||
| source | string | 来源 | ||
| refConditionOrderId | number | 关联的条件订单id | ||
| refOrderCondition | OrderCondition | 关联条件单 #Object-OrderCondition | ||
| stopLimitType | string | 条件单类型 0 -止盈 1-止损 2-计划委托 | ||
| lever | string | 杠杆 | ||
| orderPriceType | number | 20 最优20档/10 最优10档/5 最优5档/1 对手价 | ||
| positionType | number | 持仓类型 | ||
| unitAmount | string | 一张合约对应的quote面值,默认1 | ||
| marginDigit | number | 保证金小数位 | ||
| marketPriceDigit | number | 标记价格小数位 | ||
| stopLoss | object | 关联止损单 #Object-OrderCondition | ||
| stopProfit | object | 关联止盈单 #Object-OrderCondition |
Object-OrderCondition
| 名称 | 类型 | 描述 | 默认值 | 备注 |
|---|---|---|---|---|
| id | number | 条件单id | ||
| contractCode | string | 合约code:是Base和Quote之间的组合 | ||
| base | string | 基础货币名 | ||
| quote | string | 计价货币名 | ||
| indexBase | string | 指数货币 | ||
| contractDirection | number | 方向 0:正向,1:反向 | ||
| type | string | 触发类型:指数价格,标记价格,最新价格 | ||
| direction | string | 触发方向,greater大于,less小于 | ||
| triggerPrice | string | 触发价格 | ||
| triggerBy | string | 计划委托类型: index-指数价格market/mark-标记价格mark/last-最新价格last | ||
| price | string | 用户订单委托或者破产价格 | ||
| side | string | 仓位方向,long多,short空 | ||
| detailSide | string | 1.开多open_long 2.开空open_short 3.平多close_long 4.平空close_short | ||
| amount | string | 委托数量 | ||
| avgPrice | string | 平均成交价格 | ||
| dealAmount | string | 已成交数量 | ||
| orderSize | string | 委托价值 | ||
| dealSize | string | 已经成交价值 | ||
| status | number | 状态 1:已触发 0、2:未触发 3:预条件单 -1:已撤销 | ||
| reason | number | 订单被撤销原因 1:系统撤销 2:用户撤销 3、4、5:触发后委托失败 中间用逗号分割 | ||
| systemType | number | 10:限价 11:市价 13:强平单 14:爆仓单 | ||
| createdDate | string | 创建时间 | ||
| source | string | 来源 | ||
| orderPriceType | number | 下单价格类型,对手价:opponent,最优20档:optimal_20,最优10档:optimal_10,最优5档:optimal_5 | ||
| positionType | number | 仓位模式 | ||
| stopLimitType | number | 条件类型 | ||
| refOrderId | number | 关联订单id | ||
| lever | number | 杠杆 | ||
| unitAmount | string | 单位 | ||
| marginDigit | number | 保证金位数 | ||
| marketPriceDigit | number | 价格位数 | ||
| triggerDate | number | 触发时间 | ||
| modifyDate | number | 修改时间 | ||
| tiggerOrderDetail | object |
订单交易详情
GET /api/v1/perpetual/products/{contractCode}/orderDetail
请求参数:
路径参数
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| contractCode | y | string | 合约code | ||
| orderId | y | string | 委托ID |
Query
| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 |
|---|---|---|---|---|---|
| AccessKeyId | y | string | 访问key | ||
| SignatureVersion | y | string | 版本 | ||
| SignatureMethod | y | string | 签名方法 | HmacSHA256 | |
| Signature | y | string | 签名 | ||
| Timestamp | y | string | 时间戳 | ||
| orderId | y | number | 订单ID |
Response
返回
body
{
"code": 200,
"data": {
"amount": "1",
"avgPrice": "102328.4",
"beforeClosePositionPrice": "100881.3",
"brokerId": 1,
"canceledDate": 0,
"contract": {
"amount24": "",
"base": "usdt",
"baseContractCode": "",
"baseDisplayName": "USDT",
"bizType": "perpetual",
"code": "btcusdt",
"codeDisplayName": "BTCUSDT",
"contractCodeDisplayName": "",
"contractType": "perpetual",
"countDownTimeInterval": "",
"direction": 0,
"env": 0,
"fluctuation": "",
"fund": "",
"guaranteedStopLossRate": "",
"guaranteedStopLossStatus": 0,
"high": "",
"indexBase": "btc",
"indexBaseAppLogo": "",
"indexBaseDisplayName": "BTC",
"indexBaseWebLogo": "",
"indexCny": "",
"indexPrice": "",
"lastCny": "",
"liquidationDate": 1746756000000,
"liquidationHour": 0,
"low": "",
"makerRate": "",
"marginDigit": 6,
"markCny": "",
"markPrice": "",
"marketCap": 0,
"marketPriceDigit": 1,
"maxLever": 0,
"maxOpenAmount": "",
"maxOrderAmount": 0,
"minOrderAmount": 0,
"minQuoteDigit": 0,
"minTradeDigit": 0,
"minTradeUnit": 0,
"nextLiquidationInterval": 0,
"offlineTip": false,
"openTradeTime": "",
"preDeliveryPrice": "",
"price": "",
"quote": "usdt",
"quoteDisplayName": "USDT",
"size24": "",
"sort": 0,
"supportCode": "",
"takerRate": "",
"totalPosition": "",
"tradeStatus": 0,
"unitAmount": 0.001,
"unitAmountStr": "0.001",
"zonesChg": null
},
"createdDate": 1746753722494,
"currencyCode": "usdt",
"dealAmount": "1",
"dealDetails": [
{
"dealAmount": "1",
"dealDate": 1746753722623,
"deductedFee": "0.000000",
"donationFee": "0.000000",
"fee": "-0.061397",
"markerTaker": 2,
"price": "102328.4"
}
],
"deductedFee": "0.000000",
"detailSide": "open_long",
"donationFee": "0.000000",
"donationGuaranteedStopLossFee": "0.000000",
"donationOpenMargin": "0.000000",
"donationProfit": "0.000000",
"dualPosition": 1,
"fee": "-0.061397",
"growthType": 1,
"guaranteedStopLossRate": "0.003",
"guaranteedStopLossStatus": 1,
"historyOrderFlag": true,
"ioc": 0,
"lever": "100",
"liquidateExplosionDetail": null,
"liquidateExplosionDetailV2": null,
"mode": 0,
"mustMaker": 0,
"orderDonationFee": "0.000000",
"orderId": 3801378365358832,
"orderPriceType": 0,
"orderSystemType": 11,
"positionId": 2916028,
"positionType": 0,
"price": "103147.0",
"principalFee": "0.061888",
"principalGuaranteedStopLossFee": "0.000000",
"principalOpenMargin": "1.031470",
"profit": "0.000000",
"reduceOnly": 0,
"refConditionOrderId": 0,
"refOrderId": 0,
"refType": 1,
"selectedMode": 0,
"settingDate": 0,
"shadowAmount": "0.000000",
"side": "long",
"skill": 0,
"status": 2,
"stopLimitType": 0,
"systemType": 11,
"tracingCallback": "",
"tracingDirection": "",
"tracingOrderPriceType": 0,
"tracingPrice": "",
"triggerBy": "",
"triggerDate": 0,
"triggerPrice": "",
"unitAmount": "0.001",
"userId": 109200034
},
"msg": "success"
}
data
| 名称 | 类型 | 描述 | 默认值 | 备注 |
|---|---|---|---|---|
| amount | string | 委托数量 | ||
| avgPrice | string | 成交均价 | ||
| beforeClosePositionPrice | string | 平仓前持仓价 | ||
| canceledDate | number | 撤销时间 | ||
| contract | object | 合约明细 | ContractNavigation | |
| createdDate | number | 创建时间 | ||
| currencyCode | string | 币种 | ||
| dealAmount | string | 成交数量 | ||
| dealDetails | object [] | 成交详情 | item 类型: OrderDealDetail | |
| deductedFee | string | 手续费减免 | ||
| detailSide | string | 详细仓位方向:1.开多open_long 2.开空open_short 3.平多close_long 4.平空close_short | ||
| donationFee | string | 赠金手续费 | ||
| donationGuaranteedStopLossFee | string | 赠金保价止损手续费 | ||
| donationOpenMargin | string | 赠金开仓保证金 | ||
| donationProfit | string | 赠金盈亏 | ||
| dualPosition | int | 单向持仓 0-单向持仓/1-双向持仓 | ||
| fee | string | 手续费 | ||
| growthType | int | 持仓增长类型:1:开仓单 2:平仓单 0:无法确定 | ||
| guaranteedStopLossRate | string | 保价止损费率 | ||
| guaranteedStopLossStatus | int | 是否开启保价止损 | ||
| historyOrderFlag | boolean | 是否是历史订单 | ||
| lever | string | 杠杆 | ||
| liquidateExplosionDetail | object | 强平详情 | LiquidateExplosionDetail | |
| mode | int | 持仓模式,0:合仓,1:分仓 | ||
| mustMaker | int | 被动委托:0:不care 1:只做maker,如何是taker就撤单 | ||
| orderDonationFee | string | 赠金委托手续费 | ||
| orderId | number | 订单ID | ||
| orderPriceType | number | 订单类型 | ||
| orderSystemType | int | 10:限价 11:市价 13:强平单 14:爆仓单 | ||
| positionId | long | 仓位ID | ||
| positionType | number | 仓位类型 | ||
| price | string | 委托价 | ||
| profit | string | 收益 | ||
| refConditionOrderId | number | 条件单id | ||
| settingDate | number | 设置时间 | ||
| side | string | 方向 | ||
| status | number | 1 部分成交 2 完全成交 -1 已经撤销 0 未成交(当systemType不等于12时) 0 未触发(当systemType等于12时条件单) | ||
| stopLimitType | number | 条件单类型 0 -止盈 1-止损 2-计划委托 | ||
| systemType | number | 系统类型 10:限价 11:市价 12:条件单 13:强平单 14:爆仓单 15:爆仓 16:强减 | ||
| triggerDate | number | 触发时间 | ||
| triggerPrice | string | 触发价 |
ContractNavigation
| 名称 | 是否必须 | 类型 | 描述 | 默认值 | 备注 |
|---|---|---|---|---|---|
| amount24 | y | string | 24小时成交张数 | ||
| base | y | string | 基础货币名 | ||
| code | y | string | 合约code | ||
| contractType | y | string | 合约类型,永续-perpetual、 交割-deliver 、当周交割-week、次周交割-nextWeek、当季交割-quarter、次季交割-nextQuarter | ||
| countDownTimeInterval | y | string | 倒计时时间间隔 | ||
| direction | y | integer | 方向 0:正向,1:反向 | format: int32 | |
| env | y | integer | 是否测试盘 0:线上盘,1:测试盘 | format: int32 | |
| fluctuation | y | string | 涨跌幅 | ||
| fund | y | string | 资金费率 | ||
| guaranteedStopLossRate | y | string | 保价止损费率 | ||
| guaranteedStopLossStatus | y | string | 是否开启保价止损 | ||
| high | y | string | 最高价 | ||
| indexBase | y | string | 指数货币 | ||
| indexPrice | y | string | 指数价格 | ||
| lastCny | y | string | 最新价折合人民币 | ||
| liquidationDate | y | string | 清算时间 | format: date-time | |
| low | y | string | 最低价 | ||
| makerRate | y | string | maker 汇率 | ||
| marginDigit | y | integer | 保证金精度 | format: int32 | |
| markPrice | y | string | 标记价格 | ||
| marketPriceDigit | y | integer | 标记价格最小单位(精度) | format: int32 | |
| maxLever | y | number | 最大杠杆 | ||
| maxOrderAmount | y | integer | 每笔最大挂单张数 | format: int32 | |
| minOrderAmount | y | integer | 每笔最小挂单张数 | format: int32 | |
| minQuoteDigit | y | integer | 计价货币最小交易小数位 | format: int32 | |
| minTradeDigit | y | integer | 基础货币最小交易小数位 | format: int32 | |
| minTradeUnit | y | number | 最小交易单位 | ||
| nextLiquidationInterval | y | integer | 下一次清算时间差 | format: int64 | |
| openTradeTime | y | string | 开盘时间 | ||
| price | y | string | 最新价 | ||
| quote | y | string | 计价货币名 | ||
| quoteDisplayName | y | string | 计价货币显示名 | ||
| size24 | y | string | 24小时成交价值 | ||
| sort | y | integer | 排序 | format: int32 | |
| takerRate | y | string | taker 汇率 | ||
| totalPosition | y | string | 持仓量 | ||
| tradeStatus | y | integer | 发布状态:1预发,2上线后7天内,3.上线七天后 | format: int32 | |
| unitAmount | y | number | 一张合约对应的quote面值,默认1 |
OrderDealDetail
| 名称 | 类型 | 描述 | 默认值 | 备注 |
|---|---|---|---|---|
| dealAmount | string | 成交数量 | ||
| dealDate | string | 成交时间 | ||
| deductedFee | string | 手续费减免 | ||
| donationFee | string | 赠金手续费 | ||
| fee | string | 手续费 | ||
| markerTaker | int | 1:maker 2:taker | ||
| price | string | 价格 |
LiquidateExplosionDetail
| 名称 | 类型 | 描述 | 默认值 | 备注 |
|---|---|---|---|---|
| contractCode | string | 合约code | ||
| explosionPrice | string | 破产价 | ||
| feeRate | string | 手续费率 | ||
| lever | string | 杠杠 | ||
| liquidatePrice | string | 强平价 | ||
| maintainRate | string | 维持保证金率 | ||
| price | string | 委托价格 | ||
| side | string | 方向 |