Movatterモバイル変換


[0]ホーム

URL:


NAV
console

Welcome

Welcome to Bitget ApiDoc! Clickhere for quick start

Coming Soon

New Feature Forecast

No.InterfaceLaunch DateRemark
1New feature to support auto suppliment marginTBPDeveloping 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:

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

To:

{
  "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"
}

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 UrlRule
/api/mix/v1/account/setLeverage5c/1s
/api/mix/v1/account/setMargin5c/1s
/api/mix/v1/account/setMarginMode5c/1s
/api/mix/v1/account/setPositionMode5c/1s
/api/mix/v1/position/allPosition5c/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 clickhere to subscribe to announcements.

Contact Us

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

FAQ

A : Traders should useTrader Close Position

A : BTCUSDT_UMCBL

A : BTCUSDT

A : Yes

Quick Start

Access Preparation

If you need to use the API, please log in to theweb 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 clickhere 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:

When creating an APIKey, you can bind to an IP address. For security reasons, it is strongly recommended that you bind to an IP address。Risk Warning:These three keys are highly related to account security. Please keep in mind DO NOT DISCLOSESecretkey and Passphrase to anyone at any circumstances, even with BitGet employees.Leaking any one of these three keys may cause the loss of your assets. If you find by any chance that the APIKey is compromized, please delete the APIKey as soon as possible.

SDK/Code Example

openSDK(Recommended)

Java |Python |GoLang |NodeJs |PHP

PostMan(Demo)PostMan

You should first try to config theAPIKey, Secretkey and Passphrase in theEnvironments 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 beSigned.

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 NameREST APIRecommended To Use
Domain 1https://api.bitget.comMain Domain
Domain 2https://capi.bitget.comOld domain

API Verification

Initiate a request

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

//JavaLongtimestamp=System.currentTimeMillis();
//pythonimport timetime.time_ns() / 1000000
//Golangimport("time")int64(time.Now().UnixNano()/1000000)
//JavascriptMath.round(newDate())
//PHPmicrotime(true)*1000;

Signature

The request header of ACCESS-SIGN is to encrypttimestamp + method.toUpperCase() + requestPath + "?" + queryString + body string (+ means string concat) byHMAC SHA256 algorithm withsecretKey. and encode the encrypted result throughBASE64.

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 keysecretkey to encrypt the string to be signed with hmac sha256

Stringpayload=hmac_sha256(secretkey,Message);

 

Step 2. Base64 encoding for Signature.

Stringsignature=base64.encode(payload);

RSA

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

Step 2. Base64 encoding for Signature.

HMAC Signature Code Demo

Java

