English
NAV
console

Welcome

Welcome to Bitget ApiDoc! Click here for quick start

Coming Soon

New Feature Forecast

No. Interface Launch Date Remark
1 New feature to support auto suppliment margin TBP Developing and testing

Update Forecast

ETA Nov 1 , 2023

/api/mix/v1/account/account response 'crossedUnrealizedPL' 'isolatedUnrealizedPL'

Update log

Oct 30, 2023

Place Order logic update forecast:

Sep 21, 2023

New response field 'uTime' added: /api/mix/v1/position/allPosition-v2

Sep 05, 2023

Aug 31, 2023

Aug 29, 2023

Aug 23, 2023

Websocket error response format change:

From:

To:

Aug 23, 2023

Aug 21, 2023

Aug 11, 2023

July 25, 2023

July 03, 2023

Jun 30, 2023

Jun 28, 2023

Jun 15, 2023

Jun 05, 2023

May 26, 2023

May 22, 2023

May 20, 2023

May 12, 2023

May 08, 2023**

May 6, 2023

Apr 21, 2023

Mar 28, 2023

Mar 17, 2023

Mar 15, 2023

Feb 28, 2023

Feb 13, 2023

Jan 30, 2023

Jan 27, 2023

Jan 11, 2023

Dec 28, 2022

Dec, 21, 2022

Dec, 16, 2022

Dec, 07, 2022

Dec, 06, 2022

Nov, 23, 2022

Nov, 11, 2022

October, 27, 2022

October, 14, 2022

September, 15, 2022

September, 06, 2022

August, 29, 2022

August, 19, 2022

August, 16, 2022

August, 15, 2022

August, 08, 2022

August, 06, 2022

August, 03, 2022

August, 01, 2022

July, 22, 2022

July, 21, 2022

July, 20 ,2022

July, 8 ,2022

June, 24 ,2022

June, 10 ,2022

April 02, 2022

February 25, 2022

February 12, 2022

January 05, 2022【Modification of frequency limit rules to add a new domain name】

add new domain name https://api.bitget.com

Request Url Rule
/api/mix/v1/account/setLeverage 5c/1s
/api/mix/v1/account/setMargin 5c/1s
/api/mix/v1/account/setMarginMode 5c/1s
/api/mix/v1/account/setPositionMode 5c/1s
/api/mix/v1/position/allPosition 5c/1s

December 08, 2021【WebSocket Private Channel 】

October 26, 2021

September 26, 2021【WebSocket Public Channel 】

September 08, 2021【Contract List and Ticker Quotes】

September 06, 2021【New account list query】

July 27, 2021 [New Quanto Swap Contract V1 Document]

Introduction

API Introduction

Welcome to Bitget Developer document!

This document is the only official document of Bitget API. We will constantly update the functionalities of Bitget API here. Please pay attention to it regularly.

You can switch to access different APIs business line by clicking the upper menu, and you can switch the document language by clicking the language button on the upper right.

On the right side of the document usually displays example of request parameters and response results.

Updates

Regarding API additions, updates, and offline information, Bitget will issue announcements in advance to notify you. It is recommended that you follow and subscribe to our announcements to obtain relevant information in time.

You can click here to subscribe to announcements.

Contact Us

If you have any questions or suggestions, you can contact us by:

FAQ

A : Traders should use Trader Close Position

A : BTCUSDT_UMCBL

A : BTCUSDT

A : Yes

Quick Start

Access Preparation

If you need to use the API, please log in to the web page, then apply the API key application and complete the permission configuration, and then develop and trade according to the details of this document.

You can click here to create an API Key after login.

Each user can create 10 sets of Api Keys, and each Api Key can set permissions for reading and trading.

The permissions are described as follows:

After successfully created the API key, please remember the following information:

SDK/Code Example

open SDK(Recommended)

Java | Python | GoLang | PHP

PostMan(Demo) PostMan

You should first try to config the APIKey, Secretkey and Passphrase in the Environments tab on left of the PostMan

Interface Type

Interfaces are mainly divided into two types:

Public Interface

The public interface can be used to obtain configuration information and market data. Public requests can be used without authentication.

Private Interface

The private interface can be used for order management and account management. Every private request must be Signed.

The private interface will be verified from server side with your APIKey info.

Access Restriction

This chapter mainly focuses on access restrictions:

Rest API

If the APIKey is valid, we will use the APIKey to limit the frequency; if not, the public IP will be used to limit the frequency.

Frequency limit rules: There are separate instructions on each interface. If the limitation is not specified , the default frequency limit is 10 times per second.

Special note: When place orders in batch, 10 orders per currency pair will be counted as one request.

API Domain Name

You can use different domain as below Rest API.

Domain Name REST API Recommended To Use
Domain 1 https://api.bitget.com Main Domain
Domain 2 https://capi.bitget.com Old domain

API Verification

Initiate a request

The header of all REST requests must contain the following http headers:

//Java
Long timestamp = System.currentTimeMillis();
//python
import time
time.time_ns() / 1000000
//Golang
import (
"time"
)
int64(time.Now().UnixNano()/1000000)
//Javascript
Math.round(new Date())
//PHP
microtime(true) * 1000;

Signature

The request header of ACCESS-SIGN is to encrypt timestamp + method.toUpperCase() + requestPath + "?" + queryString + body string (+ means string concat) by HMAC SHA256 algorithm with secretKey. and encode the encrypted result through BASE64.

Description of each parameter in the signature

If the queryString is empty, signature content

timestamp + method.toUpperCase() + requestPath + body

If the queryString not empty, signature content

timestamp + method.toUpperCase() + requestPath + "?" + queryString + body

For example

Get contract depth information, let's take BTCUSDT_UMCBL as an example:

Generate the content to be signed:

16273667805456GET/api/mix/v1/market/depth?symbol=BTCUSDT_UMCBL&limit=20

Contract order, take BTCUSDT_UMCBL as an example:

Generate the content to be signed:

16273667805456POST/api/mix/v1/order/placeOrder{"symbol":"BTCUSDT_UMCBL","size":"8","side":"open_long","order_type":"limit","client_oid":"bitget#123456"}

Steps to generate the final signature

HMAC

Step 1. Use the private key secretkey to encrypt the string to be signed with hmac sha256

String payload = hmac_sha256(secretkey, Message);

 

Step 2. Base64 encoding for Signature.

String signature = base64.encode(payload);

RSA

Step 1. Use the RSA privateKey privateKey to encrypt the string to be signed with SHA-256

Step 2. Base64 encoding for Signature.

HMAC Signature Code Demo

Java

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.management.RuntimeErrorException;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import org.springframework.util.Base64Utils;

@Slf4j
public class CheckSign {

  private static final String secretKey = "";


  public static void main(String[] args) throws Exception {
    //POST sign example
//        String timestamp = "1684813405151";
//        String body = "{\"symbol\":\"TRXUSDT_UMCBL\",\"marginCoin\":\"USDT\",\"size\":551,\"side\":\"open_long\",\"orderType\":\"limit\",\"price\":0.0555,\"timeInForceValue\":\"normal\"}";
//
//        String sign = generate(timestamp,"POST","/api/mix/v1/order/placeOrder" ,null,body,secretKey);
//        log.info("sign:{}",sign);


    //GET sign example
    String timestamp = "1684814440729";
    String queryString = "symbol=btcusdt_umcbl&marginCoin=usdt";
    String sign = generate(timestamp,"GET","/api/mix/v1/account/account" ,queryString,null,secretKey);
    log.info("sign:{}",sign);
  }



  private static Mac MAC;

  static {
    try {
      CheckSign.MAC = Mac.getInstance("HmacSHA256");
    } catch (NoSuchAlgorithmException var1) {
      throw new RuntimeErrorException(new Error("Can't get Mac's instance."));
    }
  }

  public static String generate(String timestamp, String method, String requestPath,
                                String queryString, String body, String secretKey)
          throws CloneNotSupportedException, InvalidKeyException, UnsupportedEncodingException {

    method = method.toUpperCase();
    body = StringUtils.defaultIfBlank(body, StringUtils.EMPTY);
    queryString = StringUtils.isBlank(queryString) ? StringUtils.EMPTY : "?" + queryString;
    String preHash = timestamp + method + requestPath + queryString + body;
    log.info("preHash:{}",preHash);
    byte[] secretKeyBytes = secretKey.getBytes("UTF-8");
    SecretKeySpec secretKeySpec = new SecretKeySpec(secretKeyBytes, "HmacSHA256");
    Mac mac = (Mac) CheckSign.MAC.clone();
    mac.init(secretKeySpec);
    return Base64.getEncoder().encodeToString(mac.doFinal(preHash.getBytes("UTF-8")));
  }

}

Python

import hmac
import base64
import json
import time



def get_timestamp():
  return int(time.time() * 1000)


def sign(message, secret_key):
  mac = hmac.new(bytes(secret_key, encoding='utf8'), bytes(message, encoding='utf-8'), digestmod='sha256')
  d = mac.digest()
  return base64.b64encode(d)


def pre_hash(timestamp, method, request_path, body):
  return str(timestamp) + str.upper(method) + request_path + body


def parse_params_to_str(params):
  url = '?'
  for key, value in params.items():
    url = url + str(key) + '=' + str(value) + '&'

  return url[0:-1]


if __name__ == '__main__':
  API_SECRET_KEY = ""


  timestamp = "1685013478665" # get_timestamp()
  request_path = "/api/mix/v1/order/placeOrder"
  # POST
  params = {"symbol": "TRXUSDT_UMCBL", "marginCoin": "USDT", "price": 0.0555, "size": 551, "side": "open_long", "orderType": "limit", "timeInForceValue": "normal"}
  body = json.dumps(params)
  sign = sign(pre_hash(timestamp, "POST", request_path, str(body)), API_SECRET_KEY)
  print(sign)


  # GET
  body = ""
  request_path = "/api/mix/v1/account/account"
  params = {"symbol": "TRXUSDT_UMCBL", "marginCoin": "USDT"}
  request_path = request_path + parse_params_to_str(params)
  sign = sign(pre_hash(timestamp, "GET", request_path, str(body)), API_SECRET_KEY)
  print(sign)

For more demo code on other development languages, please refer to SDK

RSA Signature Demo Code

Java

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.management.RuntimeErrorException;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;

@Slf4j
public class CheckSign {

    public static void main(String[] args) throws Exception {
        //GET sign example
//        String timestamp = "1684814440729";
//        String queryString = "symbol=btcusdt_umcbl&marginCoin=usdt";
//        String signContent = timestamp + "GET" + "/api/mix/v1/account/account?" + queryString;
//        String sign = generate(signContent);
//        log.info("sign:{}",sign);


        //POST sign example
        String timestamp = "1684814440729";
        String preContent = timestamp + "POST" + "/api/spot/v1/trade/orders";
        String body = "{\"symbol\":\"btcusdt_spbl\",\"quantity\":\"8\",\"side\":\"buy\",\"price\":\"1\",\"orderType\":\"limit\",\"clientOrderId\":\"bitget1233456\"}";
        String signContent = preContent + body;
        String sign = generate(signContent);
        log.info("sign:{}",sign);
    }



  /**
   *
   * @param content: the string to be signed
   * @return
   */
  private String generate(String content) {
    String privateKey = "-----BEGIN PRIVATE KEY-----\n" +
            "xxxxxxxxxxxxxxxxxxxx9w0BAQEFAASCBKgwggSkAgEAAoIBAQD5C1iP01MC9fh5\n" +
            "43mGx8WgJRAp3Xz9Tcqfz6HzoSg+zd8HVxKXRTXBwMDBfLxfQXobptz1tDlPUs+g\n" +
            "YI38X8XEBZi5U4EBaZ5qHxArBTimyNXX6WNL6hTw0MI238cGKiW0WvWd9v6Z6/LX\n" +
            "i6uFUiUEsZiiuHXcO7EKGuvBrVIRl57FzvOPD5QKfhVxcHr63NfEViAEQfQH4IN2\n" +
            "+mu+L8epkWkmbua4jILUP+LXvHN7ZMiWP9bouw3r4l6v0NJ4XyucSYJL9fJ81rsI\n" +
            "iUoD1S7xlSboujR4RSsFZKFyurE1c8XiU2aZ2qq+6vjby0ncE4dKVu5x/iJZ4gsL\n" +
            "bneZujBLAgMBAAECggEAD6cF5uw6QGpjNo30emMd6aXKsUbpbyYvgQHUxPIxDFl2\n" +
            "FgkD8xv3d/j8ZGzJjhcYbJp9MrgkDfc/c23+HomKbXqIkcVMy2DvAu523q1SVTE0\n" +
            "N4DEq+XHcSc9vaMs6BdIDWDWJRp8AAKTXba6jgOOrg/Xbwq25aOeyerNPHv/N3m3\n" +
            "VImJZVV+ZcetUZ82UdX7NkvV4qmRi8se47OXUT9aypzpvGbSukkqXuE4GtKGoybR\n" +
            "R1sJtU10ap3QvyVNshn2QJnRd3GN2UENDvZS3ZvSY6f/Cq7K/EAmrsstOdUB2Ihn\n" +
            "POnI9/MrghWFq/n3ekuArWc54bDai0deKFl9KvI2oQKBgQD9ekRFMB6ueRCCeoyg\n" +
            "TOGvvW3d7X7G90XKL1xKhrg6mYh65hfQaxbihfOcrneFOoc3BgZwnbAZpF+hlq9J\n" +
            "klu69adhYlMxP2nF3PGj5vPln9/rd6/gcFFE9o7zZhI166PsmlxQ7/N0SCnlao7y\n" +
            "HZQoeeFJ1xuvCHVlNsTR+XZ88QKBgQD7hckVvGxIftcZsHChP8TFcDAn1IsaVbyt\n" +
            "i1UZ5JPznSLTcdb8YPtFr9afiCJ4b2NqRe8gCpUCUi+urnoMMsqMxTUMopiLPh2S\n" +
            "SYaBgpQYUIDLpt+Wx06krbOOyXVZ8RtgYLMpMhFCsRyzovqe8/LZQfQKWfQGTAXS\n" +
            "qL5vdyiw+wKBgQC7DMDYdbwOcFRYlOq1WEarExTCUoHdfZfIrc5jSKsmwynN14H3\n" +
            "US9gFg1BsBWPATPKzO1vqU3Mfln7umC73/9FJgZQfOh7TRpW4saGduXAq4voDTiC\n" +
            "XR/7zh6LSuVhWPRsozRAnfF/+8i+/TVjQaSVgetYPB63uXw4JoRzlq1zYQKBgQDJ\n" +
            "7ASb25G+vX1n1TsGaNBKhR9TypEFylDXreTbDaMtTzg3Mcwa/qyarGiL2Fl8AEh6\n" +
            "d7xaJ8SqgVpgTRgUFO6BBozpINt/5ZUN7NL7w92qi25qkAQt4sGi+QQOnHMGisak\n" +
            "n90VNGmg9dkJ6cxzsXqDqiwF52M9bui5zthbWfkj4wKBgEFVT+jf235aihaS88Oj\n" +
            "MbR078tvsFiRBICHlYCIef7/a+gt7N1u9sEGlPspY3HuPamA39201BuItD9X83VR\n" +
            "Vg+HjkeQIIrxmfvZn1O8/l+ItSNUzQhX6T0cSdCo6KtmZLBQ6Zaw7r63GcdvSdR2\n" +
            "xxxxxxxxxxxxxxxxxxxxxxx\n" +
            "-----END PRIVATE KEY-----\n";
    try {
      String parsedPem = privateKey.replace("\n", "").trim();
      parsedPem = parsedPem
              .replace("-----BEGIN PRIVATE KEY-----", "")
              .replace("-----END PRIVATE KEY-----", "");
      PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64Utils.decodeFromString(parsedPem));
      KeyFactory keyFactory = KeyFactory.getInstance("RSA");
      PrivateKey priKey = keyFactory.generatePrivate(priPKCS8);
      Signature signature = Signature.getInstance("SHA256WithRSA");
      signature.initSign(priKey);
      signature.update(content.getBytes(StandardCharsets.UTF_8));
      String sign = Base64Utils.encodeToString(signature.sign());
      return sign;
    } catch (Exception ex) {
      throw new RuntimeException("create sign  failed", ex);
    }
  }

}

Python

import base64
import json
import time
import base64
from Crypto.Hash import SHA256
from Crypto.Signature import PKCS1_v1_5
from Crypto.PublicKey import RSA



def get_timestamp():
    return int(time.time() * 1000)


def rsa_sign(message, private_key):
  pri_key = RSA.importKey(private_key)
  encoded_param = SHA256.new(bytes(message, encoding='utf-8'))
  sign_str = PKCS1_v1_5.new(pri_key).sign(encoded_param)
  return base64.b64encode(sign_str).decode()


def pre_hash(timestamp, method, request_path, body):
    return str(timestamp) + str.upper(method) + request_path + body


def parse_params_to_str(params):
    url = '?'
    for key, value in params.items():
        url = url + str(key) + '=' + str(value) + '&'

    return url[0:-1]


if __name__ == '__main__':
    private_key = '''-----BEGIN PRIVATE KEY-----
XXXXXXXXXXANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdTR5gmwGH77wE
e0ljABC58EVhiw7fPXWhMh7gZwurQQ8M/I9/VA8lDjwwoGuuJ6enurdfwhpZxeZH
P3wdmwvD7XLESEXVuxJv5hdpI9m6ydInK9SA8IbaF4yYWp0l4N2mA44MzadA7QZq
bQtQPlyPZHeia5q/NZHFWCrCbW2lGAAWwrhQq9LceVIW75e213xtnps0pGlII7Ye
xLkoazuhC1X8YNSxlCdLOiz1GvOeVSeiSZx31o/O+rj7tDFpSgZJEXRmtGRoJkJy
10EGSrvUMezCVSOcb1hCExg4osK6rBKnDjFjwQvwvNNZq0JG+CkfH8eHAa7gSK50
In51go29AgMBAAECggEAEvYk30hQGu7PH0stQX3UhlVsR6HXnRlvgIrmJe7F/VLO
WaZoNdUQLktU/heYY1nsX8+mIyjmvEOayqPgdkEmXevVlcuQf38Zbduynr3vlRCX
AJnL9+8GkmucSxFBODuu/EAZc3mm27C2wUV7w6SAy9g0g6Os97ehZsSGAwHl4aye
i6KtB07LAA10Eh5Ptq4YAfCYiUO7j10pQ+DJKqN9N1eyjyw5eixEgCpudcbpCc9X
+EK6zxk8Ynr0ANX8/LwvokqgYBK1UIL6ear0dtKmeFU+KwrmkKZfXk8/Amr/O8Ot
iHTTr1SLyQKRzq3La149LMmNkUYxaMSV/KGTEV7ukQKBgQDQl/fA3mxXtQg2IjTB
cvDBGhB4c3haECWcP7TQWJDb30vxOKeq1k9YPUfegZga5zlyV28PAZnb0m5x07+0
OY4862brT+pje9OhQxfkAY6AtJaiIqhCcw5ew8Go/Ja1ML0jZESWG1MWBJtCcFTm
d3+n9yU1fB1Ze0adilYmyu7zwwKBgQDBDPJZgSj7YssPyRmo3bO0MjknfYBqXvwi
6TxV11mJRe5BJ9Rc2WXGfEm3DEn7TO/Wv0t7Yqm6/sXg5HzriN/PHlaVtE6wlXe7
3gpYKjlm99KO7KKWYqP812mASl6ydLX9QWozlOXjVhWMuSGqMWjut4J3P8jlkOJ6
pNq9c8/gfwKBgQCxwvAl8ubNj78hsuDWgsddKIMkwvKrfdsvXrMOYouAdLjZJvjs
A5q2jfKzUil3s9km8g/479pYlOn+Iv/Z7Lqke8/HdOFASoQ9h1nSuujgEgXUwkg1
6Ks0Ywqkoi0k2BY3FPnGGh8iQma1pdkUVn35fAq/m7e/S+kP1JY6lPIx1QKBgQCS
jxul67KLNrNmpot+ceGt2bseSd8l4jqU3nDZ0oW8+4Qnnu9QFhN4Hn9wIjpAOGaU
p+HMKFknB6h+Vbior98JxMSDHsHmuXKPA8DishumGlqV+vxsIzLQD1Ge/dbqsERB
olnYEyB7+KyfiyUNqjk5kcPQeHIyJk5qQaF21udoTQKBgDOMbtM0Nq7cd/SAHISR
VYIGGXRFNqAjLJW7DRJGxw3AEwxKG+nxNLeG7GsQDyPCvZSKwRpdpXRTh+6mzXqe
pQ6+33v2gOtez8Cwo6tgyKRi6QPObQk00vbrKEBTihP30m81rwBPzjwj7iKXxWgA
DJoVsaqGOaIf4qXXXXXXXXXX
-----END PRIVATE KEY-----'''


    timestamp = get_timestamp()
    request_path = "/api/mix/v1/order/placeOrder"
    # POST
    params = {"symbol": "TRXUSDT_UMCBL", "marginCoin": "USDT", "price": 0.0555, "size": 551, "side": "open_long", "orderType": "limit", "timeInForceValue": "normal"}
    body = json.dumps(params)
    sign = rsa_sign(pre_hash(timestamp, "POST", request_path, str(body)), private_key)
    print(sign)


    # GET
    body = ""
    request_path = "/api/mix/v1/account/account"
    params = {"symbol": "TRXUSDT_UMCBL", "marginCoin": "USDT"}
    request_path = request_path + parse_params_to_str(params)
    sign = rsa_sign(pre_hash(timestamp, "GET", request_path, str(body)), private_key)
    print(sign)

NodeJs

