跟单员接口
跟单员 OpenAPI 使用 /api/v2/copy-trading/follower 前缀。所有接口仅访问当前 API Key 对应跟随者自己的跟单数据或设置,返回结构沿用 OpenAPI V2:
json
{ "code": 200, "msg": "success", "data": {} }- 所有接口都需要签名,API Key 账户类型必须为
COPY_TRADING。 - 查询接口允许 read-only API Key;写接口不支持 read-only API Key。
- OpenAPI 公共签名参数请参考基础信息。
- 64 位整型字段在 JSON 中按现有 OpenAPI 序列化口径多以字符串返回。
- 本次不提供“查询最大/最小跟随下单数量”接口。
当前跟单
查询当前跟随者的当前跟单仓位。
Request Weight
1
Request URL
GET /api/v2/copy-trading/follower/orders/current
Parameters
无业务参数。
Response
data 为数组,每个元素包含:
| 字段 | 类型 | 说明 |
|---|---|---|
| leaderUserId | string | 交易员用户 ID |
| leaderNickname | string | 交易员昵称 |
| leaderAvatar | string | 交易员头像 |
| symbolId | string | 交易对 ID |
| isLong | integer | 方向,0 空,1 多 |
| positionType | integer | 仓位类型 |
| leverage | string | 杠杆 |
| openAvgPrice | string | 开仓均价 |
| markPrice | string | 标记价格 |
| currentPrice | string | 当前价格 |
| quantity | string | 数量 |
| margin | string | 保证金 |
| liquidationPrice | string | 预估强平价 |
| unrealizedProfit | string | 未实现盈亏 |
| unrealizedProfitRate | string | 未实现盈亏率 |
| stopProfitRate | string | 止盈比例 |
| stopLossRate | string | 止损比例 |
Example
http
GET /api/v2/copy-trading/follower/orders/currentjson
{
"code": 200,
"msg": "success",
"data": [
{
"leaderUserId": "123456789",
"leaderNickname": "S5",
"leaderAvatar": "https://static.example.com/avatar.png",
"symbolId": "BTC-SWAP-USDT",
"isLong": 1,
"positionType": 1,
"leverage": "20",
"openAvgPrice": "6805",
"markPrice": "7121.97",
"currentPrice": "6805",
"quantity": "0.01",
"margin": "3.3854",
"liquidationPrice": "",
"unrealizedProfit": "3.17",
"unrealizedProfitRate": "0.9315",
"stopProfitRate": "",
"stopLossRate": ""
}
]
}Errors
| code | msg | 说明 |
|---|---|---|
| 200 | success | 成功 |
| -32045 | Copy trading follower not found. | 当前签名账户没有有效跟单关系 |
| -1000 | unknown | 未知异常 |
历史跟单
查询当前跟随者的历史跟单仓位。
Request Weight
1
Request URL
GET /api/v2/copy-trading/follower/orders/history
Parameters
| 名称 | 位置 | 类型 | 是否必须 | 默认值 | 说明 |
|---|---|---|---|---|---|
| page | query | LONG | NO | 1 | 页码,从 1 开始 |
| size | query | LONG | NO | 10 | 每页数量,最大 100 |
Response
data 为分页对象:
| 字段 | 类型 | 说明 |
|---|---|---|
| pages | string | 总页数 |
| total | string | 总条数 |
| list | array | 历史跟单列表 |
data.list[] 字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| symbolId | string | 交易对 ID |
| positionType | integer | 仓位类型 |
| leverage | string | 杠杆 |
| isLong | integer | 方向,0 空,1 多 |
| leaderNickname | string | 交易员昵称 |
| leaderAvatar | string | 交易员头像 |
| openTimeMs | string | 开仓时间,epoch millis |
| lastCloseTimeMs | string | 最后平仓时间,epoch millis |
| openAvgPrice | string | 开仓均价 |
| closeAvgPrice | string | 平仓均价 |
| maxPositionQuantity | string | 最大持仓量 |
| closedQuantity | string | 已平仓量 |
| realizedProfit | string | 已实现盈亏 |
| closeStatus | integer | 平仓状态 |
Example
http
GET /api/v2/copy-trading/follower/orders/history?page=1&size=10json
{
"code": 200,
"msg": "success",
"data": {
"pages": "1",
"total": "1",
"list": [
{
"symbolId": "BTC-SWAP-USDT",
"positionType": 1,
"leverage": "20",
"isLong": 1,
"leaderNickname": "S5",
"leaderAvatar": "https://static.example.com/avatar.png",
"openTimeMs": "1717200000000",
"lastCloseTimeMs": "1717203600000",
"openAvgPrice": "6805",
"closeAvgPrice": "7100",
"maxPositionQuantity": "0.02",
"closedQuantity": "0.02",
"realizedProfit": "5.9",
"closeStatus": 2
}
]
}
}Errors
| code | msg | 说明 |
|---|---|---|
| 200 | success | 成功 |
| -1130 | Data sent for paramter ... | page 或 size 不合法,size 最大为 100 |
| -32045 | Copy trading follower not found. | 当前签名账户没有有效跟单关系 |
| -1000 | unknown | 未知异常 |
设置仓位止盈止损
修改当前跟随者在指定交易员和交易对下的仓位止盈止损。
Request Weight
1
Request URL
PUT /api/v2/copy-trading/follower/positions/stop-profit-loss
Parameters
Request body 使用 JSON。
| 字段 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| leaderUserId | LONG | YES | 目标交易员用户 ID |
| symbolId | string | YES | 交易对 ID |
| isLong | integer | YES | 方向,0 空,1 多 |
| stopProfitRate | DECIMAL | NO | 止盈比例 |
| stopLossRate | DECIMAL | NO | 止损比例 |
| stopLossDelay | integer | NO | 止损延迟秒数 |
Response
成功时 data 为 null。
Example
http
PUT /api/v2/copy-trading/follower/positions/stop-profit-lossjson
{
"leaderUserId": 123456789,
"symbolId": "BTC-SWAP-USDT",
"isLong": 1,
"stopProfitRate": "0.1",
"stopLossRate": "0.2",
"stopLossDelay": 30
}Errors
| code | msg | 说明 |
|---|---|---|
| 200 | success | 成功 |
| -1020 | This operation is not supported. | read-only API Key 调用写接口 |
| -1102 | Mandatory parameter ... | 必填字段缺失或格式错误 |
| -1130 | Data sent for paramter ... | 字段范围、精度或格式不合法 |
| -32045 | Copy trading follower not found. | 当前签名账户没有有效跟单关系 |
| -1000 | unknown | 未知异常 |
修改跟单设置
修改当前跟随者对指定交易员的跟单设置。
Request Weight
1
Request URL
PUT /api/v2/copy-trading/follower/config
Parameters
Request body 使用 JSON。
| 字段 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
| leaderUserId | LONG | YES | 目标交易员用户 ID |
| investAmount | DECIMAL | YES | 跟单投入总额 |
| singlePlaceAmount | DECIMAL | YES | 固定金额单次下单金额 |
| dailyMaxInvestAmount | DECIMAL | YES | 每日最大投入金额 |
| leverage | DECIMAL | YES | 跟随杠杆 |
| maxInvestRate | DECIMAL | YES | 最大投入比例 |
| stopProfitRate | DECIMAL | YES | 止盈比例 |
| stopLossRate | DECIMAL | YES | 止损比例 |
| realInvestAmount | DECIMAL | YES | 实际投入金额 |
| followAmountMode | integer | YES | 跟随金额模式 |
| stopLossDelay | integer | YES | 止损延迟秒数 |
| isolatedReservedAmount | DECIMAL | YES | 逐仓预留保证金 |
| followMarginType | integer | YES | 跟随保证金模式 |
| followSymbolIds | STRING | YES | all 或英文逗号分隔交易对 ID |
| zeroSlippageSwitch | boolean | YES | 0 滑点开关 |
规则说明
- read-only API Key 调用该写接口会被拒绝。
investAmount、singlePlaceAmount、dailyMaxInvestAmount、leverage、stopProfitRate、stopLossRate、realInvestAmount、isolatedReservedAmount支持最多 8 位小数,且不能为负数。maxInvestRate支持最多 8 位小数,取值范围为0到1;例如0.5表示最大投入比例为 50%。followSymbolIds不能为空;all表示全部交易对。指定多个交易对时使用英文逗号分隔,例如BTC-SWAP-USDT,ETH-SWAP-USDT;分隔后的交易对 ID 不能为空,且all不能与具体交易对混用。- 当
followAmountMode = 0时,表示固定金额跟单;singlePlaceAmount不能小于当前交易员或系统配置的单次跟单最小金额,realInvestAmount不能小于isolatedReservedAmount + singlePlaceAmount。 - 当
followAmountMode = 1时,表示固定比例跟单;真实投入金额需要满足固定比例模式的最小投入要求,realInvestAmount不能小于isolatedReservedAmount + 固定比例模式最小投入金额。 investAmount表示设置后的跟单投入总额,仍会按当前跟单模式校验最低投入金额;固定金额模式低于交易员最小跟单投入会失败,固定比例模式低于固定比例最小投入会失败。dailyMaxInvestAmount传0表示不设置每日最大投入限制;大于0时不能小于单次跟单最小金额。leverage不能超过系统配置的跟单最大杠杆;已有正在跟随中的订单时,不允许修改杠杆。stopProfitRate和stopLossRate传0表示不设置;非0时不能小于0.01。followMarginType = 0表示跟随全部仓位模式;followMarginType = 1表示只跟随全仓带单;followMarginType = 2表示只跟随逐仓带单。zeroSlippageSwitch是 0 滑点布尔开关。
Response
成功时 data 为 null。
Example
http
PUT /api/v2/copy-trading/follower/configjson
{
"leaderUserId": 123456789,
"investAmount": "100",
"singlePlaceAmount": "10",
"dailyMaxInvestAmount": "50",
"leverage": "20",
"maxInvestRate": "0.5",
"stopProfitRate": "0.1",
"stopLossRate": "0.2",
"realInvestAmount": "100",
"followAmountMode": 1,
"stopLossDelay": 30,
"isolatedReservedAmount": "5",
"followMarginType": 2,
"followSymbolIds": "BTC-SWAP-USDT,ETH-SWAP-USDT",
"zeroSlippageSwitch": true
}Errors
| code | msg | 说明 |
|---|---|---|
| 200 | success | 成功 |
| -1020 | This operation is not supported. | read-only API Key 调用写接口 |
| -1102 | Mandatory parameter ... | 必填字段缺失或格式错误 |
| -1130 | Data sent for paramter ... | 字段范围、精度或格式不合法 |
| -32045 | Copy trading follower not found. | 当前签名账户与 leaderUserId 没有有效跟单关系 |
| -1000 | unknown | 未知异常 |
查询跟单设置
查询当前跟随者对指定交易员的跟单设置。
Request Weight
1
Request URL
GET /api/v2/copy-trading/follower/config
Parameters
| 名称 | 位置 | 类型 | 是否必须 | 说明 |
|---|---|---|---|---|
| leaderUserId | query | LONG | YES | 目标交易员用户 ID |
Response
data 字段包含:
| 字段 | 类型 | 说明 |
|---|---|---|
| leaderUserId | string | 目标交易员用户 ID |
| investAmount | string | 跟单投入总额 |
| singlePlaceAmount | string | 固定金额单次下单金额 |
| dailyMaxInvestAmount | string | 每日最大投入金额 |
| leverage | string | 跟随杠杆 |
| maxInvestRate | string | 最大投入比例 |
| stopProfitRate | string | 止盈比例 |
| stopLossRate | string | 止损比例 |
| followAmountMode | integer | 跟随金额模式 |
| stopLossDelay | integer | 止损延迟秒数 |
| isolatedReservedAmount | string | 逐仓预留保证金 |
| followMarginType | integer | 跟随保证金模式 |
| followSymbolIds | string | all 或英文逗号分隔交易对 ID |
| zeroSlippageSwitch | boolean | 0 滑点开关 |
Example
http
GET /api/v2/copy-trading/follower/config?leaderUserId=123456789json
{
"code": 200,
"msg": "success",
"data": {
"leaderUserId": "123456789",
"investAmount": "100",
"singlePlaceAmount": "10",
"dailyMaxInvestAmount": "50",
"leverage": "20",
"maxInvestRate": "0.5",
"stopProfitRate": "0.1",
"stopLossRate": "0.2",
"followAmountMode": 1,
"stopLossDelay": 30,
"isolatedReservedAmount": "5",
"followMarginType": 2,
"followSymbolIds": "BTC-SWAP-USDT,ETH-SWAP-USDT",
"zeroSlippageSwitch": true
}
}Errors
| code | msg | 说明 |
|---|---|---|
| 200 | success | 成功 |
| -1130 | Data sent for paramter 'leaderUserId' is not valid. | leaderUserId 不合法 |
| -32045 | Copy trading follower not found. | 当前签名账户与 leaderUserId 没有有效跟单关系 |
| -1000 | unknown | 未知异常 |
我的交易员
查询当前跟随者正在跟随的交易员列表。
Request Weight
1
Request URL
GET /api/v2/copy-trading/follower/leaders
Parameters
无业务参数。
Response
data 为数组,每个元素包含:
| 字段 | 类型 | 说明 |
|---|---|---|
| leaderUserId | string | 交易员用户 ID |
| leaderNickname | string | 交易员昵称 |
| leaderAvatar | string | 交易员头像 |
| marginBalance | string | 保证金余额 |
| availableMargin | string | 可用保证金 |
| unrealisedPnl | string | 未实现盈亏 |
| realisedProfit | string | 已实现收益 |
| holdingProfitSharing | string | 预扣分润 |
| settledProfitSharing | string | 已结分润 |
| netProfit | string | 净利润 |
Example
http
GET /api/v2/copy-trading/follower/leadersjson
{
"code": 200,
"msg": "success",
"data": [
{
"leaderUserId": "123456789",
"leaderNickname": "S5",
"leaderAvatar": "https://static.example.com/avatar.png",
"marginBalance": "521.64",
"availableMargin": "518.25",
"unrealisedPnl": "-0.03",
"realisedProfit": "0",
"holdingProfitSharing": "0",
"settledProfitSharing": "0.58",
"netProfit": "-0.58"
}
]
}Errors
| code | msg | 说明 |
|---|---|---|
| 200 | success | 成功 |
| -32045 | Copy trading follower not found. | 当前签名账户没有有效跟单关系 |
| -1000 | unknown | 未知异常 |
取消跟随交易员
当前跟随者取消跟随指定交易员。
Request Weight
1
Request URL
DELETE /api/v2/copy-trading/follower/leaders/{leaderUserId}
Parameters
| 名称 | 位置 | 类型 | 是否必须 | 说明 |
|---|---|---|---|---|
| leaderUserId | path | LONG | YES | 目标交易员用户 ID,必须大于等于 1 |
Response
成功时 data 为 null。
Example
http
DELETE /api/v2/copy-trading/follower/leaders/123456789json
{
"code": 200,
"msg": "success",
"data": null
}Errors
| code | msg | 说明 |
|---|---|---|
| 200 | success | 成功 |
| -1020 | This operation is not supported. | read-only API Key 调用写接口 |
| -1130 | Data sent for paramter 'leaderUserId' is not valid. | leaderUserId 不合法 |
| -32045 | Copy trading follower not found. | 跟单关系不存在 |
| -120055 | The follower currently has copy position, cannot be removed. | 当前有跟单仓位,不能取消跟随 |
| -1000 | unknown | 未知异常 |