importlombok.extern.slf4j.Slf4j;importorg.apache.commons.lang3.StringUtils;importjavax.crypto.Mac;importjavax.crypto.spec.SecretKeySpec;importjavax.management.RuntimeErrorException;importjava.io.UnsupportedEncodingException;importjava.security.InvalidKeyException;importjava.security.NoSuchAlgorithmException;importjava.util.Base64;importorg.springframework.util.Base64Utils;@Slf4jpublicclassCheckSign{privatestaticfinalStringsecretKey="";publicstaticvoidmain(String[]args)throwsException{//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 exampleStringtimestamp="1684814440729";StringqueryString="symbol=btcusdt_umcbl&marginCoin=usdt";Stringsign=generate(timestamp,"GET","/api/mix/v1/account/account",queryString,null,secretKey);log.info("sign:{}",sign);}privatestaticMacMAC;static{try{CheckSign.MAC=Mac.getInstance("HmacSHA256");}catch(NoSuchAlgorithmExceptionvar1){thrownewRuntimeErrorException(newError("Can't get Mac's instance."));}}publicstaticStringgenerate(Stringtimestamp,Stringmethod,StringrequestPath,StringqueryString,Stringbody,StringsecretKey)throwsCloneNotSupportedException,InvalidKeyException,UnsupportedEncodingException{method=method.toUpperCase();body=StringUtils.defaultIfBlank(body,StringUtils.EMPTY);queryString=StringUtils.isBlank(queryString)?StringUtils.EMPTY:"?"+queryString;StringpreHash=timestamp+method+requestPath+queryString+body;log.info("preHash:{}",preHash);byte[]secretKeyBytes=secretKey.getBytes("UTF-8");SecretKeySpecsecretKeySpec=newSecretKeySpec(secretKeyBytes,"HmacSHA256");Macmac=(Mac)CheckSign.MAC.clone();mac.init(secretKeySpec);returnBase64.getEncoder().encodeToString(mac.doFinal(preHash.getBytes("UTF-8")));}}

Python

importhmacimportbase64importjsonimporttimedefget_timestamp():returnint(time.time()*1000)defsign(message,secret_key):mac=hmac.new(bytes(secret_key,encoding='utf8'),bytes(message,encoding='utf-8'),digestmod='sha256')d=mac.digest()returnbase64.b64encode(d)defpre_hash(timestamp,method,request_path,body):returnstr(timestamp)+str.upper(method)+request_path+bodydefparse_params_to_str(params):url='?'forkey,valueinparams.items():url=url+str(key)+'='+str(value)+'&'returnurl[0:-1]if__name__=='__main__':API_SECRET_KEY=""timestamp="1685013478665"# get_timestamp()request_path="/api/mix/v1/order/placeOrder"# POSTparams={"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)# GETbody=""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 toSDK

RSA Signature Demo Code

Java

importlombok.extern.slf4j.Slf4j;importorg.apache.commons.lang3.StringUtils;importjavax.crypto.Mac;importjavax.crypto.spec.SecretKeySpec;importjavax.management.RuntimeErrorException;importjava.io.UnsupportedEncodingException;importjava.security.InvalidKeyException;importjava.security.NoSuchAlgorithmException;importjava.util.Base64;@Slf4jpublicclassCheckSign{publicstaticvoidmain(String[]args)throwsException{//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 exampleStringtimestamp="1684814440729";StringpreContent=timestamp+"POST"+"/api/spot/v1/trade/orders";Stringbody="{\"symbol\":\"btcusdt_spbl\",\"quantity\":\"8\",\"side\":\"buy\",\"price\":\"1\",\"orderType\":\"limit\",\"clientOrderId\":\"bitget1233456\"}";StringsignContent=preContent+body;Stringsign=generate(signContent);log.info("sign:{}",sign);}/**   *   * @param content: the string to be signed   * @return   */privateStringgenerate(Stringcontent){StringprivateKey="-----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{StringparsedPem=privateKey.replace("\n","").trim();parsedPem=parsedPem.replace("-----BEGIN PRIVATE KEY-----","").replace("-----END PRIVATE KEY-----","");PKCS8EncodedKeySpecpriPKCS8=newPKCS8EncodedKeySpec(Base64Utils.decodeFromString(parsedPem));KeyFactorykeyFactory=KeyFactory.getInstance("RSA");PrivateKeypriKey=keyFactory.generatePrivate(priPKCS8);Signaturesignature=Signature.getInstance("SHA256WithRSA");signature.initSign(priKey);signature.update(content.getBytes(StandardCharsets.UTF_8));Stringsign=Base64Utils.encodeToString(signature.sign());returnsign;}catch(Exceptionex){thrownewRuntimeException("create sign  failed",ex);}}}

Python

importbase64importjsonimporttimeimportbase64fromCrypto.HashimportSHA256fromCrypto.SignatureimportPKCS1_v1_5fromCrypto.PublicKeyimportRSAdefget_timestamp():returnint(time.time()*1000)defrsa_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)returnbase64.b64encode(sign_str).decode()defpre_hash(timestamp,method,request_path,body):returnstr(timestamp)+str.upper(method)+request_path+bodydefparse_params_to_str(params):url='?'forkey,valueinparams.items():url=url+str(key)+'='+str(value)+'&'returnurl[0:-1]if__name__=='__main__':private_key='''-----BEGIN PRIVATE KEY-----XXXXXXXXXXANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdTR5gmwGH77wEe0ljABC58EVhiw7fPXWhMh7gZwurQQ8M/I9/VA8lDjwwoGuuJ6enurdfwhpZxeZHP3wdmwvD7XLESEXVuxJv5hdpI9m6ydInK9SA8IbaF4yYWp0l4N2mA44MzadA7QZqbQtQPlyPZHeia5q/NZHFWCrCbW2lGAAWwrhQq9LceVIW75e213xtnps0pGlII7YexLkoazuhC1X8YNSxlCdLOiz1GvOeVSeiSZx31o/O+rj7tDFpSgZJEXRmtGRoJkJy10EGSrvUMezCVSOcb1hCExg4osK6rBKnDjFjwQvwvNNZq0JG+CkfH8eHAa7gSK50In51go29AgMBAAECggEAEvYk30hQGu7PH0stQX3UhlVsR6HXnRlvgIrmJe7F/VLOWaZoNdUQLktU/heYY1nsX8+mIyjmvEOayqPgdkEmXevVlcuQf38Zbduynr3vlRCXAJnL9+8GkmucSxFBODuu/EAZc3mm27C2wUV7w6SAy9g0g6Os97ehZsSGAwHl4ayei6KtB07LAA10Eh5Ptq4YAfCYiUO7j10pQ+DJKqN9N1eyjyw5eixEgCpudcbpCc9X+EK6zxk8Ynr0ANX8/LwvokqgYBK1UIL6ear0dtKmeFU+KwrmkKZfXk8/Amr/O8OtiHTTr1SLyQKRzq3La149LMmNkUYxaMSV/KGTEV7ukQKBgQDQl/fA3mxXtQg2IjTBcvDBGhB4c3haECWcP7TQWJDb30vxOKeq1k9YPUfegZga5zlyV28PAZnb0m5x07+0OY4862brT+pje9OhQxfkAY6AtJaiIqhCcw5ew8Go/Ja1ML0jZESWG1MWBJtCcFTmd3+n9yU1fB1Ze0adilYmyu7zwwKBgQDBDPJZgSj7YssPyRmo3bO0MjknfYBqXvwi6TxV11mJRe5BJ9Rc2WXGfEm3DEn7TO/Wv0t7Yqm6/sXg5HzriN/PHlaVtE6wlXe73gpYKjlm99KO7KKWYqP812mASl6ydLX9QWozlOXjVhWMuSGqMWjut4J3P8jlkOJ6pNq9c8/gfwKBgQCxwvAl8ubNj78hsuDWgsddKIMkwvKrfdsvXrMOYouAdLjZJvjsA5q2jfKzUil3s9km8g/479pYlOn+Iv/Z7Lqke8/HdOFASoQ9h1nSuujgEgXUwkg16Ks0Ywqkoi0k2BY3FPnGGh8iQma1pdkUVn35fAq/m7e/S+kP1JY6lPIx1QKBgQCSjxul67KLNrNmpot+ceGt2bseSd8l4jqU3nDZ0oW8+4Qnnu9QFhN4Hn9wIjpAOGaUp+HMKFknB6h+Vbior98JxMSDHsHmuXKPA8DishumGlqV+vxsIzLQD1Ge/dbqsERBolnYEyB7+KyfiyUNqjk5kcPQeHIyJk5qQaF21udoTQKBgDOMbtM0Nq7cd/SAHISRVYIGGXRFNqAjLJW7DRJGxw3AEwxKG+nxNLeG7GsQDyPCvZSKwRpdpXRTh+6mzXqepQ6+33v2gOtez8Cwo6tgyKRi6QPObQk00vbrKEBTihP30m81rwBPzjwj7iKXxWgADJoVsaqGOaIf4qXXXXXXXXXX-----END PRIVATE KEY-----'''timestamp=get_timestamp()request_path="/api/mix/v1/order/placeOrder"# POSTparams={"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)# GETbody=""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 theAPI 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

WordsDescription
fixedIsolated margin
crossedCross margin

holdMode

Position Mode

WordsDescription
single_holdOne-way position
double_holdTwo-way position

holdSide

Position Direction

WordsDescription
longLong position
shortShort position

business

side

tradeSide

Values fordouble_hold

WordsDescription
open_longopen long
open_shortopen short
close_longclose long
close_shortclose short
reduce_close_longForce reduce long position
reduce_close_shortForce reduce short position
offset_close_longForce netting: close long position
offset_close_shortForce netting: close short position
burst_close_longForce liquidation: close long position
burst_close_shortForce liquidation: close short position
delivery_close_longFuture delivery close long
delivery_close_shortFuture delivery close short

Values forsingle_hold

WordsDescription
buy_singleBuy in single_hold mode
sell_singleSell in single_hold mode
reduce_buy_singleForce reduce buy in single_hold mode
reduce_sell_singleForce reduce sell in single_hold mode
burst_buy_singleForce liquidation: buy in single_hold mode
burst_sell_singleForce liquidation: sell in single_hold mode
delivery_buy_singleFuture delivery buy in single_hold mode
delivery_sell_singleFuture delivery sell in single_hold mode

timeInForceValue

WordsDescription
normalgood till cancel, default value
post_onlymaker only
fokfill or kill
iocimmediately or cancel

orderType

state

order status

WordsDescription
initinitial order, inserted into DB
newnew order, pending match in orderbook
partially_filledPartially Filled
filledFilled
canceledCanceled

triggerType

WordsDescription
fill_pricefill price
market_pricemark price

planType

WordsDescription
profit_planprofit order
loss_planloss order
normal_planplan order
pos_profitposition profit
pos_lossposition loss
moving_planTrailing TP/SL
track_planTrailing Stop

isPlan

WordsDescription
planplan order, Trailing Stop
profit_lossprofit order, loss order, position profit, position loss, Trailing TP/SL

planStatus

WordsDescription
not_triggerorder not yet trigger
triggeredorder triggered
fail_triggerorder trigger failed
cancelorder cancel

enterPointSource

WordsDescription
WEBCreated from Web
APICreated from API
SYSCreated from System, usually force liquidation order
ANDROIDCreated from Android system
IOSCreated from IOS system

stopType

Websocket planType

symbolStatus

fullStatus

sortRule

sortFlag

languageType

marginType

leverType

traceType

orderSource

WordsDescription
normalnormal order
marketmarket order
profit_marketmarket profit order
loss_marketmarket loss order
Trader_delegatetrader copy trader
trader_profittrader profit
trader_losstrader loss
reversereverse order
trader_reversetrader reverse order
profit_limitlimit profit order
loss_limitlimit loss order
liquidationliquidation order
delivery_close_longdelivery close long order
delivery_close_shortdelivery close short order
pos_profit_limitposition limit profit order
pos_profit_marketposition market profit order
pos_loss_limitposition limit loss order
pos_loss_marketposition 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- sumcblUSDT simulation perpetual contract- sdmcblUniversal margin simulation perpetual contract- scmcblUSDC 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- sumcblUSDT simulation perpetual contract- sdmcblUniversal margin simulation perpetual contract- scmcblUSDC 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- sumcblUSDT simulation perpetual contract- sdmcblUniversal margin simulation perpetual contract- scmcblUSDC 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_planTrailing Stop- moving_planTrailing 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 NameParameter TypeRequiredDescription
productTypeStringYesproduct type

Request Example

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

Response

{"code":"00000","data":[{"baseCoin":"BTC","baseCoinDisplayName":"BTC","buyLimitPriceRatio":"0.01","feeRateUpRatio":"0.005","makerFeeRate":"0.0002","minTradeNum":"0.001","openCostUpRatio":"0.01","priceEndStep":"5","pricePlace":"1","quoteCoin":"USDT","quoteCoinDisplayName":"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

ParameterDescription
symbolSymbol Id, BTCUSDT_UMCBL
symbolNameSymbol name, BTCUSDT, might be empty
symbolDispalyNameSymbol display name, e.g. BTCUSDT, might be empty
baseCoinBase currency, BTC
quoteCoinQuote currency, USDT
baseCoinDisplayNameBase coin display name, e.g. BTC
quoteCoinDisplayNameQuote coin display name, e.g. USDT
buyLimitPriceRatioBuy price limit ratio, 0.02 means 2%
sellLimitPriceRatioSell price limit ratio, 0.01 means 1%
feeRateUpRatioRate of increase in handling fee, 0.005 means 0.5%
makerFeeRateMaker fee rate, 0.0002 means 0.02%
takerFeeRateTaker fee rate, 0.0006 means 0.06%
openCostUpRatioPercentage of increase in opening cost, 0.01 means 1%
supportMarginCoinsSupport margin currency array
minTradeNumMinimum number of openings(Base Currency)
priceEndStepPrice 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)
volumePlaceNumber of decimal places
pricePlacePrice scale precision, i.e. 1 means 0.1; 2 means 0.01
sizeMultiplierQuantity Multiplier The order size must be greater than minTradeNum and satisfy the multiple of sizeMultiplier
symbolTypefuture typeperpetual perpetual contractdelivery delivery contract
symbolStatusSymbol Status
offTimedelist time, '-1' means online symbol
limitOpenTimeprohibit 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 nameParameter TypeRequireddescribe
symbolStringYesTrading pair name, for example: BTCUSDT_UMCBL
precisionStringNoPrice 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.
limitStringNoFixed 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 nameParameter Typefield description
asksArrayAll 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
bidsArrayAll sell orders at the current price
precisionStringCurrent gear, for example: scale 1
scaleStringThe actual precision value, for example: 0.1
isMaxPrecisionStringYES means it is already the maximum precision, NO is not the maximum precision
tsStringThe 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 NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
limitStringNoDepth 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 NameParameter TypeRequiredDescription
symbolStringYesSymbol 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

ParameterDescription
symbolSymbol Id
lastLatest price
bestAskAsk1 price
bestBidBid1 price
bidSzAsk1 size
askSzBid1 size
high24hHighest price in 24 hours
low24hLowest price in 24 hours
timestampTimestamp (milliseconds)
priceChangePercentPrice change (24 hours)
baseVolumeBase currency trading volume
quoteVolumeQuote currency trading volume
usdtVolumeUSDT transaction volume
openUtcUTC0 open price
chgUtcUTC0 price change(24 hour)
indexPriceIndex price
fundingRateFunding rate
holdingAmountHolding amount, unit in base coin

Get All Symbol Ticker

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
productTypeStringYesproduct 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

ParameterDescription
symbolSymbol Id
lastLatest price
bestAskAsk price
bestBidBid price
bidSzAsk1 size
askSzBid1 size
high24hHighest price in 24 hours
low24hLowest price in 24 hours
timestampTimestamp (milliseconds)
priceChangePercentPrice change (24 hours)
baseVolumeBase currency trading volume
quoteVolumeQuote currency trading volume
usdtVolumeUSDT transaction volume
openUtcUTC0 open price
chgUtcUTC0 price change (24hour)
indexPriceIndex price
fundingRateFunding rate
holdingAmountHolding 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 nameParameter typeRequiredDescription
levelIntegerYesVIP level
dealAmountBigDecimalYesTransaction volume (USDT) within 30 days
assetAmountBigDecimalYesAsset amount (USDT)
takerFeeRateBigDecimalNoTaker fee rate, actual fee rate please refer to official announcement when '0'
makerFeeRateBigDecimalNoMaker fee rate, actual fee rate please refer to official announcement when '0'
withdrawAmountBigDecimalYes24 hours withdraw amount (BTC)
withdrawAmountUSDTBigDecimalYes24 hours withdraw amount (USDT)

Get Recent Fills

Get recent 100 trades.

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
limitStringNoDefault 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

ParameterDescription
tradeIdtradeId
priceprice
sizesize
sideside
timestamptimestamp, ms
symbolsymbol

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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 NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
limitStringNoDefault is 500, Max is 1000
tradeIdStringNotradeId, return records with 'tradeId' less than the provided value
startTimeStringNostartTime, ms
endTimeStringNoendTime, 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

ParameterDescription
tradeIdtradeId, desc
priceprice
sizesize, base coin
sideside, Buy/Sell
timestamptimestamp, ms
symbolsymbol

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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 NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
granularityStringYesTypes ofcandlestick interval
startTimeStringYesStart 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
endTimeStringYesEnd 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
kLineTypeStringNok-line type: 'market mark index'; Default 'market'
limitStringNoDefault 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

ParameterIndex
Timestamp in milliseconds0
Opening price1
Highest price2
Lowest price3
Closing price, value of the latest candle stick might change, please try subscribe the websocketcandlestick channel for the updates4
Base currency trading volume5
Quote currency trading volume6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Get History Candle Data

Limit rule: 20 times/1s (IP)

Get history candle data, max return 200 rows

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
granularityStringYesTypes ofcandlestick interval
startTimeStringYesStart 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
endTimeStringYesEnd 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
limitStringNoDefault 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

ParameterIndex
Timestamp in milliseconds0
Opening price1
Highest price2
Lowest price3
Closing price, value of the latest candle stick might change, please try subscribe the websocketcandlestick channel for the updates4
Base currency trading volume5
Quote currency trading volume6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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 NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
granularityStringYesTypes ofcandlestick interval
startTimeStringYesStart 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
endTimeStringYesEnd 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
limitStringNoDefault 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

ParameterIndex
Timestamp in milliseconds0
Opening price1
Highest price2
Lowest price3
Closing price, value of the latest candle stick might change, please try subscribe the websocketcandlestick channel for the updates4
Base currency trading volume5
Quote currency trading volume6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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 NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
granularityStringYesTypes ofcandlestick interval
startTimeStringYesStart 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
endTimeStringYesEnd 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
limitStringNoDefault 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

ParameterIndex
Timestamp in milliseconds0
Opening price1
Highest price2
Lowest price3
Closing price, value of the latest candle stick might change, please try subscribe the websocketcandlestick channel for the updates4
Base currency trading volume5
Quote currency trading volume6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Get Symbol Index Price

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol 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

ParameterDescription
symbolSymbol Id
indexIndex price
timestampTimestamp, milliseconds

 

 

 

 

 

 

 

Get Symbol Next Funding Time

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol 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

ParameterDescription
symbolSymbol ID
fundingTimeNext settlement time, milliseconds

Get History Funding Rate

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
pageSizeintNoPage size default 20
pageNointNoPage No.
nextPageBooleanNoWhether 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

ParameterDescription
symbolSymbol name
fundingRateCurrent funding rate
settleTimeSettlement time

Get Current Funding Rate

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol 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

ParameterDescription
symbolSymbol Id
fundingRateCurrent funding rate

Get Open Interest

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol 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

ParameterDescription
symbolSymbol ID
amountTotal platform open interest
timestampTimestamp (milliseconds)

Get Symbol Mark Price

Limit rule: 20 times/1s (IP)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol 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

ParameterDescription
symbolSymbol Id
markPriceMark price
timestampTimestamp (milliseconds)

Get Symbol Leverage

Limit rule: 20/sec (IP)

HTTP Request

Request Parameter

Parametertyperequireddescription
symbolStringYessymbol 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

ParameterDescription
symbolsymbol id
minLeveragemin leverage
maxLeveragemax leverage

Get Position Tier

Limit rule: 20/sec (IP)

HTTP Request

Request Parameter

Parametertyperequireddescription
symbolStringYessymbol Id (Must be capitalized)
productTypeStringYesproduct 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

ParameterDescription
levelTier
startUnitStart value
endUnitEnd value
leverageLeverage multiple
keepMarginRateMargin 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

ParameterDescription
symbolSymbol name
posLimitThe 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 NameParameter TypeRequiredDescription
symbolStringYessymbol Id (Must be capitalized)
marginCoinStringYesMargin 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

ParameterDescription
marginCoinMargin currency
lockedLocked amount (margin currency), system will lock when close position
availableAvailable balance(margin currency)
crossMaxAvailableThe maximum available balance for crossedmargin mode(margin currency)
fixedMaxAvailableThe maximum available balance for fixedmargin mode(margin currency)
maxTransferOutMaximum transferable
equityAccount equity (margin currency) , includes uPnL (calculated by mark price)
usdtEquityAccount equity convert to USDT,
btcEquityAccount equity convert to BTC
crossRiskRateRisk ratio at crossedmargin mode
crossMarginLeverageLeverage level for crossedmargin mode
fixedLongLeverageLong leverage with isolated(fixed)margin mode
fixedShortLeverageShort leverage with isolated(fixed)margin mode
marginModeMargin mode
holdModeHold mode
unrealizedPLunrealized profit and loss at crossedmargin mode, unit in USDT
crossedUnrealizedPLcurrent symbol unrealized profit and loss at crossedmargin mode, unit in USDT
isolatedUnrealizedPLcurrent symbol unrealized profit and loss at isolatedmargin mode, unit in USDT
bonuscoupon

Get Account List

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
productTypeStringYesproduct 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

ParameterDescription
marginCoinMargin currency
lockedLocked amount (margin currency)
availableAvailable balance(margin currency)
crossMaxAvailableThe maximum available balance for crossedmargin mode(margin currency)
fixedMaxAvailableThe maximum available balance for isolated(fixed)margin mode(margin currency)
maxTransferOutMaximum transferable
equityAccount equity (margin currency), includes uPnL (calculated by mark price)
usdtEquityAccount equity convert to USDT
btcEquityAccount equity convert to BTC
crossRiskRateRisk ratio at crossedmargin mode
unrealizedPLunrealized profit and loss
bonuscoupon

Get sub Account Contract Assets

Limit rule: 1 times/10s (uid)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
productTypeStringYesproduct 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

ParameterDescription
marginCoinMargin currency
lockedLocked amount (margin currency)
availableAvailable balance(margin currency)
crossMaxAvailableThe maximum available balance for crossedmargin mode(margin currency)
fixedMaxAvailableThe maximum available balance for isolated(fixed)margin mode(margin currency)
maxTransferOutMaximum transferable
equityAccount equity (margin currency)
usdtEquityAccount equity convert to USDT
btcEquityAccount equity convert to BTC
unrealizedPLUnrealized Profit or Lost
bonusCoupon

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 NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin currency (Must be capitalized)
openPriceBigDecimal in String formatYesOpening price
leverageInt value in String formatNoDefault leverage is 20
openAmountBigDecimal in String formatYesOpening 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 NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin currency (Must be capitalized)
leverageStringYesLeverage
holdSideStringNoPositiondirection (ignore this field ifmarginMode 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

ParameterDescription
symbolSymbol Id
marginCoinMargin currency
longLeverageLong leverage
shortLeverageShort leverage
marginModeMargin Mode

Change Margin

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin currency (Must be capitalized)
amountStringYesMargin amount, positive: add margin, negative: reduce margin
holdSideStringNoPositiondirection (ignore this field ifmarginMode 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 NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin currency (Must be capitalized)
marginModeStringYesMargin 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

ParameterDescription
symbolSymbol Id
marginCoinMargin currency
longLeverageLong leverage
shortLeverageShort leverage
marginModeMargin mode

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Set Auto Margin

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin currency (Must be capitalized)
holdSideStringYeslong / short
autoMarginStringYeson/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 NameParameter TypeRequiredDescription
productTypeStringYesproduct type
holdModeStringYesHold 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

ParameterDescription
symbolSymbol Id
marginCoinMargin currency
dualSidePositionboolean, true: "double_hold"; false: "single_hold"

 

 

 

 

 

 

 

 

Get Symbol Position

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYessymbol Id (Must be capitalized)
marginCoinStringYesMargin 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

ParameterDescription
symbolSymbol Id
marginCoinMargin currency
holdSidePositiondirection
openDelegateCountOpen amount pending to fill (base currency)
marginMargin quantity (margin currency)
autoMarginAuto suppliment margin:offon
availablePosition available (Quote currency)
lockedPosition locked (Quote currency)
totalTotal position (available + locked)
leverageLeverage
achievedProfitsRealized profit and loss
averageOpenPriceAverage opening price
marginModeMargin mode
holdModePosition mode
unrealizedPLUnrealized profit or loss
keepMarginRatekeep margin rate
marketPricemark price
cTimeCreated 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 NameParameter TypeRequiredDescription
symbolStringYessymbol Id (Must be capitalized)
marginCoinStringYesMargin 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

ParameterDescription
symbolSymbol Id
marginCoinMargin currency
holdSidePositiondirection
openDelegateCountOpen amount pending to fill (base currency)
marginMargin quantity (margin currency)
autoMarginAuto suppliment margin:offon
availablePosition available (Quote currency)
lockedPosition locked (Quote currency)
totalTotal position (available + locked)
leverageLeverage
achievedProfitsRealized profit and loss
averageOpenPriceAverage opening price
marginModeMargin mode
holdModePosition mode
unrealizedPLUnrealized profit or loss
liquidationPriceestimated liquidation price
keepMarginRatekeep margin rate
marketPricemark (typo) price
cTimeLast update time Timestamp milliseconds

Get All Position

Limit rule: 5 times/1s (uid)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
productTypeStringYesProduct type
marginCoinStringNoMargin 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

ParameterDescription
symbolSymbol Id
marginCoinMargin currency
holdSidePosition direction
openDelegateCountOpened amount pending to fill (trading currency)
marginMargin quantity (margin currency)
autoMarginAuto suppliment margin:offon
availablePosition available (Quote currency)
lockedPosition locked (Quote currency)
totalTotal position (available + locked)
leverageLeverage
achievedProfitsRealized profit and loss
averageOpenPriceAverage opening price
marginModeMargin mode
holdModePosition mode
unrealizedPLUnrealized profit and loss
keepMarginRatekeep margin rate
marketPricemarket price
cTimeLast 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 NameParameter TypeRequiredDescription
productTypeStringYesProduct type
marginCoinStringNoMargin 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

ParameterDescription
symbolSymbol Id
marginCoinMargin currency
holdSidePosition direction
openDelegateCountOpened amount pending to fill (trading currency)
marginMargin quantity (margin currency)
autoMarginAuto suppliment margin:offon
availablePosition available (Quote currency)
lockedPosition locked (Quote currency)
totalTotal position (available + locked)
leverageLeverage
achievedProfitsRealized profit and loss
averageOpenPriceAverage opening price
marginModeMargin mode
holdModePosition mode
unrealizedPLUnrealized profit and loss
liquidationPriceestimate liquidation price
keepMarginRatekeep margin rate
marketPricemarket price
cTimeLast position create time Timestamp milliseconds
uTimeLast update time Timestamp milliseconds

Get History Position

Only supports Query within 3 months

Limit rule: 20c/1s (uid)

HTTP Request

Request Parameter(Request Param)

ParametertypeRequiredDescription
productTypeStringNoBusiness type Default umcbl If symbol is passed, this field will be invalid
symbolStringNosymbolId
pageSizeIntNodefault 20 Max 100
startTimeStringYesstartTime,eg:1597026383085. (For Managed Sub-Account, the StartTime cannot be earlier than the binding time)
endTimeStringYesendTime,eg:1597026383011 Maximum interval 90 days
lastEndIdStringNolastEndId

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

parameterdescription
symbolSymbol Id
marginCoinMargin currency
holdSidePosition direction
openAvgPriceopen average price
closeAvgPriceclose average price
marginModeMargin mode
openTotalPosopen position size (accumulate)
closeTotalPosclose position size (accumulate)
pnlrealized profit and loss
netProfitnet profit and loss
totalFundingFunding costs (Funding costs Cumulative)
openFeeTotal handling fee for position opening
closeFeeTotal handling fee for position closing
cTimeLast update time Timestamp milliseconds
uTimeLast update time Timestamp milliseconds

Get Account Bill

Records within 90 days

Limit rule: 10/sec (uid)

HTTP Request

Request (Request Param)

Parametertyperequireddescription
productTypeStringNoProduct Type, choose one in: 'symbol' and 'productType'
symbolStringNoSymbol Id (Deprecated)
marginCoinStringYesmargin coin
startTimeStringYesStart Time, milliseconds
endTimeStringYesend time, milliseconds
pageSizeintNopage size, default 20, max is 100
businessStringNoBill business type
lastEndIdStringNolast 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

ParameterDescription
idrecord ID
symbolSymbol Id, might be null
marginCoinmargin Coin
amountcharge amount
feefee
feeByCouponfee deduction coupon
feeCoinfee coin
businessbusiness
cTimecreate time
lastEndIdlast end Id, will return whennext set to true

Get Business Account Bill

Records within 90 days

Limit rule: 5/sec (uid)

HTTP Request

Request (Request Param)

Parametertyperequireddescription
productTypeStringYesProduct Type
businessStringNoaccount bill business type
startTimeStringYesStart Time, millisecond
endTimeStringYesend time, millisecond
pageSizeintNopage size, default 20, max is 100
lastEndIdStringNolast end Id of last query
nextbooleanNoWhether 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

ParameterDescription
idrecord no
symbolSymbol Id
marginCoinmargin Coin
amountcharge amount
feefee
feeByCouponfee deduction coupon
feeCoinfee coin
businessbusiness type
cTimecreate time
lastEndIdlast end Id, will return whennext 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 callCopyTrade ->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 meetpricePlace andpriceEndStepvolumePlace, those fields could be found from the response ofMarket ->Get All Symbols

for example:

pricePlace ofBTCUSDT_UMCBL is 1 andpriceEndStep 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 ofETHUSDT_UMCBL is 2 andpriceEndStep 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.

Note if this error occurs when placing an order
{ "code":"40762", "msg":"The order size is greater than the max open size", "requestTime":1627293504612}

High frequency error when close position:

Note if this error occurs when closing an order
{ "code": "40757", "msg": "Not enough position is available.", "requestTime": 1666268894074, "data": null}

There are two scenarios where this error would happen

  • 0 position
  • Position exists,but specify a wrongside param when closing. For example: you have along position, and try to close it withside=close_short

Hold mode = double_hold- if specify asize greater than theposition size when closing position, the order will success withactual position size, that is, reduceOnly.

Hold mode = single_hold + reduceOnly=false

  • you are holding 1.0 long BTCUSDT
  • try to close the long BTCUSDT with size: 3.0 in market price
  • place order interface return success, 1.0 long position will be closed, and 2.0 short position will be opened

Hold mode = single_hold + reduceOnly=true

  • you are holding 1.0 long BTCUSDT
  • try to close the long BTCUSDT with size: 2.0 in market price
  • place order interface return failure
  • try to close the long BTCUSDT with size: 0.5 in market price
  • place order interface return success, position changes to 0.5 long BTCUSDT
  • try to close the long BTCUSDT with size: 0.5 in market price
  • place order interface return success, position changes to 0

 

 

 

 

 

Unknown error

Note if below error occurs when operating an order, please DO query order detail with the clientOid to get the final status
{ "code": "40010", "msg": "Request timed out", "requestTime": 1666268894074, "data": null}
{ "code": "40725", "msg": "service return an error", "requestTime": 1666268894071, "data": null}
{ "code": "45001", "msg": "Unknown error", "requestTime": 1666268894071, "data": null}

HTTP Request

  • POST /api/mix/v1/order/placeOrder

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id
marginCoinStringYesMargin currency
sizeStringYesOrder quantity, base coin
priceStringNoOrder price (not required at market price)
sideStringYesOrder direction
orderTypeStringYesOrder type
timeInForceValueStringNoTime in force
clientOidStringNoUnique client order ID, The idempotent is promised but only within 30 days
reduceOnlyBooleanNoDefault 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
presetTakeProfitPriceStringNoPreset take profit price
presetStopLossPriceStringNoPreset stop loss price
For single hold mode:
orderType could be either limited or market
Order direction could be either buy_single or sell_single, the position could ONLY exists on one side: long or shortFor example
Assumed you're holding buy_single BTCUSDT_UMCBL size=0.1, follow below instructions step by step to placeOrder:
1) first time sell_single + reduceOnly=false size=0.05: 0.05 position will be closed, you still have buy_single size=0.05
2) seconds order: sell_single + reduceOnly=false size=0.1: remain position 0.05 will be closed, buy_single size=0, sell_single size=0.05 will be opened
3) final order: sell_single + reduceOnly=false size=0.15: sell_single position size will increase 0.15, at the end sell_single size=0.2
If receive a response like below:
{
"code":"45116",
"msg":"The count of positions hold by the account exceeds the maximum count 150",
"requestTime":1669910904315,
"data":null
}

Please noted that for a business line like: USDT perpetual contract, if counted existing positions + open orders > 150, you will get above response
PS: USDC perpetual contract will be counted separately, same as universal margin perpetual contractThe limitation would change with time, please be alert with our notifications

Response Data

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

Response Description

ParameterDescription
orderIdOrder 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 ordersize 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 useclientOid as the main key when placing an order)
clientOidClient custom Id

If client does not passclientOid , 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 side2) "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 condition2) "side" value: sell_single when position side is buy_single, buy_single when position side is sell_single

Note: Your position will be closed atmarket price and open in reverseside 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 originallyside is open_long, then in reversal you should set theside to close_long;If originallyside is open_short, then in reversal you should set theside to close_short;Usesell_single when original positionside isbuy_single,Usebuy_single when original positionside issell_single;

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

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id
marginCoinStringYesMargin currency
sizeStringNoOrder quantity size = close_size = open_reverse_size; this param will be omitted in single_hold mode
sideStringYesOrder direction, set to close_long or close_short in double_hold mode; set to buy_single or sell_single in single_hold mode
orderTypeStringYesOrder type: market
clientOidStringNoUnique Client ID
timeInForceValueStringNoset to 'normal'
reverseBooleanNoDefaultfalse: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

ParameterDescription
orderIdOrder Id
clientOidClient custom Id

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Batch Order

Limit rule: 10 times/1s (uid)

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

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin currency (Must be capitalized)
orderDataListListYesOrder data list, maximum size: 50

orderDataList

Maximum 50 orders

Parameter NameParameter TypeRequiredDescription
sizeStringYesOrder quantity
priceStringNoOrder price, quote coin
sideStringYesOrder direction
orderTypeStringYesOrder type
timeInForceValueStringNoTime In Force
clientOidStringNoUnique 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

ParameterDescription
orderInfoSuccessful order array
> orderIdOrder Id
> clientOidClient custom Id
failureFailure order array
> orderIdOrder Id, might be empty
> clientOidClient custom Id
> errorMsgFail reason

 

 

 

 

  

 

 

 

 

Cancel Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin currency (Must be capitalized)
orderIdStringNoOrder Id, int64 in string format, 'orderId' or 'clientOid' must have one
clientOidStringNoClient 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

ParameterDescription
orderIdOrder Id
clientOidClient custom Id

Batch Cancel Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin currency (Must be capitalized)
orderIdsString arrayNoOrder Id list, int64 in string format, 'orderIds' or 'clientOids' must have one
clientOidsString arrayNoClient 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

ParameterDescription
symbolSymbol Id
order_idsOrder Id array
client_order_idsClient Order Id array
fail_infosFailed information array
> order_idFailed order id
> err_codeError code
> err_msgerror msg

Modify Order

Limit rule: 10c/1s (uid)

HTTP Request

Request Parameter(Request Body)

ParameterTypeRequiredDescription
orderIdStringNolimit order Id
clientOidStringNocustom clientId , If both are passed, the orderId is the main
newClientOidStringNonew custom clientOid
symbolStringYesOrder symbol
sizeStringNoorder size
priceStringNoorder price
presetTakeProfitPriceStringNoPreset take profit price
presetStopLossPriceStringNoPreset 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 NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin 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

ParameterDescription
symbolSymbol Id
order_idsOrder Id array
client_order_idsClient Order Id array
fail_infosFailed information array
> order_idFailed order id
> err_codeError code
> err_msgerror msg

Cancel All Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
productTypeStringYesProduct type
marginCoinStringYesMargin 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

ParameterDescription
order_idsCancel success order Id list
client_order_idsCancel success client order ID list
fail_infoscancel failed information
> symbolSymbol Id
> order_idFailed order id
> clientOidclient order ID
> err_codeError code
> err_msgError message

Close All Position

Limit rule: 1 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
productTypeStringYesProduct 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

ParameterDescription
orderInfoclose order Id list
> symbolSymbol Id
> orderIdorder id
> clientOidclient order ID
failureclose failed list
> symbolSymbol Id
> orderIdorder id
> clientOidclient order ID
> errorCodeError code
> errorMsgError 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 toGet History Orders

For the TPSL order please refer toGet Plan Order (TPSL) List

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYessymbol 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

ParameterDescription
symbolSymbol id
sizeOrder size
orderIdOrder Id
clientOidClient custom id
filledQtyTransaction volume, base coin
feeTransaction fee
priceOrder price
priceAvgAverage price
stateOrder state
sideOrder direction
timeInForceTime In Force
totalProfitsTotal profit and loss
posSidePosition direction
marginCoinMargin currency
filledAmountFilled Amount, quote coin
leverageleverage
marginModeMargin mode
reduceOnlyIs reduce only
enterPointSourceenterPointSource
tradeSideTrade Side
holdModeHold mode
orderTypeOrder type
orderSourceorderSource
cTimeCreated update time
uTimeLast update time

Get All Open Order

Limit rule: 20 times/1s (uid)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
productTypeStringYesproductType
marginCoinStringNomargin 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

ParameterDescription
symbolSymbol Id
sizeOrder size
orderIdOrder Id
clientOidClient custom id
filledQtyTransaction volume
feeTransaction fee
priceOrder price
stateOrder state
sideOrder direction
timeInForceTime In Force
totalProfitsTotal profit and loss
posSidePosition direction
marginCoinMargin currency
orderTypeOrder type
presetTakeProfitPriceTake profit price
presetStopLossPriceStop Loss Price
filledAmountfilledAmount
leverageleverage
marginModemarginMode
reduceOnlyreduceOnly
enterPointSourceenterPointSource
tradeSidetradeSide
holdModeholdMode
orderSourceorderSource
cTimeCreated time
uTimeLast update time

Get History Orders

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
startTimeStringYesStart time, milliseconds
endTimeStringYesEnd time, milliseconds
pageSizeStringYesPage size
lastEndIdStringNolast end Id of last query
clientOidStringNomatch exactly with the given 'clientOid'
isPreBooleanNotrue: 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

ParameterDescription
symbolSymbol Id
sizeOrder size
orderIdOrder Id
clientOidClient order id
filledQtyTransaction volume
feeTransaction fee
priceOrder price
priceAvgOrder fill avg price
stateOrder state
sideOrder direction
timeInForceTime In Force
totalProfitsTotal profit and loss
posSidePosition direction
marginCoinMargin currency
leverageorder leverage
marginModeMargin mode
orderTypeOrder type
reduceOnlyis reduce only
enterPointSourceenterPointSource
tradeSideTrade Side
holdModeHold mode
orderSourceorderSource
cTimecreate time
uTimelast update time

Get ProductType History Orders

Limit rule: 5/1s (uid)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
productTypeStringYesProduct type
startTimeStringYesStart time, milliseconds. (For Managed Sub-Account, the StartTime cannot be earlier than the binding time)
endTimeStringYesEnd time, milliseconds
pageSizeStringYespage size, max 100
lastEndIdStringNoLast query endId
clientOidStringNomatch exactly with the given 'clientOid'
isPreBooleanNotrue: 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

ParameterDescription
symbolSymbol Id
sizeOrder size
orderIdOrder Id
clientOidClient custom id
filledQtyTransaction volume
feeTransaction fee
priceOrder price
priceAvgOrder fill avg price
stateOrder state
sideOrder direction
timeInForceTime In Force
totalProfitsTotal profit and loss
posSidePosition direction
marginCoinMargin currency
leverageorder leverage
marginModeaccountMargin mode
orderTypeOrder type
reduceOnlyis reduce only
enterPointSourceenterPointSource
tradeSideTrade Side
holdModeHold mode
orderSourceorderSource
cTimecreate time
uTimelast update time

Get Order Details

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Param)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
orderIdStringNoOrder Id, int64 in string format, 'orderId' or 'clientOid' must have one
clientOidStringNoCustomized 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

ParameterDescription
symbolSymbol Id
sizeOrder size
orderIdOrder Id
clientOidClient custom id
filledQtyTransaction volume
priceAvgTransaction price
feeTransaction fee
priceOrder price
stateOrder state
sideOrder direction
timeInForceTime In Force
totalProfitsTotal profit and loss
posSidePosition direction
marginCoinMargin currency
cTimecreate time
uTimeupdate time
presetTakeProfitPricePreset take profit price
presetStopLossPricePreset stop loss price
filledAmountfilled amount, limit/market
orderTypeorder type
leverageleverage
marginModeMargin Mode
reduceOnlyIs reduce only
enterPointSourceenterPointSource
tradeSideTrade Side
holdModeHold mode
orderSourceorderSource
cTimeCreated time, ms
uTimeUpdated time, ms

Get Order fill detail

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Param)

ParameterTypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
orderIdStringNoOrder Id
startTimeStringNoStart time (timestamp in milliseconds) This field is required if orderId is empty. (For Managed Sub-Account, the StartTime cannot be earlier than the binding time)
endTimeStringNoEnd time (timestamp in milliseconds) This field is required if orderId is empty
lastEndIdStringNoPagination 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

ParameterDescription
tradeIdTrade Id
symbolSymbol Id
orderIdOrder Id
priceTransaction price
sizeQtyTransaction volume
feeTransaction fee
sideTrade side
fillAmountfill Amount
profitprofit
enterPointSourceenterPointSource
tradeSideTrade Side
holdModeHold mode
takerMakerFlagtaker, maker
cTimeTrade time

Get ProductType Order fill detail

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Param)

ParameterTypeRequiredDescription
productTypeStringYesProduct type
startTimeStringNoStart time (timestamp in milliseconds) This field is required if querying all details. (For Managed Sub-Account, the StartTime cannot be earlier than the binding time)
endTimeStringNoEnd time (timestamp in milliseconds) This field is required if querying all details
lastEndIdStringNoQuery 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

ParameterDescription
tradeIdTrade Id
symbolSymbol Id
orderIdOrder Id
priceTransaction price
sizeQtyTransaction volume
feeTransaction fee
sideTrade side
fillAmountfill Amount
profitprofit
enterPointSourceenterPointSource
tradeSideTrade Side
holdModeHold mode
takerMakerFlagtaker, maker
cTimeTrade time