export function sign() {

    const private_key = '-----BEGIN PRIVATE KEY-----\n' +
        'XXXXXXXXXXANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdTR5gmwGH77wE\n' +
        'e0ljABC58EVhiw7fPXWhMh7gZwurQQ8M/I9/VA8lDjwwoGuuJ6enurdfwhpZxeZH\n' +
        'P3wdmwvD7XLESEXVuxJv5hdpI9m6ydInK9SA8IbaF4yYWp0l4N2mA44MzadA7QZq\n' +
        'bQtQPlyPZHeia5q/NZHFWCrCbW2lGAAWwrhQq9LceVIW75e213xtnps0pGlII7Ye\n' +
        'xLkoazuhC1X8YNSxlCdLOiz1GvOeVSeiSZx31o/O+rj7tDFpSgZJEXRmtGRoJkJy\n' +
        '10EGSrvUMezCVSOcb1hCExg4osK6rBKnDjFjwQvwvNNZq0JG+CkfH8eHAa7gSK50\n' +
        'In51go29AgMBAAECggEAEvYk30hQGu7PH0stQX3UhlVsR6HXnRlvgIrmJe7F/VLO\n' +
        'WaZoNdUQLktU/heYY1nsX8+mIyjmvEOayqPgdkEmXevVlcuQf38Zbduynr3vlRCX\n' +
        'AJnL9+8GkmucSxFBODuu/EAZc3mm27C2wUV7w6SAy9g0g6Os97ehZsSGAwHl4aye\n' +
        'i6KtB07LAA10Eh5Ptq4YAfCYiUO7j10pQ+DJKqN9N1eyjyw5eixEgCpudcbpCc9X\n' +
        '+EK6zxk8Ynr0ANX8/LwvokqgYBK1UIL6ear0dtKmeFU+KwrmkKZfXk8/Amr/O8Ot\n' +
        'iHTTr1SLyQKRzq3La149LMmNkUYxaMSV/KGTEV7ukQKBgQDQl/fA3mxXtQg2IjTB\n' +
        'cvDBGhB4c3haECWcP7TQWJDb30vxOKeq1k9YPUfegZga5zlyV28PAZnb0m5x07+0\n' +
        'OY4862brT+pje9OhQxfkAY6AtJaiIqhCcw5ew8Go/Ja1ML0jZESWG1MWBJtCcFTm\n' +
        'd3+n9yU1fB1Ze0adilYmyu7zwwKBgQDBDPJZgSj7YssPyRmo3bO0MjknfYBqXvwi\n' +
        '6TxV11mJRe5BJ9Rc2WXGfEm3DEn7TO/Wv0t7Yqm6/sXg5HzriN/PHlaVtE6wlXe7\n' +
        '3gpYKjlm99KO7KKWYqP812mASl6ydLX9QWozlOXjVhWMuSGqMWjut4J3P8jlkOJ6\n' +
        'pNq9c8/gfwKBgQCxwvAl8ubNj78hsuDWgsddKIMkwvKrfdsvXrMOYouAdLjZJvjs\n' +
        'A5q2jfKzUil3s9km8g/479pYlOn+Iv/Z7Lqke8/HdOFASoQ9h1nSuujgEgXUwkg1\n' +
        '6Ks0Ywqkoi0k2BY3FPnGGh8iQma1pdkUVn35fAq/m7e/S+kP1JY6lPIx1QKBgQCS\n' +
        'jxul67KLNrNmpot+ceGt2bseSd8l4jqU3nDZ0oW8+4Qnnu9QFhN4Hn9wIjpAOGaU\n' +
        'p+HMKFknB6h+Vbior98JxMSDHsHmuXKPA8DishumGlqV+vxsIzLQD1Ge/dbqsERB\n' +
        'olnYEyB7+KyfiyUNqjk5kcPQeHIyJk5qQaF21udoTQKBgDOMbtM0Nq7cd/SAHISR\n' +
        'VYIGGXRFNqAjLJW7DRJGxw3AEwxKG+nxNLeG7GsQDyPCvZSKwRpdpXRTh+6mzXqe\n' +
        'pQ6+33v2gOtez8Cwo6tgyKRi6QPObQk00vbrKEBTihP30m81rwBPzjwj7iKXxWgA\n' +
        'DJoVsaqGOaIf4qXXXXXXXXXX\n' +
        '-----END PRIVATE KEY-----\n'

    const ts = Date.now();
    const NodeRSA = require('node-rsa')
    const pri_key = new NodeRSA(private_key)

    //GET
    const ts = Date.now();
    const params = 'coin=USDT&startTime=1687744761000&endTime=1690336761929'
    const endpoint = '/api/spot/v1/wallet/withdrawal-list'
    const method = "GET"
    const pre_hash = String(ts) + method + endpoint + '?' + params
    const sign = pri_key.sign(pre_hash, 'base64', 'UTF-8')

    //POST
    const endpoint_post = '/api/spot/v1/trade/open-orders'
    const params_post = '{"symbol": "BTCUSDT_SPBL"}'
    const method_post = "POST"
    const pre_hash_post = String(ts) + method_post + endpoint_post + params_post
    const sign_post = pri_key.sign(pre_hash_post, 'base64', 'UTF-8')

    return sign
}

Request Interaction

All requests are based on the Https protocol, and the Content-Type in the POST request header should set to:'application/json'.

Request Interaction Description

Success

HTTP status code 200 indicates a successful response and may contain content. If the response contains content, it will be displayed in the corresponding return content.

Common Error Codes

Standard Specification

Timestamp

The unit of ACCESS-TIMESTAMP in the HTTP request signature is milliseconds. The timestamp of the request must be within 30 seconds of the API server time, otherwise the request will be considered expired and rejected. If there is a large deviation between the local server time and the API server time, we recommend that you compare the timestamp by querying the API server time.

Frequency Limiting Rules

If the request is too frequent, the system will automatically limit the request and return the 429 too many requests status code.

Request Format

There are currently only two supported request methods: GET and POST

API Common parameters

productType

candlestick interval

marginMode

Margin Mode

Words Description
fixed Isolated margin
crossed Cross margin

holdMode

Position Mode

Words Description
single_hold One-way position
double_hold Two-way position

holdSide

Position Direction

Words Description
long Long position
short Short position

business

side

tradeSide

Values for double_hold

Words Description
open_long open long
open_short open short
close_long close long
close_short close short
reduce_close_long Force reduce long position
reduce_close_short Force reduce short position
offset_close_long Force netting: close long position
offset_close_short Force netting: close short position
burst_close_long Force liquidation: close long position
burst_close_short Force liquidation: close short position
delivery_close_long Future delivery close long
delivery_close_short Future delivery close short

Values for single_hold

Words Description
buy_single Buy in single_hold mode
sell_single Sell in single_hold mode
reduce_buy_single Force reduce buy in single_hold mode
reduce_sell_single Force reduce sell in single_hold mode
burst_buy_single Force liquidation: buy in single_hold mode
burst_sell_single Force liquidation: sell in single_hold mode
delivery_buy_single Future delivery buy in single_hold mode
delivery_sell_single Future delivery sell in single_hold mode

timeInForceValue

Words Description
normal good till cancel, default value
post_only maker only
fok fill or kill
ioc immediately or cancel

orderType

state

order status

Words Description
init initial order, inserted into DB
new new order, pending match in orderbook
partially_filled Partially Filled
filled Filled
canceled Canceled

triggerType

Words Description
fill_price fill price
market_price mark price

planType

Words Description
profit_plan profit order
loss_plan loss order
normal_plan plan order
pos_profit position profit
pos_loss position loss
moving_plan Trailing TP/SL
track_plan Trailing Stop

isPlan

Words Description
plan plan order, Trailing Stop
profit_loss profit order, loss order, position profit, position loss, Trailing TP/SL

planStatus

Words Description
not_trigger order not yet trigger
triggered order triggered
fail_trigger order trigger failed
cancel order cancel

enterPointSource

Words Description
WEB Created from Web
API Created from API
SYS Created from System, usually force liquidation order
ANDROID Created from Android system
IOS Created from IOS system

stopType

Websocket planType

symbolStatus

fullStatus

sortRule

sortFlag

languageType

marginType

leverType

traceType

orderSource

Words Description
normal normal order
market market order
profit_market market profit order
loss_market market loss order
Trader_delegate trader copy trader
trader_profit trader profit
trader_loss trader loss
reverse reverse order
trader_reverse trader reverse order
profit_limit limit profit order
loss_limit limit loss order
liquidation liquidation order
delivery_close_long delivery close long order
delivery_close_short delivery close short order
pos_profit_limit position limit profit order
pos_profit_market position market profit order
pos_loss_limit position limit loss order
pos_loss_market position market loss order

Demo Coin Test on Simulated Trading

Demo coins include :SUSDT, SBTC, SETH, SEOS, SUSDC, demo Coin does not have actual value it is only for users to do the simulated trading, demo coin will be in your account after account registeration : Futures Account - USDT_M Futures Demo

Simulated trading does not support to use sub-account in most of interfaces, please use main account

Get Symbol Information on Simulated Trading

HTTP Request:/api/mix/v1/market/contracts?productType=sumcbl

method:GET

productType - sumcbl USDT simulation perpetual contract - sdmcbl Universal margin simulation perpetual contract - scmcbl USDC simulation perpetual contract

Response:

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1687763055328,
  "data": [
    {
      "symbol": "SBTCSUSDT_SUMCBL",
      "makerFeeRate": "0.0002",
      "takerFeeRate": "0.0006",
      "feeRateUpRatio": "0.1",
      "openCostUpRatio": "0.1",
      "quoteCoin": "SUSDT",
      "baseCoin": "SBTC",
      "buyLimitPriceRatio": "0.01",
      "sellLimitPriceRatio": "0.01",
      "supportMarginCoins": [
        "SUSDT"
      ],
      "minTradeNum": "0.001",
      "priceEndStep": "5",
      "volumePlace": "3",
      "pricePlace": "1",
      "sizeMultiplier": "0.001",
      "symbolType": "perpetual",
      "symbolStatus": "normal",
      "offTime": "-1",
      "limitOpenTime": "-1",
      "maintainTime": "",
      "symbolName": "SBTCSUSDT"
    },
    {
      "symbol": "SETHSUSDT_SUMCBL",
      "makerFeeRate": "0.0002",
      "takerFeeRate": "0.0006",
      "feeRateUpRatio": "0.1",
      "openCostUpRatio": "0.1",
      "quoteCoin": "SUSDT",
      "baseCoin": "SETH",
      "buyLimitPriceRatio": "0.03",
      "sellLimitPriceRatio": "0.03",
      "supportMarginCoins": [
        "SUSDT"
      ],
      "minTradeNum": "0.001",
      "priceEndStep": "1",
      "volumePlace": "3",
      "pricePlace": "2",
      "sizeMultiplier": "0.001",
      "symbolType": "perpetual",
      "symbolStatus": "normal",
      "offTime": "-1",
      "limitOpenTime": "-1",
      "maintainTime": "",
      "symbolName": "SETHSUSDT"
    }
  ]
}

Get Depth Information in Simulated Trading

HTTP Request:/api/mix/v1/market/depth?symbol=SBTCSUSDT_SUMCBL

method:GET

productType - sumcbl USDT simulation perpetual contract - sdmcbl Universal margin simulation perpetual contract - scmcbl USDC simulation perpetual contract

Response:

{
  "code":"00000",
  "data":{
    "asks":[
      [
        "30002",
        "0.2300000000000000"
      ],
      [
        "30002.5",
        "0.91"
      ],
      [
        "30003",
        "0.18"
      ]
    ],
    "bids":[
      [
        "29987",
        "0.28"
      ],
      [
        "300",
        "0.3333000000000000"
      ]
    ],
    "timestamp":"1627115809358"
  },
  "msg":"success",
  "requestTime":1627115809358
}

Get Ticker Information in Simulated Trading

HTTP Request:/api/mix/v1/market/tickers?symbol=SBTCSUSDT_SUMCBL

method:GET

productType - sumcbl USDT simulation perpetual contract - sdmcbl Universal margin simulation perpetual contract - scmcbl USDC simulation perpetual contract

Response:

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1687764449397,
  "data": [
    {
      "symbol": "SEOSSUSDT_SUMCBL",
      "last": "0.732",
      "bestAsk": "0.736",
      "bestBid": "0.731",
      "bidSz": "39322",
      "askSz": "21875",
      "high24h": "0.753",
      "low24h": "0.701",
      "timestamp": "1687764449400",
      "priceChangePercent": "0.01667",
      "baseVolume": "5092110",
      "quoteVolume": "3684527.064",
      "usdtVolume": "3684527.064",
      "openUtc": "0.724",
      "chgUtc": "0.01105",
      "indexPrice": "0.73204",
      "fundingRate": "-0.0006",
      "holdingAmount": "14571063"
    },
    {
      "symbol": "SXRPSUSDT_SUMCBL",
      "last": "0.4834",
      "bestAsk": "0.4835",
      "bestBid": "0.4833",
      "bidSz": "89142",
      "askSz": "231868",
      "high24h": "0.4975",
      "low24h": "0.4804",
      "timestamp": "1687764449400",
      "priceChangePercent": "-0.01105",
      "baseVolume": "9267164",
      "quoteVolume": "4529961.9166",
      "usdtVolume": "4529961.9166",
      "openUtc": "0.4898",
      "chgUtc": "-0.01307",
      "indexPrice": "0.483906",
      "fundingRate": "0.0006",
      "holdingAmount": "58883676"
    }
  ]
}

Get Account Information in Simulated Trading

HTTP Request:/api/mix/v1/account/account?symbol=SBTCSUSDT_SUMCBL&marginCoin=SUSDT

method:GET

Response:

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1687765715697,
  "data": {
    "marginCoin": "SUSDT",
    "locked": "0",
    "available": "2579.07608651",
    "crossMaxAvailable": "2579.07608651",
    "fixedMaxAvailable": "2579.07608651",
    "maxTransferOut": "2579.07608651",
    "equity": "2579.07608651",
    "usdtEquity": "2579.076086513333",
    "btcEquity": "0.085011902546",
    "crossRiskRate": "0",
    "crossMarginLeverage": 6,
    "fixedLongLeverage": 6,
    "fixedShortLeverage": 20,
    "marginMode": "fixed",
    "holdMode": "double_hold",
    "unrealizedPL": "0",
    "bonus": "0"
  }
}

Get Open Count in Simulated Trading

HTTP Request:/api/mix/v1/account/open-count

method:POST

curl -X POST "https://api.bitget.com/api/mix/v1/account/open-count" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "SBTCSUSDT_SUMCBL","marginCoin": "SUSDT","openPrice": "30189.5","leverage": "20","openAmount":"5000"}'

Response:

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1687766165234,
  "data": {
    "openCount": 2.975
  }
}

Get Symbol Position in Simulated Trading

HTTP Request: /api/mix/v1/position/singlePosition?symbol=SBTCSUSDT_SUMCBL&marginCoin=SUSDT

method:POST

curl -X POST "https://api.bitget.com/api/mix/v1/account/open-count" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "SBTCSUSDT_SUMCBL","marginCoin": "SUSDT","openPrice": "30189.5","leverage": "20","openAmount":"5000"}'

Response:

{
  "code": "00000",
  "msg": "success",
  "requestTime": 0,
  "data": [
    {
      "marginCoin": "SUSDT",
      "symbol": "SBTCSUSDT_SUMCBL",
      "holdSide": "long",
      "openDelegateCount": "0",
      "margin": "0",
      "available": "0",
      "locked": "0",
      "total": "0",
      "leverage": 6,
      "achievedProfits": null,
      "averageOpenPrice": null,
      "marginMode": "fixed",
      "holdMode": "double_hold",
      "unrealizedPL": null,
      "liquidationPrice": null,
      "keepMarginRate": null,
      "marketPrice": null,
      "cTime": null
    },
    {
      "marginCoin": "SUSDT",
      "symbol": "SBTCSUSDT_SUMCBL",
      "holdSide": "short",
      "openDelegateCount": "0",
      "margin": "0",
      "available": "0",
      "locked": "0",
      "total": "0",
      "leverage": 20,
      "achievedProfits": null,
      "averageOpenPrice": null,
      "marginMode": "fixed",
      "holdMode": "double_hold",
      "unrealizedPL": null,
      "liquidationPrice": null,
      "keepMarginRate": null,
      "marketPrice": null,
      "cTime": null
    }
  ]
}

Get All Position in Simulated Trading

HTTP Request: /api/mix/v1/position/singlePosition?productType=SUMCBL

method:GET

Response:

{
  "code": "00000",
  "msg": "success",
  "requestTime": 0,
  "data": [
    {
      "marginCoin": "SUSDT",
      "symbol": "SBTCSUSDT_SUMCBL",
      "holdSide": "long",
      "openDelegateCount": "0",
      "margin": "0",
      "available": "0",
      "locked": "0",
      "total": "0",
      "leverage": 6,
      "achievedProfits": null,
      "averageOpenPrice": null,
      "marginMode": "fixed",
      "holdMode": "double_hold",
      "unrealizedPL": null,
      "liquidationPrice": null,
      "keepMarginRate": null,
      "marketPrice": null,
      "cTime": null
    },
    {
      "marginCoin": "SUSDT",
      "symbol": "SBTCSUSDT_SUMCBL",
      "holdSide": "short",
      "openDelegateCount": "0",
      "margin": "0",
      "available": "0",
      "locked": "0",
      "total": "0",
      "leverage": 20,
      "achievedProfits": null,
      "averageOpenPrice": null,
      "marginMode": "fixed",
      "holdMode": "double_hold",
      "unrealizedPL": null,
      "liquidationPrice": null,
      "keepMarginRate": null,
      "marketPrice": null,
      "cTime": null
    }
  ]
}

Place Order in Simulated Trading

HTTP Request: /api/mix/v1/order/placeOrder

method:POST

curl -X POST "https://api.bitget.com/api/mix/v1/order/placeOrder" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "SBTCUSDT_SUMCBL","marginCoin": "SUSDT","size": "0.01","price": "30145.5","side":"open_long","orderType":"limit","timeInForceValue":"normal","clientOid":"myClientOid00001"}'

Response:

{
  "code":"00000",
  "data":{
    "orderId":"1627293504612",
    "clientOid":"BITGET#1627293504612"
  },
  "msg":"success",
  "requestTime":1627293504612
}

Place Plan order in Simulated Trading

HTTP Request: /api/mix/v1/plan/placePlan

method:POST

curl -X POST "https://api.bitget.com/api/mix/v1/plan/placePlan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "SBTCSUSDT_SUMCBL","marginCoin": "SUSDT","size": "0.01","executePrice": "31145.5","triggerPrice":"30555.5","side":"open_long","orderType":"limit","triggerType":"market_price","clientOid":"test@483939290000"}'

Response:

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Cancel Plan Order in Simulated Trading

HTTP Request: /api/mix/v1/plan/cancelPlan

method:POST

curl -X POST "https://api.bitget.com/api/mix/v1/plan/cancelPlan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"orderId":"803521986049314816","symbol": "SBTCSUSDT_SUMCBL","marginCoin": "SUSDT","planType":"loss_plan"}'

Response:

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Cancel All trigger Order in Stimualted Trading

HTTP Request: /api/mix/v1/plan/cancelPlan

method:POST

curl -X POST "https://api.bitget.com/api/mix/v1/plan/cancelAllPlan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"productType":"SUMCBL","planType": "profit_plan"}'

planType - profit_plan - normal_plan - loss_plan - pos_profit - pos_loss - track_plan Trailing Stop - moving_plan Trailing TP/SL

Response:

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Get Plan Order (TPSL) List in Simulated Trading

HTTP Request: /api/mix/v1/plan/currentPlan?symbol=SBTCSUSDT_SUMCBL&isPlan=plan

method:GET

Response:

{
    "code": "00000",
    "msg": "success",
    "requestTime": 0,
    "data": [
        {
            "orderId": "1083162196761448449",
            "clientOid": "1083162196761448448",
            "symbol": "SBTCSUSDT_SUMCBL",
            "marginCoin": "SUSDT",
            "size": "0.01",
            "executePrice": "0",
            "triggerPrice": "26746.5",
            "status": "not_trigger",
            "orderType": "market",
            "planType": "normal_plan",
            "side": "buy_single",
            "triggerType": "market_price",
            "presetTakeProfitPrice": "0",
            "presetTakeLossPrice": "0",
            "rangeRate": "",
            "enterPointSource": "API",
            "tradeSide": "buy_single",
            "holdMode": "single_hold",
            "reduceOnly": false,
            "cTime": "1693971912565",
            "uTime": null
        }
    ]
}

Get History Plan Orders in Simulated Trading

HTTP Request: /api/mix/v1/plan/historyPlan?symbol=SBTCSUSDT_SUMCBL&startTime=1659406928000&endTime=1659414128000&pageSize=20

method:GET

Response:

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1693981786695,
    "data": [
        {
            "orderId": "1048210602999750657",
            "clientOid": "1048210602999750656",
            "executeOrderId": "1048508364888899593",
            "symbol": "SBTCSUSDT_SUMCBL",
            "marginCoin": "SUSDT",
            "size": "0.001",
            "executePrice": "27500",
            "triggerPrice": "27200",
            "status": "triggered",
            "orderType": "limit",
            "planType": "normal_plan",
            "side": "sell_single",
            "triggerType": "market_price",
            "presetTakeProfitPrice": "0",
            "presetTakeLossPrice": "0",
            "rangeRate": null,
            "enterPointSource": "API",
            "tradeSide": "sell_single",
            "holdMode": "single_hold",
            "reduceOnly": false,
            "executeTime": "1685709795259",
            "executeSize": "0.001",
            "cTime": "1685638803243",
            "uTime": "1685709795259"
        }
    ]
}

Get Order Details in Simulated Trading

HTTP Request: /api/mix/v1/order/detail?symbol=SBTCSUSDT_SUMCBL&orderId=1627293504612

method:GET

Response:

{
  "code":"00000",
  "data":{
    "symbol":"SBTCUSDT_SUMCBL",
    "size":1,
    "orderId":"802382049422487552",
    "clientOid":"RFIut#1627028708738",
    "filledQty":0,
    "priceAvg":0,
    "fee":0,
    "price":23999.3,
    "state":"canceled",
    "side":"open_long",
    "timeInForce":"normal",
    "totalProfits":0,
    "posSide":"long",
    "marginCoin":"SUSDT",
    "presetTakeProfitPrice":69582.5,
    "presetStopLossPrice":21432.5,
    "filledAmount":45838,
    "orderType":"limit",
    "leverage": "6",
    "marginMode": "fixed",
    "reduceOnly": false,
    "enterPointSource": "WEB",
    "tradeSide": "buy_single",
    "holdMode": "single_hold",
    "orderSource": "market",
    "cTime":1627028708807,
    "uTime":1627028717807
  },
  "msg":"success",
  "requestTime":1627300098776
}

Get Order fill detail in Stimualted Trading

HTTP Request: /api/mix/v1/order/fills?symbol=SBTCSUSDT_SUMCBL&orderId=802382049422487552

method:GET

Response:

{
  "code":"00000",
  "data":[
    {
      "tradeId":"802377534023585793",
      "symbol":"SBTCSUSDT_SUMCBL",
      "orderId":"802377533381816325",
      "price":"0",
      "sizeQty":"0.3247",
      "fee":"0E-8",
      "side":"burst_close_long",
      "fillAmount":"0.3247",
      "profit":"0E-8",
      "enterPointSource": "WEB",
      "tradeSide": "buy_single",
      "holdMode": "single_hold",
      "takerMakerFlag": "taker",
      "cTime":"1627027632241"
    }
  ],
  "msg":"success",
  "requestTime":1627386245672
}

Cancel Order in Simulated Trading

HTTP Request: /api/mix/v1/order/cancel-order

method:POST

curl -X POST "https://api.bitget.com/api/mix/v1/order/cancel-order" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "SBTCSUSDT_SUMCBL","marginCoin": "SUSDT"}'

Response:

{
  "code":"00000",
  "data":{
    "orderId":"1627293504612",
    "clientOid":"BITGET#1627293504612"
  },
  "msg":"success",
  "requestTime":1627293504612
}

Cancel All Order in Simulated Trading

请求API接口: /api/mix/v1/order/cancel-all-orders

method:POST

curl -X POST "https://api.bitget.com/api/mix/v1/order/cancel-all-orders" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"productType": "SUMCBL","marginCoin": "SUSDT"}'

Response:

{
  "code": "00000",
  "data": {
    "order_ids": [
      "1627293504612"
    ],
    "fail_infos": [
      {
        "order_id": "",
        "err_code": "",
        "err_msg": ""
      }
    ]
  },
  "msg": "success",
  "requestTime": 1627293504612
}

Close All Position in Simulated Trading

HTTP Request: /api/mix/v1/order/close-all-positions

method:POST

curl -X POST "https://api.bitget.com/api/mix/v1/order/close-all-positions" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"productType": "SUMCBL"}'

Response:

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1684747525424,
  "data": {
    "orderInfo": [
      {
        "orderId": "1044472355251990528",
        "clientOid": "1044472355256184832"
      },
      {
        "orderId": "1044472355256184835",
        "clientOid": "1044472355260379136"
      }
    ],
    "failure": [],
    "result": true
  }
}

Get All Open Order in Simulated Trading

method:GET

HTTP Request: /api/mix/v1/order/marginCoinCurrent?productType=SUMCBL&marginCoin=SUSDT

Response:

{
  "code":"00000",
  "data": [
    {
      "symbol": "SBTCUSDT_SUMCBL",
      "size": 0.050,
      "orderId": "1044911928892862465",
      "clientOid": "xx005",
      "filledQty": 0.000,
      "fee": 0E-8,
      "price": 25500.00,
      "state": "new",
      "side": "open_long",
      "timeInForce": "normal",
      "totalProfits": 0E-8,
      "posSide": "long",
      "marginCoin": "SUSDT",
      "presetTakeProfitPrice": 33800.00,
      "presetStopLossPrice": 11300.00,
      "filledAmount": 0.0000,
      "orderType": "limit",
      "leverage": "4",
      "marginMode": "crossed",
      "reduceOnly": false,
      "enterPointSource": "API",
      "tradeSide": "open_long",
      "holdMode": "double_hold",
      "orderSource": "normal",
      "cTime": "1684852338057",
      "uTime": "1684852338057"
    }
  ],
  "msg":"success",
  "requestTime":1627299486707
}

