简体中文
shell

Change Log

2022-10-16

Create a document

Introduction

API Key Setup

API Key Restrictions

Enabling Accounts

Spot Account

A SPOT account is provided by default upon creation of a Account.

General Info

General API Information

HTTP Return Codes

General Information on Endpoints

LIMITS

General Info on Limits

Order Rate Limits

Websocket Limits

Endpoint security type

Security Type Description
NONE Endpoint can be accessed freely.
TRADE Endpoint requires sending a valid API-Key and signature.
USER_DATA Endpoint requires sending a valid API-Key and signature.
USER_STREAM Endpoint requires sending a valid API-Key.
MARKET_DATA Endpoint requires sending a valid API-Key.

SIGNED (TRADE, USER_DATA) Endpoint security

Timing security

The logic is as follows:

if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {
  // process request
} else {
  // reject request
}

Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server.

SIGNED Endpoint Examples for POST /api/v1/spot/order - HMAC Keys

Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using echo, openssl, and curl.

Key Value
apiKey SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq
secretKey 30lfjDT51iOG1kYZnDoLNynOyMdIcmQyO1XYfxzYOmQfx9tjiI98Pzio4uhZ0Uk2
Parameter Value
symbol BTCUSDT
side SELL
type LIMIT
timeInForce GTC
quantity 1
price 4000
recvWindow 100000
timestamp 1668481902307

Example 1: As a query string

Example 1:

HMAC SHA256 signature:

$ echo -n "symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=400&recvWindow=100000&timestamp=1668481902307" | openssl dgst -sha256 -hmac "30lfjDT51iOG1kYZnDoLNynOyMdIcmQyO1XYfxzYOmQfx9tjiI98Pzio4uhZ0Uk2"
(stdin)= 8420e499e71cce4a00946db16543198b6bcae01791bdb75a06b5a7098b156468
curl command:
(HMAC SHA256)
$ curl -H "X-BB-APIKEY: SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq" -X POST 'https://api.toobit.com/api/v1/spot/order' -d 'symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=400&recvWindow=100000&timestamp=1668481902307&signature=8420e499e71cce4a00946db16543198b6bcae01791bdb75a06b5a7098b156468'

Example 2: As a request body

Example 2:
HMAC SHA256 signature:
$ echo -n "symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=400&recvWindow=100000&timestamp=1668481902307" | openssl dgst -sha256 -hmac "30lfjDT51iOG1kYZnDoLNynOyMdIcmQyO1XYfxzYOmQfx9tjiI98Pzio4uhZ0Uk2"
(stdin)= 8420e499e71cce4a00946db16543198b6bcae01791bdb75a06b5a7098b156468
curl command:
(HMAC SHA256)
$ curl -H "X-BB-APIKEY: SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq" -X POST 'https://api.toobit.com/api/v1/spot/order' -d 'symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=400&recvWindow=100000&timestamp=1668481902307&signature=8420e499e71cce4a00946db16543198b6bcae01791bdb75a06b5a7098b156468'

Example 3: Mixed query string and request body

Example 3:
HMAC SHA256 signature:
$ echo -n "symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTCquantity=1&price=400&recvWindow=10000000&timestamp=1668481902307" | openssl dgst -sha256 -hmac "30lfjDT51iOG1kYZnDoLNynOyMdIcmQyO1XYfxzYOmQfx9tjiI98Pzio4uhZ0Uk2"
(stdin)= 59ef0b2085ebb99cca5b6445c202d99add17be2d5d1861c0f4aa17bc785ac4d5
curl command:
(HMAC SHA256)
$ curl -H "X-BB-APIKEY: SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq" -X POST 'https://api.toobit.com/api/v1/spot/order?symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=400&recvWindow=10000000&timestamp=1668481902307&signature=59ef0b2085ebb99cca5b6445c202d99add17be2d5d1861c0f4aa17bc785ac4d5'

Note that the signature is different in example 3. There is no & between "GTC" and "quantity=1".

Public API Definitions

Terminology

These terms will be used throughout the documentation, so it is recommended especially for new users to read to help their understanding of the API.

ENUM definitions

Order status (status):

Order types (orderTypes, type):

Order side (side):

Time in force (timeInForce):

Kline/Candlestick chart intervals:

m -> minutes; h -> hours; d -> days; w -> weeks; M -> months

Rate limiters (rateLimitType)

Rate limit intervals (interval)

Wallet Endpoints

Withdraw (USER_DATA)

Submit a withdraw request.

Weight:1

Response

{
"status": 0,
"success": true,
"needBrokerAudit": false, // Do you need a brokerage review?
"id": "423885103582776064", // Withdrawal successful order id
"refuseReason":"" // failure rejection reason
}

Parameters

Name Type Mandatory Description
coin STRING YES asset
clientOrderId LONG YES client id for withdraw
address STRING YES Withdrawal address (Note: the withdrawal address must be maintained in the PC terminal or APP terminal in the common address list inside the address)
addressExt STRING NO tag
quantity DECIMAL YES Number of coin withdrawals
chainType STRING NO chain type, The chainType of USDT is OMNI ERC20 TRC20 respectively, and the default is OMNI

Withdrawal records (USER_DATA)

Weight:5

Response

[
    {
        "time":"1536232111669",
        "id ":"90161227158286336",
        "accountId":"517256161325920",
        "coinId ":"BHC",
        "coinName":"BHC",
        "address":"0x815bF1c3cc0f49b8FC66B21A7e48fCb476051209",
        "addressExt":"address tag",
        "quantity":"14", // Withdrawal amount
        "arriveQuantity":"14", // Amount received
        "statusCode":"PROCESSING_STATUS",
        "status":3,
        "txId ":"",
        "txIdUrl ":"",
        "walletHandleTime":"1536232111669",
        "feeCoinId ":"BHC",
        "feeCoinName ":"BHC",
        "fee":"0.1",
        "requiredConfirmTimes ":0, // Number of confirmation requests
        "confirmTimes ":0, // number of confirmations
        "kernelId":"", // Exclusive to BEAM and GRIN
        "isInternalTransfer": false // Whether internal transfer
    }
]

Parameters

Name Type Mandatory Description
coin STRING NO asset
startTime LONG NO start timestamp
endTime LONG NO end timestamp
fromId LONG NO From which OrderId to start fetching
withdrawOrderId LONG NO Withdrawal order ID
limit INT NO default 500; maximum 1000
recvWindow LONG NO recv window
timestamp LONG YES Timestamp

Deposit Address (USER_DATA)

Fetch deposit address with network.

Weight:1

Response

    {
        "canDeposit":false,//Is it possible to recharge
        "address":"0x815bF1c3cc0f49b8FC66B21A7e48fCb476051209",
        "addressExt":"address tag",
        "minQuantity":"100",//minimum amount
        "requiredConfirmTimes ":1,//Arrival confirmation number
        "canWithdrawConfirmNum ":12,//Withdrawal confirmation number
        "coinType":"ERC20_TOKEN"
    }

Parameters

Name Type Mandatory Description
coin STRING YES asset
chainType STRING YES chain type, The chainType of USDT is OMNI ERC20 TRC20 respectively, and the default is OMNI

Deposit History (USER_DATA)

Weight: 5