Place Plan order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Body)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin currency (Must be capitalized)
sizeStringYesOrder quantity
executePriceStringNoExecute price, could not be null when orderType=limit
triggerPriceStringYesTrigger price
sideStringYesOrder side
orderTypeStringYesOrder type
triggerTypeStringYesTrigger type
clientOidStringNoUnique Client ID, idempotent is only promised within 24 hours
presetTakeProfitPriceStringNoPreset take profit price
presetStopLossPriceStringNoPreset stop loss price
reduceOnlyStringNoDefault 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

ParameterDescription
clientOidClient custom Id
orderIdOrder Id

Modify Plan Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Body)

Parameter NameParameter TypeRequiredDescription
orderIdStringNoPlan order Id, 'orderId' or 'clientOid' must have one
clientOidStringNoClient order Id, 'orderId' or 'clientOid' must have one
marginCoinStringYesMargin currency
symbolStringYesSymbol Id
executePriceStringNoStrike price, could not be null when orderType=limit
triggerPriceStringYesTrigger price
triggerTypeStringYesTrigger type
orderTypeStringYesOrder 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

ParameterDescription
clientOidClient custom Id
orderIdOrder Id

Modify Plan Order TPSL

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Body)

Parameter NameParameter TypeRequiredDescription
orderIdStringNoPlan order Id, 'orderId' or 'clientOid' must have one
clientOidStringNoClient order Id, 'orderId' or 'clientOid' must have one
marginCoinStringYesMargin currency (Must be capitalized)
symbolStringYesSymbol Id (Must be capitalized)
presetTakeProfitPriceStringNoTake profit price If it is empty, cancel and take profit
presetStopLossPriceStringNoStop 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