Get ProductType History Orders in Simulated Trading

method:GET

HTTP Request: /api/mix/v1/order/historyProductType?productType=SUMCB&startTime=1659403328000&endTime=1659410528000&pageSize=20

Response:

{
  "code":"00000",
  "data":{
    "nextFlag":false,
    "endId":"802355881591844864",
    "orderList":[
      {
        "symbol":"SBTCUSDT_SUMCBL",
        "size":1,
        "orderId":"802382049422487552",
        "clientOid":"RFIut#1627028708738",
        "filledQty":0,
        "fee":0,
        "price":23999.3,
        "state":"canceled",
        "side":"open_long",
        "timeInForce":"normal",
        "totalProfits":0,
        "posSide":"long",
        "marginCoin":"SUSDT",
        "leverage":"20",
        "marginMode":"crossed",
        "orderType":"limit",
        "reduceOnly": false,
        "enterPointSource": "WEB",
        "tradeSide": "open_long",
        "holdMode": "double_hold",
        "orderSource": "normal",
        "cTime": "1665452796883",
        "uTime": "1665452797002"
      }
    ]
  },
  "msg":"success",
  "requestTime":1627299486707
}

Websocket in Simulated Trading

Tickers Channel: Retrieve the latest traded price, bid price, ask price and 24-hour trading volume of the instruments. Data will be pushed every 150 ms.

Request Example: Json { "op":"subscribe", "args":[ { "instType":"MC", "channel":"ticker", "instId":"SBTCSUSDT" } ] }

Successful Response Example: Json { "event":"subscribe", "arg":{ "instType":"MC", "channel":"ticker", "instId":"SBTCSUSDT" } }

Push data Example:

{
  "action":"snapshot",
  "arg":{
    "instType":"mc",
    "channel":"ticker",
    "instId":"SBTCSUSDT"
  },
  "data":[
    {
      "instId":"SBTCSUSDT",
      "last":"44962.00",
      "bestAsk":"44962",
      "bestBid":"44961",
      "high24h":"45136.50",
      "low24h":"43620.00",
      "priceChangePercent":"0.02",
      "capitalRate":"-0.00010",
      "nextSettleTime":1632495600000,
      "systemTime":1632470889087,
      "markPrice":"44936.21",
      "indexPrice":"44959.23",
      "holding":"1825.822",
      "baseVolume":"39746.470",
      "quoteVolume":"1760329683.834",
      "openUtc": "17088.5000000000000000",
      "chgUTC": "-0.00778",
      "symbolType": 1,
      "symbolId": "SBTCSUSDT_SUMCBL",
      "deliveryPrice": "0",
      "bidSz": "10.344",
      "askSz": "3.024"
    }
  ]
}

Order Book Channel: Get Detph data

Request Example: Json { "op":"subscribe", "args":[ { "instType":"mc", "channel":"books5", "instId":"SBTCSUSDT" } ] }

Successful Response Example: Json { "event":"subscribe", "arg":{ "instType":"mc", "channel":"books5", "instId":"SBTCSUSDT" } }

Push data Example:

{
  "action": "snapshot",
  "arg": {
    "instType": "MC",
    "channel": "books",
    "instId": "BTCUSDT"
  },
  "data": [  {
    "asks": [
      [44849.3, 0.0031]
    ],
    "bids": [
      [44845.2, 0.725]
    ],
    "checksum":" -1638549107",
    "ts": "1628826748009"
  }   ]
}

RestAPI

Market

Get All Symbols

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
productType String Yes product type

Request Example

curl "https://api.bitget.com/api/mix/v1/market/contracts?productType=umcbl"

Response

{
  "code": "00000",
  "data": [
    {
      "baseCoin": "BTC",
      "buyLimitPriceRatio": "0.01",
      "feeRateUpRatio": "0.005",
      "makerFeeRate": "0.0002",
      "minTradeNum": "0.001",
      "openCostUpRatio": "0.01",
      "priceEndStep": "5",
      "pricePlace": "1",
      "quoteCoin": "USDT",
      "sellLimitPriceRatio": "0.01",
      "sizeMultiplier": "0.001",
      "supportMarginCoins": [
        "USDT"
      ],
      "symbol": "BTCUSDT_UMCBL",
      "takerFeeRate": "0.0006",
      "volumePlace": "3",
      "symbolType":"delivery",
      "symbolStatus": "normal",
      "offTime": "-1",
      "limitOpenTime": "-1"
    }
  ],
  "msg": "success",
  "requestTime": 1627114525850
}

Response Description

Parameter Description
symbol Symbol Id, BTCUSDT_UMCBL
symbolName Symbol name, BTCUSDT, might be empty
baseCoin Base currency, BTC
quoteCoin Quote currency, USDT
buyLimitPriceRatio Buy price limit ratio, 0.02 means 2%
sellLimitPriceRatio Sell price limit ratio, 0.01 means 1%
feeRateUpRatio Rate of increase in handling fee, 0.005 means 0.5%
makerFeeRate Maker fee rate, 0.0002 means 0.02%
takerFeeRate Taker fee rate, 0.0006 means 0.06%
openCostUpRatio Percentage of increase in opening cost, 0.01 means 1%
supportMarginCoins Support margin currency array
minTradeNum Minimum number of openings(Base Currency)
priceEndStep Price step, i.e. when pricePlace=1, priceEndStep=5 means the price would only accept numbers like 10.0, 10.5, and reject numbers like 10.2(10.2 divided by 0.5 not equals to 0)
volumePlace Number of decimal places
pricePlace Price scale precision, i.e. 1 means 0.1; 2 means 0.01
sizeMultiplier Quantity Multiplier The order size must be greater than minTradeNum and satisfy the multiple of sizeMultiplier
symbolType future type perpetual perpetual contract delivery delivery contract
symbolStatus Symbol Status
offTime delist time, '-1' means online symbol
limitOpenTime prohibit create order time, '-1' means normal; other value means symbol is under maintenance, and is not allow to create order afterwards

Get merged depth data

Speed limit rule: 20 times/1s

HTTP Request

request example

curl "https://api.bitget.com/api/mix/v1/market/merge-depth?symbol=ETHUSDT_UMCBL&precision=scale0&limit=5"

request parameters

parameter name Parameter Type Required describe
symbol String Yes Trading pair name, for example: BTCUSDT_UMCBL
precision String No Price accuracy, according to the selected accuracy as the step size to return the cumulative depth, enumeration value: scale0/scale1/scale2/scale3, scale0 is not merged, the default value, in general, scale1 is the merged depth of the transaction pair’s quotation accuracy*10, generally In this case, scale2 is the quotation precision *100, scale3 is the quotation precision *1000, and the precision corresponding to 0/1/2/3 is subject to the actual return parameter "scale". The quotation precision of each trading pair is different, and some currencies The pair does not have scale2, and the request for a scale that does not exist for the currency pair will be processed according to the maximum scale. Example: A certain trading pair only has scale 0/1, and when scale2 is requested, it will be automatically reduced to scale1.
limit String No Fixed gear enumeration value: 1/5/15/50/max, the default gear is 100. When the actual depth does not meet the limit, it will be returned according to the actual gear. Passing in max will return the maximum gear of the trading pair.

return data

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1692761045039,
  "data": {
    "asks": [
      [
        1842.2,
        0.100
      ],
      [
        1842.3,
        3.176
      ],
      [
        1842.8,
        7.428
      ],
      [
        1843.3,
        6.128
      ],
      [
        1843.8,
        2.747
      ]
    ],
    "bids": [
      [
        1841.8,
        0.519
      ],
      [
        1841.3,
        2.931
      ],
      [
        1840.8,
        8.622
      ],
      [
        1840.3,
        1.018
      ],
      [
        1839.8,
        4.112
      ]
    ],
    "ts": "1692761045063",
    "scale": "0.1",
    "precision": "scale0",
    "isMaxPrecision": "NO"
  }
}

Return value description

parameter name Parameter Type field description
asks Array All buy orders at the current price, such as ["38084.5","0.5"], "38084.5" represents the depth price, and "0.5" represents the amount of base currency
bids Array All sell orders at the current price
precision String Current gear, for example: scale 1
scale String The actual precision value, for example: 0.1
isMaxPrecision String YES means it is already the maximum precision, NO is not the maximum precision
ts String The time corresponding to the current depth

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

&npsp;

Get Depth

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
limit String No Depth gear 5,15,50,100 default 100

Request Example

curl "https://api.bitget.com/api/mix/v1/market/depth?symbol=BTCUSDT_UMCBL&limit=100"

Response

{
  "code":"00000",
  "data":{
    "asks":[
      [
        "30002",
        "0.2300000000000000"
      ],
      [
        "30002.5",
        "0.91"
      ],
      [
        "30003",
        "0.18"
      ]
    ],
    "bids":[
      [
        "29987",
        "0.28"
      ],
      [
        "300",
        "0.3333000000000000"
      ]
    ],
    "timestamp":"1627115809358"
  },
  "msg":"success",
  "requestTime":1627115809358
}

The price & volume pair would return values in scientific notation expression

["1.937E+4","156.814"]

["0.000010934","1.2224E+8"]

Please do adjust your code for the scientific notation expression

Get Single Symbol Ticker

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/market/ticker?symbol=BTCUSDT_UMCBL"

Response

{
  "code": "00000",
  "msg": "success",
  "data": {
    "symbol": "BTCUSDT_UMCBL",
    "last": "23990.5",
    "bestAsk": "23991",
    "bestBid": "23989.5",
    "bidSz": "2.154",
    "askSz": "176.623",
    "high24h": "24131.5",
    "low24h": "23660.5",
    "timestamp": "1660705778888",
    "priceChangePercent": "0.00442",
    "baseVolume": "156243.358",
    "quoteVolume": "3735854069.908",
    "usdtVolume": "3735854069.908",
    "openUtc": "23841.5",
    "chgUtc": "0.00625",
    "indexPrice": "22381.253737",
    "fundingRate": "0.000072",
    "holdingAmount": "85862.241"
  }
}

Response Description

Parameter Description
symbol Symbol Id
last Latest price
bestAsk Ask1 price
bestBid Bid1 price
bidSz Ask1 size
askSz Bid1 size
high24h Highest price in 24 hours
low24h Lowest price in 24 hours
timestamp Timestamp (milliseconds)
priceChangePercent Price change (24 hours)
baseVolume Base currency trading volume
quoteVolume Quote currency trading volume
usdtVolume USDT transaction volume
openUtc UTC0 open price
chgUtc UTC0 price change(24 hour)
indexPrice Index price
fundingRate Funding rate
holdingAmount Holding amount, unit in base coin

Get All Symbol Ticker

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
productType String Yes product type

Request Example

curl "https://api.bitget.com/api/mix/v1/market/tickers?productType=umcbl"

Response

{
  "code": "00000",
  "msg": "success",
  "requestTime": 0,
  "data": [{
    "symbol": "BTCUSDT_UMCBL",
    "last": "23990.5",
    "bestAsk": "23991",
    "bestBid": "23989.5",
    "bidSz": "2.154",
    "askSz": "176.623",
    "high24h": "24131.5",
    "low24h": "23660.5",
    "timestamp": "1660705778888",
    "priceChangePercent": "0.00442",
    "baseVolume": "156243.358",
    "quoteVolume": "3735854069.908",
    "usdtVolume": "3735854069.908",
    "openUtc": "23841.5",
    "chgUtc": "0.00625",
    "indexPrice": "22381.253737",
    "fundingRate": "0.000072",
    "holdingAmount": "85862.241"
  }]
}

Response Description

Parameter Description
symbol Symbol Id
last Latest price
bestAsk Ask price
bestBid Bid price
bidSz Ask1 size
askSz Bid1 size
high24h Highest price in 24 hours
low24h Lowest price in 24 hours
timestamp Timestamp (milliseconds)
priceChangePercent Price change (24 hours)
baseVolume Base currency trading volume
quoteVolume Quote currency trading volume
usdtVolume USDT transaction volume
openUtc UTC0 open price
chgUtc UTC0 price change (24hour)
indexPrice Index price
fundingRate Funding rate
holdingAmount Holding amount, unit in base coin

 

 

 

 

 

 

 

 

 

VIP fee rate

Rate Limit: 10 times/1s (IP)

HTTP Request

Request Example

curl "https://api.bitget.com/api/mix/v1/market/contract-vip-level"

Response

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1675759699382,
  "data": [
    {
      "level": 1,
      "dealAmount": "1000000",
      "assetAmount": "50000",
      "takerFeeRate": "0.000475",
      "makerFeeRate": "0.00006",
      "withdrawAmount": "300",
      "withdrawAmountUSDT": "5000000"
    }
  ]
}

Response parameter

Parameter name Parameter type Required Description
level Integer Yes VIP level
dealAmount BigDecimal Yes Transaction volume (USDT) within 30 days
assetAmount BigDecimal Yes Asset amount (USDT)
takerFeeRate BigDecimal No Taker fee rate, actual fee rate please refer to official announcement when '0'
makerFeeRate BigDecimal No Maker fee rate, actual fee rate please refer to official announcement when '0'
withdrawAmount BigDecimal Yes 24 hours withdraw amount (BTC)
withdrawAmountUSDT BigDecimal Yes 24 hours withdraw amount (USDT)

Get Recent Fills

Get recent 100 trades.

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
limit String No Default limit is 100, max 100

Request Example

curl "https://api.bitget.com/api/mix/v1/market/fills?symbol=BTCUSDT_UMCBL&limit=100"

Response Data

{
  "code":"00000",
  "data":[
    {
      "tradeId":"802751431994691585",
      "price":"29990.5",
      "size":"0.0166",
      "side":"sell",
      "timestamp":"1627116776464",
      "symbol":"BTCUSDT_UMCBL"
    },
    {
      "tradeId":"802750695521046529",
      "price":"30007.0",
      "size":"0.0166",
      "side":"buy",
      "timestamp":"1627116600875",
      "symbol":"BTCUSDT_UMCBL"
    }
  ],
  "msg":"success",
  "requestTime":1627116936176
}

Response Description

Parameter Description
tradeId tradeId
price price
size size
side side
timestamp timestamp, ms
symbol symbol

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Get Fills

Fetch trade history within 30 days, response will be cached with same param for 10 minutes, please revise 'endTime' to get the latest records

Limit rule: 10 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
limit String No Default is 500, Max is 1000
tradeId String No tradeId, return records with 'tradeId' less than the provided value
startTime String No startTime, ms
endTime String No endTime, ms

Request Example

curl "https://api.bitget.com/api/mix/v1/market/fills-history?symbol=BTCUSDT_UMCBL&limit=12&tradeId=1020224189048217601&startTime&endTime"

Response Data

{
  "code": "00000",
  "msg": "success",
  "requestTime": 0,
  "data": [
    {
      "tradeId": "1020224187601182723",
      "price": "21120",
      "size": "23.296",
      "side": "Buy",
      "timestamp": "1678966321000",
      "symbol": "BTCUSDT_UMCBL"
    },
    {
      "tradeId": "1020224187055923213",
      "price": "21120",
      "size": "0.804",
      "side": "Sell",
      "timestamp": "1678966321000",
      "symbol": "BTCUSDT_UMCBL"
    }
  ]
}

Response Description

Parameter Description
tradeId tradeId, desc
price price
size size, base coin
side side, Buy/Sell
timestamp timestamp, ms
symbol symbol

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Get Candle Data

Limit rule: 20 times/1s (IP)

Could only get data within 30 days for '1m' data, default return 100 rows

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
granularity String Yes Types of candlestick interval
startTime String Yes Start time (Timestamp ms, bigger or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672410780000 (2022-12-30 22:33:00) if granularity=1m
endTime String Yes End time (Timestamp ms, less or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672408800000 (2022-12-30 22:00:00) if granularity=1H
kLineType String No k-line type: 'market mark index'; Default 'market'
limit String No Default 100, max 1000

Request Example

curl "https://api.bitget.com/api/mix/v1/market/candles?symbol=BTCUSDT_UMCBL&granularity=5m&startTime=1659406928000&endTime=1659410528000"

Response

[
  [
    "1627008780000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "0.000000000000",
    "0.000000000000"
  ],
  [
    "1627008840000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "0.000000000000",
    "0.000000000000"
  ]
]

Response Description

Parameter Index
Timestamp in milliseconds 0
Opening price 1
Highest price 2
Lowest price 3
Closing price, value of the latest candle stick might change, please try subscribe the websocket candlestick channel for the updates 4
Base currency trading volume 5
Quote currency trading volume 6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Get History Candle Data

Limit rule: 20 times/1s (IP)

Get history candle data, max return 200 rows

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
granularity String Yes Types of candlestick interval
startTime String Yes Start time (Timestamp ms, bigger or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672410780000 (2022-12-30 22:33:00) if granularity=1m
endTime String Yes End time (Timestamp ms, less or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672408800000 (2022-12-30 22:00:00) if granularity=1H
limit String No Default 100, max 200

Request Example

curl "https://api.bitget.com/api/mix/v1/market/history-candles?symbol=BTCUSDT_UMCBL&granularity=5m&startTime=1659406928000&endTime=1659410528000"

Response

[
  [
    "1627008780000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "0.000000000000",
    "0.000000000000"
  ],
  [
    "1627008840000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "0.000000000000",
    "0.000000000000"
  ]
]

Response Description

Parameter Index
Timestamp in milliseconds 0
Opening price 1
Highest price 2
Lowest price 3
Closing price, value of the latest candle stick might change, please try subscribe the websocket candlestick channel for the updates 4
Base currency trading volume 5
Quote currency trading volume 6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Get History Index Candle Data

Limit rule: 20 times/1s (IP)

Could only get data within 30 days for '1m' data, default return 100 rows

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
granularity String Yes Types of candlestick interval
startTime String Yes Start time (Timestamp ms, bigger or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672410780000 (2022-12-30 22:33:00) if granularity=1m
endTime String Yes End time (Timestamp ms, less or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672408800000 (2022-12-30 22:00:00) if granularity=1H
limit String No Default 100, max 200

Request Example

curl "https://api.bitget.com/api/mix/v1/market/history-index-candles?symbol=BTCUSDT_UMCBL&granularity=5m&startTime=1659406928000&endTime=1659410528000"

Response

[
  [
    "1627008780000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "0.000000000000",
    "0.000000000000"
  ],
  [
    "1627008840000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "0.000000000000",
    "0.000000000000"
  ]
]

Response Description

Parameter Index
Timestamp in milliseconds 0
Opening price 1
Highest price 2
Lowest price 3
Closing price, value of the latest candle stick might change, please try subscribe the websocket candlestick channel for the updates 4
Base currency trading volume 5
Quote currency trading volume 6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Get History Mark Candle Data

Limit rule: 20 times/1s (IP)

Could only get data within 30 days for '1m' data, default return 100 rows

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
granularity String Yes Types of candlestick interval
startTime String Yes Start time (Timestamp ms, bigger or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672410780000 (2022-12-30 22:33:00) if granularity=1m
endTime String Yes End time (Timestamp ms, less or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672408800000 (2022-12-30 22:00:00) if granularity=1H
limit String No Default 100, max 200

Request Example

curl "https://api.bitget.com/api/mix/v1/market/history-mark-candles?symbol=BTCUSDT_UMCBL&granularity=5m&startTime=1659406928000&endTime=1659410528000"

Response

[
  [
    "1627008780000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "0.000000000000",
    "0.000000000000"
  ],
  [
    "1627008840000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "24016.0000000000000000",
    "0.000000000000",
    "0.000000000000"
  ]
]

Response Description

Parameter Index
Timestamp in milliseconds 0
Opening price 1
Highest price 2
Lowest price 3
Closing price, value of the latest candle stick might change, please try subscribe the websocket candlestick channel for the updates 4
Base currency trading volume 5
Quote currency trading volume 6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Get Symbol Index Price

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/market/index?symbol=BTCUSDT_UMCBL"

Response

{
  "code":"00000",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "index":"35000",
    "timestamp":"1627291836179"
  },
  "msg":"success",
  "requestTime":1627291836179
}

Response Description

Parameter Description
symbol Symbol Id
index Index price
timestamp Timestamp, milliseconds

 

 

 

 

 

 

 

Get Symbol Next Funding Time

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/market/funding-time?symbol=BTCUSDT_UMCBL"

Response

{
  "code":"00000",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "fundingTime":"1627311600000"
  },
  "msg":"success",
  "requestTime":1627291915767
}

Response Description

Parameter Description
symbol Symbol ID
fundingTime Next settlement time, milliseconds

Get History Funding Rate

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
pageSize int No Page size default 20
pageNo int No Page No.
nextPage Boolean No Whether to query the next page default false

Request Example

curl "https://api.bitget.com/api/mix/v1/market/history-fundRate?symbol=BTCUSDT_UMCBL"

Response

{
  "code":"00000",
  "data":[
    {
      "symbol":"BTCUSDT",
      "fundingRate":"0",
      "settleTime":"1627369200000"
    }
  ],
  "msg":"success",
  "requestTime":1627389063463
}

Response Description

Parameter Description
symbol Symbol name
fundingRate Current funding rate
settleTime Settlement time

Get Current Funding Rate

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/market/current-fundRate?symbol=BTCUSDT_UMCBL"

Response

{
  "code":"00000",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "fundingRate":"0.0002"
  },
  "msg":"success",
  "requestTime":1627291969594
}

Response Description

Parameter Description
symbol Symbol Id
fundingRate Current funding rate

Get Open Interest

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/market/open-interest?symbol=BTCUSDT_UMCBL"

Response

{
  "code":"00000",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "amount":"757.8338",
    "timestamp":"1627292005913"
  },
  "msg":"success",
  "requestTime":1627292005913
}

Response Description

Parameter Description
symbol Symbol ID
amount Total platform open interest
timestamp Timestamp (milliseconds)

Get Symbol Mark Price

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/market/mark-price?symbol=BTCUSDT_UMCBL"

Response

{
  "code":"00000",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "markPrice":"35000",
    "timestamp":"1627292076687"
  },
  "msg":"success",
  "requestTime":1627292076687
}

Response Description

Parameter Description
symbol Symbol Id
markPrice Mark price
timestamp Timestamp (milliseconds)

Get Symbol Leverage

Limit rule: 20/sec (IP)

HTTP Request

Request Parameter

Parameter type required description
symbol String Yes symbol Id (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/market/symbol-leverage?symbol=BTCUSDT_UMCBL"

Response

{
  "code":"00000",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "minLeverage":"1",
    "maxLeverage":"125"
  },
  "msg":"success",
  "requestTime":1627292076687
}

Response Description

Parameter Description
symbol symbol id
minLeverage min leverage
maxLeverage max leverage

Get Position Tier

Limit rule: 20/sec (IP)

HTTP Request

Request Parameter

Parameter type required description
symbol String Yes symbol Id (Must be capitalized)
productType String Yes product type

Request Example

curl "https://api.bitget.com/api/mix/v1/market/queryPositionLever?symbol=BTCUSDT_UMCBL&productType=UMCBL"

Response

{
  "code":"00000",
  "data":[
    {
      "level": 1,
      "startUnit": 0,
      "endUnit": 150000,
      "leverage": 125,
      "keepMarginRate": "0.004"
    }
  ],
  "msg":"success",
  "requestTime":1627292076687
}

Response Description

Parameter Description
level Tier
startUnit Start value
endUnit End value
leverage Leverage multiple
keepMarginRate Margin Rate, The value corresponding to the position, when the margin rate of the position is less than the maintenance margin rate, forced decreased or liquidation will be triggered

Get Risk Position Limit

Limit rule: 20/sec (IP)

HTTP Request

Request Example

curl "https://api.bitget.com/api/mix/v1/market/open-limit"

Response

{
  "code": "00000",
  "data": [
    {
      "symbol": "BTCUSDT_UMCBL",
      "posLimit": "0.05"
    },
    {
      "symbol": "ETHUSDT_UMCBL",
      "posLimit": "0.05"
    }
  ],
  "msg": "success",
  "requestTime": 1627292076687
}

Response Description

Parameter Description
symbol Symbol name
posLimit The percentage of positions that can be held by a single trader.

Account

Get Single Account

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes symbol Id (Must be capitalized)
marginCoin String Yes Margin coin

Request Example

curl "https://api.bitget.com/api/mix/v1/account/account?symbol=BTCUSDT_UMCBL&marginCoin=USDT" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
  "code":"00000",
  "data":{
    "marginCoin":"USDT",
    "locked":0,
    "available":13168.86110692,
    "crossMaxAvailable":13168.86110692,
    "fixedMaxAvailable":13168.86110692,
    "maxTransferOut":13168.86110692,
    "equity":13178.86110692,
    "usdtEquity":13178.861106922,
    "btcEquity":0.344746495477,
    "crossRiskRate":0,
    "crossMarginLeverage":20,
    "fixedLongLeverage":20,
    "fixedShortLeverage":20,
    "marginMode":"crossed",
    "holdMode":"double_hold",
    "unrealizedPL": null,
    "crossedUnrealizedPL": null,
    "isolatedUnrealizedPL": null,
    "bonus": "0"
  },
  "msg":"success",
  "requestTime":1627292199523
}

Response Description

Parameter Description
marginCoin Margin currency
locked Locked amount (margin currency), system will lock when close position
available Available balance(margin currency)
crossMaxAvailable The maximum available balance for crossed margin mode(margin currency)
fixedMaxAvailable The maximum available balance for fixed margin mode(margin currency)
maxTransferOut Maximum transferable
equity Account equity (margin currency) , includes uPnL (calculated by mark price)
usdtEquity Account equity convert to USDT,
btcEquity Account equity convert to BTC
crossRiskRate Risk ratio at crossed margin mode
crossMarginLeverage Leverage level for crossed margin mode
fixedLongLeverage Long leverage with isolated(fixed) margin mode
fixedShortLeverage Short leverage with isolated(fixed) margin mode
marginMode Margin mode
holdMode Hold mode
unrealizedPL unrealized profit and loss at crossed margin mode, unit in USDT
crossedUnrealizedPL current symbol unrealized profit and loss at crossed margin mode, unit in USDT
isolatedUnrealizedPL current symbol unrealized profit and loss at isolated margin mode, unit in USDT
bonus coupon

Get Account List

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
productType String Yes product type

Request Example

curl "https://api.bitget.com/api/mix/v1/account/accounts?productType=umcbl" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
  "code":"00000",
  "data":[
    {
      "marginCoin":"USDT",
      "locked":"0.31876482",
      "available":"10575.26735771",
      "crossMaxAvailable":"10580.56434289",
      "fixedMaxAvailable":"10580.56434289",
      "maxTransferOut":"10572.92904289",
      "equity":"10582.90265771",
      "usdtEquity":"10582.902657719473",
      "btcEquity":"0.204885807029",
      "crossRiskRate": "0",
      "unrealizedPL": null,
      "bonus": "0"
    }
  ],
  "msg":"success",
  "requestTime":1630901215622
}

Response Description

Parameter Description
marginCoin Margin currency
locked Locked amount (margin currency)
available Available balance(margin currency)
crossMaxAvailable The maximum available balance for crossed margin mode(margin currency)
fixedMaxAvailable The maximum available balance for isolated(fixed) margin mode(margin currency)
maxTransferOut Maximum transferable
equity Account equity (margin currency), includes uPnL (calculated by mark price)
usdtEquity Account equity convert to USDT
btcEquity Account equity convert to BTC
crossRiskRate Risk ratio at crossed margin mode
unrealizedPL unrealized profit and loss
bonus coupon

Get sub Account Contract Assets

Limit rule: 1 times/10s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
productType String Yes product type

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/account/sub-account-contract-assets" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"productType": "umcbl"}'

Response

{
  "code":"00000",
  "data":[
    {
      "userId": 4351550450,
      "contractAssetsList": [
        {
          "marginCoin": "USDT",
          "locked": "0",
          "available": "23.123",
          "crossMaxAvailable": "23.123",
          "fixedMaxAvailable": "23.123",
          "maxTransferOut": "23.123",
          "equity": "23.123",
          "usdtEquity": "23.123",
          "btcEquity": "0.001403612744",
          "unrealizedPL": "0",
          "bonus": null
        }
      ]
    },
    {
      "userId": 9465254769,
      "contractAssetsList": [
        {
          "marginCoin": "USDT",
          "locked": "0",
          "available": "11",
          "crossMaxAvailable": "11",
          "fixedMaxAvailable": "11",
          "maxTransferOut": "11",
          "equity": "11",
          "usdtEquity": "11",
          "btcEquity": "0.000667722189",
          "unrealizedPL": "0",
          "bonus": null
        }
      ]
    }
  ],
  "msg":"success",
  "requestTime":1630901215622
}

Response Description

Parameter Description
marginCoin Margin currency
locked Locked amount (margin currency)
available Available balance(margin currency)
crossMaxAvailable The maximum available balance for crossed margin mode(margin currency)
fixedMaxAvailable The maximum available balance for isolated(fixed) margin mode(margin currency)
maxTransferOut Maximum transferable
equity Account equity (margin currency)
usdtEquity Account equity convert to USDT
btcEquity Account equity convert to BTC
unrealizedPL Unrealized Profit or Lost
bonus Coupon

Get Open Count

Limit rule: 20 times/1s (IP)

This interface is only used to calculate the maximum number of positions that can be opened when the user does not hold a position by the specified leverage. The result does not represent the actual number of positions opened.

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)
openPrice BigDecimal in String format Yes Opening price
leverage Int value in String format No Default leverage is 20
openAmount BigDecimal in String format Yes Opening amount in margin coin

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/account/open-count" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","openPrice": "23189.5","leverage": "20","openAmount":"5000"}'

