Skip to content

跟单员接口

跟单员 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 为数组,每个元素包含:

字段类型说明
leaderUserIdstring交易员用户 ID
leaderNicknamestring交易员昵称
leaderAvatarstring交易员头像
symbolIdstring交易对 ID
isLonginteger方向,0 空,1
positionTypeinteger仓位类型
leveragestring杠杆
openAvgPricestring开仓均价
markPricestring标记价格
currentPricestring当前价格
quantitystring数量
marginstring保证金
liquidationPricestring预估强平价
unrealizedProfitstring未实现盈亏
unrealizedProfitRatestring未实现盈亏率
stopProfitRatestring止盈比例
stopLossRatestring止损比例

Example

http
GET /api/v2/copy-trading/follower/orders/current
json
{
  "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

codemsg说明
200success成功
-32045Copy trading follower not found.当前签名账户没有有效跟单关系
-1000unknown未知异常

历史跟单

查询当前跟随者的历史跟单仓位。

Request Weight

1

Request URL

GET /api/v2/copy-trading/follower/orders/history

Parameters

名称位置类型是否必须默认值说明
pagequeryLONGNO1页码,从 1 开始
sizequeryLONGNO10每页数量,最大 100

Response

data 为分页对象:

字段类型说明
pagesstring总页数
totalstring总条数
listarray历史跟单列表

data.list[] 字段:

字段类型说明
symbolIdstring交易对 ID
positionTypeinteger仓位类型
leveragestring杠杆
isLonginteger方向,0 空,1
leaderNicknamestring交易员昵称
leaderAvatarstring交易员头像
openTimeMsstring开仓时间,epoch millis
lastCloseTimeMsstring最后平仓时间,epoch millis
openAvgPricestring开仓均价
closeAvgPricestring平仓均价
maxPositionQuantitystring最大持仓量
closedQuantitystring已平仓量
realizedProfitstring已实现盈亏
closeStatusinteger平仓状态

Example

http
GET /api/v2/copy-trading/follower/orders/history?page=1&size=10
json
{
  "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

codemsg说明
200success成功
-1130Data sent for paramter ...pagesize 不合法,size 最大为 100
-32045Copy trading follower not found.当前签名账户没有有效跟单关系
-1000unknown未知异常

设置仓位止盈止损

修改当前跟随者在指定交易员和交易对下的仓位止盈止损。

Request Weight

1

Request URL

PUT /api/v2/copy-trading/follower/positions/stop-profit-loss

Parameters

Request body 使用 JSON。

字段类型是否必须说明
leaderUserIdLONGYES目标交易员用户 ID
symbolIdstringYES交易对 ID
isLongintegerYES方向,0 空,1
stopProfitRateDECIMALNO止盈比例
stopLossRateDECIMALNO止损比例
stopLossDelayintegerNO止损延迟秒数

Response

成功时 datanull

Example

http
PUT /api/v2/copy-trading/follower/positions/stop-profit-loss
json
{
  "leaderUserId": 123456789,
  "symbolId": "BTC-SWAP-USDT",
  "isLong": 1,
  "stopProfitRate": "0.1",
  "stopLossRate": "0.2",
  "stopLossDelay": 30
}

Errors

codemsg说明
200success成功
-1020This operation is not supported.read-only API Key 调用写接口
-1102Mandatory parameter ...必填字段缺失或格式错误
-1130Data sent for paramter ...字段范围、精度或格式不合法
-32045Copy trading follower not found.当前签名账户没有有效跟单关系
-1000unknown未知异常

修改跟单设置

修改当前跟随者对指定交易员的跟单设置。

Request Weight

1

Request URL

PUT /api/v2/copy-trading/follower/config

Parameters

Request body 使用 JSON。

字段类型是否必须说明
leaderUserIdLONGYES目标交易员用户 ID
investAmountDECIMALYES跟单投入总额
singlePlaceAmountDECIMALYES固定金额单次下单金额
dailyMaxInvestAmountDECIMALYES每日最大投入金额
leverageDECIMALYES跟随杠杆
maxInvestRateDECIMALYES最大投入比例
stopProfitRateDECIMALYES止盈比例
stopLossRateDECIMALYES止损比例
realInvestAmountDECIMALYES实际投入金额
followAmountModeintegerYES跟随金额模式
stopLossDelayintegerYES止损延迟秒数
isolatedReservedAmountDECIMALYES逐仓预留保证金
followMarginTypeintegerYES跟随保证金模式
followSymbolIdsSTRINGYESall 或英文逗号分隔交易对 ID
zeroSlippageSwitchbooleanYES0 滑点开关

规则说明

  • read-only API Key 调用该写接口会被拒绝。
  • investAmountsinglePlaceAmountdailyMaxInvestAmountleveragestopProfitRatestopLossRaterealInvestAmountisolatedReservedAmount 支持最多 8 位小数,且不能为负数。
  • maxInvestRate 支持最多 8 位小数,取值范围为 01;例如 0.5 表示最大投入比例为 50%。
  • followSymbolIds 不能为空;all 表示全部交易对。指定多个交易对时使用英文逗号分隔,例如 BTC-SWAP-USDT,ETH-SWAP-USDT;分隔后的交易对 ID 不能为空,且 all 不能与具体交易对混用。
  • followAmountMode = 0 时,表示固定金额跟单;singlePlaceAmount 不能小于当前交易员或系统配置的单次跟单最小金额,realInvestAmount 不能小于 isolatedReservedAmount + singlePlaceAmount
  • followAmountMode = 1 时,表示固定比例跟单;真实投入金额需要满足固定比例模式的最小投入要求,realInvestAmount 不能小于 isolatedReservedAmount + 固定比例模式最小投入金额
  • investAmount 表示设置后的跟单投入总额,仍会按当前跟单模式校验最低投入金额;固定金额模式低于交易员最小跟单投入会失败,固定比例模式低于固定比例最小投入会失败。
  • dailyMaxInvestAmount0 表示不设置每日最大投入限制;大于 0 时不能小于单次跟单最小金额。
  • leverage 不能超过系统配置的跟单最大杠杆;已有正在跟随中的订单时,不允许修改杠杆。
  • stopProfitRatestopLossRate0 表示不设置;非 0 时不能小于 0.01
  • followMarginType = 0 表示跟随全部仓位模式;followMarginType = 1 表示只跟随全仓带单;followMarginType = 2 表示只跟随逐仓带单。
  • zeroSlippageSwitch 是 0 滑点布尔开关。

Response

成功时 datanull

Example

http
PUT /api/v2/copy-trading/follower/config
json
{
  "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

codemsg说明
200success成功
-1020This operation is not supported.read-only API Key 调用写接口
-1102Mandatory parameter ...必填字段缺失或格式错误
-1130Data sent for paramter ...字段范围、精度或格式不合法
-32045Copy trading follower not found.当前签名账户与 leaderUserId 没有有效跟单关系
-1000unknown未知异常

查询跟单设置

查询当前跟随者对指定交易员的跟单设置。

Request Weight

1

Request URL

GET /api/v2/copy-trading/follower/config

Parameters

名称位置类型是否必须说明
leaderUserIdqueryLONGYES目标交易员用户 ID

Response

data 字段包含:

字段类型说明
leaderUserIdstring目标交易员用户 ID
investAmountstring跟单投入总额
singlePlaceAmountstring固定金额单次下单金额
dailyMaxInvestAmountstring每日最大投入金额
leveragestring跟随杠杆
maxInvestRatestring最大投入比例
stopProfitRatestring止盈比例
stopLossRatestring止损比例
followAmountModeinteger跟随金额模式
stopLossDelayinteger止损延迟秒数
isolatedReservedAmountstring逐仓预留保证金
followMarginTypeinteger跟随保证金模式
followSymbolIdsstringall 或英文逗号分隔交易对 ID
zeroSlippageSwitchboolean0 滑点开关

Example

http
GET /api/v2/copy-trading/follower/config?leaderUserId=123456789
json
{
  "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

codemsg说明
200success成功
-1130Data sent for paramter 'leaderUserId' is not valid.leaderUserId 不合法
-32045Copy trading follower not found.当前签名账户与 leaderUserId 没有有效跟单关系
-1000unknown未知异常

我的交易员

查询当前跟随者正在跟随的交易员列表。

Request Weight

1

Request URL

GET /api/v2/copy-trading/follower/leaders

Parameters

无业务参数。

Response

data 为数组,每个元素包含:

字段类型说明
leaderUserIdstring交易员用户 ID
leaderNicknamestring交易员昵称
leaderAvatarstring交易员头像
marginBalancestring保证金余额
availableMarginstring可用保证金
unrealisedPnlstring未实现盈亏
realisedProfitstring已实现收益
holdingProfitSharingstring预扣分润
settledProfitSharingstring已结分润
netProfitstring净利润

Example

http
GET /api/v2/copy-trading/follower/leaders
json
{
  "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

codemsg说明
200success成功
-32045Copy trading follower not found.当前签名账户没有有效跟单关系
-1000unknown未知异常

取消跟随交易员

当前跟随者取消跟随指定交易员。

Request Weight

1

Request URL

DELETE /api/v2/copy-trading/follower/leaders/{leaderUserId}

Parameters

名称位置类型是否必须说明
leaderUserIdpathLONGYES目标交易员用户 ID,必须大于等于 1

Response

成功时 datanull

Example

http
DELETE /api/v2/copy-trading/follower/leaders/123456789
json
{
  "code": 200,
  "msg": "success",
  "data": null
}

Errors

codemsg说明
200success成功
-1020This operation is not supported.read-only API Key 调用写接口
-1130Data sent for paramter 'leaderUserId' is not valid.leaderUserId 不合法
-32045Copy trading follower not found.跟单关系不存在
-120055The follower currently has copy position, cannot be removed.当前有跟单仓位,不能取消跟随
-1000unknown未知异常

基于 MIT 许可发布