Response

[
  {
        "id": 100234,
        "coin": "EOS",
        "coinName": "EOS",
        "address": "deposit2bb",
        "addressTag": "19012584",
        "fromAddress": "clarkkent",
        "fromAddressTag": "19029901",
        "time": 1499865549590,
        "quantity": "1.01",
        "status": "2", // 2=SUCCESS, 11=REJECT, 12=AUDIT
        "statusCode": "DEPOSIT_CAN_WITHDRAW",
        "requiredConfirmTimes": "5",
        "confirmTimes": "5",
        "txId": "98A3EA560C6B3336D348B6C83F0F95ECE4F1F5919E94BD006E5BF3BF264FACFC",
        "txIdUrl": ""
  }
]

Parameters

Name Type Mandatory Description
coin STRING NO asset
startTime LONG NO start timestamp
endTime LONG NO end timestamp
fromId LONG NO From which Id to start crawling
limit INT NO Default 500; Max 1000
recvWindow LONG NO recv window
timestamp LONG YES 时间戳

Notes:

Market Data Endpoints

Test Connectivity

est connectivity to the Rest API.

Weight:1

Response

{}

Parameters

NONE

Check Server Time

Test connectivity to the Rest API and get the current server time.

Weight:1

Response

{
  "serverTime": 1538323200000
}

Parameters

NONE

Exchange Information

Current exchange trading rules and symbol information

Weight:1

Response

