跳到主要内容

获取追踪止损/止盈信息

API说明

此接口允许查询合约交易的追踪止损和止盈详情。

注意:追踪止损/止盈信息数据只能通过 RESTful API 获取。

注意事项

认证

这是一个私有接口,需要认证。有关使用RESTful API的详细信息,请参考简介 > 认证和代码示例 > 合约 > RESTful私有接口。

请求方法

GET

接口地址

/v1/perpum/moveTPSL

频率限制

该接口的调用频率限制为:每个 IP 和用户 ID 每秒最多请求5次。
此外,该接口还受到全局频率限制的约束。
有关"全局速率限制"和"API限频策略"的详细信息,请参阅“频率限制”部分,跳转

请求参数

响应参数

参数类型描述
baseSizeBigDecimal以合约计的订单规模
callbackRateBigDecimal回调率
createdDateLong订单创建时间戳
currentPieceBigDecimal当前合约数量
directionString交易方向:做多(long),做空(short)
feeBigDecimal手续费
instrumentString交易品种的基础货币,例如BTC或ETH
leverageBigDecimal持仓杠杆率
marginBigDecimal持仓使用的保证金
openIdLong持仓ID
openPriceBigDecimal订单成交的开仓价格
orderPriceBigDecimal指定的订单价格
originalTypeString原始订单类型
posTypeString持仓类型:plan/planTrigger/execute/moveStopProfitLoss
positionModelInteger持仓持仓模式:0:逐仓,1:全仓
positionMarginBigDecimal持仓保证金
quantityBigDecimal基于quantityUnit 指定订单数量:
当 quantityUnit = 0 时,数量以计价货币计量(例如,BTC-USDT 中的 USDT);
当 quantityUnit = 1 时,数量以合约张数计量;
当 quantityUnit = 2 时,数量以基础货币计量(例如,BTC-USDT 中的 BTC)。
quantityUnitInteger用于指定订单数量的计量单位:
0:以计价货币计价(例如,BTC-USDT 合约中的 USDT);
1:以合约张数计价;
2:以基础货币计价(例如,BTC-USDT 合约中的 BTC)。
statusString状态:open(开仓),close(平仓)
triggerPriceBigDecimal永续合约计划订单的触发价格
triggerTypeString指定触发价格满足时的订单类型:0:限价单,1:市价单
updatedDateLong最后更新的时间戳
contractTypeInteger合约类型:1:U本位永续合约
finishStatusInteger完成状态
fundingFeeString资金费用
idLongID(用户可忽略)
processStatusInteger匹配服务器处理状态:0:等待,1:处理中,2:成功,3:失败
sourceString来源:web/api
statusString订单状态:open/close/cancel
userIdInteger合约账户用户ID
versionInteger(用户可忽略)

请求示例

以下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': ''}