ParameterDescription
clientOidClient custom Id
orderIdOrder 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 NameParameter TypeRequiredDescription
marginCoinStringYesMargin currency (Must be capitalized)
symbolStringYesSymbol Id (Must be capitalized)
planTypeStringYesplan type, please use "profit_plan", "loss_plan" and "moving_plan"
triggerPriceStringYesTrigger price
triggerTypeStringNoTrigger Type default 'fill_price'
holdSideStringYesHold Side, Whether this position is long or short
sizeStringNoOrder Quantity Default Position Quantity
rangeRateStringNoOnly works when planType is "moving_plan", "1" means 1.0% price correction, two decimal places
clientOidStringNoCustomized 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

ParameterDescription
clientOidClient custom Id
orderIdOrder Id

Place Trailing Stop Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
marginCoinStringYesMargin currency (Must be capitalized)
symbolStringYesSymbol Id (Must be capitalized)
triggerPriceStringYesTrigger price
triggerTypeStringNoTrigger Type
sizeStringYesOrder Quantity, please provide value less than 'available position size'
sideStringYesOrder side
rangeRateStringYes"1" means 1.0% price correction, max "10"
clientOidStringNoCustomized 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

ParameterDescription
clientOidClient custom Id
orderIdOrder 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 NameParameter TypeRequiredDescription
marginCoinStringYesMargin currency (Must be capitalized)
symbolStringYesSymbol Id (Must be capitalized)
planTypeStringYesplan type, please use "pos_profit", "pos_loss"
triggerPriceStringYesTrigger price
triggerTypeStringYesTrigger type
holdSideStringYesWhether this position is long or short
clientOidStringNoCustomized 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