{
  "timezone": "UTC",
  "serverTime": "1668407511495",
  "brokerFilters": [],
  "symbols": [
    {
      "filters":[
          {
              "minPrice":"0.01",
              "maxPrice":"100000.00000000",
              "tickSize":"0.01",
              "filterType":"PRICE_FILTER"
          },
          {
              "minQty":"0.0001",
              "maxQty":"4000",
              "stepSize":"0.0001",
              "filterType":"LOT_SIZE"
          },
          {
              "minNotional":"10",
              "filterType":"MIN_NOTIONAL"
          },
              {
              "minAmount": "10", // minimum transaction amount
              "maxAmount": "6600000", // maximum trade amount
              "minBuyPrice": "0.01", // minimum buy price
              "filterType": "TRADE_AMOUNT" 
          }.
          {
              "maxSellPrice": "999999999", // limit max sell price
              "buyPriceUpRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // the maximum sell price of the limit
              "maxEntrustNum": "100000", // the maximum number of orders (contracts)
              "maxConditionNum": "100000", // maximum number of condition orders (contracts)
              "filterType": "LIMIT_TRADING"
          }.
          {
              "buyPriceUpRate": "0.1", // Buy cannot be higher than 10% of the marked (contract)/latest (spot) price
              "sellPriceDownRate": "0.1", // Sell cannot be less than 10% of the marked (contract)/latest (spot) price
              "filterType": "MARKET_TRADING"
          }.
          {
              "noAllowMarketStartTime": "0", // Market order start time is not allowed 
              "noAllowMarketEndTime": "0", // Do not allow the market order end time
              "limitOrderStartTime": "0", // the start time of a limit order
              "limitOrderEndTime": "0", // Limit order end time
              "limitMinPrice": "0", // the minimum price of a limit order
              "limitMaxPrice": "0", // the maximum price of the limit order
              "filterType": "OPEN_QUOTE"
          }
      ], 
      "symbol": "ETHUSDT",
      "symbolName": "ETHUSDT",
      "status": "TRADING",
      "baseAsset": "ETH",
      "baseAssetName": "ETH",
      "baseAssetPrecision": "0.0001",
      "quoteAsset": "USDT",
      "quoteAssetName": "USDT",
      "quotePrecision": "0.01",
      "icebergAllowed": false,
      "isAggregate": false,
      "allowMargin": true
    },
    {
      "filters":[
          {
              "minPrice":"0.01",
              "maxPrice":"100000.00000000",
              "tickSize":"0.01",
              "filterType":"PRICE_FILTER"
          },
          {
              "minQty":"0.0001",
              "maxQty":"4000",
              "stepSize":"0.0001",
              "filterType":"LOT_SIZE"
          },
          {
              "minNotional":"10",
              "filterType":"MIN_NOTIONAL"
          },
              {
              "minAmount": "10", // minimum transaction amount
              "maxAmount": "6600000", // maximum trade amount
              "minBuyPrice": "0.01", // minimum buy price
              "filterType": "TRADE_AMOUNT" 
          }.
          {
              "maxSellPrice": "999999999", // limit max sell price
              "buyPriceUpRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // the maximum sell price of the limit
              "maxEntrustNum": "100000", // the maximum number of orders (contracts)
              "maxConditionNum": "100000", // maximum number of condition orders (contracts)
              "filterType": "LIMIT_TRADING"
          }.
          {
              "buyPriceUpRate": "0.1", // Buy cannot be higher than 10% of the marked (contract)/latest (spot) price
              "sellPriceDownRate": "0.1", // Sell cannot be less than 10% of the marked (contract)/latest (spot) price
              "filterType": "MARKET_TRADING"
          }.
          {
              "noAllowMarketStartTime": "0", // Market order start time is not allowed 
              "noAllowMarketEndTime": "0", // Do not allow the market order end time
              "limitOrderStartTime": "0", // the start time of a limit order
              "limitOrderEndTime": "0", // Limit order end time
              "limitMinPrice": "0", // the minimum price of a limit order
              "limitMaxPrice": "0", // the maximum price of the limit order
              "filterType": "OPEN_QUOTE"
          }
      ], 
      "symbol": "BTCUSDT",
      "symbolName": "BTCUSDT",
      "status": "TRADING",
      "baseAsset": "BTC",
      "baseAssetName": "BTC",
      "baseAssetPrecision": "0.000001",
      "quoteAsset": "USDT",
      "quoteAssetName": "USDT",
      "quotePrecision": "0.01",
      "icebergAllowed": false,
      "isAggregate": false,
      "allowMargin": true
    },
    {
      "filters":[
          {
              "minPrice":"0.01",
              "maxPrice":"100000.00000000",
              "tickSize":"0.01",
              "filterType":"PRICE_FILTER"
          },
          {
              "minQty":"0.0001",
              "maxQty":"4000",
              "stepSize":"0.0001",
              "filterType":"LOT_SIZE"
          },
          {
              "minNotional":"10",
              "filterType":"MIN_NOTIONAL"
          },
              {
              "minAmount": "10", // minimum transaction amount
              "maxAmount": "6600000", // maximum trade amount
              "minBuyPrice": "0.01", // minimum buy price
              "filterType": "TRADE_AMOUNT" 
          }.
          {
              "maxSellPrice": "999999999", // limit max sell price
              "buyPriceUpRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // the maximum sell price of the limit
              "maxEntrustNum": "100000", // the maximum number of orders (contracts)
              "maxConditionNum": "100000", // maximum number of condition orders (contracts)
              "filterType": "LIMIT_TRADING"
          }.
          {
              "buyPriceUpRate": "0.1", // Buy cannot be higher than 10% of the marked (contract)/latest (spot) price
              "sellPriceDownRate": "0.1", // Sell cannot be less than 10% of the marked (contract)/latest (spot) price
              "filterType": "MARKET_TRADING"
          }.
          {
              "noAllowMarketStartTime": "0", // Market order start time is not allowed 
              "noAllowMarketEndTime": "0", // Do not allow the market order end time
              "limitOrderStartTime": "0", // the start time of a limit order
              "limitOrderEndTime": "0", // Limit order end time
              "limitMinPrice": "0", // the minimum price of a limit order
              "limitMaxPrice": "0", // the maximum price of the limit order
              "filterType": "OPEN_QUOTE"
          }
      ], 
      "symbol": "XRPUSDT",
      "symbolName": "XRPUSDT",
      "status": "TRADING",
      "baseAsset": "XRP",
      "baseAssetName": "XRP",
      "baseAssetPrecision": "0.01",
      "quoteAsset": "USDT",
      "quoteAssetName": "USDT",
      "quotePrecision": "0.01",
      "icebergAllowed": false,
      "isAggregate": false,
      "allowMargin": false
    }
  ],
  "rateLimits": [
    {
      "rateLimitType": "REQUEST_WEIGHT",
      "interval": "MINUTE",
      "intervalUnit": 1,
      "limit": 3000
    },
    {
      "rateLimitType": "ORDERS",
      "interval": "SECOND",
      "intervalUnit": 60,
      "limit": 60
    }
  ],
  "options": [],
  "contracts": [
    {
      "filters":[
          {
              "minPrice":"0.01",
              "maxPrice":"100000.00000000",
              "tickSize":"0.01",
              "filterType":"PRICE_FILTER"
          },
          {
              "minQty":"0.0001",
              "maxQty":"4000",
              "stepSize":"0.0001",
              "filterType":"LOT_SIZE"
          },
          {
              "minNotional":"10",
              "filterType":"MIN_NOTIONAL"
          },
              {
              "minAmount": "10", // minimum transaction amount
              "maxAmount": "6600000", // maximum trade amount
              "minBuyPrice": "0.01", // minimum buy price
              "filterType": "TRADE_AMOUNT" 
          }.
          {
              "maxSellPrice": "999999999", // limit max sell price
              "buyPriceUpRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // the maximum sell price of the limit
              "maxEntrustNum": "100000", // the maximum number of orders (contracts)
              "maxConditionNum": "100000", // maximum number of condition orders (contracts)
              "filterType": "LIMIT_TRADING"
          }.
          {
              "buyPriceUpRate": "0.1", // Buy cannot be higher than 10% of the marked (contract)/latest (spot) price
              "sellPriceDownRate": "0.1", // Sell cannot be less than 10% of the marked (contract)/latest (spot) price
              "filterType": "MARKET_TRADING"
          }.
          {
              "noAllowMarketStartTime": "0", // Market order start time is not allowed 
              "noAllowMarketEndTime": "0", // Do not allow the market order end time
              "limitOrderStartTime": "0", // the start time of a limit order
              "limitOrderEndTime": "0", // Limit order end time
              "limitMinPrice": "0", // the minimum price of a limit order
              "limitMaxPrice": "0", // the maximum price of the limit order
              "filterType": "OPEN_QUOTE"
          }
      ], 
      "symbol": "BTC-SWAP-USDT",
      "symbolName": "BTC-SWAP-USDTUSDT",
      "status": "TRADING",
      "baseAsset": "BTC-SWAP-USDT",
      "baseAssetPrecision": "1",
      "quoteAsset": "USDT",
      "quoteAssetPrecision": "0.1",
      "icebergAllowed": false,
      "inverse": false,
      "index": "BTCUSDT",
      "marginToken": "USDT",
      "marginPrecision": "0.0001",
      "contractMultiplier": "0.0001",
      "underlying": "BTC",
      "riskLimits": [
        {
          "riskLimitId": "200000133",
          "quantity": "1000000.0",
          "initialMargin": "0.01",
          "maintMargin": "0.005"
        },
        {
          "riskLimitId": "200000134",
          "quantity": "2000000.0",
          "initialMargin": "0.02",
          "maintMargin": "0.01"
        },
        {
          "riskLimitId": "200000135",
          "quantity": "3000000.0",
          "initialMargin": "0.03",
          "maintMargin": "0.015"
        },
        {
          "riskLimitId": "200000136",
          "quantity": "4000000.0",
          "initialMargin": "0.04",
          "maintMargin": "0.02"
        }
      ]
    },
    {
      "filters":[
          {
              "minPrice":"0.01",
              "maxPrice":"100000.00000000",
              "tickSize":"0.01",
              "filterType":"PRICE_FILTER"
          },
          {
              "minQty":"0.0001",
              "maxQty":"4000",
              "stepSize":"0.0001",
              "filterType":"LOT_SIZE"
          },
          {
              "minNotional":"10",
              "filterType":"MIN_NOTIONAL"
          },
              {
              "minAmount": "10", // minimum transaction amount
              "maxAmount": "6600000", // maximum trade amount
              "minBuyPrice": "0.01", // minimum buy price
              "filterType": "TRADE_AMOUNT" 
          }.
          {
              "maxSellPrice": "999999999", // limit max sell price
              "buyPriceUpRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // maximum sell price
              "sellPriceDownRate": "0.1", // the maximum sell price of the limit
              "maxEntrustNum": "100000", // the maximum number of orders (contracts)
              "maxConditionNum": "100000", // maximum number of condition orders (contracts)
              "filterType": "LIMIT_TRADING"
          }.
          {
              "buyPriceUpRate": "0.1", // Buy cannot be higher than 10% of the marked (contract)/latest (spot) price
              "sellPriceDownRate": "0.1", // Sell cannot be less than 10% of the marked (contract)/latest (spot) price
              "filterType": "MARKET_TRADING"
          }.
          {
              "noAllowMarketStartTime": "0", // Market order start time is not allowed 
              "noAllowMarketEndTime": "0", // Do not allow the market order end time
              "limitOrderStartTime": "0", // the start time of a limit order
              "limitOrderEndTime": "0", // Limit order end time
              "limitMinPrice": "0", // the minimum price of a limit order
              "limitMaxPrice": "0", // the maximum price of the limit order
              "filterType": "OPEN_QUOTE"
          }
      ], 
      "symbol": "BTC-SWAP",
      "symbolName": "BTC-SWAP",
      "status": "TRADING",
      "baseAsset": "BTC-SWAP",
      "baseAssetPrecision": "1",
      "quoteAsset": "USDT",
      "quoteAssetPrecision": "0.1",
      "icebergAllowed": false,
      "inverse": true,
      "index": "BTCUSDT",
      "marginToken": "BTC",
      "marginPrecision": "0.00000001",
      "contractMultiplier": "1.0",
      "underlying": "BTC",
      "riskLimits": [
        {
          "riskLimitId": "200000137",
          "quantity": "1000000.0",
          "initialMargin": "0.01",
          "maintMargin": "0.005"
        },
        {
          "riskLimitId": "200000138",
          "quantity": "2000000.0",
          "initialMargin": "0.02",
          "maintMargin": "0.01"
        },
        {
          "riskLimitId": "200000139",
          "quantity": "3000000.0",
          "initialMargin": "0.03",
          "maintMargin": "0.015"
        },
        {
          "riskLimitId": "200000140",
          "quantity": "4000000.0",
          "initialMargin": "0.04",
          "maintMargin": "0.02"
        }
      ]
    }
  ],
  "coins": [
    {
      "coinId": "ETH",
      "coinName": "ETH",
      "coinFullName": "Ethereum",
      "allowWithdraw": true,
      "allowDeposit": true,
      "chainTypes": []
    },
    {
      "coinId": "USDT",
      "coinName": "USDT",
      "coinFullName": "TetherUS",
      "allowWithdraw": true,
      "allowDeposit": true,
      "chainTypes": [
        {
          "chainType": "ERC20",
          "withdrawFee": "0.1",
          "minWithdrawQuantity": "10",
          "maxWithdrawQuantity": "1000",
          "minDepositQuantity": "1",
          "allowDeposit": true,
          "allowWithdraw": true
        },
        {
          "chainType": "TRC20",
          "withdrawFee": "0.1",
          "minWithdrawQuantity": "10",
          "maxWithdrawQuantity": "1000",
          "allowDeposit": true,
          "allowWithdraw": true
        },
        {
          "chainType": "OMNI",
          "withdrawFee": "0.1",
          "minWithdrawQuantity": "10",
          "maxWithdrawQuantity": "1000",
          "allowDeposit": true,
          "allowWithdraw": true
        }
      ]
    },
    {
      "coinId": "BTC",
      "coinName": "BTC",
      "coinFullName": "Bitcoin",
      "allowWithdraw": false,
      "allowDeposit": false,
      "chainTypes": []
    },
    {
      "coinId": "UNI",
      "coinName": "UNI",
      "coinFullName": "uniswap",
      "allowWithdraw": false,
      "allowDeposit": false,
      "chainTypes": []
    },
    {
      "coinId": "XRP",
      "coinName": "XRP",
      "coinFullName": "XRP",
      "allowWithdraw": false,
      "allowDeposit": false,
      "chainTypes": []
    },
    {
      "coinId": "EOS",
      "coinName": "EOS1",
      "coinFullName": "EOS",
      "allowWithdraw": true,
      "allowDeposit": true,
      "chainTypes": []
    },
    {
      "coinId": "JET",
      "coinName": "JET",
      "coinFullName": "JET",
      "allowWithdraw": false,
      "allowDeposit": false,
      "chainTypes": []
    }
  ]
}

