获取追踪止损/止盈信息
API说明
此接口允许查询合约交易的追踪止损和止盈详情。
注意:追踪止损/止盈信息数据只能通过 RESTful API 获取。
注意事项
无
认证
这是一个私有接口,需要认证。有关使用RESTful API的详细信息,请参考简介 > 认证和代码示例 > 合约 > RESTful私有接口。
请求方法
GET
接口地址
频率限制
该接口的调用频率限制为:每个 IP 和用户 ID 每秒最多请求5次。
此外,该接口还受到全局频率限制的约束。
有关"全局速率限制"和"API限频策略"的详细信息,请参阅“频率限制”部分,跳转
请求参数
无
响应参数
| 参数 | 类型 | 描述 |
|---|---|---|
| baseSize | BigDecimal | 以合约计的订单规模 |
| callbackRate | BigDecimal | 回调率 |
| createdDate | Long | 订单创建时间戳 |
| currentPiece | BigDecimal | 当前合约数量 |
| direction | String | 交易方向:做多(long),做空(short) |
| fee | BigDecimal | 手续费 |
| instrument | String | 交易品种的基础货币,例如BTC或ETH |
| leverage | BigDecimal | 持仓杠杆率 |
| margin | BigDecimal | 持仓使用的保证金 |
| openId | Long | 持仓ID |
| openPrice | BigDecimal | 订单成交的开仓价格 |
| orderPrice | BigDecimal | 指定的订单价格 |
| originalType | String | 原始订单类型 |
| posType | String | 持仓类型:plan/planTrigger/execute/moveStopProfitLoss |
| positionModel | Integer | 持仓持仓模式:0:逐仓,1:全仓 |
| positionMargin | BigDecimal | 持仓保证金 |
| quantity | BigDecimal | 基于quantityUnit 指定订单数量: 当 quantityUnit = 0 时,数量以计价货币计量(例如,BTC-USDT 中的 USDT); 当 quantityUnit = 1 时,数量以合约张数计量; 当 quantityUnit = 2 时,数量以基础货币计量(例如,BTC-USDT 中的 BTC)。 |
| quantityUnit | Integer | 用于指定订单数量的计量单位: 0:以计价货币计价(例如,BTC-USDT 合约中的 USDT); 1:以合约张数计价; 2:以基础货币计价(例如,BTC-USDT 合约中的 BTC)。 |
| status | String | 状态:open(开仓),close(平仓) |
| triggerPrice | BigDecimal | 永续合约计划订单的触发价格 |
| triggerType | String | 指定触发价格满足时的订单类型:0:限价单,1:市价单 |
| updatedDate | Long | 最后更新的时间戳 |
| contractType | Integer | 合约类型:1:U本位永续合约 |
| finishStatus | Integer | 完成状态 |
| fundingFee | String | 资金费用 |
| id | Long | ID(用户可忽略) |
| processStatus | Integer | 匹配服务器处理状态:0:等待,1:处理中,2:成功,3:失败 |
| source | String | 来源:web/api |
| status | String | 订单状态:open/close/cancel |
| userId | Integer | 合约账户用户ID |
| version | Integer | (用户可忽略) |
请求示例
以下Python代码展示了如何获取追踪止损和止盈信息。
注意:完整代码示例请参考简介 > 认证和代码示例 > 合约 > RESTful私有接口。
params = {}
api_url = "/v1/perpum/moveTPSL"
method = "GET"
response_code, response_data = FuturesRestfulPrivate(params, api_url, method, sec_key, api_key) # function FuturesRestfulPrivate() is defined in section (Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface)
注意:完整Java代码示例请参考简介 > 认证和代码示例 > 合约 > RESTful私有接口。
响应示例
以下是上述Python请求返回的示例响应:
{'code': 0,
'data': [{'baseSize': 0.001,
'callbackRate': 0.5,
'contractType': 1,
'createdDate': 1740901653000,
'currentPiece': 1,
'direction': 'long',
'fee': '0',
'finishStatus': 1,
'fundingFee': '0',
'id': '650302470008901',
'instrument': 'BTC',
'leverage': 2,
'margin': 43.1233,
'openId': '2435521222632107649',
'openPrice': 86246.6,
'orderPrice': 0,
'originalType': 'moveStopProfitLoss',
'posType': 'moveStopProfitLoss',
'positionMargin': 43.1233,
'positionModel': 0,
'processStatus': 0,
'quantity': 1,
'quantityUnit': 1,
'source': 'api',
'status': 'close',
'triggerPrice': 0,
'triggerType': 1,
'updatedDate': 1740901653000,
'userId': 1162061,
'version': 0}],
'msg': ''}