Response

{
  "code":"00000",
  "data":{
    "openCount":"2000"
  },
  "msg":"success",
  "requestTime":1627293049406
}

Change Leverage

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)
leverage String Yes Leverage
holdSide String No Position direction (ignore this field if marginMode is crossed)

The leverage could set to different number in fixed margin mode(holdSide is required)

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/account/setLeverage" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","leverage": "20"}'

Response

{
  "code":"00000",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "marginCoin":"USDT",
    "longLeverage":25,
    "shortLeverage":20,
    "marginMode":"crossed"
  },
  "msg":"success",
  "requestTime":1627293049406
}

Response Description

Parameter Description
symbol Symbol Id
marginCoin Margin currency
longLeverage Long leverage
shortLeverage Short leverage
marginMode Margin Mode

Change Margin

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)
amount String Yes Margin amount, positive: add margin, negative: reduce margin
holdSide String No Position direction (ignore this field if marginMode is crossed)

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/account/setMargin" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","amount": "-10"}'

Response

{
  "code":"00000",
  "data":{
    "result":true
  },
  "msg":"success",
  "requestTime":1627293357336
}

 

 

 

 

 

 

 

 

 

 

 

Change Margin Mode

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Server will return error if you call this interface with any exists position/order

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)
marginMode String Yes Margin mode

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/account/setMarginMode" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","marginMode": "crossed"}'

Response

{
  "code":"00000",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "marginCoin":"USDT",
    "longLeverage":25,
    "shortLeverage":20,
    "marginMode":"crossed"
  },
  "msg":"success",
  "requestTime":1627293445916
}

Response Description

Parameter Description
symbol Symbol Id
marginCoin Margin currency
longLeverage Long leverage
shortLeverage Short leverage
marginMode Margin mode

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Set Auto Margin

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)
holdSide String Yes long / short
autoMargin String Yes on/off

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/account/set-auto-margin" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","holdSide": "long","autoMargin":"on"}'

Response

{
  "code":"00000",
  "data":"success",
  "msg":"success",
  "requestTime":1627293445916
}

 

 

 

 

 

 

 

 

 

 

 

Change Hold Mode

Please DO NOT change the hold mode with existing position/order under any symbols within the 'productType'

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
productType String Yes product type
holdMode String Yes Hold mode

Might fail if intended to change hold mode when the "symbol" has positions/orders on any side

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/account/setPositionMode" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"productType": "umcbl","holdMode": "double_hold"}'

Response

{
  "code":"00000",
  "msg":"success",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "marginCoin":"USDT",
    "dualSidePosition":true
  },
  "requestTime":1627293445916
}

Response Description

Parameter Description
symbol Symbol Id
marginCoin Margin currency
dualSidePosition boolean, true: "double_hold"; false: "single_hold"

 

 

 

 

 

 

 

 

Get Symbol Position

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/position/singlePosition?symbol=BTCUSDT_UMCBL&marginCoin=USDT" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" 

Response

{
  "code":"00000",
  "data":[
    {
      "marginCoin":"USDT",
      "symbol":"BTCUSDT_UMCBL",
      "holdSide":"long",
      "openDelegateCount":"0",
      "margin":"10",
      "autoMargin":"off",
      "available":"0",
      "locked":"0",
      "total":"0",
      "leverage":25,
      "achievedProfits":"0",
      "averageOpenPrice":"0",
      "marginMode":"fixed",
      "holdMode":"double_hold",
      "unrealizedPL":"0",
      "keepMarginRate":"0.015",
      "marketPrice":"0",
      "ctime":"1626232130664"
    }
  ],
  "msg":"success",
  "requestTime":1627293612502
}

Response Description

Parameter Description
symbol Symbol Id
marginCoin Margin currency
holdSide Position direction
openDelegateCount Open amount pending to fill (base currency)
margin Margin quantity (margin currency)
autoMargin Auto suppliment margin: off on
available Position available (Quote currency)
locked Position locked (Quote currency)
total Total position (available + locked)
leverage Leverage
achievedProfits Realized profit and loss
averageOpenPrice Average opening price
marginMode Margin mode
holdMode Position mode
unrealizedPL Unrealized profit or loss
keepMarginRate keep margin rate
marketPrice mark price
cTime Created time Timestamp milliseconds

Get Symbol Position V2

Only return the position information of the position, and return the liquidation price

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/position/singlePosition-v2?symbol=BTCUSDT_UMCBL&marginCoin=USDT" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" 

Response

{
  "code": "00000",
  "msg": "success",
  "requestTime": 0,
  "data": [
    {
      "marginCoin": "USDT",
      "symbol": "BTCUSDT_UMCBL",
      "holdSide": "long",
      "openDelegateCount": "0",
      "margin": "0",
      "autoMargin":"off",
      "available": "0",
      "locked": "0",
      "total": "0",
      "leverage": 10,
      "achievedProfits": null,
      "averageOpenPrice": null,
      "marginMode": "crossed",
      "holdMode": "double_hold",
      "unrealizedPL": null,
      "liquidationPrice": null,
      "keepMarginRate": null,
      "marketPrice": null,
      "cTime": null
    },
    {
      "marginCoin": "USDT",
      "symbol": "BTCUSDT_UMCBL",
      "holdSide": "short",
      "openDelegateCount": "0",
      "margin": "0",
      "autoMargin":"off",
      "available": "0",
      "locked": "0",
      "total": "0",
      "leverage": 10,
      "achievedProfits": null,
      "averageOpenPrice": null,
      "marginMode": "crossed",
      "holdMode": "double_hold",
      "unrealizedPL": null,
      "liquidationPrice": null,
      "keepMarginRate": null,
      "marketPrice": null,
      "cTime": null
    }
  ]
}

Response Description

Parameter Description
symbol Symbol Id
marginCoin Margin currency
holdSide Position direction
openDelegateCount Open amount pending to fill (base currency)
margin Margin quantity (margin currency)
autoMargin Auto suppliment margin: off on
available Position available (Quote currency)
locked Position locked (Quote currency)
total Total position (available + locked)
leverage Leverage
achievedProfits Realized profit and loss
averageOpenPrice Average opening price
marginMode Margin mode
holdMode Position mode
unrealizedPL Unrealized profit or loss
liquidationPrice estimated liquidation price
keepMarginRate keep margin rate
marketPrice mark (typo) price
cTime Last update time Timestamp milliseconds

Get All Position

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
productType String Yes Product type
marginCoin String No Margin currency (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/position/allPosition?productType=umcbl&marginCoin=USDT" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" 

Response

{
  "code":"00000",
  "data":[
    {
      "marginCoin":"USDT",
      "symbol":"BTCUSDT_UMCBL",
      "holdSide":"long",
      "openDelegateCount":"0",
      "margin":"10",
      "autoMargin":"off",
      "available":"0",
      "locked":"0",
      "total":"0",
      "leverage":25,
      "achievedProfits":"0",
      "averageOpenPrice":"0",
      "marginMode":"fixed",
      "holdMode":"double_hold",
      "unrealizedPL":"0",
      "keepMarginRate":"0",
      "marketPrice":"0",
      "ctime":"1626232130664"
    }
  ],
  "msg":"success",
  "requestTime":1627293612502
}

Response Description

Parameter Description
symbol Symbol Id
marginCoin Margin currency
holdSide Position direction
openDelegateCount Opened amount pending to fill (trading currency)
margin Margin quantity (margin currency)
autoMargin Auto suppliment margin: off on
available Position available (Quote currency)
locked Position locked (Quote currency)
total Total position (available + locked)
leverage Leverage
achievedProfits Realized profit and loss
averageOpenPrice Average opening price
marginMode Margin mode
holdMode Position mode
unrealizedPL Unrealized profit and loss
keepMarginRate keep margin rate
marketPrice market price
cTime Last update time Timestamp milliseconds

Get All Position V2

Only return the position information of the position, and return the liquidation price

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
productType String Yes Product type
marginCoin String No Margin currency (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/position/allPosition-v2?productType=umcbl&marginCoin=USDT" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" 

Response

{
  "code":"00000",
  "data":[
    {
      "marginCoin": "USDT",
      "symbol": "BTCUSDT_UMCBL",
      "holdSide": "long",
      "openDelegateCount": "0",
      "margin": "0",
      "autoMargin":"off",
      "available": "0",
      "locked": "0",
      "total": "0",
      "leverage": 10,
      "achievedProfits": "0",
      "averageOpenPrice": "0",
      "marginMode": "crossed",
      "holdMode": "double_hold",
      "unrealizedPL": "0",
      "liquidationPrice": "0",
      "keepMarginRate": "0.004",
      "marketPrice": "28038.69",
      "cTime": "1669362331867",
      "uTime": "1626232130664"
    },
    {
      "marginCoin": "USDT",
      "symbol": "BTCUSDT_UMCBL",
      "holdSide": "short",
      "openDelegateCount": "0",
      "margin": "0",
      "autoMargin":"off",
      "available": "0",
      "locked": "0",
      "total": "0",
      "leverage": 10,
      "achievedProfits": "0",
      "averageOpenPrice": "0",
      "marginMode": "crossed",
      "holdMode": "double_hold",
      "unrealizedPL": "0",
      "liquidationPrice": "0",
      "keepMarginRate": "0.004",
      "marketPrice": "28038.69",
      "cTime": "1669362331868",
      "uTime": "1626232130664"
    }
  ],
  "msg":"success",
  "requestTime":1627293612502
}

Response Description

Parameter Description
symbol Symbol Id
marginCoin Margin currency
holdSide Position direction
openDelegateCount Opened amount pending to fill (trading currency)
margin Margin quantity (margin currency)
autoMargin Auto suppliment margin: off on
available Position available (Quote currency)
locked Position locked (Quote currency)
total Total position (available + locked)
leverage Leverage
achievedProfits Realized profit and loss
averageOpenPrice Average opening price
marginMode Margin mode
holdMode Position mode
unrealizedPL Unrealized profit and loss
liquidationPrice estimate liquidation price
keepMarginRate keep margin rate
marketPrice market price
cTime Last position create time Timestamp milliseconds
uTime Last update time Timestamp milliseconds

Get History Position

Only supports Query within 3 months

Limit rule: 20c/1s (uid)

HTTP Request

Request Parameter(Request Param)

Parameter type Required Description
productType String No Business type Default umcbl If symbol is passed, this field will be invalid
symbol String No symbolId
pageSize Int No default 20 Max 100
startTime String Yes startTime,eg:1597026383085
endTime String Yes endTime,eg:1597026383011 Maximum interval 90 days
lastEndId String No lastEndId

Request Example

curl "https://api.bitget.com/api/mix/v1/position/history-positions?productType=umcbl&startTime=&endTime="

Response

{
  "code": "00000",
  "msg": "success",
  "requestTime": 0,
  "data": {
    "list": [
      {
        "symbol": "ETHUSDT_UMCBL",
        "marginCoin": "USDT",
        "holdSide": "short",
        "openAvgPrice": "1206.7",
        "closeAvgPrice": "1206.8",
        "marginMode": "fixed",
        "openTotalPos": "1.15",
        "closeTotalPos": "1.15",
        "pnl": "-0.11",
        "netProfit": "-1.780315",
        "totalFunding": "0",
        "openFee": "-0.83",
        "closeFee": "-0.83",
        "ctime": "1689300233897",
        "utime": "1689300238205"
      }
    ],
    "endId": "1062308959580516352"
  }
}

Response Description

parameter description
symbol Symbol Id
marginCoin Margin currency
holdSide Position direction
openAvgPrice open average price
closeAvgPrice close average price
marginMode Margin mode
openTotalPos open position size (accumulate)
closeTotalPos close position size (accumulate)
pnl realized profit and loss
netProfit net profit and loss
totalFunding Funding costs (Funding costs Cumulative)
openFee Total handling fee for position opening
closeFee Total handling fee for position closing
cTime Last update time Timestamp milliseconds
uTime Last update time Timestamp milliseconds

Get Account Bill

Records within 90 days

Limit rule: 10/sec (uid)

HTTP Request

Request (Request Param)

Parameter type required description
productType String No Product Type, choose one in: 'symbol' and 'productType'
symbol String No Symbol Id (Deprecated)
marginCoin String Yes margin coin
startTime String Yes Start Time, milliseconds
endTime String Yes end time, milliseconds
pageSize int No page size, default 20, max is 100
business String No Bill business type
lastEndId String No last end Id of last query

Request Example

curl "https://api.bitget.com/api/mix/v1/account/accountBill?productType=UMCBL&marginCoin=USDT&startTime=1659403328000&endTime=1659406928000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
  "code": "00000",
  "msg": "success",
  "data": {
    "result": [
      {
        "id": "892962903462432768",
        "symbol": "BTCUSDT_UMCBL",
        "marginCoin": "USDT",
        "amount": "0",
        "fee": "-0.1765104",
        "feeByCoupon": "",
        "feeCoin": "USDT",
        "business": "open_long",
        "ctime": "1648624867354"
      }
    ],
    "endId": "885353495773458432",
    "nextFlag": false
  }
}

Response params

Parameter Description
id record ID
symbol Symbol Id, might be null
marginCoin margin Coin
amount charge amount
fee fee
feeByCoupon fee deduction coupon
feeCoin fee coin
business business
cTime create time
lastEndId last end Id, will return when next set to true

Get Business Account Bill

Records within 90 days

Limit rule: 5/sec (uid)

HTTP Request

Request (Request Param)

Parameter type required description
productType String Yes Product Type
business String No account bill business type
startTime String Yes Start Time, millisecond
endTime String Yes end time, millisecond
pageSize int No page size, default 20, max is 100
lastEndId String No last end Id of last query
next boolean No Whether query return lastEndId? default false

Request Example

curl "https://api.bitget.com/api/mix/v1/account/accountBusinessBill?productType=umcbl&startTime=1659403328000&endTime=1659406928000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
  "code": "00000",
  "msg": "success",
  "data": {
    "result": [
      {
        "id": "892962903462432768",
        "symbol": "ETHUSDT_UMCBL",
        "marginCoin": "USDT",
        "amount": "0",
        "fee": "-0.1765104",
        "feeByCoupon": "",
        "feeCoin": "USDT",
        "business": "open_long",
        "ctime": "1648624867354"
      }
    ],
    "endId": "885353495773458432",
    "nextFlag": false,
    "preFlag": false
  }
}

Response params

Parameter Description
id record no
symbol Symbol Id
marginCoin margin Coin
amount charge amount
fee fee
feeByCoupon fee deduction coupon
feeCoin fee coin
business business type
cTime create time
lastEndId last end Id, will return when next set to true

Trade

Place Order

Limit rule: 10 times/1s (uid)

Trader Limit rule: 1 times/1s (uid)

If you are a trader, you can only use this interface to open a position. To close a position, you need to call CopyTrade -> Trader close Position

For trader, if multiple limit order/plan order triggers at the same second, then the first order will become CopyTrade order, while the rest will become normal orders (As a result: no one could follow)

The price and quantity of the order need to meet pricePlace and priceEndStep volumePlace, those fields could be found from the response of Market -> Get All Symbols

for example:

pricePlace of BTCUSDT_UMCBL is 1 and priceEndStep is 5, then the order price needs to satisfy a multiple of 0.5, for example, the price should be 23455.0, 23455.5, 23446.0

pricePlace of ETHUSDT_UMCBL is 2 and priceEndStep is 1, then the order price needs to satisfy a multiple of 0.01, for example, the price should be 1325.00, 1325.01, 1325.02

If the position quantity is less than the minimum order quantity, the position can be closed by entering the order quantity into the remaining quantity of the position when closing the position. However, if the position quantity is greater than the minimum order quantity, the minimum order quantity must be met when placing an order.

High frequency error when close position:

There are two scenarios where this error would happen

Hold mode = double_hold - if specify a size greater than the position size when closing position, the order will success with actual position size, that is, reduceOnly.

Hold mode = single_hold + reduceOnly=false

Hold mode = single_hold + reduceOnly=true

 

 

 

 

 

Unknown error

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id
marginCoin String Yes Margin currency
size String Yes Order quantity, base coin
price String No Order price (not required at market price)
side String Yes Order direction
orderType String Yes Order type
timeInForceValue String No Time in force
clientOid String No Unique client order ID, The idempotent is promised but only within 30 days
reduceOnly Boolean No Default false; set to true when try to reduce position in 'single_hold' mode and when close position with value less than 5 USDT, DOES NOT WORK under 'double_hold' mode
presetTakeProfitPrice String No Preset take profit price
presetStopLossPrice String No Preset stop loss price

Response Data

{
  "code":"00000",
  "data":{
    "orderId":"1627293504612",
    "clientOid":"BITGET#1627293504612"
  },
  "msg":"success",
  "requestTime":1627293504612
}

Response Description

Parameter Description
orderId Order Id, might be null. (especially in one-way mode when limit order is reduce order: if there is an unexecuted limit order in the current position, when the order size of the placing limit order is greater than or equals to the size that are available in the current position, then the previous limit order will be canceled, and place another new order asynchronously. the response orderId will be null, please DO use clientOid as the main key when placing an order)
clientOid Client custom Id

If client does not pass clientOid , the user should be awared that the order might be duplicated, as this is the only idempotent promise field between client and server

 

Duplicate clientOid

{
    "code":"40786",
    "msg":"Duplicate clientOid",
    "requestTime":1627293504612
}

 

 

 

 

 

 

 

 

 

 

 

 

Reversal

Limit rule: 10 times/1s (uid), counted together with placeOrder

Reversal share the same interface with Place order.

Reversal logic is different under "double_hold"/"single_hold" hold mode:

double_hold: 1) You could usually specify a size(size > 0 and size <= position size), which the size will be closed from your current position and a same size will be opened on the opposite side 2) "side" value: close_short or close_long

single_hold: 1) The size parameter is omitted, that means you could only close the whole position, then try to open on the opposite side with market price, the open position might fail due to margin condition 2) "side" value: sell_single when position side is buy_single, buy_single when position side is sell_single

Note: Your position will be closed at market price and open in reverse side for the specific amount.

If the close position settled amount + available balance are insufficient to open the specific size of positions, or the reverse order value is less than 5 USDT, the specified size position will be closed and the position open will fail.

Your operation may not be 100% successful due to margin, market conditions and other factors.

You must have an exists position to trigger a reversal operation, or server will return error "Not enough position is available."

Not enough position