Parameters

NONE

Order Book

权重:

Response

{
  "b": [
    [
      "3.90000000",   // price
      "431.00000000"  // quantity
    ],
    [
      "4.00000000",
      "431.00000000"
    ]
  ],
  "a": [
    [
      "4.00000200",  // price
      "12.00000000"  // quantity
    ],
    [
      "5.10000000",
      "28.00000000"
    ]
  ]
}

Parameters

Name Type Mandatory Description
symbol STRING YES symbol
limit INT NO Default 100; Max 200.

Notes: If you set limit=0, a lot of data will be returned.

Recent Trades List

Get recent trades.

Weight: 1

Response

[
  {
    "p": "4.00000100",
    "q": "12.00000000",
    "t": 1499865549590,
    "ibm": true  // Transaction direction isBuyerMaker
  }
]

Parameters

Name Type Mandatory Description
symbol STRING YES
limit INT NO Default 60; Max 60.

Kline/Candlestick Data

Kline/candlestick bars for a symbol.
Klines are uniquely identified by their open time.

Weight:1

Response

[
  [
    1499040000000,      // Kline open time
    "0.01634790",       // Open price
    "0.80000000",       // High price
    "0.01575800",       //  Low price
    "0.01577100",       // Close price
    "148976.11427815",  // Volume
    1499644799999,      //  Kline Close time
    "2434.19055334",    // Quote asset volume
    308,                // Number of trades
    "1756.87402397",    // Taker buy base asset volume
    "28.46694368"       // Taker buy quote asset volume
  ]
]

Parameters

Name Type Mandatory Description
symbol STRING YES symbol
interval ENUM YES interval
startTime LONG NO start timestamp
endTime LONG NO end timestamp
limit INT NO Default 100; Max 100.

24hr Ticker Price Change Statistics

24 hour rolling window price change statistics. Careful when accessing this with no symbol.

Weight:

1 if only one symbol was sent; 40 if no symbol was sent.

Response

[
    {
        "t": 1538725500422,   // time
        "a": "1.10000000",    // highest selling price
        "b": "1.00000000",    // highest bid
        "s": "ETHBTC",        // symbol 
        "c": "4.00000200",    // latest transaction price
        "o": "99.00000000",   // opening price
        "h": "100.00000000",  // highest price 
        "l": "0.10000000",    // lowest price
        "v": "8913.30000000", // Total trade volume (in base asset)
        "qv": "15.30000000",   // otal trade volume (in quote asset)
        "pc": "15.30000000",   // priceChange
        "pcp": "15.30000000"   // priceChangePercent
    }
]

Parameters

Name Type Mandatory Description
symbol STRING NO symbol

Symbol Price Ticker

Latest price for a symbol or symbols.

Weight:1

Response

[
  {
    "s": "LTCBTC",     // symbol
    "p": "4.00000200"  // price
  }
]

Parameters

Name Type Mandatory Description
symbol STRING NO symbol

Symbol Order Book Ticker

Best price/qty on the order book for a symbol or symbols.

Weight:1

Response

[
  {
      "t": 1672035413265,     // time
      "s": "LTCBTC",            // symbol          
      "b": "4.00000000",        // bidPrice
      "bq": "431.00000000",     // bidQty
      "a": "4.00000200",        // askPrice
      "aq": "9.00000000"        // askQty
  }
]

Parameters

Name Type Mandatory Description
symbol STRING NO symbol

Merge Depth

Weight: 1

Response

{
    "t": 1672035413265,//time
    "b": [//Buy Depth High to Low
        [
            "16851.95",//price
            "0.003321"//quantity
        ],
        [
            "16851.87",
            "0.005456"
        ],
        [
            "16851.47",
            "0.002219"
        ]
    ],
    "a": [//Sell Depth Low to High
        [
            "16870.19",
            "0.003838"
        ],
        [
            "16873.05",
            "0.00361"
        ],
        [
            "16873.06",
            "0.002623"
        ]
    ]
}

Parameters

Name Type Mandatory Description
symbol STRING YES symbol
scale INT NO Gears: 0,1,2,3,4,5 For example: 0means gear 1, 1 means gear 2
limit INT NO limit

Websocket Market Streams

Name value
topic realtimes, trade, kline_$interval, depth,markPrice,markPriceKline_$interval,indexindexKline_$interval
event sub, cancel, cancel_all
interval 1m, 5m, 15m, 30m, 1h, 2h, 6h, 12h, 1d, 1w, 1M

Live Subscribing/Unsubscribing to streams

Subscribe to a stream:

{

"symbol": "$symbol0, $symbol1",

"topic": "$topic",

"event": "sub",

"params": {

"limit": "$limit", // kline return upper limit is 2000, the default is 1

"binary": "false" //Whether the returned data is compressed, the default is false

}

}

Unsubscribe to a stream:

{

"symbol": "$symbol0, $symbol1",

"topic": "$topic",

"event": "cancel",

"params": {

"limit": "$limit", // kline return upper limit is 2000, the default is 1

"binary": "false" //Whether the returned data is compressed, the default is false

}

}

Heartbeat

Every once in a while, the client needs to send a ping frame, and the server will reply with a pong frame, otherwise the server will actively disconnect within 5 minutes.

Payblad

{
    "pong": 1535975085052
}

Request

{

"ping": 1535975085052

}

Trade Streams

Push the information of each transaction transaction by transaction. A deal, or the definition of a transaction, is that there is only one taker and one maker trading with each other. After successfully connecting to the server, the server will first push a recent 60 transactions. After this push, each push is a real-time transaction. The variable "v" can be understood as a transaction ID. This variable is globally incremented and unique. For example: Suppose there have been 3 transactions in the past 5 seconds, namely ETHUSDT, BTCUSDT, BHTBTC. Their "v" will be consecutive values (112, 113, 114).

Payload

{
    "symbol": "BTCUSDT",
    "symbolName": "BTCUSDT",
    "topic": "trade",
    "params": {
        "realtimeInterval": "24h",
        "binary": "false"
    },
    "data": [
        {
            "v": "1291465821801168896", 
            "t": 1668690723096, //time
            "p": "399", // price
            "q": "1", // quantity
            "m": false // true = buy, false = sell
        },
        {
            "v": "1291465842546196481",
            "t": 1668690725569,
            "p": "399",
            "q": "1",
            "m": false
        }
    ],
    "f": true, // is it the first to return
    "sendTime": 1668753154192,
    "shared": false
}

Request:

{

"symbol": "$symbol0, $symbol1",'

"topic": "trade",

"event": "sub",

"params": {

"binary": false // Whether data returned is in binary format

}

}

Kline/Candlestick Streams

The Kline/Candlestick Stream push updates to the current klines/candlestick every second.

Kline/Candlestick chart intervals:

m -> minutes; h -> hours; d -> days; w -> weeks; M -> months

Payload

{
    "symbol": "BTCUSDT",
    "symbolName": "BTCUSDT",
    "topic": "kline",
    "params": {
        "realtimeInterval": "24h",
        "klineType": "1m",
        "binary": "false"
    },
    "data": [
        {
            "t": 1668753840000,// Event time
            "s": "BTCUSDT",// symbol
            "sn": "BTCUSDT",// symbol name
            "c": "445",//Close price
            "h": "445",//High price
            "l": "445",//Low price
            "o": "445",//Open price
            "v": "0"//Base asset volume
        }
    ],
    "f": true,// Is it the first return
    "sendTime": 1668753854576,
    "shared": false
}

Request:

{

"symbol": "$symbol0, $symbol1",

"topic": "kline_"+$interval,

"event": "sub",

"params": {

"binary": false

}

}

Individual Symbol Ticker Streams

24-hour complete ticker information refreshed second by symbol

Payload

{
    "symbol": "BTCUSDT",
    "symbolName": "BTCUSDT",
    "topic": "realtimes",
    "params": {
        "realtimeInterval": "24h",
        "binary": "false"
    },
    "data": [
        {
            "t": 1668753480049, //time
            "s": "BTCUSDT", //symbol
            "sn": "BTCUSDT", // symbol name
            "c": "445", //Close price
            "h": "445", //High price
            "l": "310", // Low price
            "o": "311", //Open price
            "v": "3747.7597191", //Total traded base asset volume
            "qv": "1426443.9553995", // Total traded quote asset volume
            "m": "0.4309", // margin
            "e": 301 // trade id
        }
    ],
    "f": true, 
    "sendTime": 1668753481048,
    "shared": false
}

Request:

{

"symbol": "$symbol0, $symbol1",

"topic": "realtimes",

"event": "sub",

"params": {

"binary": false

}

}

Partial Book Depth Streams

Symbol's depth information.

Payload