ParameterDescription
clientOidClient custom Id
orderIdOrder Id

Modify Stop Order

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
orderIdStringNoTPSL Order Id, int64 in string format, 'orderId' or 'clientOid' must have one
clientOidStringNoCustomized Client Order Id, 'orderId' or 'clientOid' must have one
marginCoinStringYesMargin currency (Must be capitalized)
symbolStringYesSymbol Id (Must be capitalized)
triggerPriceStringYesTrigger price
planTypeStringYesRefer toplan 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

ParameterDescription
clientOidClient custom Id
orderIdOrder Id

Cancel Plan Order (TPSL)

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
orderIdStringNoOrder ID, 'orderId' or 'clientOid' must have one
clientOidStringNoClient Order ID, 'orderId' or 'clientOid' must have one
symbolStringYesSymbol Id (Must be capitalized)
marginCoinStringYesMargin Coin
planTypeStringYesplan 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

ParameterDescription
clientOidClient custom Id
orderIdOrder Id

Cancel Plan Order (TPSL) By Symbol

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter(Request Body)

Parameter NameParameter TypeRequiredDescription
symbolStringYesSymbol Id (Must be capitalized)
planTypeStringYesplan 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

ParameterDescription
dataWhether '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 NameParameter TypeRequiredDescription
productTypeStringYesproduct type
planTypeStringYesplan 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

ParameterDescription
clientOidClient custom Id
orderIdOrder Id

Get Plan Order (TPSL) List

Limit rule: 20 times/1s (uid)

HTTP Request

Request Parameter

Parameter NameParameter TypeRequiredDescription
symbolStringNoSymbol Id (Must be capitalized), 'productType' and 'symbol' must have one
isPlanStringNoIs plan
productTypeStringNoproduct 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

ParameterDescription
orderIdOrder Id
clientOidClient Order Id
symbolSymbol Id
marginCoinMargin currency
sizeOrder size
executePriceOrder price
triggerPriceTrigger price
statusPlan order status
orderTypeOrder type
planTypeplan type
sideTrade side
triggerTypeTrigger type
presetTakeProfitPricePreset take profit price
presetTakeLossPricePreset stop loss price
rangeRateplanType is "moving_plan", "1" means 1.0% price correction, two decimal places
enterPointSourceenterPointSource
tradeSideTrade Side
holdModeHold Mode
reduceOnlyIs reduce only
ctimeOrder Creation time
utimeOrder Update time

Get History Plan Orders (TPSL)

Limit rule: 10 times/1s (uid)