{
  "code": "40757",
  "msg": "Not enough position is available.",
  "requestTime": 1665454799692,
  "data": null
}

The reverse order size usually should be same as the original size. For example: original position size 100, in reversal request you should set the size to 100, Server will then close your original position 100, and open extra 100 in reversal side in market price with the best efforts.

The reverse order size could also be set to 1.5 or 3 times of the original size(or even more), in reversal it will first close all of your position in market price, then try to open reverse position with the original size (that is: if reversal size is bigger than the original position size, the reversal size will be treated as the original position size)

The reverse order size could also be set to a number between 0 to 1 times of the original position size, in reversal it will first close your position with specific reversal size in market price, then try to open reverse position with the specific size

orderType must be market price, a limit price order will be treated as market price order in reversal

Reversal Sample: original order

{
  "size": "100",
  "side": "open_long",
  "orderType": "market",
  "timeInForceValue": "normal",
  "symbol": "TRXUSDT_UMCBL",
  "marginCoin": "USDT"
}

Reversal Sample: reverse order

{
  "size": "100",
  "side": "close_long",
  "orderType": "market",
  "timeInForceValue": "normal",
  "symbol": "TRXUSDT_UMCBL",
  "marginCoin": "USDT",
  "reverse":true
}

If originally side is open_long, then in reversal you should set the side to close_long; If originally side is open_short, then in reversal you should set the side to close_short; Use sell_single when original position side is buy_single, Use buy_single when original position side is sell_single;

Samples on the right side demonstrate a reversal operation. Ideally at the end you should be holding 100 TRXUSDT short position

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id
marginCoin String Yes Margin currency
size String No Order quantity size = close_size = open_reverse_size; this param will be omitted in single_hold mode
side String Yes Order direction, set to close_long or close_short in double_hold mode; set to buy_single or sell_single in single_hold mode
orderType String Yes Order type: market
clientOid String No Unique Client ID
timeInForceValue String No set to 'normal'
reverse Boolean No Default false: place order; true: reversal order

Reversal Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/order/placeOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","size": "0.01","side":"open_long","orderType":"market","timeInForceValue":"normal","clientOid":"reverse@483939290002","reverse":true}'

Reversal Response Data

{
  "code":"00000",
  "data":{
    "orderId":"1627293504612",
    "clientOid":"BITGET#1627293504612"
  },
  "msg":"success",
  "requestTime":1627293504612
}

Response Description

Parameter Description
orderId Order Id
clientOid Client custom Id

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Batch Order

Limit rule: 10 times/1s (uid)

Trader Limit rule: 1 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)
orderDataList List Yes Order data list, maximum size: 50

orderDataList

Maximum 50 orders

Parameter Name Parameter Type Required Description
size String Yes Order quantity
price String No Order price, quote coin
side String Yes Order direction
orderType String Yes Order type
timeInForceValue String No Time In Force
clientOid String No Unique Client ID, the idempotent is promised but only within 24 hours

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/order/batch-orders" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT",  "orderDataList":[{"size": "0.01","price": "23145.5","side":"open_long","orderType":"limit","timeInForceValue":"normal","clientOid":"test@483939290000"}] }'

Response

{
  "code": "00000",
  "data": {
    "orderInfo": [
      {
        "orderId": "1627293504612",
        "clientOid": "BITGET#1627293504612"
      }
    ],
    "failure":[
      {
        "orderId": "1627293504611",
        "clientOid": "BITGET#1627293504611",
        "errorMsg":"Duplicate clientOid"
      }
    ]
  },
  "msg": "success",
  "requestTime": 1627293504612
}

Response Description

Parameter Description
orderInfo Successful order array
> orderId Order Id
> clientOid Client custom Id
failure Failure order array
> orderId Order Id, might be empty
> clientOid Client custom Id
> errorMsg Fail reason

 

 

 

 

  

 

 

 

 

Cancel Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)
orderId String No Order Id, int64 in string format, 'orderId' or 'clientOid' must have one
clientOid String No Client Order Id, 'orderId' or 'clientOid' must have one

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/order/cancel-order" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","orderId":"1627293504612"}'

Response

{
  "code":"00000",
  "data":{
    "orderId":"1627293504612",
    "clientOid":"BITGET#1627293504612"
  },
  "msg":"success",
  "requestTime":1627293504612
}

Response Description

Parameter Description
orderId Order Id
clientOid Client custom Id

Batch Cancel Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)
orderIds String array No Order Id list, int64 in string format, 'orderIds' or 'clientOids' must have one
clientOids String array No Client Order Id list, 'orderIds' or 'clientOids' must have one

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/order/cancel-batch-orders" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","orderIds":["1627293504612"]}'

Response

{
  "code": "00000",
  "data": {
    "symbol": "BTCUSDT_UMCBL",
    "order_ids": [
      "1627293504612"
    ],
    "client_order_ids":[
      "xxx001"
    ],
    "fail_infos": [
      {
        "order_id": "",
        "err_code": "",
        "err_msg": ""
      }
    ]
  },
  "msg": "success",
  "requestTime": 1627293504612
}

Response Description

Parameter Description
symbol Symbol Id
order_ids Order Id array
client_order_ids Client Order Id array
fail_infos Failed information array
> order_id Failed order id
> err_code Error code
> err_msg error msg

Modify Order

Limit rule: 10c/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Type Required Description
orderId String No limit order Id
clientOid String No custom clientId , If both are passed, the orderId is the main
newClientOid String No new custom clientOid
symbol String Yes Order symbol
size String No order size
price String No order price
presetTakeProfitPrice String No Preset take profit price
presetStopLossPrice String No Preset stop loss price

Example

curl -X POST "https://api.bitget.com/api/mix/v1/order/modifyOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"orderId":"1627293504612","newClientOid":"BITGET#1627293504612","symbol": "BTCUSDT_UMCBL","size":"0.001","price":"26775.5"}'

Response

{
  "code":"00000",
  "data":{
    "orderId":"1627293504612",
    "clientOid":"BITGET#1627293504612"
  },
  "msg":"success",
  "requestTime":1627293504612
}

Cancel Order By Symbol

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/order/cancel-symbol-orders" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT"}'

Response

{
  "code": "00000",
  "data": {
    "symbol": "BTCUSDT_UMCBL",
    "order_ids": [
      "1627293504612"
    ],
    "client_order_ids":[
      "xxx001"
    ],
    "fail_infos": [
      {
        "order_id": "",
        "err_code": "",
        "err_msg": ""
      }
    ]
  },
  "msg": "success",
  "requestTime": 1627293504612
}

Response Description

Parameter Description
symbol Symbol Id
order_ids Order Id array
client_order_ids Client Order Id array
fail_infos Failed information array
> order_id Failed order id
> err_code Error code
> err_msg error msg

Cancel All Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
productType String Yes Product type
marginCoin String Yes Margin currency (Must be capitalized)

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/order/cancel-all-orders" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"productType": "umcbl","marginCoin": "USDT"}'

Response

{
  "code": "00000",
  "data": {
    "order_ids": [
      "1627293504612"
    ],
    "client_order_ids": [
      "abc123"
    ],
    "fail_infos": [
      {
        "order_id": "",
        "clientOid": "",
        "symbol": "",
        "err_code": "",
        "err_msg": ""
      }
    ]
  },
  "msg": "success",
  "requestTime": 1627293504612
}

Response Description

Parameter Description
order_ids Cancel success order Id list
client_order_ids Cancel success client order ID list
fail_infos cancel failed information
> symbol Symbol Id
> order_id Failed order id
> clientOid client order ID
> err_code Error code
> err_msg Error message

Close All Position

Limit rule: 1 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
productType String Yes Product type

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/order/close-all-positions" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"productType": "umcbl"}'

Response

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1684747525424,
  "data": {
    "orderInfo": [
      {
        "symbol": "BTCUSDT_UMCBL",
        "orderId": "1044472355251990528",
        "clientOid": "1044472355256184832"
      },
      {
        "symbol": "BTCUSDT_UMCBL",
        "orderId": "1044472355256184835",
        "clientOid": "1044472355260379136"
      }
    ],
    "failure": [],
    "result": true
  }
}

Response Description

Parameter Description
orderInfo close order Id list
> symbol Symbol Id
> orderId order id
> clientOid client order ID
failure close failed list
> symbol Symbol Id
> orderId order id
> clientOid client order ID
> errorCode Error code
> errorMsg Error message

Get Open Order

Limit rule: 20 times/1s (uid)

HTTP Request

Get pending order list on one symbol;

Note that for the history order please refer to Get History Orders

For the TPSL order please refer to Get Plan Order (TPSL) List

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes symbol Id (Must be capitalized)

Request Example

curl "https://api.bitget.com/api/mix/v1/order/current?symbol=BTCUSDT_UMCBL" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
  "code":"00000",
  "data":{
    "nextFlag":false,
    "endId":"802355881591844864",
    "orderList": [
      {
        "symbol":"BTCUSDT_UMCBL",
        "size":1,
        "orderId":"802382049422487552",
        "clientOid":"RFIut#1627028708738",
        "filledQty":0,
        "fee":0,
        "price":23999.3,
        "priceAvg": 23999.00,
        "state":"filled",
        "side":"open_long",
        "timeInForce":"normal",
        "totalProfits":0,
        "posSide":"long",
        "marginCoin":"USDT",
        "filledAmount": 48.4520,
        "leverage": "6",
        "marginMode": "fixed",
        "reduceOnly": false,
        "enterPointSource": "WEB",
        "tradeSide": "buy_single",
        "holdMode": "single_hold",
        "orderType":"limit",
        "orderSource": "normal",
        "cTime": "1678779464831",
        "uTime": "1678779464891"
      }
    ]
  },
  "msg":"success"
}

Response Description

Parameter Description
symbol Symbol id
size Order size
orderId Order Id
clientOid Client custom id
filledQty Transaction volume, base coin
fee Transaction fee
price Order price
priceAvg Average price
state Order state
side Order direction
timeInForce Time In Force
totalProfits Total profit and loss
posSide Position direction
marginCoin Margin currency
filledAmount Filled Amount, quote coin
leverage leverage
marginMode Margin mode
reduceOnly Is reduce only
enterPointSource enterPointSource
tradeSide Trade Side
holdMode Hold mode
orderType Order type
orderSource orderSource
cTime Created update time
uTime Last update time

Get All Open Order

Limit rule: 20 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
productType String Yes productType
marginCoin String No margin coin

Request Example

curl "https://api.bitget.com/api/mix/v1/order/marginCoinCurrent?productType=umcbl&marginCoin=USDT" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1684852347068,
  "data": [
    {
      "symbol": "BTCUSDT_UMCBL",
      "size": 0.050,
      "orderId": "1044911928892862465",
      "clientOid": "xx005",
      "filledQty": 0.000,
      "fee": 0E-8,
      "price": 25500.00,
      "state": "new",
      "side": "open_long",
      "timeInForce": "normal",
      "totalProfits": 0E-8,
      "posSide": "long",
      "marginCoin": "USDT",
      "presetTakeProfitPrice": 33800.00,
      "presetStopLossPrice": 11300.00,
      "filledAmount": 0.0000,
      "orderType": "limit",
      "leverage": "4",
      "marginMode": "crossed",
      "reduceOnly": false,
      "enterPointSource": "API",
      "tradeSide": "open_long",
      "holdMode": "double_hold",
      "orderSource": "normal",
      "cTime": "1684852338057",
      "uTime": "1684852338057"
    }
  ]
}

Response Description

Parameter Description
symbol Symbol Id
size Order size
orderId Order Id
clientOid Client custom id
filledQty Transaction volume
fee Transaction fee
price Order price
state Order state
side Order direction
timeInForce Time In Force
totalProfits Total profit and loss
posSide Position direction
marginCoin Margin currency
orderType Order type
presetTakeProfitPrice Take profit price
presetStopLossPrice Stop Loss Price
filledAmount filledAmount
leverage leverage
marginMode marginMode
reduceOnly reduceOnly
enterPointSource enterPointSource
tradeSide tradeSide
holdMode holdMode
orderSource orderSource
cTime Created time
uTime Last update time

Get History Orders

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
startTime String Yes Start time, milliseconds
endTime String Yes End time, milliseconds
pageSize String Yes Page size
lastEndId String No last end Id of last query
clientOid String No match exactly with the given 'clientOid'
isPre Boolean No true: order by order Id asc; default false

Request Example

curl "https://api.bitget.com/api/mix/v1/order/history?symbol=BTCUSDT_UMCBL&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1665715936583,
  "data": {
    "nextFlag": true,
    "endId": "963544804144852112",
    "orderList": [
      {
        "symbol": "SOLUSDT_UMCBL",
        "size": 1,
        "orderId": "963544804144852112",
        "clientOid": "963544804144852113",
        "filledQty": 1,
        "fee": -0.00629204,
        "price": 31.4602,
        "priceAvg": 31.4602,
        "state": "filled",
        "side": "close_short",
        "timeInForce": "normal",
        "totalProfits": 0.00760000,
        "posSide": "short",
        "marginCoin": "USDT",
        "filledAmount": 31.4602,
        "orderType": "limit",
        "leverage": "5",
        "marginMode": "crossed",
        "reduceOnly": false,
        "enterPointSource": "WEB",
        "tradeSide": "open_long",
        "holdMode": "double_hold",
        "orderSource":"normal",
        "cTime": "1665452903781",
        "uTime": "1665452917467"
      }
    ]
  }
}

Response Description

Parameter Description
symbol Symbol Id
size Order size
orderId Order Id
clientOid Client order id
filledQty Transaction volume
fee Transaction fee
price Order price
priceAvg Order fill avg price
state Order state
side Order direction
timeInForce Time In Force
totalProfits Total profit and loss
posSide Position direction
marginCoin Margin currency
leverage order leverage
marginMode Margin mode
orderType Order type
reduceOnly is reduce only
enterPointSource enterPointSource
tradeSide Trade Side
holdMode Hold mode
orderSource orderSource
cTime create time
uTime last update time

Get ProductType History Orders

Limit rule: 5/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
productType String Yes Product type
startTime String Yes Start time, milliseconds
endTime String Yes End time, milliseconds
pageSize String Yes page size, max 100
lastEndId String No Last query endId
clientOid String No match exactly with the given 'clientOid'
isPre Boolean No true: order by order Id asc; default false

Request Example

curl "https://api.bitget.com/api/mix/v1/order/historyProductType?productType=umcbl&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
  "code":"00000",
  "data":{
    "nextFlag": true,
    "endId": "963544804144852112",
    "orderList": [
      {
        "symbol":"BTCUSDT_UMCBL",
        "size":1,
        "orderId":"802382049422487552",
        "clientOid":"RFIut#1627028708738",
        "filledQty":0,
        "fee":0,
        "price":23999.3,
        "state":"canceled",
        "side":"open_long",
        "timeInForce":"normal",
        "totalProfits":0,
        "posSide":"long",
        "marginCoin":"USDT",
        "leverage":"20",
        "marginMode":"crossed",
        "orderType":"limit",
        "reduceOnly": false,
        "enterPointSource": "WEB",
        "tradeSide": "open_long",
        "holdMode": "double_hold",
        "orderSource":"normal",
        "ctime":1627028708807
      }
    ]
  },
  "msg":"success"
}

Response Description

Parameter Description
symbol Symbol Id
size Order size
orderId Order Id
clientOid Client custom id
filledQty Transaction volume
fee Transaction fee
price Order price
priceAvg Order fill avg price
state Order state
side Order direction
timeInForce Time In Force
totalProfits Total profit and loss
posSide Position direction
marginCoin Margin currency
leverage order leverage
marginMode account Margin mode
orderType Order type
reduceOnly is reduce only
enterPointSource enterPointSource
tradeSide Trade Side
holdMode Hold mode
orderSource orderSource
cTime create time
uTime last update time

Get Order Details

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Param)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
orderId String No Order Id, int64 in string format, 'orderId' or 'clientOid' must have one
clientOid String No Customized Client Order Id, 'orderId' or 'clientOid' must have one

Request Example

curl "https://api.bitget.com/api/mix/v1/order/detail?symbol=BTCUSDT_UMCBL&orderId=802382049422487552" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
  "code":"00000",
  "data":{
    "symbol":"BTCUSDT_UMCBL",
    "size":1,
    "orderId":"802382049422487552",
    "clientOid":"RFIut#1627028708738",
    "filledQty":0,
    "priceAvg":0,
    "fee":0,
    "price":23999.3,
    "state":"canceled",
    "side":"open_long",
    "timeInForce":"normal",
    "totalProfits":0,
    "posSide":"long",
    "marginCoin":"USDT",
    "presetTakeProfitPrice":69582.5,
    "presetStopLossPrice":21432.5,
    "filledAmount":45838,
    "orderType":"limit",
    "leverage": "6",
    "marginMode": "fixed",
    "reduceOnly": false,
    "enterPointSource": "WEB",
    "tradeSide": "buy_single",
    "holdMode": "single_hold",
    "orderSource": "normal",
    "cTime":1627028708807,
    "uTime":1627028717807
  },
  "msg":"success",
  "requestTime":1627300098776
}

Response Description

Parameter Description
symbol Symbol Id
size Order size
orderId Order Id
clientOid Client custom id
filledQty Transaction volume
priceAvg Transaction price
fee Transaction fee
price Order price
state Order state
side Order direction
timeInForce Time In Force
totalProfits Total profit and loss
posSide Position direction
marginCoin Margin currency
cTime create time
uTime update time
presetTakeProfitPrice Preset take profit price
presetStopLossPrice Preset stop loss price
filledAmount filled amount, limit/market
orderType order type
leverage leverage
marginMode Margin Mode
reduceOnly Is reduce only
enterPointSource enterPointSource
tradeSide Trade Side
holdMode Hold mode
orderSource orderSource
cTime Created time, ms
uTime Updated time, ms

Get Order fill detail

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Param)

Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
orderId String No Order Id
startTime String No Start time (timestamp in milliseconds) This field is required if orderId is empty
endTime String No End time (timestamp in milliseconds) This field is required if orderId is empty
lastEndId String No Pagination parameter; Query the data after this tradeId; works when orderId is null

Default return 100 records

Request Example

curl "https://api.bitget.com/api/mix/v1/order/fills?symbol=BTCUSDT_UMCBL&orderId=802382049422487552" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "data":[
    {
      "tradeId":"802377534023585793",
      "symbol":"BTCUSDT_UMCBL",
      "orderId":"802377533381816325",
      "price":"0",
      "sizeQty":"0.3247",
      "fee":"0E-8",
      "side":"burst_close_long",
      "fillAmount":"0.3247",
      "profit":"0E-8",
      "enterPointSource": "WEB",
      "tradeSide": "buy_single",
      "holdMode": "single_hold",
      "takerMakerFlag": "taker",
      "ctime":"1627027632241"
    }
  ],
  "msg":"success",
  "requestTime":1627386245672
}

Response Description

Parameter Description
tradeId Trade Id
symbol Symbol Id
orderId Order Id
price Transaction price
sizeQty Transaction volume
fee Transaction fee
side Trade side
fillAmount fill Amount
profit profit
enterPointSource enterPointSource
tradeSide Trade Side
holdMode Hold mode
takerMakerFlag taker, maker
cTime Trade time

Get ProductType Order fill detail

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Param)

Parameter Type Required Description
productType String Yes Product type
startTime String No Start time (timestamp in milliseconds) This field is required if querying all details
endTime String No End time (timestamp in milliseconds) This field is required if querying all details
lastEndId String No Query the data after this tradeId

Default pageSize: 100

Request Example

curl "https://api.bitget.com/api/mix/v1/order/allFills?productType=umcbl&startTime=1659406928000&endTime=1659410528000" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "data":[
    {
      "tradeId":"802377534023585793",
      "symbol":"BTCUSDT_UMCBL",
      "orderId":"802377533381816325",
      "price":"0",
      "sizeQty":"0.3247",
      "fee":"0E-8",
      "side":"burst_close_long",
      "fillAmount":"0.3247",
      "profit":"0E-8",
      "enterPointSource": "WEB",
      "tradeSide": "buy_single",
      "holdMode": "single_hold",
      "takerMakerFlag": "taker",
      "ctime":"1627027632241"
    }
  ],
  "msg":"success",
  "requestTime":1627386245672
}

Response Description

Parameter Description
tradeId Trade Id
symbol Symbol Id
orderId Order Id
price Transaction price
sizeQty Transaction volume
fee Transaction fee
side Trade side
fillAmount fill Amount
profit profit
enterPointSource enterPointSource
tradeSide Trade Side
holdMode Hold mode
takerMakerFlag taker, maker
cTime Trade time

Place Plan order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin currency (Must be capitalized)
size String Yes Order quantity
executePrice String No Execute price, could not be null when orderType=limit
triggerPrice String Yes Trigger price
side String Yes Order side
orderType String Yes Order type
triggerType String Yes Trigger type
clientOid String No Unique Client ID, idempotent is only promised within 24 hours
presetTakeProfitPrice String No Preset take profit price
presetStopLossPrice String No Preset stop loss price
reduceOnly String No Default false; set to true when try to reduce position in 'single_hold' mode and when close position with value less than 5USDT, DOES NOT WORK under 'double_hold' mode

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/placePlan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","size": "0.01","executePrice": "23145.5","triggerPrice":"23555.5","side":"open_long","orderType":"limit","triggerType":"market_price","clientOid":"test@483939290000"}'

Response

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
clientOid Client custom Id
orderId Order Id

Modify Plan Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Body)

Parameter Name Parameter Type Required Description
orderId String No Plan order Id, 'orderId' or 'clientOid' must have one
clientOid String No Client order Id, 'orderId' or 'clientOid' must have one
marginCoin String Yes Margin currency
symbol String Yes Symbol Id
executePrice String No Strike price, could not be null when orderType=limit
triggerPrice String Yes Trigger price
triggerType String Yes Trigger type
orderType String Yes Order type

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/modifyPlan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"orderId":"803521986049314816","symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","executePrice": "23145.5","triggerPrice":"23555.5","orderType":"limit","triggerType":"market_price"}'

Response

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
clientOid Client custom Id
orderId Order Id

Modify Plan Order TPSL

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Body)

Parameter Name Parameter Type Required Description
orderId String No Plan order Id, 'orderId' or 'clientOid' must have one
clientOid String No Client order Id, 'orderId' or 'clientOid' must have one
marginCoin String Yes Margin currency (Must be capitalized)
symbol String Yes Symbol Id (Must be capitalized)
presetTakeProfitPrice String No Take profit price If it is empty, cancel and take profit
presetStopLossPrice String No Stop loss price If it is empty, cancel the stop loss

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/modifyPlanPreset" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"orderId":"803521986049314816","symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","presetTakeProfitPrice": "23145.5","presetStopLossPrice":"23555.5"}'

Response

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
clientOid Client custom Id
orderId Order Id

Place Stop Order

Limit rule: 10 times/1s (uid)

At present, take-profit and stop-loss orders are only supported at market price, and the trigger type is transaction trigger price

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
marginCoin String Yes Margin currency (Must be capitalized)
symbol String Yes Symbol Id (Must be capitalized)
planType String Yes plan type, please use "profit_plan", "loss_plan" and "moving_plan"
triggerPrice String Yes Trigger price
triggerType String No Trigger Type default 'fill_price'
holdSide String Yes Hold Side, Whether this position is long or short
size String No Order Quantity Default Position Quantity
rangeRate String No Only works when planType is "moving_plan", "1" means 1.0% price correction, two decimal places
clientOid String No Customized client order ID

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/placeTPSL" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","size": "0.01","planType": "profit_plan","triggerPrice":"23555.5","holdSide":"long"}'

Response

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
clientOid Client custom Id
orderId Order Id

Place Trailing Stop Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
marginCoin String Yes Margin currency (Must be capitalized)
symbol String Yes Symbol Id (Must be capitalized)
triggerPrice String Yes Trigger price
triggerType String No Trigger Type
size String Yes Order Quantity, please provide value less than 'available position size'
side String Yes Order side
rangeRate String Yes "1" means 1.0% price correction, max "10"
clientOid String No Customized client order ID

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/placeTrailStop" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","size": "0.01","triggerPrice":"23555.5","side":"open_long","rangeRate":"10"}'