{
  "symbol": "BTCUSDT",
  "topic": "depth",
  "data": [{
    "s": "BTCUSDT", //Symbol
    "t": 1565600357643, //time
    "v": "112801745_18", // Base asset volume
    "b": [ //Bids
      ["11371.49", "0.0014"], //[price, quantity]
      ["11371.12", "0.2"],
      ["11369.97", "0.3523"],
      ["11369.96", "0.5"],
      ["11369.95", "0.0934"],
      ["11369.94", "1.6809"],
      ["11369.6", "0.0047"],
      ["11369.17", "0.3"],
      ["11369.16", "0.2"],
      ["11369.04", "1.3203"],
    "a": [//Asks
      ["11375.41", "0.0053"], //[price, quantity]
      ["11375.42", "0.0043"],
      ["11375.48", "0.0052"],
      ["11375.58", "0.0541"],
      ["11375.7", "0.0386"],
      ["11375.71", "2"],
      ["11377", "2.0691"],
      ["11377.01", "0.0167"],
      ["11377.12", "1.5"],
      ["11377.61", "0.3"]
    ]
  }],
  "f": true//Is it the first return
}

Request:

{

  "symbol": "$symbol0, $symbol1",
  "topic": "depth",
  "event": "sub",
  "params": {
    "binary": false
  }

Diff. Depth Stream

Payload

{
  "symbol": "BTCUSDT",
  "topic": "diffDepth",
  "data": [{
    "e": 0,
    "t": 1565687625534,
    "v": "115277986_18",
    "b": [
      ["11316.78", "0.078"],
      ["11313.16", "0.0052"],
      ["11312.12", "0"],
      ["11309.75", "0.0067"],
      ["11309.58", "0"],
      ["11306.14", "0.0073"]
    ],
    "a": [
      ["11318.96", "0.0041"],
      ["11318.99", "0.0017"],
      ["11319.12", "0.0017"],
      ["11319.22", "0.4516"],
      ["11319.23", "0.0934"],
      ["11319.24", "3.0665"]
    ]
  }],
  "f": false //Is it the first return
}

Request:

{

"symbol": "$symbol0, $symbol1",

"topic": "diffDepth",

"event": "sub",

"params": {

"binary": false

}

}

Push the changing part of the order book (if any) every second. In incremental depth information, the quantity is not necessarily equal to the quantity corresponding to the price. If the quantity=0, it means that the price in the last push is no longer available. If the quantity>0, the quantity at this time is the quantity corresponding to the updated price Suppose there is such an item in the returned data we received:

["0.00181860", "155.92000000"]// price, quantity

If the next returned data contains:

["0.00181860", "12.3"]

This means that the quantity corresponding to this price has changed, and the changed quantity has been updated If the next returned data contains:

["0.00181860", "0"]

This means that the quantity corresponding to this price has disappeared and will be deleted in the client.

Spot Account/Trade

Test New Order (TRADE)

Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine.

Weight:1

Response

{}

Parameters

Same as POST /api/v1/spot/order

New Order (TRADE)

Send in a new order.

Weight:1

Response

{
    "accountId": "1287091689761137921",
    "symbol": "BTCUSDT",
    "symbolName": "BTCUSDT",
    "clientOrderId": "1668483032042259",
    "orderId": "1289723583082363136",
    "transactTime": "1668483032058",
    "price": "400",
    "origQty": "1",
    "executedQty": "0",
    "status": "FILLED",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "SELL"
}

Parameters

Name Type Mandatory Description
symbol STRING YES symbol
assetType ENUM NO CASHMARGIN,only supports CASH
side ENUM YES BUY or SELL
type ENUM YES See enumeration definition for details: order type
timeInForce ENUM NO For details, see enumeration definition: valid methods
quantity DECIMAL YES quantity
price DECIMAL NO price
newClientOrderId STRING NO A unique id among open orders. Automatically generated if not sent.
stopPrice DECIMAL NO Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. currently unavailable
icebergQty DECIMAL NO Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order. currently unavailable
recvWindow LONG NO recv window
timestamp LONG YES timestamp

Additional mandatory parameters based on type:

Type Additional mandatory parameters
LIMIT quantity,price
MARKET quantity
STOP_LOSS quantity, stopPrice currently unavailable
STOP_LOSS_LIMIT timeInForce, quantity, price, stopPrice currently unavailable
TAKE_PROFIT quantity, stopPrice currently unavailable
TAKE_PROFIT_LIMIT timeInForce, quantity, price, stopPrice currently unavailable
LIMIT_MAKER quantity, price

Place Multiple Orders (TRADE)

Weight:2

Create new orders in batches, up to 20 orders at a time, must be the same symbol.

example:

curl  -H "Content-Type:application/json" -H "X-BB-APIKEY: SRQGN9M8Sr87nbfKsaSxm33Y6CmGVtUu9Erz73g9vHFNn36VROOKSaWBQ8OSOtSq" -X POST -d '[   
{     "newClientOrderId": "pl12241234567898",     
      "symbol": "BTCUSDT",     
      "side": "SELL",     
      "type": "LIMIT",     
      "price": 17001,     
      "quantity": 1   
},   
{     "newClientOrderId": "pl12241234567899",     
      "symbol": "BTCUSDT",     
      "side": "SELL",     
      "type": "LIMIT",     
      "price": 17002,     
      "quantity": 1  
 } ]' 'https://api.toobit.com/api/v1/spot/batchOrders?timestamp=1671880913657&signature=7548b6834613afed3b7d3b0b9bfb0e0b3e3799c46db3ea6b952439fde35cb88f'

Response success : json { "code": 0, "result": [{ "code": 0, "order": { "accountId": "1287091689761137921", "symbol": "BTCUSDT", "symbolName": "BTCUSDT", "clientOrderId": "pl12241234567898", "orderId": "202212241234567898", "transactTime": "1671880251836", "price": "17001", "origQty": "1", "executedQty": "0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "SELL" } }, { "code": 0, "order": { "accountId": "1287091689761137921", "symbol": "BTCUSDT", "symbolName": "BTCUSDT", "clientOrderId": "pl12241234567899", "orderId": "202212241234567899", "transactTime": "1671880251853", "price": "17002", "origQty": "1", "executedQty": "0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "SELL" } }] } fail : json { "code": 0, "result": [{ "code": -1149, "msg": "Create order failed" }, { "code": -1149, "msg": "Create order failed" }] }

Parameters

Name Type Mandatory Description
list YES RequestBody parameter
recvWindow LONG NO recv window
timestamp LONG YES timestamp

The batchOrders in RequestBody should fill in the order parameters in list of JSON format

Name Type Mandatory Description
symbol STRING YES symbol
side ENUM YES BUY or SELL
type ENUM YES See enumeration definition for details: orderType
timeInForce ENUM NO See enumeration definition for details: timeInForce
quantity DECIMAL YES quantity
price DECIMAL NO price
newClientOrderId STRING YES The ID of the order, defined by the user

Depending on the order type, certain parameters are mandatory:

Type Additional mandatory parameters
LIMIT timeInForce, quantity,price
MARKET quantity
STOP_LOSS quantity, stopPrice currently unavailable
STOP_LOSS_LIMIT timeInForce, quantity, price, stopPrice currently unavailable
TAKE_PROFIT quantity, stopPrice currently unavailable
TAKE_PROFIT_LIMIT timeInForce, quantity, price, stopPrice currently unavailable

Cancel Order (TRADE)

Cancel an active order.

Weight:1

Response

{
  "symbol": "LTCBTC",
  "orderId": "1",
  "clientOrderId": "9t1M2K0Ya092",
  "price": "0.1",
  "origQty": "1.0",
  "executedQty": "0.0",
  "status": "CANCELED",
  "timeInForce": "GTC",
  "type": "LIMIT",
  "side": "BUY",
  "transactTime": "1499827319559"
}

Parameters

Name Type Mandatory Description
orderId LONG NO order id
clientOrderId STRING NO client order id
recvWindow LONG NO recv window
timestamp LONG YES Timestamp

Either orderIdor clientOrderIdmust be sent.

Cancel All Open Orders (TRADE)

Weight:5

Response

{
  "success":true
}

Parameters

Name Type Mandatory Description
symbol STRING NO symbol
side ENUM NO BUY or SELL
recvWindow LONG NO recv window
timestamp LONG YES Timestamp

Cancel Multiple Orders (TRADE)

Cancel orders in batches according to the order id, maximum 100 items at a time

Weight:5

Response

success : json { "code":0, // 0 On behalf of successful execution "result":[] // }

Some or all of the cancellations failed: json { "code":0, "result":[ { "orderId":"202212231234567895", "code":-2013 // }, { "orderId":"202212231234567896", "code":-2013 } ] }

Parameters

Name Type Mandatory Description
ids STRING YES order Id (Multiple separated by ,
recvWindow LONG NO recv window
timestamp LONG YES timestamp

Note: code returns 0 to indicate that the order cancellation request has been executed. Whether it is successful or not depends on the results in result. If result is empty, it means that all of them are successful, and if orderId is not empty, it means that the cancellation failed The order id, code represents the reason for the cancellation failure.

Query Order (USER_DATA)

Weight:1

Response

{
  "symbol": "LTCBTC",
  "orderId": "1",
  "clientOrderId": "9t1M2K0Ya092",
  "price": "0.1",
  "origQty": "1.0",
  "executedQty": "0.0",
  "cumulativeQuoteQty": "0.0",
  "status": "NEW",
  "timeInForce": "GTC",
  "type": "LIMIT",
  "side": "BUY",
  "stopPrice": "0.0",
  "icebergQty": "0.0",
  "time": "1499827319559",
  "updateTime": "1499827319559",
  "isWorking": true
}

Parameters

Name Type Mandatory Description
orderId LONG NO order id
origClientOrderId STRING NO client order id
recvWindow LONG NO recv window
timestamp LONG YES timestamp

Notes:

Current Open Orders (USER_DATA)

Get all open orders on a symbol. Careful when accessing this with no symbol.

Weight :1

Response

[
  {
    "symbol": "LTCBTC",
    "orderId": "1",
    "clientOrderId": "t7921223K12",
    "price": "0.1",
    "origQty": "1.0",
    "executedQty": "0.0",
    "cumulativeQuoteQty": "0.0",
    "status": "NEW",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "stopPrice": "0.0",
    "icebergQty": "0.0",
    "time": "1499827319559",
    "updateTime": "1499827319559",
    "isWorking": true
  }
]

Parameters

Name Type Mandatory Description
orderId LONG NO order id
symbol STRING NO symbol
limit INT NO Default 500; Max 1000.
recvWindow LONG NO recv window
timestamp LONG YES timestamp

Notes:

All Orders (USER_DATA)

Get all account orders; active, canceled, or filled.

Weight:5

Response

[
  {
    "symbol": "LTCBTC",
    "orderId": "1",
    "clientOrderId": "987yjj2Ym",
    "price": "0.1",
    "origQty": "1.0",
    "executedQty": "0.0",
    "cumulativeQuoteQty": "0.0",
    "status": "NEW",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "stopPrice": "0.0",
    "icebergQty": "0.0",
    "time": "1499827319559",
    "updateTime": "1499827319559",
    "isWorking": true
  }
]

Parameters

Name Type Mandatory Description
orderId LONG NO order id
symbol STRING NO symbol
startTime LONG NO start timestamp.Default value three days ago
endTime LONG NO end timestamp
limit INT NO Default 500; Max 1000.
recvWindow LONG NO recv window
timestamp LONG YES timestamp

Account Information (USER_DATA)

Weight:5

Response

{
    "balances": [
        {
            "asset": "BTC",  // asset
            "assetId": "BTC",  // asset id
            "assetName": "BTC",  // asset name
            "total": "995.899",  // total number
            "free": "995.899", //available number
            "locked": "0" //frozen number
        }
    ]
}

Parameters

Name Type Mandatory Description
recvWindow LONG NO recv window
timestamp LONG YES Timestamp

Account Trade List (USER_DATA)

Weight:5

Response

[
    {
        "id": "1291291745779199489",
        "symbol": "BTCUSDT",
        "symbolName": "BTCUSDT",
        "orderId": "1290805676579237376",
        "matchOrderId": "1291291745191996928",
        "price": "314",
        "qty": "0.71433122",
        "commission": "0.22430000308",
        "commissionAsset": "USDT",
        "time": "1668669971575",
        "isBuyer": false,
        "isMaker": true,
        "fee": {
            "feeCoinId": "USDT",
            "feeCoinName": "USDT",
            "fee": "0.22430000308"
        },
        "feeCoinId": "USDT",
        "feeAmount": "0.22430000308",
        "makerRebate": "0",
        "ticketId": "1185465136943458745" // ticketId
    }
]

Parameters

Name Type Mandatory Description
symbol STRING YES symbol
startTime LONG NO start timestamp
endTime LONG NO end timestamp
fromId LONG NO from id
toId LONG NO end id
limit INT NO Number of items displayed per page
recvWindow LONG NO recv window
timestamp LONG YES timestamp

Notes:

Query Sub-account (USER_DATA)

Weight:5

Response:

[
    {
        "accountId": "122216245228131",
        "nickName": "",
        "accountType": 1,
        "accountIndex": 0 
    },
    {
        "accountId": "482694560475091200",
        "nickName": "createSubAccountByCurl", 
        "accountType": 1, // 1 Spot Account 3 Futures Account
        "accountIndex": 1
    }
]

Parameters

Name Type Mandatory Description
recvWindow LONG NO recv window
timestamp LONG YES Timestamp

Account Transfer

Supported transfer operations:

Translated with www.DeepL.com/Translator (free version) Execute the transfer between the spot account and the contract account

Weight:1

Response:

{
    "code": 200, // 200 = success
    "msg": "success" // response message
}

Parameters

名称 类型 是否必须 描述
fromUid LONG YES from uid
toUid LONG YES to uid
fromAccountType String YES from account type
toAccountType String YES to account type
asset String YES asset
quantity DECIMAL YES transfer quantity
timestamp LONG YES timestamp
recvWindow LONG NO recv window

accountType: MAIN: spot account FUTURES: U-contract account

Get Account Transaction History List (USER_DATA)

Weight:5

Response:

[
    {
        "id": "539870570957903104",
        "accountId": "122216245228131",
        "coin": "BTC",
        "coinId": "BTC",
        "coinName": "BTC",
        "flowTypeValue": 51, 
        "flowType": "USER_ACCOUNT_TRANSFER", 
        "flowName": "Transfer", 
        "change": "-12.5", 
        "total": "379.624059937852365", 
        "created": "1579093587214"
    },
    {
        "id": "536072393645448960",
        "accountId": "122216245228131",
        "coin": "USDT",
        "coinId": "USDT",
        "coinName": "USDT",
        "flowTypeValue": 7,
        "flowType": "AIRDROP",
        "flowName": "Airdrop",
        "change": "-2000",
        "total": "918662.0917630848",
        "created": "1578640809195"
    }
]

Parameters

Name Type Mandatory Description
accountType INT NO Account corresponding to account_type
coin STRING NO coin
flowType INT NO transfer:3
fromId LONG NO from id
endId LONG NO end id
startTime LONG NO start timestamp
endTime LONG NO end timestamp
limit INT NO limit
recvWindow LONG NO recv window
timestamp LONG YES timestamp

Get API KEY Type (USER_DATA)

Response

{
    "accountType": "master"
}

参数

Name Type Mandatory Description
recvWindow LONG NO recv window
timestamp LONG YES timestamp

User Data Streams

Listen Key (SPOT)

Create a ListenKey (USER_STREAM)

Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent.

Weight:1

Response

{
  "listenKey": "1A9LWJjuMwKWYP4QQPw34GRm8gz3x5AephXSuqcDef1RnzoBVhEeGE963CoS1Sgj"
}

Parameters

Name Type Mandatory Description
recvWindow LONG NO recv window
timestamp LONG YES timestamp

Ping/Keep-alive a ListenKey (USER_STREAM)

Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 30 minutes.

Weight:1

Response

{}

Parameters

Name Type Mandatory Description
listenKey STRING YES
recvWindow LONG NO
timestamp LONG YES

Close a ListenKey (USER_STREAM)

Weight:1

Response

{}

Parameters

Name Type Mandatory Description
listenKey STRING YES listenKey
recvWindow LONG NO recv window
timestamp LONG YES timestamp

Payload: Account Update

Payload

[
  {
    "e": "outboundAccountInfo",   // Event type
    "E": 1499405658849,           // Event time
    "T": true,                    // Can trade
    "W": true,                    // Can withdraw
    "D": true,                    // Can deposit
    "B": [                        // Balances changed 
      {
        "a": "LTC",               // Asset 
        "f": "17366.18538083",    // Free amount 
        "l": "0.00000000"         // Locked amount 
      }
    ]
  }
]

Whenever the account balance changes, an event outboundAccountInfo is sent containing the assets that may have been moved by the event that generated the balance change.

Payload: Order Update

Payload

[
  {
    "e": "executionReport",        // Event type 
    "E": 1499405658658,            // Event time 
    "s": "ETHBTC",                 // Symbol 
    "c": 1000087761,               // Client order ID 
    "S": "BUY",                    // Side 
    "o": "LIMIT",                  // Order type 
    "f": "GTC",                    // Time in force 
    "q": "1.00000000",             // Order quantity 
    "p": "0.10264410",             // Order price 
    "pt": "MARKET",                // price type  INPUT:input price. MARKET: market price
    "X": "NEW",                    // Current order status 
    "i": 4293153,                  // Order ID 
    "l": "0.00000000",             // Last executed quantity 
    "z": "0.00000000",             // Cumulative filled quantity 
    "L": "0.00000000",             // Last executed price 
    "n": "0",                      // Commission amount 
    "N": null,                     // Commission asset 
    "u": true,                     // Is the trade normal, ignore for now 
    "w": true,                     // Is the order working? Stops will have
    "m": false,                    // Is this trade the maker side?
    "O": 1499405658657,            // Order creation time 
    "Z": "0.00000000"              // Cumulative quote asset transacted quantity 
  }
]

Order updates are updated through the executionReport event. Check out the API docs and the relevant enum definitions below. The average price can be found by dividing Z by z.

Execution Type

Payload: Ticket push

Payload

[
    {
        "e": "ticketInfo",                // Event type 
        "E": "1668693440976",             // Event time 
        "s": "BTCUSDT",                   // Symbol 
        "q": "0.205",                     // quantity 
        "t": "1668693440899",             // time 
        "p": "441.0",                     // price 
        "T": "1291488620385157122",       // ticketId
        "o": "1291488620167835136",       // orderId 
        "c": "1668693440093",             // clientOrderId 
        "a": "1286424214388204801",       // accountId 
        "m": false,                       // isMaker 
        "S": "SELL"                       // side  SELL or BUY
    }
]

Error Codes

Errors consist of two parts: an error code and a message. Codes are universal, but messages can vary.

The error JSON payload

{  
  "code":-1121, 
  "msg":"Invalid symbol."
}

10xx - General Server or Network issues

-1000 UNKNOWN

-1001 DISCONNECTED

-1002 UNAUTHORIZED

-1003 TOO_MANY_REQUESTS

-1006 UNEXPECTED_RESP

-1007 TIMEOUT

-1014 UNKNOWN_ORDER_COMPOSITION

-1015 TOO_MANY_ORDERS

-1016 SERVICE_SHUTTING_DOWN

-1020 UNSUPPORTED_OPERATION

-1021 INVALID_TIMESTAMP

-1022 INVALID_SIGNATURE

11xx - 2xxx Request issues

-1100 ILLEGAL_CHARS

-1101 TOO_MANY_PARAMETERS

-1102 MANDATORY_PARAM_EMPTY_OR_MALFORMED

-1103 UNKNOWN_PARAM

-1104 UNREAD_PARAMETERS

-1105 PARAM_EMPTY

-1106 PARAM_NOT_REQUIRED

-1111 BAD_PRECISION

-1112 NO_DEPTH

-1114 TIF_NOT_REQUIRED

-1115 INVALID_TIF

-1116 INVALID_ORDER_TYPE

-1117 INVALID_SIDE

-1118 EMPTY_NEW_CL_ORD_ID

-1119 EMPTY_ORG_CL_ORD_ID

-1120 BAD_INTERVAL

-1121 BAD_SYMBOL

-1125 INVALID_LISTEN_KEY

-1127 MORE_THAN_XX_HOURS

-1128 OPTIONAL_PARAMS_BAD_COMBO

-1130 INVALID_PARAMETER

-1132 ORDER_PRICE_TOO_HIGH

-1133 ORDER_PRICE_TOO_SMALL

-1134 ORDER_PRICE_PRECISION_TOO_LONG

-1135 ORDER_QUANTITY_TOO_BIG

-1136 ORDER_QUANTITY_TOO_SMALL

-1137 ORDER_QUANTITY_PRECISION_TOO_LONG

-1138 ORDER_PRICE_WAVE_EXCEED

-1139 ORDER_HAS_FILLED

-1140 ORDER_AMOUNT_TOO_SMALL

-1141 ORDER_DUPLICATED

-1142 ORDER_CANCELLED

-1143 ORDER_NOT_FOUND_ON_ORDER_BOOK

-1144 ORDER_LOCKED

-1145 ORDER_NOT_SUPPORT_CANCELLATION

-1146 ORDER_CREATION_TIMEOUT

-1147 ORDER_CANCELLATION_TIMEOUT

-1193 ORDER_COUNT_LIMIT

-1194 MARKET_ORDER_FORBIDDEN

-1195 LIMIT_ORDER_PRICE_TOO_SMALL

-1196 LIMIT_ORDER_PRICE_TOO_BIG

-1197 LIMIT_ORDER_BUY_PRICE_TOO_BIG

-1198 LIMIT_ORDER_SELL_PRICE_TOO_SMALL

-1199 ORDER_BUY_QUANTITY_TOO_SMALL

-1200 ORDER_BUY_QUANTITY_TOO_BIG

-1201 LIMIT_ORDER_SELL_PRICE_TOO_BIG

-1202 ORDER_SELL_QUANTITY_TOO_SMALL

-1203 ORDER_SELL_QUANTITY_TOO_BIG

- Create order sell quantity too big

-1206 ORDER_AMOUNT_TOO_BIG

-2010 NEW_ORDER_REJECTED

-2011 CANCEL_REJECTED

-2013 NO_SUCH_ORDER

-2014 BAD_API_KEY_FMT

-2015 REJECTED_MBX_KEY

-2016 NO_TRADING_WINDOW

Filter failures

Error message Description
"Filter failure: PRICE_FILTER" price is too high, too low, and/or not following the tick size rule for the symbol.
"Filter failure: LOT_SIZE" quantity is too high, too low, and/or not following the step size rule for the symbol.
"Filter failure: MIN_NOTIONAL" price* quantity is too low to be a valid order for the symbol.
"Filter failure: MAX_NUM_ORDERS" Account has too many open orders on the symbol.
"Filter failure: MAX_ALGO_ORDERS" Account has too many open stop loss and/or take profit orders on the symbol.
"Filter failure: ICEBERG_PARTS" Iceberg order would break into too many parts; icebergQty is too small.

Order Rejection Issues

Error message Description
"Unknown order sent." The order (by either orderId, clOrdId, origClOrdId) could not be found
"Duplicate order sent." The clOrdId is already in use
"Market is closed." The symbol is not trading
"Account has insufficient balance for requested action." Not enough funds to complete the action
"Market orders are not supported for this symbol." MARKET is not enabled on the symbol
"Iceberg orders are not supported for this symbol." icebergQty is not enabled on the symbol
"Stop loss orders are not supported for this symbol." STOP_LOSS is not enabled on the symbol
"Stop loss limit orders are not supported for this symbol." STOP_LOSS_LIMIT is not enabled on the symbol
"Take profit orders are not supported for this symbol." TAKE_PROFIT is not enabled on the symbol
"Take profit limit orders are not supported for this symbol." TAKE_PROFIT_LIMIT is not enabled on the symbol
"Price* QTY is zero or less." price* quantity is too low
"IcebergQty exceeds QTY." icebergQty must be less than the order quantity
"This action disabled is on this account." Contact customer support; some actions have been disabled on the account.
"Unsupported order combination" The orderType, timeInForce, stopPrice, and/or icebergQty combination isn't allowed.
"Order would trigger immediately." The order's stop price is not valid when compared to the last traded price.
"Cancel order is invalid. Check origClOrdId and orderId." No origClOrdId or orderId was sent in.
"Order would immediately match and take." LIMIT_MAKER order type would immediately match and trade, and not be a pure maker order.