HTTP Request

Request Parameter (Request Param)

Parameter NameParameter TypeRequiredDescription
productTypeStringNoproductType
symbolStringNoSymbol Id (Must be capitalized)
startTimeStringYesStart time, milliseconds (For Managed Sub-Account, the StartTime cannot be earlier than the binding time)
endTimeStringYesEnd time, milliseconds
pageSizeIntegerNoPage size, default 100
isPrebooleanNotrue: order by order Id asc; default false
isPlanStringNoIs 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

ParameterDescription
orderIdPlan Order Id
clientOidClient Order Id
executeOrderIdExecute success Order Id
symbolSymbol Id
marginCoinMargin currency
sizeOrder size
executePriceOrder price
triggerPriceTrigger price
statusPlan order status
orderTypeOrder type
planTypePlan type
sideSide
triggerTypeTrigger type
presetTakeProfitPricePreset take profit price
presetTakeLossPricePreset stop loss price
rangeRateplanType is "moving_plan", "1" means 1.0% price correction, two decimal places
enterPointSourceenterPointSource
tradeSideTrade Side
holdModeHold Mode
reduceOnlyIs reduce only
executeTimeExecute Time
executeSizeExecute Size
ctimeOrder creation time
utimeOrder 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.

domainWebSocket APIRecommended to use
domain 1wss://ws.bitget.com/mix/v1/streaminternationality

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 to1000 Streams;
  9. A single IP can create up to100 connections.

Login

apiKey: Unique identification for invoking API. Requires user toapply 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

consttimestamp=''+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 theAPI server time and then compare the timestamp.

Steps to generate the final signature:

Step 1. concat the content

Longtimestamp=System.currentTimeMillis()/1000;Stringcontent=timestamp+"GET"+"/user/verify";

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

Stringhash=hmac_sha256(content,secretkey)

The final step is to base64 encode the hash

Stringsign=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

ParameterTypeRequiredDescription
opStringYesOperation, subscribe
argsArrayYesList of subscribe channels
> instTypeStringNoInstrument TypeMC:Perpetual contract public channel
> channelStringYesChannel name
> instIdStringNoInstrument ID

Example response

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

Return parameters

ParameterTypeRequiredDescription
eventStringYesEvent, subscribe error
argObjectNoSubscribed channel
> instTypeStringNoInstrument TypeMC:Perpetual contract public channel
> channelStringYesChannel name
> instIdStringNoInstrument ID
codeStringNoError code
msgStringNoError 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

ParameterTypeRequiredDescription
opStringYesOperation, unsubscribe
argsArrayYesList of channels to unsubscribe from
> instTypeStringYesInstrument TypeMC:Perpetual contract public channel
> channelStringYesChannel name
> instIdStringYesInstrument ID

Example response

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

Return parameters

ParameterTypeRequiredDescription
eventStringYesEvent, unsubscribe error
argObjectYesUnsubscribed channel
> instTypeStringYesInstrument Type
> channelStringYesChannel name
> instIdStringYesInstrument ID
codeStringNoError Code
msgStringNoError 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) ofOrder 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 askA 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 askA 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

ParameterTypeRequiredDescription
opStringYesOperation, subscribe unsubscribe
argsArrayYesList of subscribed channels
> instTypeStringYesInstrument TypeMC: Perpetual contract public channel
> channelStringYesChannel name, tickers
> instIdStringYesInstrument ID, value refer toGet 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

ParameterTypeRequiredDescription
eventStringYesEvent, subscribe unsubscribe error
argObjectNoSubscribed channel
> instTypeStringYesInstrument type
> channelStringYesChannel name
> instIdStringYesInstrument ID
codeStringNoError Code
msgStringNoError 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

ParameterTypeDescription
argObjectSuccessfully subscribed channel
> instTypeStringInstrument Type
> channelStringChannel name
> instIdStringInstrument Name
actionStringPush data action, incremental push data or full push datasnapshot: fullupdate: incremental
dataArraySubscribed data
> instIdStringInstrument Name
> lastStringLast traded price
>bestAskStringBest ask price
>bestBidStringBest bid price
>high24hStringHighest price in the past 24 hours
>low24hStringLowest price in the past 24 hours
>priceChangePercentStringPrice change int the past 24 hours
>capitalRateStringFunding rate
>nextSettleTimeStringThe next fund rate settlement time timestamp milliseconds
>systemTimeStringsystem time
>markPriceStringMarket price
>indexPriceStringIndex price
>holdingStringOpen interest
>baseVolumeString24h trading volume, with a unit ofbase.
>quoteVolumeString24h trading volume, with a unit ofquote
>openUtcStringOpen price at UTC 00:00
>chgUTCStringPrice change since UTC 00:00
>symbolTypeIntegerSymbolType: 2: Settled Futures; 1: Perpetual Futures
>symbolIdStringSymbol Id
>deliveryPriceStringDelivery price - 0 when SymbolType=perpetual
>bidSzStringBest bid size
>askSzStringBest 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 toGet Candle Data

Request Example

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

Request parameters

ParameterTypeRequiredDescription
opStringYesOperation, subscribe unsubscribe
argsArrayYesList of subscribed channels
> instTypeStringYesInstrument TypeMC: Perpetual contract public channel
> channelStringYesChannel Name,candle1W candle1D candle12H candle4H candle1H candle30m candle15m candle5m candle1m
> instIdStringYesInstrument ID, value refer toGet 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

ParameterTypeRequiredDescription
eventStringYesEvent, subscribe unsubscribe error
argObjectNoSubscribed channel
> instTypeStringYesInstrument Type
> channelStringYeschannel name
> instIdStringYesInstrument ID
codeStringNoError Code
msgStringNoError 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**

ParameterTypeDescription
actionStringsnapshot or update
argObjectSuccessfully subscribed channel
> instTypeStringInstrument Type
> channelStringChannel name
> instIdStringInstrument ID
dataArraySubscribed data
> tsStringData generation time, Unix timestamp format in milliseconds
> oStringOpen price
> hStringhighest price
> lStringLowest price
> cStringClose price
> baseVolStringTrading 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

ChannelLength of bidsLength of asksRemark
booksmaximum 200maximum 200Snapshot 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
books111Top 1 order book of "books" that begins from bid1/ask1
books555Top 5 order book of "books" that begins from bid1/ask1
books151515Top 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 askschannel 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 4channel 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

ParameterTypeRequiredDescription
opStringYesOperation, subscribe unsubscribe
argsArrayYesList of subscribed channels
> instTypeStringYesInstrument typeMC: Perpetual contract public channel
> channelStringYesChannel name, books ,books1,books5,books15
> instIdStringYesInstrument ID, value refer toGet 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

ParameterTypeRequiredDescription
eventStringYesEvent,subscribe unsubscribe error
argObjectNoSubscribed channel
> instTypeStringYesInstrument Type
> channelStringYesChannel name
> instIdStringYesInstrument ID
msgStringNoError Message
codeStringNoError Code

Push data parameters

ParameterTypeDescription
argObjectSuccessfully subscribed channel
> instTypeStringInstrument Type
> channelStringChannel name
> instIdStringInstrument ID
actionStringPush data action, incremental push data or full push data.snapshot: full;update: incremental
dataArraySubscribed data array
> asksArrayOrder book on sell side
> bidsArrayOrder book on buy side
> tsStringOrder book generation time, Unix timestamp format in milliseconds
> checksumIntegerChecksum

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

ParameterTypeRequiredDescription
opStringYesOperation, subscribe unsubscribe
argsArrayYesList of subscribed channels
> instTypeStringYesInstrument typeMC: Perpetual contract public channel
> channelStringYesChannel Name,trade
> instIdStringYesInstrument ID, value refer toGet 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

ParameterTypeRequiredDescription
eventStringYesEvent,subscribe unsubscribe error
argObjectNoSubscribed channel
> instTypeStringYesInstrumentType
> channelStringYesChannel Name
> instIdStringYesInstrument ID
codeStringNoError Code
msgStringNoError 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

ParameterTypeDescription
actionStringsnapshot for the first push, afterwards push data will beupdate
argObjectSuccessfully subscribed channel
> instTypeStringInstrument Type
> channelStringChannel Name
> instIdStringInstrument ID
dataArraySubscribed data String array
> tsStringFilled time, Unix timestamp format in milliseconds
> pxStringTrade price
> szStringTrade size
> sideStringTrade 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

ParameterTypeRequiredDescription
opStringYesOperation, subscribe unsubscribe
argsArrayYesList of subscribed channels
> instTypeStringYesInstrument typeMC: Perpetual contract public channel
> channelStringYesChannel Name,tradeNew
> instIdStringYesInstrument ID, value refer toGet 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