Response

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
clientOid Client custom Id
orderId Order Id

Place Position TPSL

Limit rule: 10 times/1s (uid)

When the position take profit and stop loss are triggered, the full amount of the position will be entrusted at the market price by default

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
marginCoin String Yes Margin currency (Must be capitalized)
symbol String Yes Symbol Id (Must be capitalized)
planType String Yes plan type, please use "pos_profit", "pos_loss"
triggerPrice String Yes Trigger price
triggerType String Yes Trigger type
holdSide String Yes Whether this position is long or short
clientOid String No Customized client order ID

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/placePositionsTPSL" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","planType": "pos_profit","triggerPrice":"23555.5","holdSide":"long"}'

Response

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
clientOid Client custom Id
orderId Order Id

Modify Stop Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
orderId String No TPSL Order Id, int64 in string format, 'orderId' or 'clientOid' must have one
clientOid String No Customized Client Order Id, 'orderId' or 'clientOid' must have one
marginCoin String Yes Margin currency (Must be capitalized)
symbol String Yes Symbol Id (Must be capitalized)
triggerPrice String Yes Trigger price
planType String Yes Refer to plan type: "pos_profit" or "profit_plan"; "pos_loss" or "loss_plan"

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/modifyTPSLPlan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"orderId":"803521986049314816","symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","triggerPrice":"23555.5","planType":"pos_profit"}'

Response

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
clientOid Client custom Id
orderId Order Id

Cancel Plan Order (TPSL)

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
orderId String No Order ID, 'orderId' or 'clientOid' must have one
clientOid String No Client Order ID, 'orderId' or 'clientOid' must have one
symbol String Yes Symbol Id (Must be capitalized)
marginCoin String Yes Margin Coin
planType String Yes plan type

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/cancelPlan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"orderId":"803521986049314816","symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","planType":"loss_plan"}'

Response

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
clientOid Client custom Id
orderId Order Id

Cancel Plan Order (TPSL) By Symbol

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
symbol String Yes Symbol Id (Must be capitalized)
planType String Yes plan type

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/cancelSymbolPlan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT_UMCBL","planType":"loss_plan"}'

Response

{
  "code":"00000",
  "data":true,
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
data Whether 'cancel' is received

Final cancel result should be confirmed via websocket or /api/mix/v1/plan/currentPlan

Cancel All trigger Order (TPSL)

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter Name Parameter Type Required Description
productType String Yes product type
planType String Yes plan type, default 'plan'

Request Example

curl -X POST "https://api.bitget.com/api/mix/v1/plan/cancelPlan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"productType":"umcbl","planType":"loss_plan"}'

Response

{
  "code":"00000",
  "data":{
    "clientOid":"RFIut#1627300490884",
    "orderId":"803521986049314816"
  },
  "msg":"success",
  "requestTime":1627300490899
}

Response Description

Parameter Description
clientOid Client custom Id
orderId Order Id

Get Plan Order (TPSL) List

Limit rule: 20 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String No Symbol Id (Must be capitalized), 'productType' and 'symbol' must have one
isPlan String No Is plan
productType String No product type, 'productType' and 'symbol' must have one

Request Example

curl "https://api.bitget.com/api/mix/v1/plan/currentPlan?symbol=BTCUSDT_UMCBL&isPlan=plan" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 0,
    "data": [
        {
            "orderId": "1083147482484514819",
            "clientOid": "1083147482484514818",
            "symbol": "SBTCSUSDT_SUMCBL",
            "marginCoin": "SUSDT",
            "size": "0.01",
            "executePrice": "0",
            "triggerPrice": "26746.5",
            "status": "not_trigger",
            "orderType": "market",
            "planType": "normal_plan",
            "side": "buy_single",
            "triggerType": "market_price",
            "presetTakeProfitPrice": "0",
            "presetTakeLossPrice": "0",
            "rangeRate": "",
            "enterPointSource": "API",
            "tradeSide": "buy_single",
            "holdMode": "single_hold",
            "reduceOnly": false,
            "cTime": "1693968404408",
            "uTime": null
        }
    ]
}

Response Description

Parameter Description
orderId Order Id
clientOid Client Order Id
symbol Symbol Id
marginCoin Margin currency
size Order size
executePrice Order price
triggerPrice Trigger price
status Plan order status
orderType Order type
planType plan type
side Trade side
triggerType Trigger type
presetTakeProfitPrice Preset take profit price
presetTakeLossPrice Preset stop loss price
rangeRate planType is "moving_plan", "1" means 1.0% price correction, two decimal places
enterPointSource enterPointSource
tradeSide Trade Side
holdMode Hold Mode
reduceOnly Is reduce only
ctime Order Creation time
utime Order Update time

Get History Plan Orders (TPSL)

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Param)

Parameter Name Parameter Type Required Description
productType String No productType
symbol String No Symbol Id (Must be capitalized)
startTime String Yes Start time, milliseconds
endTime String Yes End time, milliseconds
pageSize Integer No Page size, default 100
isPre boolean No true: order by order Id asc; default false
isPlan String No Is plan

Request Example

curl "https://api.bitget.com/api/mix/v1/plan/historyPlan?symbol=BTCUSDT_UMCBL&startTime=1659406928000&endTime=1659414128000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1693968259096,
    "data": [
        {
            "orderId": "1048210602999750657",
            "clientOid": "1048210602999750656",
            "executeOrderId": "1048508364888899593",
            "symbol": "SBTCSUSDT_SUMCBL",
            "marginCoin": "SUSDT",
            "size": "0.001",
            "executePrice": "27500",
            "triggerPrice": "27200",
            "status": "triggered",
            "orderType": "limit",
            "planType": "normal_plan",
            "side": "sell_single",
            "triggerType": "market_price",
            "presetTakeProfitPrice": "0",
            "presetTakeLossPrice": "0",
            "rangeRate": null,
            "enterPointSource": "API",
            "tradeSide": "sell_single",
            "holdMode": "single_hold",
            "reduceOnly": false,
            "executeTime": "1685709795259",
            "executeSize": "0.001",
            "cTime": "1685638803243",
            "uTime": "1685709795259"
        }
    ]
}

Response Description

Parameter Description
orderId Plan Order Id
clientOid Client Order Id
executeOrderId Execute success Order Id
symbol Symbol Id
marginCoin Margin currency
size Order size
executePrice Order price
triggerPrice Trigger price
status Plan order status
orderType Order type
planType Plan type
side Side
triggerType Trigger type
presetTakeProfitPrice Preset take profit price
presetTakeLossPrice Preset stop loss price
rangeRate planType is "moving_plan", "1" means 1.0% price correction, two decimal places
enterPointSource enterPointSource
tradeSide Trade Side
holdMode Hold Mode
reduceOnly Is reduce only
executeTime Execute Time
executeSize Execute Size
ctime Order creation time
utime Order Update time

WebSocketAPI

Overview

WebSocket is a new HTML5 protocol that achieves full-duplex data transmission between the client and server, allowing data to be transferred effectively in both directions. A connection between the client and server can be established with just one handshake. The server will then be able to push data to the client according to preset rules. Its advantages include:

It is strongly recommended that developers use WebSocket API to obtain market information and transaction depth.

domain WebSocket API Recommended to use
domain 1 wss://ws.bitget.com/mix/v1/stream internationality

Connect

Connection instructions:

Connection limit: 100 connections per IP

Subscription limit: 240 times per hour

If there’s a network problem, the system will automatically disconnect the connection.

The connection will break automatically if the subscription is not established or data has not been pushed for more than 30 seconds.

To keep the connection stable:

  1. Set a timer of 30 seconds.
  2. If the timer is triggered, send the String 'ping'.
  3. Expect a 'pong' as a response. If the response message is not received within 30 seconds, please raise an error and/or reconnect.
  4. The Websocket server accepts up to 10 messages per second. The message includes:
  5. PING frame
  6. Messages in JSON format, such as subscribe, unsubscribe.
  7. If the user sends more messages than the limit, the connection will be disconnected. IPs that are repeatedly disconnected may be blocked by the server;
  8. A single connection can subscribe up to 1000 Streams;
  9. A single IP can create up to 100 connections.

Login

apiKey: Unique identification for invoking API. Requires user to apply one manually.

passphrase: APIKey password

timestamp: the Unix Epoch time, the unit is seconds(--different from the signature timestamp of restAPI--)

secretKey: The security key generated when the user applies for APIKey, e.g. : 22582BD0CFF14C41EDBF1AB98506286D

Example of timestamp

const timestamp ='' + Date.now() / 1000

Sign example

sign=CryptoJS.enc.Base64.Stringify(CryptoJS.HmacSHA256(timestamp +'GET'+'/user/verify', secretKey))

method: always 'GET'.

requestPath : always '/user/verify'

sign: signature string, the signature algorithm is as follows:

First concatenate timestampmethodrequestPath, then use HMAC SHA256 method to encrypt the concatenated string with SecretKey, and then perform Base64 encoding.

The request will expire 30 seconds after the timestamp. If your server time differs from the API server time, we recommended using the REST API to query the API server time and then compare the timestamp.

Steps to generate the final signature:

Step 1. concat the content

Long timestamp = System.currentTimeMillis() / 1000;
        String content = timestamp +"GET"+"/user/verify";

Step 1. Use the private key secretkey to encrypt the string to be signed with hmac sha256

String hash = hmac_sha256(content, secretkey)

The final step is to base64 encode the hash

String sign = base64.encode(hash)

If login fails, it will automatically disconnect

Request format description

{
  "op":"login",
  "args":[
    {
      "apiKey":"<api_key>",
      "passphrase":"<passphrase>",
      "timestamp":"<timestamp>",
      "sign":"<sign>"
    }
  ]
}

Request Example

{
  "op":"login",
  "args":[
    {
      "apiKey":"bg_573af5eca856acd91c230da294ce2105",
      "passphrase":"123456",
      "timestamp":"1538054050",
      "sign":"8RCOqCJAhhEh4PWcZB/96QojLDqMAg4qNynIixFzS3E="
    }
  ]
}

Successful Response Example

{
  "event":"login",
  "code":"0",
  "msg":""
}

Failure Response Example

{
  "event":"error",
  "code":"30005",
  "msg":"error"
}

Subscribe

Subscription Instructions

Request format description

{
  "op": "subscribe",
  "args": ["<SubscriptionTopic>"]
}

WebSocket channels : public and private .

Public channels -- include

Tickers channel

Candlesticks channel

Order book channel

Trades channel

etc -- do not require log in.

Private channels -- include

Account channel

Positions channel

Order channel

Plan order channel

Users can choose to subscribe to one or more channels, and the total length of multiple channels cannot exceed 4096 bytes.

Request Example

