Skip to content

Examples

For general basic information, please refer to the Basic Information documentation.

Rest API Information

  • All data types are defined by Java data types.
  • Copy Trading OpenAPI endpoints only support data and settings of the leader bound to the current API Key.
  • All Copy Trading endpoints require OpenAPI V2 signed access. The API Key account type must be COPY_TRADING.

LIMITS

  • The REQUEST_WEIGHT of each Copy Trading endpoint is 1.
  • Users who repeatedly violate rate limits, or who continue sending requests after receiving 429, will have their IP banned with error code 418.
  • IP bans are tracked and adjusted based on repeated violations. Ban duration ranges from 2 minutes to 3 days.

SIGNED Endpoint Examples

The following examples show how to call Copy Trading endpoints in a Linux bash environment with echo, openssl, and curl. apiKey and secretKey are for demonstration only.

KeyValue
apiKeySRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq
secretKey30lfjDT51iOG1kYZnDoLNynOyMdIcmQyO1XYfxzYOmQfx9tjiI98Pzio4uhZ0Uk2

GET /api/v2/copy-trading/leader/orders/current Example

ParameterValue
recvWindow5000
timestamp1717200000000
bash
HMAC SHA256 signature:
$ echo -n "recvWindow=5000&timestamp=1717200000000" | openssl dgst -sha256 -hmac "30lfjDT51iOG1kYZnDoLNynOyMdIcmQyO1XYfxzYOmQfx9tjiI98Pzio4uhZ0Uk2"
(stdin)= 0b54c7a90b48f1b6c5cc8170f030594f3eb3c7e6dd81b76f65e18fc76f8b1a88
bash
curl request:
$ curl -H "X-BB-APIKEY: SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq" \
  -X GET 'https://api.toobit.com/api/v2/copy-trading/leader/orders/current?recvWindow=5000&timestamp=1717200000000&signature=0b54c7a90b48f1b6c5cc8170f030594f3eb3c7e6dd81b76f65e18fc76f8b1a88'

PUT /api/v2/copy-trading/leader/config Example

Write endpoints do not support read-only API Keys. When the request body participates in signing, build the signature payload according to OpenAPI V2 signing rules.

ParameterValue
recvWindow5000
timestamp1717200000000
bash
HMAC SHA256 signature:
$ echo -n "recvWindow=5000&timestamp=1717200000000" | openssl dgst -sha256 -hmac "30lfjDT51iOG1kYZnDoLNynOyMdIcmQyO1XYfxzYOmQfx9tjiI98Pzio4uhZ0Uk2"
(stdin)= 0b54c7a90b48f1b6c5cc8170f030594f3eb3c7e6dd81b76f65e18fc76f8b1a88
bash
curl request:
$ curl -H "X-BB-APIKEY: SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq" \
  -H "Content-Type: application/json" \
  -X PUT 'https://api.toobit.com/api/v2/copy-trading/leader/config?recvWindow=5000&timestamp=1717200000000&signature=0b54c7a90b48f1b6c5cc8170f030594f3eb3c7e6dd81b76f65e18fc76f8b1a88' \
  -d '{
    "unLeadType": 0,
    "leadPositionType": 0,
    "tradeProtect": 1,
    "profitPeriod": 7,
    "profitRate": "10",
    "followAssetLowerLimit": "100",
    "fixedAmountFollowMin": "10",
    "fixedRateFollowMin": "1",
    "isNeedInvite": 0,
    "inviteScope": 0,
    "symbolIds": ["BTC-SWAP-USDT"]
  }'

Released under the MIT License.