ParameterTypeRequiredDescription
eventStringYesEvent,subscribe unsubscribe error
argObjectNoSubscribed channel
> instTypeStringYesInstrumentType
> channelStringYesChannel Name
> instIdStringYesInstrument ID
codeStringNoError Code
msgStringNoError 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

ParameterTypeDescription
actionStringsnapshot for the first push, afterwards push data will beupdate
argObjectSuccessfully subscribed channel
> instTypeStringInstrument Type
> channelStringChannel Name
> instIdStringInstrument ID
dataArraySubscribed data String array
> tsStringFilled time, Unix timestamp format in milliseconds
> pStringTrade price
> cStringTrade size
> tyStringTrade direction, buysell
> tiStringTrade 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

ParameterTypeRequiredDescription
opStringYesOperation,subscribe unsubscribe
argsArrayYesSubscribed channel
> instTypeStringYesInstrument TypeUMCBL:USDT Perpetual Contract Private Channel;DMCBL:Coin Margin Perpetual Contract Private Channel;CMCBL: USDC margin Perpetual Contract Private Channel
> channelStringYesChannel nameaccount
> instIdStringYesCoin, please set todefault

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

ParameterTypeRequiredDescription
eventStringYesOperation,subscribe unsubscribe error
argObjectNoSubscribed channel
> instTypeStringYesInstrument Type
> channelStringYesChannel Name
> instIdStringNoSymbol Name
codeStringNoError code
msgStringNoError message

Push Data Parameter

ParameterTypeDescription
argObjectSubscribed channel
> instTypeStringInstrument Type
> channelStringChannel Name
> instIdStringCoin
dataArraySubscribed Data
marginCoinStringMargin Coin
lockedStringLock balance
availableStringAvailable balance
maxOpenPosAvailableStringMax available to open position
maxTransferOutStringMax transfer out
equityStringEquity of the currency
usdtEquityStringEquity 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

ParameterTypeRequiredDescription
opStringYesOperation ,subscribe unsubscribe
argsArrayYesSubscribed channel List
> channelStringYesChannel Name,positions
> instTypeStringYesInstrument TypeUMCBL:USDT Perpetual Contract Private Channel;DMCBL:Coin Margin Perpetual Contract Private Channel;CMCBL: USDC margin Perpetual Contract Private Channel
> instIdStringNoSymbol Name

Response Parameter

ParameterTypeRequiredDescription
eventStringYesEvent ,subscribe unsubscribe errror
argObjectNoSubscribed channel
> channelStringYesChannel Name
> instTypeStringYesInstrument Type
> instIdStringNoSymbol Name
codeStringNoError Code
msgStringNoError Message

Push Data Parameter

ParameterTypeDescription
argObjectSubscribed channel
> channelStringChannel Name
> instTypeStringInstrument Type
> instIdStringInstrument ID
dataArraySubscribed Data
> posIdStringPosition Id
> instIdStringSymbol Name
> instNameStringSymbol Name
> marginCoinStringMargin Coin
> marginStringMargin, can be added or reduced
> autoMarginStringAuto suppliment margin, value: on/off
> marginModeStringMargin mode, cross fixed
> holdSideStringPosition sidelongshort
> holdModeStringhold Modesingle_hold ,double_hold
> totalStringQuantity of positions
> availableStringPosition that can be closed
> lockedStringFrozen quantity
> averageOpenPriceStringAverage open price
> leverageStringLeverage
> achievedProfitsStringRealized profit and loss
> uplStringUnrealized profit and loss
> uplRateStringUnrealized profit and loss ratio
> liqPxStringEstimated liquidation price
> keepMarginRateStringMaintenance margin requirement Ratio
> fixedMarginRateStringMargin requirement Ratiofixed
> marginRateStringRisk rate.
> cTimeStringCreation time, Unix timestamp format in milliseconds
> uTimeStringLatest 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

ParameterTypeRequiredDescription
opStringYesOperation ,subscribe unsubscribe
argsArrayYesRequest Subscribed channel List
> channelStringYesChannel Name, orders
> instTypeStringYesInstrument TypeUMCBL:USDT Perpetual Contract Private Channel;DMCBL:Coin Margin Perpetual Contract Private Channel;CMCBL: USDC margin Perpetual Contract Private Channel
> instIdStringNoCurrently only supportsdefault 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

ParameterTypeRequiredDescription
eventStringYesEvent ,subscribe unsubscribe errror
argObjectNoSubscribed channel
> channelStringYesChannel Name
> instTypeStringYesInstrument Type
> instIdStringNoInstrument Id
codeStringNoError Code
msgStringNoError Message

Push Data Parameter

ParameterTypeDescription
actionStringSnapshot.
argObjectSubscribed channel
> channelStringChannel Name
> instTypeStringInstrument Type
> instIdStringInstrument Id
dataArraySubscribed Data
> instIdStringInstrument Id
> ordIdStringOrder Id
> clOrdIdStringClient-supplied order ID
> pxStringOrder price
> szStringThe original order quantity, in the unit of currency
> hMStringHold Mode
> epsStringenterPointSource
> tSStringTrade Side
> notionalUsdStringEstimated national value in USD of order
> ordTypeStringOrder Typemarketlimit
> forceStringOrder Forcenormal: normal orderpost_only: Post-only orderfok: Fill-or-kill orderioc: Immediate-or-cancel order
> sideStringOrder side, buy sell
> posSideStringPosition side; 'double_hold':long orshort; 'single_hold':net
> tdModeStringTrade mode, cross: cross fixed: fixed
> tgtCcyStringMargin Coin
> fillPxStringLast filled price
> tradeIdStringLast trade ID
> fillSzStringLast filled quantity
> fillTimeStringLast filled time
> fillFeeStringlast filled fee, negative
> fillFeeCcyStringlast filled fee currency
> execTypeStringOrder flow type, T: taker M: maker
> accFillSzStringAccumulated fill quantity
> fillNotionalUsdStringFilled notional value in USD of order
> avgPxStringAverage filled price. If none is filled, it will return0
> statusStringOrder Statusinitnewpartial-fillfull-fillcancelled
> leverStringLeverage
> orderFeeArray
>> feeCcyStringFee currency
>> feeStringFeeNegative number represents the user transaction fee charged by the platform.Positive number represents rebate.
> pnlStringProfit and loss
> uTimeStringUpdate time, Unix timestamp format in milliseconds
> cTimeStringCreation time, Unix timestamp format in milliseconds
> lowBooleanIs 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

ParameterTypeRequiredDescription
opStringYesOperation ,subscribe unsubscribe
argsArrayYesSubscribed channel List
> channelStringYesChannel Name,ordersAlgo
> instTypeStringYesInstrument TypeUMCBL:USDT Perpetual Contract Private Channel;DMCBL:Coin Margin Perpetual Contract Private Channel;CMCBL: USDC margin Perpetual Contract Private Channel
> instIdStringNoSymbol 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

ParameterTypeRequiredDescription
eventStringYesEvent,subscribe unsubscribe errror
argObjectNoSubscribed channel
> channelStringYesChannel Name
> instTypeStringYesInstrument Type
> instIdStringNoInstrument Id
codeStringNoError Code
msgStringNoError Message

Push Data

ParameterTypeDescription
actionString'snapshot'
argObjectSubscribed channel
> channelStringChannel Name
> instTypeStringInstrument Type
> instIdStringInstrument ID
dataArraySubscribed data
> instIdStringinstrument ID
> idStringorder ID
> cOidStringClient-supplied order ID
> triggerPxStringtrigger price
> planTypeStringWebsocket planType, null means 'pl'
> ordPxStringactual price
> szStringtrigger size
> actualSzStringactual size
> actualPxStringActual price
> ordTypeStringOrder Typemarketlimit
> sideStringOrder Side,buysell
> posSideStringPosition side; 'double_hold':long orshort; 'single_hold':net
> tgtCcyStringMargin Coin
> stateStringOrder statusnot_triggertriggeredfail_triggercancel
> hMStringHold mode
> epsStringenterPointSource.
> triggerTimeStringtrigger time, ms
> userIdStringuserId
> versionLongversion
> triggerPxTypeString'mark': mark price; 'last': fill price(market price)
> keyStringkey ID
> tSStringTrade Side
> uTimeStringUpdate time, Unix timestamp format in milliseconds
> cTimeStringCreation time, Unix timestamp format in milliseconds

RestAPI error codes

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

WebSocket error codes

Error MessageError Code
Channel does not exist30001
Illegal request30002
Invalid op30003
User needs to log in30004
Login failed30005
request too many30006
request over limit,connection close30007
Invalid ACCESS_KEY30011
Invalid ACCESS_PASSPHRASE30012
Invalid ACCESS_TIMESTAMP30013
Request timestamp expired30014
Invalid signature30015
Param error30016
console

[8]ページ先頭

©2009-2025 Movatter.jp