{
  "op":"subscribe",
  "args":[
    {
      "instType":"mc",
      "channel":"ticker",
      "instId":"BTCUSDT"
    },
    {
      "instType":"mc",
      "channel":"candle5m",
      "instId":"BTCUSDT"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe
args Array Yes List of subscribe channels
> instType String No Instrument Type MC:Perpetual contract public channel
> channel String Yes Channel name
> instId String No Instrument ID

Example response

{ "event": "subscribe", "arg": { "instType":"SP","channel":"ticker", "instId":"BTCUSDT" }} 

Return parameters

Parameter Type Required Description
event String Yes Event, subscribe error
arg Object No Subscribed channel
> instType String No Instrument Type MC:Perpetual contract public channel
> channel String Yes Channel name
> instId String No Instrument ID
code String No Error code
msg String No Error message

Unsubscribe

Unsubscribe from one or more channels.

Request format description

{
  "op": "unsubscribe",
  "args": ["< SubscriptionTopic> "]
}

Request Example

{
  "op":"unsubscribe",
  "args":[
    {
      "instType":"mc",
      "channel":"ticker",
      "instId":"BTCUSDT"
    },
    {
      "instType":"mc",
      "channel":"candle1m",
      "instId":"BTCUSDT"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, unsubscribe
args Array Yes List of channels to unsubscribe from
> instType String Yes Instrument Type MC:Perpetual contract public channel
> channel String Yes Channel name
> instId String Yes Instrument ID

Example response

{
  "op":"unsubscribe",
  "args":[
    {
      "instType":"mc",
      "channel":"ticker",
      "instId":"BTCUSDT"
    },
    {
      "instType":"mc",
      "channel":"candle1m",
      "instId":"BTCUSDT"
    }
  ]
}

Return parameters

Parameter Type Required Description
event String Yes Event, unsubscribe error
arg Object Yes Unsubscribed channel
> instType String Yes Instrument Type
> channel String Yes Channel name
> instId String Yes Instrument ID
code String No Error Code
msg String No Error Message

Checksum

This mechanism can assist users in checking the accuracy of depth(order book) data.

Merging update data into snapshot

After subscribe to the channel (such as books 400 levels) of Order book , user first receive the initial snapshot of market depth. Afterwards the incremental update is subsequently received, user are responsible to update the snapshot from client side.

  1. If there are any levels with same price from the updates, compare the amount with the snapshot order book:

    If the amount is 0, delete this depth data.

    If the amount changes, replace the depth data.

  2. If there is no level in the snapshot with same price from the update, insert the update depth information into the snapshot sort by price (bid in descending order, ask in ascending order).

Calculate Checksum

Use the first 25 bids and asks in the local snapshot to build a string (where a colon connects the price and amount in an ask or a bid), and then calculate the CRC32 value (32-bit signed integer).

Calculate Checksum

1. More than 25 levels of bid and ask
A local snapshot of market depth (only 2 levels of the orderbook are shown here, while 25 levels of orderbook should actually be intercepted):
    "bids": [
      [ 43231.1, 4 ],   //bid1
      [ 43231,   6 ]    //bid2
    ]
    "asks": [
      [ 43232.8, 9 ],   //ask1
      [ 43232.9, 8 ]    //ask2
    ]
Build the string to check CRC32:
"43231.1:4:43232.8:9:43231:6:43232.9:8"
The sequence:
"bid1[price:amount]:ask1[price:amount]:bid2[price:amount]:ask2[price:amount]"

2. Less than 25 levels of bid or ask
A local snapshot of market depth:
    "bids": [
      [ 3366.1, 7 ] //bid1
    ]
    "asks": [
      [ 3366.8, 9 ],    //ask1
      [ 3368  , 8 ],    //ask2
      [ 3372  , 8 ]     //ask3
    ]

Build the string to check CRC32:
"3366.1:7:3366.8:9:3368:8:3372:8"
The sequence:
"bid1[price:amount]:ask1[price:amount]:ask2[price:amount]:ask3[price:amount]"
  1. When the bid and ask depth data exceeds 25 levels, each of them will intercept 25 levels of data, and the string to be checked is queued in a way that the bid and ask depth data are alternately arranged. Such as: bid1[price:amount]:ask1[price:amount]:bid2[price:amount]:ask2[price:amount]...
  2. When the bid or ask depth data is less than 25 levels, the missing depth data will be ignored. Such as: bid1[price:amount]:ask1[price:amount]:ask2[price:amount]:ask3[price:amount]...
  3. If price is '0.5000', DO NOT calculate the checksum by '0.5', please DO use the original value

Public Channels

Tickers Channel

Retrieve the latest traded price, bid price, ask price and 24-hour trading volume of the instruments. Data will be pushed every 150 ms.

Request Example

{
  "op":"subscribe",
  "args":[
    {
      "instType":"mc",
      "channel":"ticker",
      "instId":"BTCUSDT"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> instType String Yes Instrument Type MC: Perpetual contract public channel
> channel String Yes Channel name, tickers
> instId String Yes Instrument ID, value refer to Get All Symbols on response field: 'symbolName'

Successful Response Example

{ "event": "subscribe", "arg": { "instType":"mc","channel": "ticker", "instId": "BTCUSDT"} }

Failure Response Example

{
  "event": "error",
  "code": 30001,
  "msg": "instType:MC,channel:ticker,instId:BTC-USDT doesn't exist"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
> instType String Yes Instrument type
> channel String Yes Channel name
> instId String Yes Instrument ID
code String No Error Code
msg String No Error Message

Push data Example

{
  "action":"snapshot",
  "arg":{
    "instType":"mc",
    "channel":"ticker",
    "instId":"BTCUSDT"
  },
  "data":[
    {
      "instId":"BTCUSDT",
      "last":"44962.00",
      "bestAsk":"44962",
      "bestBid":"44961",
      "high24h":"45136.50",
      "low24h":"43620.00",
      "priceChangePercent":"0.02",
      "capitalRate":"-0.00010",
      "nextSettleTime":1632495600000,
      "systemTime":1632470889087,
      "markPrice":"44936.21",
      "indexPrice":"44959.23",
      "holding":"1825.822",
      "baseVolume":"39746.470",
      "quoteVolume":"1760329683.834",
      "openUtc": "17088.5000000000000000",
      "chgUTC": "-0.00778",
      "symbolType": 1,
      "symbolId": "BTCUSDT_UMCBL",
      "deliveryPrice": "0",
      "bidSz": "10.344",
      "askSz": "3.024"
    }
  ]
}

Push data parameters

Parameter Type Description
arg Object Successfully subscribed channel
> instType String Instrument Type
> channel String Channel name
> instId String Instrument Name
action String Push data action, incremental push data or full push data snapshot: full update: incremental
data Array Subscribed data
> instId String Instrument Name
> last String Last traded price
>bestAsk String Best ask price
>bestBid String Best bid price
>high24h String Highest price in the past 24 hours
>low24h String Lowest price in the past 24 hours
>priceChangePercent String Price change int the past 24 hours
>capitalRate String Funding rate
>nextSettleTime String The next fund rate settlement time timestamp milliseconds
>systemTime String system time
>markPrice String Market price
>indexPrice String Index price
>holding String Open interest
>baseVolume String 24h trading volume, with a unit of base.
>quoteVolume String 24h trading volume, with a unit of quote
>openUtc String Open price at UTC 00:00
>chgUTC String Price change since UTC 00:00
>symbolType Integer SymbolType: 2: Settled Futures; 1: Perpetual Futures
>symbolId String Symbol Id
>deliveryPrice String Delivery price - 0 when SymbolType=perpetual
>bidSz String Best bid size
>askSz String Best ask size

Candlesticks Channel

Retrieve the candlesticks data of an instrument. Data will be pushed every 500 ms.

The channel will push a snapshot after successful subscribed, later on the updates will be pushed

If intended to query history data in a customized time range, please refer to Get Candle Data

Request Example

{
  "op":"subscribe",
  "args":[
    {
      "instType":"mc",
      "channel":"candle1m",
      "instId":"BTCUSDT"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> instType String Yes Instrument Type MC: Perpetual contract public channel
> channel String Yes Channel Name,candle1W candle1D candle12H candle4H candle1H candle30m candle15m candle5m candle1m
> instId String Yes Instrument ID, value refer to Get All Symbols on response field: 'symbolName'

Successful Response Example

{
  "event":"subscribe",
  "arg":{
    "instType":"mc",
    "channel":"candle1D",
    "instId":"BTCUSDT"
  }
}

Failure Response Example

{
  "event":"error",
  "arg":
    {
      "instType":"MC",
      "channel":"ticker",
      "instId":"BTC-USDT"
    },
  "code":30003,
  "msg":"instType:MC,channel:ticker,instId:BTC-USDT Symbol not exists",
  "op":"subscribe"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
> instType String Yes Instrument Type
> channel String Yes channel name
> instId String Yes Instrument ID
code String No Error Code
msg String No Error Message

Push Data Example - snapshot

{
  "action": "snapshot",
  "arg":{
    "instType":"mc",
    "channel":"candle1D",
    "instId":"BTCUSDT"
  },
  "data":[
    [
      "1639584000000",
      "8533.02",
      "8553.74",
      "8527.17",
      "8548.26",
      "45247"
    ]
  ]
}

Push Data Example - update

{
    "action": "update",
    "arg": {
        "instType": "mc",
        "channel": "candle1D",
        "instId": "BTCUSDT"
    },
    "data": [
        [
            "1665590400000",
            "19129",
            "19223.5",
            "19007.5",
            "19078.5",
            "67440.713"
        ]
    ]
}

Push data parameters**

Parameter Type Description
action String snapshot or update
arg Object Successfully subscribed channel
> instType String Instrument Type
> channel String Channel name
> instId String Instrument ID
data Array Subscribed data
> ts String Data generation time, Unix timestamp format in milliseconds
> o String Open price
> h String highest price
> l String Lowest price
> c String Close price
> baseVol String Trading volume, with a unit of base coin.

Order Book Channel

Subscribe order book data.

Use books for snapshot data, book5 for 5 depth levels,  book15 for 15 depth levels

Channel Length of bids Length of asks Remark
books maximum 200 maximum 200 Snapshot and update might return less than 200 bids/asks as per symbol's orderbook various from each other; The number of bids/asks is not a fixed value and may vary in the future
books1 1 1 Top 1 order book of "books" that begins from bid1/ask1
books5 5 5 Top 5 order book of "books" that begins from bid1/ask1
books15 15 15 Top 15 order book of "books" that begins from bid1/ask1

For example, if the whole order book consist of 20 bids and 12 asks

channel books return 20 bids and 12 asks

channel books1 return 1 bids and 1 asks, bids return index 19(index 19 is bid1), asks return index 0 

channel books5 return 5 bids and 5 asks, bids return from index 15 to 19(index 19 is bid1), asks return from index 0 to index 4

channel books15 return 15 bids index from 5 to 19(index 19 is bid1), and return 12 asks index from 0 to 11

Noted that bids are in descending order, while asks are in ascending order

Request Example

{
  "op":"subscribe",
  "args":[
    {
      "instType":"mc",
      "channel":"books5",
      "instId":"BTCUSDT"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> instType String Yes Instrument type MC: Perpetual contract public channel
> channel String Yes Channel name, books , books1, books5, books15
> instId String Yes Instrument ID, value refer to Get All Symbols on response field: 'symbolName'

Example Response

{
  "event":"subscribe",
  "arg":{
    "instType":"mc",
    "channel":"books5",
    "instId":"BTCUSDT"
  }
}

Failure example

{
  "event":"error",
  "arg":
    {
      "instType":"MC",
      "channel":"books5",
      "instId":"BTC-USDT"
    },
  "code":30003,
  "msg":"instType:MC,channel:books5,instId:BTC-USDT Symbol not exists",
  "op":"subscribe"
}

Response parameters

Parameter Type Required Description
event String Yes Event,subscribe unsubscribe error
arg Object No Subscribed channel
> instType String Yes Instrument Type
> channel String Yes Channel name
> instId String Yes Instrument ID
msg String No Error Message
code String No Error Code

Push data parameters

Parameter Type Description
arg Object Successfully subscribed channel
> instType String Instrument Type
> channel String Channel name
> instId String Instrument ID
action String Push data action, incremental push data or full push data. snapshot: full; update: incremental
data Array Subscribed data array
> asks Array Order book on sell side
> bids Array Order book on buy side
> ts String Order book generation time, Unix timestamp format in milliseconds
> checksum Integer Checksum

An example of the array of asks and bids values: ["411.8", "10"] where "411.8" is the depth price, "10" is the size

Trades Channel

Retrieve the recent trades data. Data will be pushed whenever there is a trade.

Request Example

{
  "op":"subscribe",
  "args":[
    {
      "instType":"mc",
      "channel":"trade",
      "instId":"BTCUSDT"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> instType String Yes Instrument type MC: Perpetual contract public channel
> channel String Yes Channel Name,trade
> instId String Yes Instrument ID, value refer to Get All Symbols on response field: 'symbolName'

Successful Response Example

{
  "event":"subscribe",
  "arg":[
    {
      "instType":"mc",
      "channel":"trade",
      "instId":"BTCUSDT"
    }
  ]
}

Failure Response Example

{
  "event":"error",
  "arg":
    {
      "instType":"MC",
      "channel":"trade",
      "instId":"BTC-USDT"
    },
  "code":30003,
  "msg":"instType:MC,channel:trade,instId:BTC-USDT Symbol not exists",
  "op":"subscribe"
}

Response parameters

Parameter Type Required Description
event String Yes Event,subscribe unsubscribe error
arg Object No Subscribed channel
> instType String Yes InstrumentType
> channel String Yes Channel Name
> instId String Yes Instrument ID
code String No Error Code
msg String No Error Message

Push data example

{
  "action": "snapshot",
  "arg": {
    "instType": "mc",
    "channel": "trade",
    "instId": "BTCUSDT"
  },
  "data": [
    [
      "1665645128291",
      "18991",
      "0.016",
      "buy"
    ],
    [
      "1665645128256",
      "18990.5",
      "0.241",
      "sell"
    ]
  ]
}

Push data parameters

Parameter Type Description
action String snapshot for the first push, afterwards push data will be update
arg Object Successfully subscribed channel
> instType String Instrument Type
> channel String Channel Name
> instId String Instrument ID
data Array Subscribed data String array
> ts String Filled time, Unix timestamp format in milliseconds
> px String Trade price
> sz String Trade size
> side String Trade direction, buysell

New Trades Channel

Retrieve the recent trades data. The first snapshot will push 50 trade records. Data will be pushed whenever there is a trade.

Request Example

{
  "op":"subscribe",
  "args":[
    {
      "instType":"mc",
      "channel":"tradeNew",
      "instId":"BTCUSDT"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> instType String Yes Instrument type MC: Perpetual contract public channel
> channel String Yes Channel Name,tradeNew
> instId String Yes Instrument ID, value refer to Get All Symbols on response field: 'symbolName'

Successful Response Example

{
  "event":"subscribe",
  "arg":[
    {
      "instType":"mc",
      "channel":"tradeNew",
      "instId":"BTCUSDT"
    }
  ]
}

Failure Response Example

{
  "event":"error",
  "arg":
    {
      "instType":"MC",
      "channel":"tradeNew",
      "instId":"BTC-USDT"
    },
  "code":30003,
  "msg":"instType:MC,channel:tradeNew,instId:BTC-USDT Symbol not exists",
  "op":"subscribe"
}

Response parameters

Parameter Type Required Description
event String Yes Event,subscribe unsubscribe error
arg Object No Subscribed channel
> instType String Yes InstrumentType
> channel String Yes Channel Name
> instId String Yes Instrument ID
code String No Error Code
msg String No Error Message

Push data example - snaphsot

{
  "data": [
    {
      "p": "20221.5",
      "c": "0.009",
      "ti": "969054894406951028",
      "ty": "sell",
      "ts": 1666766611672
    },
    {
      "p": "20221.5",
      "c": "1.100",
      "ti": "969054894406951026",
      "ty": "sell",
      "ts": 1666766611672
    }
  ],
  "arg": {
    "instType": "mc",
    "instId": "BTCUSDT",
    "channel": "tradeNew"
  },
  "action": "snapshot"
}

Push data example - update

{
  "data": [
    {
      "p": "20221.0",
      "c": "0.249",
      "ti": "969054896504102913",
      "ty": "buy",
      "ts": 1666766612172
    }
  ],
  "arg": {
    "instType": "mc",
    "instId": "BTCUSDT",
    "channel": "tradeNew"
  },
  "action": "update"
}

Push data parameters

Parameter Type Description
action String snapshot for the first push, afterwards push data will be update
arg Object Successfully subscribed channel
> instType String Instrument Type
> channel String Channel Name
> instId String Instrument ID
data Array Subscribed data String array
> ts String Filled time, Unix timestamp format in milliseconds
> p String Trade price
> c String Trade size
> ty String Trade direction, buysell
> ti String Trade ID

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Private Channels

Account Channel

Retrieve account information. Data will be pushed when triggered by events such as placing/canceling order, and will also be pushed in regular interval according to subscription granularity.

Request Example

{
  "op": "subscribe",
  "args": [{
    "instType": "UMCBL",
    "channel": "account",
    "instId": "default"
  }]
}

Request Parameter

Parameter Type Required Description
op String Yes Operation,subscribe unsubscribe
args Array Yes Subscribed channel
> instType String Yes Instrument Type UMCBL:USDT Perpetual Contract Private Channel; DMCBL:Coin Margin Perpetual Contract Private Channel; CMCBL: USDC margin Perpetual Contract Private Channel
> channel String Yes Channel name account
> instId String Yes Coin, please set to default

Successful Response Example

{
  "event":"subscribe",
  "arg":{
    "instType":"UMCBL",
    "channel":"account",
    "instId":"default"
  }
}

Failure Response Example

{
  "event":"error",
  "arg":
    {
      "instType":"UMCBL",
      "channel":"account",
      "instId":"BTC-USDT"
    },
  "code":30003,
  "msg":"instType:UMCBL,channel:account,instId:BTC-USDT Symbol not exists",
  "op":"subscribe"
}

Response parameters

Parameter Type Required Description
event String Yes Operation,subscribe unsubscribe error
arg Object No Subscribed channel
> instType String Yes Instrument Type
> channel String Yes Channel Name
> instId String No Symbol Name
code String No Error code
msg String No Error message

Push Data Parameter

Parameter Type Description
arg Object Subscribed channel
> instType String Instrument Type
> channel String Channel Name
> instId String Coin
data Array Subscribed Data
marginCoin String Margin Coin
locked String Lock balance
available String Available balance
maxOpenPosAvailable String Max available to open position
maxTransferOut String Max transfer out
equity String Equity of the currency
usdtEquity String Equity of the currency USD

First push: full push.

Incremental push: push transaction changes

Positions Channel

Retrieve position information. Initial snapshot will be pushed once subscribed. Data will be pushed when triggered by events such as placing/canceling order.

Request Example

{
    "op": "subscribe",
    "args": [{
        "instType": "UMCBL",
        "channel": "positions",
        "instId": "default"
    }]
}

Request Parameter

Parameter Type Required Description
op String Yes Operation ,subscribe unsubscribe
args Array Yes Subscribed channel List
> channel String Yes Channel Name,positions
> instType String Yes Instrument Type UMCBL:USDT Perpetual Contract Private Channel; DMCBL:Coin Margin Perpetual Contract Private Channel; CMCBL: USDC margin Perpetual Contract Private Channel
> instId String No Symbol Name

Response Parameter

Parameter Type Required Description
event String Yes Event ,subscribe unsubscribe errror
arg Object No Subscribed channel
> channel String Yes Channel Name
> instType String Yes Instrument Type
> instId String No Symbol Name
code String No Error Code
msg String No Error Message

Push Data Parameter

Parameter Type Description
arg Object Subscribed channel
> channel String Channel Name
> instType String Instrument Type
> instId String Instrument ID
data Array Subscribed Data
> posId String Position Id
> instId String Symbol Name
> instName String Symbol Name
> marginCoin String Margin Coin
> margin String Margin, can be added or reduced
> autoMargin String Auto suppliment margin, value: on/off
> marginMode String Margin mode, cross fixed
> holdSide String Position sidelong short
> holdMode String hold Mode single_hold , double_hold
> total String Quantity of positions
> available String Position that can be closed
> locked String Frozen quantity
> averageOpenPrice String Average open price
> leverage String Leverage
> achievedProfits String Realized profit and loss
> upl String Unrealized profit and loss
> uplRate String Unrealized profit and loss ratio
> liqPx String Estimated liquidation price
> keepMarginRate String Maintenance margin requirement Ratio
> fixedMarginRate String Margin requirement Ratio fixed
> marginRate String Risk rate.
> cTime String Creation time, Unix timestamp format in milliseconds
> uTime String Latest time position was adjusted, Unix timestamp format in milliseconds

When multiple orders are being executed at the same time, the changes of position data will be aggregated into one as much as possible.

Order Channel

Retrieve order information. Data will not be pushed when first subscribed. Data will only be pushed when triggered by events such as placing/canceling/force liquidate order.

Request Example

{
  "op": "subscribe",
  "args": [{
    "channel": "orders",
    "instType": "UMCBL",
    "instId": "default"
  }]
}

Request Parameter

Parameter Type Required Description
op String Yes Operation ,subscribe unsubscribe
args Array Yes Request Subscribed channel List
> channel String Yes Channel Name, orders
> instType String Yes Instrument Type UMCBL:USDT Perpetual Contract Private Channel; DMCBL:Coin Margin Perpetual Contract Private Channel; CMCBL: USDC margin Perpetual Contract Private Channel
> instId String No Currently only supports default all trading pair orders

Success Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "orders",
    "instType": "UMCBL",
    "instId": "default"
  }
}

Failure Response Example

{
  "event":"error",
  "arg":
    {
      "instType":"UMCBL",
      "channel":"orders",
      "instId":"BTC-USDT"
    },
  "code":30003,
  "msg":"instType:UMCBL,channel:orders,instId:BTC-USDT Symbol not exists",
  "op":"subscribe"
}

Response Parameter

Parameter Type Required Description
event String Yes Event ,subscribe unsubscribe errror
arg Object No Subscribed channel
> channel String Yes Channel Name
> instType String Yes Instrument Type
> instId String No Instrument Id
code String No Error Code
msg String No Error Message

Push Data Parameter

Parameter Type Description
action String Snapshot.
arg Object Subscribed channel
> channel String Channel Name
> instType String Instrument Type
> instId String Instrument Id
data Array Subscribed Data
> instId String Instrument Id
> ordId String Order Id
> clOrdId String Client-supplied order ID
> px String Order price
> sz String The original order quantity, in the unit of currency
> hM String Hold Mode
> eps String enterPointSource
> tS String Trade Side
> notionalUsd String Estimated national value in USD of order
> ordType String Order Type market limit
> force String Order Force normal: normal order post_only: Post-only orderfok: Fill-or-kill orderioc: Immediate-or-cancel order
> side String Order side, buy sell
> posSide String Position side; 'double_hold':long or short; 'single_hold': net
> tdMode String Trade mode, cross: cross fixed: fixed
> tgtCcy String Margin Coin
> fillPx String Last filled price
> tradeId String Last trade ID
> fillSz String Last filled quantity
> fillTime String Last filled time
> fillFee String last filled fee, negative
> fillFeeCcy String last filled fee currency
> execType String Order flow type, T: taker M: maker
> accFillSz String Accumulated fill quantity
> fillNotionalUsd String Filled notional value in USD of order
> avgPx String Average filled price. If none is filled, it will return 0
> status String Order Status init new partial-fill full-fill cancelled
> lever String Leverage
> orderFee Array
>> feeCcy String Fee currency
>> fee String FeeNegative number represents the user transaction fee charged by the platform.Positive number represents rebate.
> pnl String Profit and loss
> uTime String Update time, Unix timestamp format in milliseconds
> cTime String Creation time, Unix timestamp format in milliseconds
> low Boolean Is reduce only

Plan Order Channel

Retrieve order information. Data will not be pushed when first subscribed. Data will only be pushed when triggered by events such as created/cancelled/modified/triggered.

Request Example

{
  "op": "subscribe",
  "args": [{
    "channel": "ordersAlgo",
    "instType": "UMCBL",
    "instId": "default"
  }]
}

Request Parameter

Parameter Type Required Description
op String Yes Operation ,subscribe unsubscribe
args Array Yes Subscribed channel List
> channel String Yes Channel Name,ordersAlgo
> instType String Yes Instrument Type UMCBL:USDT Perpetual Contract Private Channel; DMCBL:Coin Margin Perpetual Contract Private Channel; CMCBL: USDC margin Perpetual Contract Private Channel
> instId String No Symbol Name

Success

{
  "event": "subscribe",
  "arg": {
    "channel": "ordersAlgo",
    "instType": "UMCBL",
    "instId": "default"
  }
}

Fail

{
  "event":"error",
  "arg":
    {
      "instType":"UMCBL",
      "channel":"ordersAlgo",
      "instId":"BTC-USDT"
    },
  "code":30003,
  "msg":"instType:UMCBL,channel:ordersAlgo,instId:BTC-USDT Symbol not exists",
  "op":"subscribe"
}

Response Parameter

Parameter Type Required Description
event String Yes Event,subscribe unsubscribe errror
arg Object No Subscribed channel
> channel String Yes Channel Name
> instType String Yes Instrument Type
> instId String No Instrument Id
code String No Error Code
msg String No Error Message

Push Data

Parameter Type Description
action String 'snapshot'
arg Object Subscribed channel
> channel String Channel Name
> instType String Instrument Type
> instId String Instrument ID
data Array Subscribed data
> instId String instrument ID
> id String order ID
> cOid String Client-supplied order ID
> triggerPx String trigger price
> planType String Websocket planType, null means 'pl'
> ordPx String actual price
> sz String trigger size
> actualSz String actual size
> actualPx String Actual price
> ordType String Order Type market limit
> side String Order Side, buy sell
> posSide String Position side; 'double_hold':long or short; 'single_hold': net
> tgtCcy String Margin Coin
> state String Order status not_trigger triggered fail_trigger cancel
> hM String Hold mode
> eps String enterPointSource.
> triggerTime String trigger time, ms
> userId String userId
> version Long version
> triggerPxType String 'mark': mark price; 'last': fill price(market price)
> key String key ID
> tS String Trade Side
> uTime String Update time, Unix timestamp format in milliseconds
> cTime String Creation time, Unix timestamp format in milliseconds

RestAPI error codes

Error message Error code http status code
Error message Error code http status code
00000 success! 400
40001 ACCESS_KEY cannot be empty 400
40002 ACCESS_SIGN cannot be empty 400
40003 Signature cannot be empty 400
40004 Request timestamp expired 400
40005 Invalid ACCESS_TIMESTAMP 400
40006 Invalid ACCESS_KEY 400
40007 Invalid Content_Type 400
40008 Request timestamp expired 400
40009 sign signature error 400
40010 Request timed out 400
40011 ACCESS_PASSPHRASE cannot be empty 400
40012 apikey/password is incorrect 400
40013 User status is abnormal 400
40014 Incorrect permissions, need {0} permissions 400
40015 System is abnormal, please try again later 400
40016 The user must bind the phone or Google 400
40017 Parameter verification failed {0} 400
00171 Parameter verification failed {0}{1} 400
00172 Parameter verification failed 400
40018 Invalid IP 400
40019 Parameter {0} cannot be empty 400
40020 Parameter {0} error 400
40021 User disable withdraw 400
40022 The business of this account has been restricted 400
40023 The business of this account has been restricted 400
40024 Account has been frozen 400
40025 The business of this account has been restricted 400
40026 User is disabled 400
40027 Withdrawals in this account area must be kyc 400
40028 This subUid does not belong to this account 400
40029 This account is not a Broker, please apply to become a Broker first 400
40031 The account has been cancelled and cannot be used again 400
40032 The Max of sub-account created has reached the limit 400
40033 This email has been bound 400
40034 Parameter {0} does not exist 400
50001 coin {0} does not support cross 400
50002 symbol {0} does not support isolated 400
50003 coin {0} does not support isolated 400
50004 symbol {0} does not support cross 400
40035 Judging from your login information, you are required to complete KYC first for compliance reasons. 400
40036 passphrase is error 400
40037 Apikey does not exist 400
40038 The current ip is not in the apikey ip whitelist 400
40039 FD Broker's user signature error 400
40040 user api key permission setting error 400
40041 User's ApiKey does not exist 400
40043 FD Broker does not exist 400
40045 The bound user cannot be an FD broker 400
40047 FD Broker binding related interface call frequency limit 400
40048 The user's ApiKey must be the parent account 400
40049 User related fields decrypt error 400
40051 This account is not a FD Broker, please apply to become a FD Broker first 400
40052 Security settings have been modified for this account. For the safety of your account, withdrawals are prohibited within 24 hours 400
40053 Value range verification failed: {0} should be between {1} 400
40054 The data fetched by {0} is empty 400
40055 subName must be an English letter with a length of 8 400
40056 remark must be length of 1 ~ 20 400
40057 Parameter {0} {1} does not meet specification 400
40058 Parameter {0} Only a maximum of {1} is allowed 400
40059 Parameter {0} should be less than {1} 400
40060 subNames already exists 400
40061 sub-account not allow access 400
40063 API exceeds the maximum limit added 400
40064 Sub-account creation failed, please check if there is a duplicate 400
40065 This subApikey does not exist 400
40066 This subUid does not belong to the account or is not a virtual sub-account 400
40067 sub-account create failed, please check if there is a duplicate 400
40068 Disable subaccount access 400
40069 The maximum number of sub-accounts created has been reached 400
40070 passphrase 8-32 characters with letters and numbers 400
40071 subName exist duplication 400
40072 symbol {0} is Invalid or not supported mix contract trade 400
40102 Symbol does not exist 400
40109 The data of the order cannot be found, please confirm the order number 400
40200 Server upgrade, please try again later 400
40301 Permission has not been obtained yet. If you need to use it, please contact customer service 400
40303 Can only query up to 20,000 data 400
40304 clientOid or clientOrderId length cannot greater than 50 400
40305 clientOid or clientOrderId length cannot greater than 64, and cannot be Martian characters 400
40306 Batch processing orders can only process up to 20 400
40308 The contract is being temporarily maintained 400
40309 The contract has been removed 400
40400 Status check abnormal 400
40401 The operation cannot be performed 400
40402 orderId or clientOId format error 400
40407 The query direction is not the direction entrusted by the plan 400
40408 Range error 400
40409 wrong format 400
40704 Can only check the data of the last three months 400
40705 The start and end time cannot exceed 90 days 400
40706 Wrong order price 400
40707 Start time is greater than end time 400
40708 client_oid duplicate 400
40709 There is no position in this position, and no automatic margin call can be set 400
40710 Abnormal account status 400
40711 Insufficient contract account balance 400
40712 Insufficient margin 400
40713 Cannot exceed the maximum transferable margin amount 400
40714 No direct margin call is allowed 400
40715 delegate count can not high max of open count 400
40716 This trading pair not support Cross Margin mode 400
40717 The number of closed positions cannot exceed the number of sheets held 400
40718 The entrusted price of Pingduo shall not be lower than the bursting price 400
40719 Flat empty entrustment price is not allowed to be higher than explosion price 400
40720 swap hand depth does not exist 400
40721 Market price list is not allowed at present 400
40722 Due to excessive price fluctuations and the insufficient market price entrusted cost, the opening commission is failed. 400
40723 The total number of unexecuted orders is too high 400
40724 Parameter is empty 400
40725 service return an error 400
40726 Cross margin not support Auto Margin Replenishment (AMR) 400
40727 Cross margin not support margin adjustment 400
40728 You’re log in as trader, please close position for current copy trade orders 400
40729 Failed to adjust the position, the current position or order or plan order 400
40730 There is currently a commission or a planned commission, and the leverage cannot be adjusted 400
40731 This product does not support copy trading 400
40732 Not currently a trader 400
40199 Traders are prohibited from calling the API 400
40733 The order closing has been processed 400
40734 Failed to place an order, the minimum number of traders to open a position {0} 400
40735 Long position take profit price should be greater than the average opening price 400
40736 Long position take profit price is greater than the current price 400
40737 The short position take profit price should be less than the average opening price 400
40738 The short position take profit price should be less than the current price 400
40739 The stop loss price of a long position should be less than the average opening price 400
40740 The stop loss price of a long position should be less than the current price 400
40741 The stop loss price of a short position should be greater than the average opening price 400
40742 The stop loss price of the short position should be greater than the current price 400
40743 The order is being closed and cannot be closed again 400
40744 The tracking order status is wrong 400
40745 This order is being commissioned, and liquidation is not supported temporarily 400
40746 The current maximum number of positions that can be closed is {0}, if you exceed the number, please go to the current order to close the position 400
40747 The bonus is not allowed to hold two-way positions 400
40748 The commission price is higher than the highest bid price 400
40749 The commission price is lower than the lowest selling price 400
40750 The plan commission for this contract has reached the upper limit 400
40751 The contract's stop profit and stop loss order has reached the upper limit 400
40752 You are disabled for current business, if you have any questions, please contact customer service 400
40753 The contract transaction business is disabled, if you have any questions, please contact customer service 400
40754 balance not enough 400
40755 Not enough open positions are available. 400
40756 The balance lock is insufficient. 400
40757 Not enough position is available. 400
40758 The position lock is insufficient. 400
40759 No assets 400
40760 Account abnormal status 400
40761 The total number of unfilled orders is too high 400
40762 The order size is greater than the max open size 400
40763 The number of orders cannot exceed the maximum amount of the corresponding gear 400
40764 The remaining amount of the order is less than the current transaction volume 400
40765 The remaining volume of the position is less than the current transaction volume 400
40766 The number of open orders is less than this transaction volume 400
40767 Position does not exist when opening a position 400
40768 Order does not exist 400
40769 Reject order has been completed 400
40770 The settlement or fee currency configuration was not found. 400
40771 When there is a gap, you cannot have a position closing order. 400
40772 The account does not exist 400
40773 Closed positions can only occur in two-way positions. 400
40774 The order type for unilateral position must also be the unilateral position type. 400
40775 The market-making account can only be a unilateral position type. 400
40776 Error creating order. 400
40777 Cancel order error. 400
40778 Coin pair {0} does not support {1} currency as margin 400
40779 Please check that the correct delegateType is used 400
40780 There are multiple risk handling records for the same symbolId at the same time 400
40781 The transfer order was not found 400
40782 Internal transfer error 400
40783 No gear found 400
40784 Need to configure modify depth account 400
40785 Need to configure draw line account 400
40786 Duplicate clientOid 400
40787 The price step does not match 400
40788 Internal batch transfer error 400
40789 The tokenId is duplicated in the configuration item 400
40790 Duplicate symbolCode in configuration item 400
40791 The baseToken or quoteToken of symbolCode does not exist 400
40792 The symbol in the configuration item is duplicated 400
40793 The symbolCode of BusinessSymbol does not exist 400
40794 The supportMarginToken of BusinessSymbol is not configured 400
40795 The transaction is suspended due to settlement or maintenance reasons 400
40796 The adjusted leverage is not within the appropriate range 400
40797 Exceeded the maximum settable leverage 400
40798 Insufficient contract account balance 400
40799 Cannot be less than the minimum transfer amount 400
40800 Insufficient amount of margin 400
40801 Cannot exceed the maximum transferable deposit amount 400
40802 Position is zero and direct margin call is not allowed 400
40803 The leverage is reduced and the amount of margin call is incorrect 400
40804 The number of closed positions cannot exceed the number of positions held 400
40805 Unsupported operation 400
40806 Unsupported currency 400
40807 The account does not exist 400
40808 Parameter verification exception {0} 400
40809 Execution price parameter verification exception 400
40810 Triggered price parameter verification exception 400
40811 The parameter {0} should not be null 400
40812 The condition {0} is not met 400
40813 The parameter {0} must have a value and cannot be empty 400
40814 No change in leverage 400
40815 The order price is higher than the highest bid price 400
40816 The order price is lower than the lowest selling price 400
40817 The current order status cannot be cancelled 400
40818 The current order type cannot be cancelled 400
40819 The order does not exist! 400
40820 The order price for closing a long position is not allowed to be lower than the liquidation price 400
40821 The closing order price cannot be higher than the liquidation price 400
40822 The contract configuration does not exist 400
40823 The transaction or reasonable marked price does not exist 400
40824 Currently, it is not allowed to list market orders 400
40825 Contract opponent depth does not exist 400
40826 Due to excessive price fluctuations, the market order cost is insufficient, and the position opening order failed. 400
40827 The bonus is not allowed to hold two-way positions 400
40828 Special market making accounts cannot manually place orders 400
40829 The take profit price of a long position should be greater than the average open price 400
40830 The take profit price of the long position should be greater than the current price 400
40831 The short position take profit price should be less than the average open price 400
40832 The take profit price of short positions should be less than the current price 400
40833 The stop loss price of a long position should be less than the average opening price 400
40834 The stop loss price of the long position should be less than the current price 400
40835 The stop loss price of the short position should be greater than the average opening price 400
40836 The stop loss price of the short position should be greater than the current price 400
40837 There is no position in this position, so stop-profit and stop-loss orders cannot be made 400
40838 There is no position in this position, and automatic margin call cannot be set 400
40839 The automatic margin call function of this contract has been suspended 400
40840 Duplicate shard market making account 400
40841 Online environment does not allow execution 400
40842 Current configuration does not allow adjustment, please try again later 400
40843 no_datasource_key_exists 400
40844 This contract is under temporary maintenance 400
40845 This contract has been removed 400
40846 Status verification abnormal 400
40847 The operation cannot be performed 400
40848 Cannot open a copy transaction if there is a position 400
40849 This user already has an ongoing copy 400
40850 The copy is in progress, the balance cannot be transferred 400
40851 Account status is wrong, cannot end copying 400
40852 There are unfilled orders, cannot end the copy 400
40853 There is an unexecuted plan order, cannot end the copy 400
40854 This product does not support copy trading 400
40855 The user has ended copying and cannot end copying again 400
40856 Data abnormal 400
40857 Document number error 400
40858 Error tracking order status 400
40859 This order is being closed and cannot be closed again 400
40860 The trader does not exist and cannot be set to follow 400
40861 The trader has been disabled and cannot be set to follow 400
40862 Please cancel the current order 400
40863 Please cancel the current plan 400
40864 Please close the current position with orders 400
40865 This order is being commissioned, and it is not currently supported to close the position 400
40866 You are currently a trader, please close the position under the current order 400
40867 Currently the maximum number of positions that can be closed is {0}, please go to the current order to close the position if the amount exceeds 400
40868 You are currently a trader and currently do not support liquidation through planned orders 400
40869 You are currently a trader and currently do not support modification of leverage 400
40870 You are currently copying an order and currently do not support modifying the leverage 400
40871 The leverage does not meet the configuration, and you cannot become a trader 400
40872 Failed to adjust position, currently holding position or order or plan order 400
40873 The account has a margin and needs to be transferred out 400
40874 Whole position mode does not support automatic margin call 400
40875 Whole position mode does not support margin adjustment 400
40876 Too many tracking orders 400
40877 Too many follow-up orders 400
40878 The contract index data is abnormal. In order to avoid causing your loss, please try again later. 400
40879 The risk is being processed, and the funds cannot be adjusted. 400
40880 The risk is being processed and the leverage cannot be adjusted. 400
40881 There is currently an order, or an order is planned, and the leverage cannot be adjusted. 400
40882 You are currently a trader and you cannot switch to the full position mode 400
40883 When the currencies are mixed, it cannot be adjusted to the warehouse-by-warehouse mode 400
40884 When a one-way position is held, it cannot be adjusted to a position-by-position mode 400
40885 In the case of position by position mode, it cannot be adjusted to one-way position 400
40886 The automatic margin call cannot be adjusted in the full position mode 400
40887 Failed to place the order, the number of single lightning open positions is at most {0} 400
40888 Failed to place the order, the maximum amount of single lightning closing is {0} 400
40889 The plan order of this contract has reached the upper limit 400
40890 The order of stop-profit and stop-loss for this contract has reached the upper limit 400
40891 Insufficient position, can not set take profit or stop loss 400
40892 Failed to place the order, the minimum number of positions opened by the trader is {0} 400
40893 Unable to update the leverage factor of this position, there is not enough margin! 400
40894 The documentary closing has been processed 400
40895 The preset price does not match the order/execution price 400
40896 The default stop profit and stop loss has been partially fulfilled and cannot be modified 400
40897 The system experience gold account does not exist 400
40898 The system experience gold account balance is insufficient 400
40899 The number of stored users exceeds the limit 400
40900 The system experience gold account is inconsistent 400
40901 The contract experience fund balance is insufficient 400
40902 Future time is not allowed 400
40903 Failed to obtain leverage information 400
40904 Failed to collect funds 400
40905 Failed to collect user funds 400
40906 Failed to pay user funds 400
40907 The payment cannot be transferred 400
40908 Concurrent operation failed 400
40909 Transfer processing 400
40910 Operation timed out 400
40911 Request timestamp expired 400
40912 single cancel cannot exceed 50 400
40913 {0} must be passed one 400
40914 Trader the maximum leverage can use is {0} 400
40915 Long position take profit price please > mark price 400
40916 The business of this account has been restricted 400
40917 Stop price for long positions please < mark price {0} 400
40918 Traders open positions with orders too frequently 400
40919 This function is not open yet 400
40920 Position or order exists, the position mode cannot be switched 400
40921 The order size cannot exceed the maximum size of the positionLevel 400
40922 Only work order modifications are allowed 400
40923 Order size and price have not changed 400
40924 orderId and clientOid must have one 400
40925 price or size must be passed in together 400
43013 Take profit price needs> current price 400
43014 Take profit price needs to be <current price 400
43015 Stop loss price needs to be <current price 400
43016 Stop loss price needs to be> current price 400
43017 You are currently a trader and currently do not support liquidation through planned orders 400
43020 Stop profit and stop loss order does not exist 400
43021 The stop-profit and stop-loss order has been closed 400
43022 Failed to trigger the default stop loss 400
43023 Insufficient position, can not set profit or stop loss 400
43024 Take profit/stop loss in an existing order, please change it after canceling all 400
43025 Plan order does not exist 400
43026 The planned order has been closed 400
43027 The minimum order value {0} is not met 400
43028 Please enter an integer multiple of {0} for price 400
43029 The size of the current Order > the maximum number of positions that can be closed 400
43030 Take profit order already existed 400
43031 Stop loss order already existed 400
43032 rangeRate is smaller than {0} 400
43033 Trailing order does not exist 400
43034 The trigger price should be ≤ the current market price 400
43035 The trigger price should be ≥ the current market price 400
43036 Trader modify tpsl can only be operated once within 300ms 400
43037 The minimum order amount allowed for trading is {0} 400
43038 The maximum order amount allowed for trading is {0} 400
43039 Maximum price limit exceeded {0} 400
43040 Minimum price limit exceeded {0} 400
43041 Maximum transaction amount {0} 400
43042 Minimum transaction amount {0} 400
43043 There is no position 400
43044 The follow order status error 400
43045 The trader is ful 400
43046 User does not exist 400
43047 Followers are not allowed to follow again within xx minutes after being removed, please try again later! 400
43048 The symbol is null 400
43049 Margin coin is not allowed 400
43050 Leverage exceeds the effective range 400
43051 Maximum limit exceeded 400
43052 Follow order count can not less than {0} 400
43053 The copy ratio cannot exceed {0} 400
43054 The copy ratio cannot be less than {0} 400
43055 The take loss ratio must be between {0}-{1} 400
43056 The take profit ratio must be between {0}-{1} 400
43057 It is not allowed to bring orders or copy orders between sub-accounts 400
43058 Parameter verification failed 400
43059 Request failed, please try again 400
43060 Sort rule must send 400
43061 Sort Flag must send 400
43062 not to follow 400
43063 Can not follow trade with yourself 400
43064 Tracking order status error 400
43065 Tracking No does not exist 400
43066 operation failed 400
43067 The loaded data has reached the upper limit, and the maximum support for loading {0} data 400
43068 The status of the current follower is abnormal and removal is not allowed for now 400
43069 A follower account can only be removed when its equity is lower than {0} USDT 400
43001 The order does not exist 400
43002 Pending order failed 400
43003 Pending order failed 400
43004 There is no order to cancel 400
43005 Exceed the maximum number of orders 400
43006 The order quantity is less than the minimum transaction quantity 400
43007 The order quantity is greater than the maximum transaction quantity 400
43008 The current order price cannot be less than {0}{1} 400
43009 The current order price exceeds the limit {0}{1} 400
43010 The transaction amount cannot be less than {0}{1} 400
43011 The parameter does not meet the specification {0} 400
43012 Insufficient balance 400
41103 param {0} error 400
41101 param {0} error 400
41113 symbol is offline 400
41114 The current trading pair is under maintenance, please refer to the official announcement for the opening time 400
42013 transfer fail 400
42014 The current currency does not support deposit 400
42015 The current currency does not support withdrawal 400
42016 symbol {0} is Invalid or not supported spot trade 400
41100 error {0} 400
43111 param error {0} 400
43112 The amount of coins withdrawn is less than the handling fee {0} 400
43113 The daily limit {0} is exceeded in a single transaction 400
43114 Withdrawal is less than the minimum withdrawal count {0} 400
43115 The current trading pair is opening soon, please refer to the official announcement for the opening time 400
43116 This chain requires a tag to withdraw coins 400
43117 Exceeds the maximum amount that can be transferred 400
43118 clientOrderId duplicate 400
43119 Trading is not open 400
43120 symbol is not open trade 400
43121 Withdrawal address cannot be your own 400
43122 The purchase limit of this currency is {0}, and there is still {1} left 400
43123 param error {0} 400
43124 withdraw step is error 400
43125 No more than 8 decimal places 400
43126 This currency does not support withdrawals 400
43127 Sub transfer not by main account, or main/sub relationship error 400
43128 Exceeded the limit of the maximum number of orders for the total transaction pair {0} 400
45034 clientOid duplicate 400
47001 Currency recharge is not enabled 400
47002 Address verification failed 400
45001 Unknown error 400
45002 Insufficient asset 400
45003 Insufficient position 400
45004 Insufficient lock-in asset 400
45005 Insufficient available positions 400
45006 Insufficient position 400
45007 Insufficient lock position 400
45008 No assets 400
45009 The account is at risk and cannot perform trades temporarily 400
45010 The number of orders cannot exceed the maximum amount of the corresponding leverage 400
45011 Order remaining volume < Current transaction volume 400
45012 Remaining volume of position < Volume of current transaction 400
45013 The number of open orders < Current transaction volume 400
45014 Position does not exist during opening 400
45017 Settlement or the coin for transaction configuration not found 400
45018 In the case of a netting, you cannot have a liquidation order 400
45019 Account does not exist 400
45020 Liquidation can only occur under two-way positions 400
45021 When one-way position is held, the order type must also be one-way position type 400
45023 Error creating order 400
45024 Cancel order error 400
45025 The currency pair does not support the currency as a margin 400
45026 Please check that the correct delegateType is used 400
45031 The order is finalized 400
45035 Price step mismatch 400
45043 Due to settlement or maintenance reasons, the trade is suspended 400
45044 Leverage is not within the suitable range after adjustment 400
45045 Exceeds the maximum possible leverage 400
45047 Reduce the leverage and the amount of additional margin is incorrect 400
45051 Execution price parameter verification is abnormal 400
45052 Trigger price parameter verification anbormal 400
45054 No change in leverage 400
45055 The current order status cannot be cancelled 400
45056 The current order type cannot be cancelled 400
45057 The order does not exist! 400
45060 TP price of long position > Current price {0} 400
45061 TP price of short position < Current price {0} 400
45062 SL price of long position < Current price {0} 400
45064 TP price of long position > order price {0} 400
45065 TP price of short position < order price {0} 400
45066 SL price of long position < order price {0} 400
45067 SL price of short position > order price {0} 400
45068 There is no position temporarily, and the order of TP and SL cannot be carried out 400
45075 The user already has an ongoing copy trade 400
45082 Copy trade number error 400
45089 You are currently copy trading, leverage cannot be changed 400
45091 Too many tracking orders 400
45097 There is currently an order or a limit order, and the leverage cannot be adjusted 400
45098 You are currently a trader and cannot be switched to the full position mode 400
45099 When there are different coins, it cannot be adjusted to Isolated Margin mode 400
45100 When a one-way position is held, it cannot be adjusted to the Isolated Margin mode 400
45101 In Isolated Margin mode, it cannot be adjusted to a one-way position 400
45102 In the full position mode, the automatic margin call cannot be adjusted 400
45103 Failed to place the order, the maximum amount of single flash opening position is %s 400
45104 Failed to place the order, the maximum amount of single flash closing position is %s 400
45106 copy trade liquidation has been processed 400
45107 API is restricted to open positions. If you have any questions, please contact our customer service 400
45108 API is restricted to close position. If you have any questions, please contact our customer service 400
45109 The current account is a two-way position 400
45110 less than the minimum amount {0} USDT 400
45111 less than the minimum order quantity 400
45112 more than the maximum order quantity 400
45113 Maximum order value limit triggered 400
45114 The minimum order requirement is not met 400
45115 The price you enter should be a multiple of {0} 400
45116 The count of positions hold by the account exceeds the maximum count {0} 400
45117 Currently holding positions or orders, the margin mode cannot be adjusted 400
45118 Reached the upper limit of the order of transactions (the current number of order + the current number of orders) {0} 400
45119 This symbol does not support position opening operation 400
45120 size > max can open order size 400
45121 The reasonable mark price deviates too much from the market, and your current leveraged position opening risk is high 400
45122 Short position stop loss price please > mark price {0} 400
45123 Insufficient availability, currently only market orders can be placed 400
45124 Please edit and submit again. 400
45125 Order cancellation is unavailable for inactive orders. Please cancel parent order and place a new order. 400
45126 Order cancellation is unavailable for inactive orders. Please cancel parent order and place a new order. 400
45127 Position brackets disabled TP SL 400
45128 Position brackets disabled modify qty 400
45129 Cancel order is too frequent, the same orderId is only allowed to be canceled once in a second 400
49000 apiKey and userId mismatch 400
49001 not custody account, operation deny 400
49002 missing http header: ACCESS-BROKER-KEY or ACCESS-BROKER-SIGN 400
49003 illegal IP, access deny 400
49004 illegal ACCESS-BROKER-KEY 400
49005 access deny: sub account 400
49006 ACCESS-BROKER-SIGN check sign fail 400
49007 account is unbound 400
49008 account is bound 400
49009 clientUserId check mismatch with the bound user ID 400
49010 account: {0} still have assets: {1} 400
49011 kyc must be done before bind 400
49020 unsupported coin 400
49021 operation accepted 400
49022 access deny 400
49023 insufficient fund 400
49024 {0} decimal precision error 400
49025 Parameter mismatch with the initial requestId, request body: {0} 400
49026 {0} maximum {1} digits 400
49030 custody account, operation deny 400
49040 Unknown Error 400
60001 StartTime not empty 400
60002 MerchantId not empty 400
60003 Not found the p2p order 400
60004 Not found the p2p advertisement 400
60005 Not found the p2p merchant 400
70001 Activity ID not correct 400
70002 rankType error 400
40000 Bitget is providing services to many countries and regions around the world and strictly adheres to the rules and regulatory requirements of each country and region. According to the relevant regulations, Bitget is currently unable to provide services to your region (Mainland China) and you do not have access to open positions.Apologies for any inconvenience caused! 400
48001 Parameter validation failed {0} 400
48002 Missing request Parameter 400
46013 This symbol limits the selling amount{0},Remaining{0} 400
40404 Request URL NOT FOUND 400
50010 Unknown error 400
50012 The account has been suspended or deleted. Please contact our Customer Support 400
50013 The account has been suspended and deleted. Please contact our Customer Support 400
50019 The user is forbidden to trade. 400
50059 This currency cannot be transferred 400
50052 The asset balance will be less than 0 after transferring 400
50048 The maximum number of orders is exceeded 400
50046 The price is too low 400
50047 The price is too high 400
50026 The trading pair is currently unavailable 400
50025 The trading pair is currently unavailable 400
50016 The number of open orders is smaller than the minimum limit of the trading pair 400
50017 The number of open orders is bigger than the maximum limit of the trading pair 400
50023 The account has been suspended due to abnormal behavior. Please contact our Customer Support is you have any questions. 400
50031 System error 400
50044 The system account is not found 400
50049 The request body of the system user is empty 400
50050 The system loan collection has been done 400
50027 The trading pair is suspended for maintenance 400
50030 The trading pair will soon be available 400
50029 The trading pair has no order price 400
50028 The trading pair is removed 400
50040 The repayment amount must be more than 0 400
50042 The repayment amount must be more than the interest 400
50041 The repayment amount must be less than your available balance 400
50051 The user in reconciliation is not in the system (cache) 400
50024 The trading pair does not exist 400
50011 Parameter verification error 400
50053 The amount is less than 0 when making loan repayment 400
50056 The amount is less than 0 when paying liquidation fees 400
50054 The amount is less than 0 when making interest repayment 400
50055 The amount is less than 0 when paying trading fees 400
50033 The topic of the websocket query does not exist 400
50057 The amount is less than 0 when paying the excessive loss resulted from liquidation 400
50032 The currency does not exist 400
50036 The loan configuration does not exist 400
50037 This currency cannot be borrowed 400
50038 The system limit is exceeded 400
50034 The borrowing amount must be over 0.00000001 400
50035 The maximum borrowing amount is exceeded 400
50020 Insufficient balance 400
50045 Insufficient locked asset 400
50015 Currently, sub-accounts cannot engage in margin trading 400
50021 The margin trading account does not exist 400
50022 The account is liquidated 400
50014 The account already exists 400
50060 Duplicated clientOid 400
50058 After the profit is used to cover the excessive loss resulted from liquidation, the balance will be less than 0 400
50039 The currency and the trading pair do not match 400
50018 The price must be 0 or higher 400
50043 Unknown transaction type 400
50061 There is a problem with the parameter you requested 400
50062 The order status is cancelled or fullFill 400
50063 Token precision must less than or equal to eight 400
50064 Your account is temporarily frozen. Please contact customer support if you have any questions 400
50065 symbol_off_shelf 400
50066 Position closing, please try again later 400
31001 The user is not a trader 400
31002 Condition {0} is not satisfied 400
31003 Parameter {0} must have a value, cannot be empty 400
31004 Take profit price must be > current price 400
31005 Stop loss price must be < current price 400
31006 The order is in the process of being placed, closing of the position is not supported at the moment 400
31007 Order does not exist 400
31008 There is no position in this position, no take profit or stop loss order can be made 400
31009 Tracking order status error 400
31010 Clear user prompt 400
31011 The order is not completely filled and the order is closed prompting the cancellation of the commission 400
31012 Pullback greater than {0} 400
31013 Pullback range is less than {0} 400
31014 Stop gain yield greater than {0} 400
31015 Stop loss yield less than {0} 400
31016 Batch execution exception 400
31017 Maximum price limit exceeded {0} 400
31018 Minimum price change of {0} 400
31019 Support trading currency pair does not exist 400
31020 Business is restricted 400
31021 The currency pair is not available for trading, please select another currency pair 400
31022 Minimum order size for this trading area is not met, please select another trading area 400
31023 Ending order processing 400
31024 The order is not completely filled, please go to \"Spot trading\"-\"Current orders\" to cancel the order and then sell or close the operation! 400
31025 The user is not a trader 400
31026 The user is not exist 400
31027 Operation failed, please try again 400
31028 Parameter verification failed 400
31029 User is not existed 400
31030 Chosen trading pair is empty 400
31031 You’re log in as trader,can not follow trade 400
31032 Can not follow trade with yourself 400
31033 Fail to remove 400
31034 This trader’s no. of follower has reached limit, please select other trader 400
31035 Follow order ratio can not less than{0} 400
31036 Follow order ratio can not greater than{0} 400
31037 Follow order count can not less than{0} 400
31038 Exceeds max. limit 400
31039 Can not set reminder as your Elite Trader status has been revoked 400
31040 T/P ratio must between {0}%%-{1}%% 400
31041 S/L ratio must between {0}%%-{1}%% 400
31042 The status of your Elite Trader has been suspended, please contact online customer service to resume. 400
31043 Your copy trade follower cap is too high. Please contact customer support to lower it if you want to enable this function! 400
31044 You are applying to become a trader now. Copying trade is not allowed 400
31045 The max. quantity for TP/SL is {0}. For any quantity exceeding this limit, please operate under “Initiated Copies”. 400
31046 No copy trade relationship is allowed between a parent account and its sub-account 400
31047 No copying is allowed within {0} minutes after the copier has been removed. Please try again later. 400
31048 Only this trader's referrals are allowed to follow this trader at the moment. Please create an account with the trader's referral link! 400
31049 The trader's status is abnormal or has been revoked, and cannot be viewed at this time! 400
31050 This trader UID is already set for the region. 400
31051 traderUserId error 400
31052 Cannot set trading symbol that have not been opened by traders. 400
31053 executePrice cannot exceed triggerPrice 的{0} 400
31054 No order to cancel 400
20001 startTime should be less than endTime 400
22001 No order to cancel 400
22002 No position to close 400
22003 modify price and size, please pass in newClientOid 400
22004 This symbol {0} not support API trade 400
22005 This symbol does not support cross mode 400
22006 limit price > risk price 400
22007 limit price < risk price 400
22008 market price > risk price 400
22009 market price < risk price 400
22010 Please bind ip whitelist address 400
40100 Due to regulatory requirements, Hong Kong IPs are required to complete identity verification first 400
40101 Please complete KYC 400
00001 startTime and endTime interval cannot be greater than 366 days 400
12001 {0} can be used at most 400
12002 Current currency {0}, limit net sell value {1} USD 400
12003 Current currency {0}, limit net buy value {1} USD 400
13001 Withdraw is too frequent 400
13002 Currency does not exist 400
13003 Withdrawal exceeds the monthly limit 400
13004 Your remaining withdrawal amount{0} 400
13005 Failed to generate address 400
60006 Parameter error 400
60007 upload image cannot exceed 5M 400
60008 The image format must be [". jpg", ". jpeg", ". png"] 400
60009 The image format error 400
60010 upload error 400
60011 Ordinary users can not post ads 400
60012 Please change your status from offline to online before posting your ads! 400
60013 Insufficient balance 400
60014 Fiat info not found 400
60015 Digital currency info not found 400
60016 Only supports publish CNY advertisement 400
60017 Not support publish CNY advertisement 400
60018 Your KYC certification only supports publishing {0} 400
60019 Post failed. Unable to obtain preference price 400
60020 advertisement type error 400
60021 Payment method is empty 400
60022 Trading amount incorrect 400
60023 Beyond fiat limit ({0}-{1}) 400
60024 Fund reconciliation errors 400
60025 The remark length cannot be longer than the configuration length 400
60026 Exclusive country error 400
60027 Payment time limit error 400
60028 Payment method error 400
60029 publish advertisement error 400
60030 status error 400
60031 The advertisement number is too long 400
60032 The advertisement not exist 400
60033 Posted ad amount incorrect 400
60034 Number of images attached in the remark cannot exceed the allocation limit. 400
60035 Edit advertisement error 400
60036 payTimeLimit cannot be empty 400
60037 Post failed. Price is significantly deviated from preference price 400
60038 Post failed. Incorrect floating rate 400
60039 User does not exist 400
60040 Unauthorized access not supported 400
60041 Edit advertisement price error 400
60042 limitPrice not empty 400
60043 The advertisement status update fail 400
60044 The advertisement status in editing can be edited 400
60045 Exceeding the number of advertisement that can be published 400
60046 priceValue not empty 400
60047 userPayMethodId not empty 400
40926 Your identity authentication is still under review. Please wait for the review to pass before trying this function again 400
13007 The current currency is {0}, and the net purchase value of {1} USD is limited within 24 hours, and the net purchase value of {2} USD is also allowed for {3} 400
11000 withdraw address is not in addressBook 400
40103 based on your IP address , it appears that you are located in a country or region where we are currently unable to provide services 400
40104 Unable to withdraw to this account Please make sure this is a valid and verified account 400
30001 Minimum Price Change {0} % 400
40928 Risk control, currently your max open size is {0} {1}. The size was calculated with all the main-sub accounts 400
47003 Withdraw address is not in addressBook 400
13008 A single withdrawal exceeds the maximum limit 400
13009 Exceeds withdrawal daily limit 400
32038 The sell price cannot be lower than the trigger price percent{0} 400

WebSocket error codes

Error Message Error Code
Channel does not exist 30001
Illegal request 30002
Invalid op 30003
User needs to log in 30004
Login failed 30005
request too many 30006
request over limit,connection close 30007
Invalid ACCESS_KEY 30011
Invalid ACCESS_PASSPHRASE 30012
Invalid ACCESS_TIMESTAMP 30013
Request timestamp expired 30014
Invalid signature 30015
Param error 30016