NAV Navbar

Introduction

Apifiny Connect™ ’s institutional-grade REST and Websocket API gives Traders, OTC desks, Brokers, and Market Makers faster access to trade and easier reallocation of assets among a multitude of global exchanges using one consistent set of APIs.

There is also a FIX API for order management.

Getting Started

Professional traders can easily execute their strategies across all* crypto-to-crypto and other crypto fiat pairs. With one deposit and KYC process, traders can reallocate assets among exchanges and start trading.

An account must be obtained by clients and will be given an accountID, API_Key_ID and API_Secret_Key.

All requests must be signed with JWT, i.e. they must use JWT to generate a Signature and add the parameter signature to each request header.

General Note

Co-location URLs

We offer co-location services for Institutional clients, support 5 exchanges now, more will coming soon. For these co-location venues, the base URL will be different, make sure to use the following URLs:

BINANCEUS

REST: https://apibnu.apifiny.com/gx/openApi/v1

FIX: fixapibnu.apifiny.com:1443

COINBASEPRO

REST: https://apicb.apifiny.com/gx/openApi/v1

FIX: fixapicb.apifiny.com:1443

HUOBI

REST: https://apihb.apifiny.com/gx/openApi/v1

FIX: fixapihb.apifiny.com:1443

KUCOIN

REST: https://apikc.apifiny.com/gx/openApi/v1

FIX: fixapiok.apifiny.com:1443

OKEX

REST: https://apiok.apifiny.com/gx/openApi/v1

FIX: fixapiok.apifiny.com:1443

Signature

Signature:

// js
signature = JWT(payload={
    "accountId": "accountID",
    "secretKeyId": "API_Key_ID",
    "digest": hash256(RequestBody),
    "method": "module.methodName",
    "exp": 1535526941
}, key='API_Secret_Key', algorithm='HS256'
# python3
import hashlib
import jwt
import json

digest = hashlib.sha256(json.dumps(RequestBody).encode()).hexdigest()
signature = jwt.encode({
    'accountId': "accountID",
    'secretKeyId': "API_Key_ID",
    'digest': digest,
    'method': "module.methodName",
    'exp': 1535526941,
}, "API_Secret_Key", algorithm='HS256')

Please use JWT to generate Signature for each request. Please refer to jwt.io on how to use JWT.

For every request, please use JWT and secretKey to generate Signature and use Signature in HTTP post parameter.

Payload in Signature includes the following content:

Parameter Description
accountId Account ID
secretKeyId API Access Key
key API Secret Key
digest hash value of the request body using sha256 hash
method api method
exp expiration time of signature

Make Request

HTTP:

POST /gx/openApi/v1 HTTP/1.1
Host: api.apifiny.com
Content-Type: application/json
cache-control: no-cache
{
    "accountId": "STA-00000001"
}

Use HTTP POST to make a request:

POST https://api.apifiny.com/gx/openApi/v1?signature={signature}

The request end point is embedded in the signature.

Standard response

The structure of the response:

{
  "result": null,
  "error": {
    "code": 0x02002B,
    "message": "Account doesn't exist, please verify account ID"
  }
}

After making an API request, the server will send back a response in JSON format. The response includes:

Parameter Description
result when the request is successful, this key will include the result of the request. When the request is not successful, its value is null.
error when the request is not successful, the key will give the error message. Its value is null when the request is successful.
code Error code. Please refer to the error code explanation section.
message Error message.

Account API

The Account API has a number of calls to enable the user to get information about the account, to deposit and withdraw crypto from the account and interrogate the balances in the account. Only RESTful queries are supported for this set of functions.

Query Account Info

Request:

{
  "accountId": "STA-00000001",
  "venue": "VENUE1"
}

Response:

{
  "accountId": "STA-00000001",
  "accountStatus": "OPENED",
  "createdAt": 1537857271784,
  "updatedAt": 1551956476878,
    "subAccountInfo": [
    {
      "accountId": "STA-VENUE1_00000001",
      "venue": "VENUE1",
      "accountStatus": "OPENED",
      "createdAt": 1584611383104,
      "updatedAt": 1584611383104
    }
  ]
}

Method:

method: account.queryAccountInfoLite

Request:

Parameter Description
accountId account ID
venue venue name (optional)

Response:

Parameter Description
accountId account ID
venue venue name
accountStatus account status
createdAt creation time
updatedAt update time

Account Status:

Account Status Explanation
OPENED normal
RESTRICTED restricted. Cannot submit order or cancel order, but can query order.
SUSPENDED suspended, no operations are allowed

Query Account Asset

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1"
}

Response:

[
  {
    "accountId": "STA-VENUE1_00000001",
    "venue":"VENUE1",
    "currency": "BTC",
    "amount": 51.95,
    "available": 51.95,
    "frozen": 0
  },
  {
    "accountId": "STA-VENUE1_00000001",
    "venue":"VENUE1",
    "currency": "USDT",
    "amount": 101.95,
    "available": 51.95,
    "frozen": 50
  }
]

Method:

method: asset.listBalanceByLite

Request:

Parameter Description
accountId account ID
venue venue name (optional)

Response:

Parameter Description
accountId account ID
venue venue name
currency symbol of asset
amount amount
available available quantity
frozen frozen value
updatedAt update time

Get Deposit Address

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1",
  "coin": "BTC"
}

Response:

{
  "venue":"VENUE1",
  "currency": "BTC",
  "coin": "BTC"
  "address": "3Nxwena****************fp8v",
  "expiredAt": 1584606409507
}
{
  "venue":"VENUE1",
  "currency": "EOS",
  "currency": "EOS",
  "address": "acc******bnw",
  "memo": "10230001",
  "expiredAt": 1584606409507
}

Method:

method: asset.queryAddressLite

Request:

Parameter Description
accountId Account ID
venue venue name
coin currency code in system, different from currency name if multiple chains are supported

Response:

Parameter Description
venue venue name
currency currency name
address deposits address
memo memo information, some currencies are necessary, e.g. EOS
expiredAt expiration time

Create a Withdraw Ticket

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1"
}

Response:

{
  "ticket": "b215282*************bbe436f",
  "expiredAt": 1584633883235
}

You need to get a ticket before you can withdraw. Also if your ID verification has not been approved, you will get rejection error message.

Method:

method: asset.createWithdrawTicketLite

Request:

Parameter Description
accountId account ID
venue venue name

Response:

Parameter Description
ticket withdraw ticket
expiredAt expired time

Create a Withdraw Request

Request:

{
  "accountId": "STA-0000001",
  "venue":"VENUE1",
  "coin": "BTC",
  "amount": 10.0021,
  "memo": "",
  "address": "3Nxwena****************fp8v",
  "ticket": "b2152827079******793d4bbe436f"
}

Response:

{
  "accountId": "STA-VENUE1_00000001",
  "venue":"VENUE1",
  "currency": "BTC",
  "coin": "BTC",
  "amount": 10.0021,
  "fee": 0.0005,
  "fromAddress": null,
  "targetAddress": "3Nxwena****************fp8v",
  "type": "OUTGOING",
  "actionType": "ACCOUNT_CLIENT_WITHDRAW",
  "actionNote": "ACCOUNT_CLIENT_WITHDRAW",
  "logId": "STA-VENUE1_00000001.a93cdec7f3544ad89e2dd2a1515a7cba",
  "txId":"6af5256d5d3dd**********************************e1c31de",
  "status": "SUBMITTED",
  "logCreatedAt": 1584613315735,
  "logUpdatedAt": 1584613839359
}

Method:

method: asset.withdrawLite

Request:

Parameter Description
accountId Account ID
venue venue name
currency currency name
coin currency code in system, different from currency name if multiple chains are supported
amount the amount to withdraw
address a crypto address of the recipient
memo memo(Optional), It is usually necessary for EOS
ticket withdraw ticket

Response:

Parameter Description
accountId Account ID
venue venue name
currency currency name
coin internal coin name
amount the amount to withdraw
fee fee of withdrawal
fromAddress from address
targetAddress a crypto address of the recipient
type OUTGOING, INCOMING
actionType source of request
logId internal transfer ID
txId transaction ID
status SUBMITTED, COMPLETED, CANCELLED
logCreatedAt creation time
logUpdatedAt updated time

Transfer Between Venues

Request:

{
  "accountId": "STA-0000001",
  "venue":"VENUE1",
  "currency": "BTC",
  "amount": 10.0,
  "targetVenue": "VENUE2"
}

Response:

{
  "accountId": "STA-0000001",
  "venue":"FROM_VENUE",
  "currency": "BTC",
  "amount": 10.0,
  "fee": 0.0005,
  "targetVenue": "TO_VENUE",
  "logId": "STA-VENUE1_00000001.a93cdec7f3544ad89e2dd2a1515a7cba",
  "status": "SUBMITTED",
  "logCreatedAt": 1584613315735,
  "logUpdatedAt": 1584613839359
}

Method:

method: asset.transferToVenue

Request:

Parameter Description
accountId Account ID
venue venue name
currency currency name
amount the amount to withdraw
targetVenue name of target venue

Response:

Parameter Description
accountId Account ID
venue venue name
currency currency name
amount the amount to withdraw
fee fee of withdrawal
targetVenue target venue name
logId internal transfer ID
status SUBMITTED, COMPLETED, CANCELLED
logCreatedAt creation time
logUpdatedAt updated time

Query Account History

Account activity either increases or decreases your account balance.

Request:

{
  "accountId": "STA-00000001",
  "startTimeDate": "1584355090628",
  "endTimeDate": "1584614290628",
  "limit": "10",  
  "page": "1"
}

Response:

{
  "records" : [ {
    "accountId" : "STA-VENUE1_00000001",
    "currency" : "BTC",
    "status" : "SUBMITTED",
    "type" : "OUTGOING",
    "amount" : 0.01,
    "fee" : 0.003,
    "targetAddress" : "",
    "coin" : "BTC",
    "logId" : "STA-VENUE1_00000001.8de7fc99b5064f288f8fb9608951fb69",
    "logCreatedAt" : "1584355090628",
    "logUpdatedAt" : "1584614290628",
    "actionType" : "ACCOUNT_CLIENT_TRANSFER_OUTGOING",
    "actionNote" : "ACCOUNT_CLIENT_TRANSFER_OUTGOING",
    "fromAccountId" : "STA-VENUE1_00000001",
    "toAccountId" : "STA-VENUE2_00000001"
  }, {
    "accountId" : "STA-VENUE1_00000001",
    "currency" : "BTC",
    "status" : "SUBMITTED",
    "type" : "OUTGOING",
    "amount" : 0.01,
    "fee" : 0.003,
    "targetAddress" : "",
    "coin" : "BTC",
    "logId" : "STA-VENUE1_00000001.fde92d5bf570468e9e6b4a023d8080ce",
    "logCreatedAt" : "1584355090628",
    "logUpdatedAt" : "1584614290628",
    "actionType" : "ACCOUNT_CLIENT_TRANSFER_OUTGOING",
    "actionNote" : "ACCOUNT_CLIENT_TRANSFER_OUTGOING",
    "fromAccountId" : "STA-VENUE1_00000001",
    "toAccountId" : "STA-VENUE2_00000001"
  } ],
  "total" : 5,
  "size" : 2,
  "current" : 1,
  "orders" : [ ],
  "hitCount" : false,
  "searchCount" : true,
  "pages" : 3
}

Method:

method: asset.queryAssetActivityListLite

Request:

Parameter Description
accountId Account ID
startTimeDate start time
endTimeDate end time
limit records per page
page page number

Response:

Parameter Description
accountId Account ID
currency currency name
status status of this account activity, SUBMITTED, COMPLETED, CANCELLED
type IMCOMING for deposits, OUTGOING for withdrawals
amount amount of currency changed
fee fee occurs during this activity
fromAddress from address
targetAddress a crypto address of the recipient
txId transaction ID onchain
coin internal coin name
logId internal ID
logCreatedAt create time
logUpdatedAt update time
actionType source of request
actionNote note of request
fromAccountId the iniate sub-account transfer from
toAccountId the target sub-account transfer to
count total number of records
limit records per page
page page number
pages page count

Market Data API

The Market Data API is available in both Websocket and RESTful interfaces.

Rate Limit: We throttle public endpoints by Access Key 1 request per second.

Signature

Signature:

// js
signature = JWT(payload={
    "accessKey": "API_Key_ID"
}, key="API_Secret_Key", algorithm='HS256')
# python3
import jwt
signature = jwt.encode({'accessKey': "API_Key_ID"}, "API_Secret_Key", algorithm='HS256')
headers = {'signature': str(signature, encoding='utf-8')}
// Java 
public String jwtTest() {
        String accessKey = "API_Key_ID";
        String secretKey = "API_Secret_Key";
        HashMap<String, Object> claims = new HashMap<>();
        claims.put("accessKey", accessKey);
        String signature = Jwts.builder().setClaims(claims)
                .signWith(Keys.hmacShaKeyFor(secretKey.getBytes()),          SignatureAlgorithm.HS256).compact();
        System.out.println("signature:" + signature);
        return signature;
    }

Request:

curl -X GET -H "signature: eyJhbI1NiJ9.eyJhY**************lY1TyJ9.RrWnyheQs" "https://api.apifiny.com/md/orderbook/v1/BTCUSD/VENUE1"

Please use JWT to generate Signature and add the parameter signature to each request header.

For every request, please use JWT and secretKey to generate Signature and use Signature in request header parameter.

Parameter Description
accessKey API Key ID
key API Key secret

Websocket API

Request (subscription):

{
  "channel":"ChannelName",
  "symbol":"BTCUSD",
  "venues":["VENUE1","VENUE2"],
  "action":"sub"
}

Request (unsubscribing):

{
  "channel":"ChannelName",
  "symbol":"BTCUSD",
  "venues":["VENUE1","VENUE2"],
  "action":"unsub"
}

The websocket end point is

URL:

wss://api.apifiny.com/md/orderbook/v1

Parameter Description
channel channel name, orderbook or trade or kline_<period> or ticker
symbol symbol
venues venue name list
action subscription or unsubscribing

The request for subscription/unsubscribe must be in JSON format.

Listed below are all allowed values for channel variables:

Channel Name Description
orderbook The current order book of a specific pair.
trade The most recent trades with their price, volume, and direction.
kline_<period> OHLCV, the Kline/Candlestick Stream push updates to the current klines/candlestick every second.
ticker 24hr rolling window ticker statistics for all symbols that changed in an array.

** For trade, klin_<period> and ticker we support 5 venues currently: BINANCEUS, COINBASEPRO, HUOBI, KUCOIN, OKEX. Others will result in an error message.*

Order Book Payload:

{
  "venues":["VENUE1"],
  "channel":"orderbook",
  "orderbook":{
    "symbol":"BTCUSD",
    "updatedAt":1584523325000,
    "asks": [
        [10000.0, 0.004]
        // [price, size]
        // ……
    ],
    "bids": [
        [7000.0, 0.04],
        [6980.0, 0.0048]
    ]
  }
}
// ....
{
  "venues":["VENUE2"],
  "channel":"orderbook",
  "orderbook":{
    "symbol":"BTCUSD",
    "updatedAt":1584523325000,
    "asks": [
        [8010.0, 1.02],
        [8000.0, 0.05]
    ],
    "bids": [
        [7001.0, 0.04],
        [6980.0, 0.048]
    ]
  }
}

Recent Trades Payload:

[
    {
        "symbol":"BTCUSD",
        "provider":"ConnectVenue",
        "price":59177.17,
        "qty":0.09999844,
        "side":"BUY",
        "tradeTime":1617266375515,
        "exchangeID":"151651858",
        "updateTime":1617266375626
    }
]

OHLCV Request (subscription):

{
  "channel":"kline_1m",
  "symbol":"BTC/USD",
  "venues":["VENUE1","VENUE2"],
  "action":"sub"
}

OHLCV Payload:

[
    {
        "currencyPair":"BTC/USDT", 
        "period":"1m",
        "open":58053.69,
        "high":58053.69,
        "low":58053.69,
        "close":58053.69,
        "vol":0.027921,
        "count":1,
        "timestamp":1616140260000,
        "exchange":"ConnectVenue"
    },
    {
        "currencyPair":"BTC/USDT",
        "period":"1m",
        "open":57865.28,
        "high":57885.08,
        "low":57865.28,
        "close":57885.08,
        "vol":0.068214,
        "count":2,
        "timestamp":1616140860000,
        "exchange":"ConnectVenue"
    }]

Ticker Payload:

{
    "symbol":"BTCUSD",
    "high":56668.2,
    "vol":935.342312,
    "amount":51110415.03946448,
    "low":53518.77,
    "provider":"ConnectVenue",
    "count":1,
    "updateAt":1616580009925,
    "close":56471.34,
    "open":54643.54
}

Order book - REST API

The RESTFul interface endpoint is:

Request URL:

GET https://api.apifiny.com/md/orderbook/v1/{SYMBOL}/{VENUE}

The {SYMBOL} is the trading pairs. For example, ETHBTC.

The {VENUE} is the exchanges. For example, VENUE1.

Response:

{
    "symbol":"BTCUSD",
    "updatedAt":1584523325000,
    "asks": [
        [10000.0, 0.004]
        // [price, size]
        // ……
    ],
    "bids": [
        [7000.0, 0.04],
        [6980.0, 0.0048]
    ]
}

Trades - REST API

Executed transactions data, also known as matched orders data or active data.

Request URL:

GET https://api.apifiny.com/md/trade/v1/{SYMBOL}/{VENUE}

The {SYMBOL} is the trading pairs. For example, ETHBTC.

The {VENUE} is the exchanges. For example, VENUE1.

Response:

[
    {
        "symbol":"BTCUSD",
        "provider":"ConnectVenue",
        "price":59177.17,
        "qty":0.09999844,
        "side":"BUY",
        "tradeTime":1617266375515,
        "exchangeID":"151651858",
        "updateTime":1617266375626
    }
]
Parameter Description
symbol symbol
price filled price
qty filled size
side maker order side of this fill, BUY or SELL
tradeTime filled time
updateTime updated time

The trade side indicates the maker order side. The maker order is the order that was open on the order book. buy side indicates a down-tick because the maker was a buy order and their order was removed. Conversely, sell side indicates an up-tick.

Support 5 venues currently: BINANCEUS, COINBASEPRO, HUOBI, KUCOIN, OKEX. Others will result in an error message.

OHLCV - REST API

OHLCV (Open, High, Low, Close, Volume) timeseries data. Each data point of this timeseries represents several indicators calculated from transactions activity inside a time range (period).

Request URL:

GET https://api.apifiny.com/md/kline/v1/{VENUE}/{BASE}/{QUOTE}/{PERIOD}

For Example: https://api.apifiny.com/md/kline/v1/COINBASEPRO/BTC/USD/5m?startTime=1616923800000&endTime=1616937900000

Parameter Description
VENUE Venue name
BASE Base asset
QUOTE Quote Asset
PERIOD The period of each candle, 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M
startTime The start time period
endTime The end time period

If startTime and endTime are not sent, the most recent klines are returned

Response:

[
    {
        "currencyPair":"BTC/USDT", 
        "period":"1m",
        "open":58053.69,
        "high":58053.69,
        "low":58053.69,
        "close":58053.69,
        "vol":0.027921,
        "count":1,
        "timestamp":1616140260000,
        "exchange":"ConnectVenue"
    },
    {
        "currencyPair":"BTC/USDT",
        "period":"1m",
        "open":57865.28,
        "high":57885.08,
        "low":57865.28,
        "close":57885.08,
        "vol":0.068214,
        "count":2,
        "timestamp":1616140860000,
        "exchange":"ConnectVenue"
    }]
Parameter Description
currencyPair symbol
period The period of each candle, 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M
open The opening price
high The closing price
low lowest price
close close price
vol Accumulated trading volume, in base asset
count The number of completed trades
timestamp The UNIX timestamp in seconds
exchange Venue name

Support 5 venues currently: BINANCEUS, COINBASEPRO, HUOBI, KUCOIN, OKEX. Others will result in an error message.

Ticker - REST API

24 hr stats for the trading pairs. volume is in base currency units. open, high, low are in quote currency units.

Request URL:

GET https://api.apifiny.com/md/ticker/v1/{SYMBOL}/{VENUE}/

The {SYMBOL} is the trading pairs. For example, BTCUSDT.

The {VENUE} is the exchanges. For example, VENUE1.

Response:

{
    "symbol":"BTCUSD",
    "high":56668.2,
    "vol":935.342312,
    "amount":51110415.03946448,
    "low":53518.77,
    "provider":"ConnectVenue",
    "count":1,
    "updateAt":1616580009925,
    "close":56471.34,
    "open":54643.54
}

Support 5 venues currently: BINANCEUS, COINBASEPRO, HUOBI, KUCOIN, OKEX. Others will result in an error message.

Trading API

Clients will typically be using the Websocket API to subscribe to the market data and RESTful API to submit orders. Clients can use the websocket API to subscribe to the order updates or use RESTful API to get order updates. A typical trade flow would be as follows:

Step 1: Subscribe to market data. The websocket endpoint used to subscribe and unsubscribe for market data is wss://api.apifiny.com/md/orderbook/v1 . Request and reply are in JSON format.

The RESTful endpoint is GET https://api.apifiny.com/md/orderbook/v1/{SYMBOL}/{VENUE}, where {SYMBOL} denotes the currency pair of interest and the {VENUE} denotes the exchange.

Step 2: Create order and send order using the RESTful API.

The method for creating an order is order.insertOrderLite, which enables an order to be created and submitted. Note that the orderID parameter needs to be generated with the following specification: account id plus 13 digit of timestamp + 3 digit of random number.

Step 3: Subscribe to the order updates using websocket. A number of methods enable the querying of order(s) state.

The methods are order.queryOrderInfoLite to find the state of a single submitted order; order.queryListOrderLite to find the state of a max list of 500 submitted orders; order.listOpenOrderLite to get a list of all open orders; and order.listCompleteOrderLite to get a list of all complete orders.

Step 4: Cancel Order (as needed). When an order that was submitted and is open needs to be cancelled, the method used is order.cancelOrderLite. Any order that has a status of PENDING_SUBMIT or has already been cancelled, cannot be cancelled. In addition, cancelledUpdatedAt must be null.

Below is the sample code to demonstrate the workflow.

Sample Python Code

    # Subscribe to market data

    ACCOUNT_ID = "YOUR_ACCOUNT_ID"
    API_KEY_ID = "YOUR_API_KEY_ID"
    SECRET_KEY = "YOUR_API_SECRET_KEY"

    API_HTTP = "https://api.apifiny.com/gx/openApi/v1"
    MD_HTTP = "https://api.apifiny.com/gx/orderbook/v1"
    MD_WS = "wss://api.apifiny.com/gx/orderbook/v1"

    print("get market data using http")
    headers = {'signature': get_md_signature(API_KEY_ID, SECRET_KEY)}
    res = requests.get("/BTCUSD", headers=headers)
    print(res.json())


    print("get market data using websocket")
    # Specify the name of the exchange, 
    # subscribe to the market can subscribe to multiple exchanges

    VENUES = ["VENUE1", "VENUE2"]   
    msg = {"channel": "orderbook", 
           "symbol": 'BTCUSDT', 
           "venues": VENUES,
           'collect': True, 
           "action": "sub"}


    def sub_md(message):
        from websocket import create_connection
        import ssl
        sslopt = {"cert_reqs": ssl.CERT_NONE}
        con = create_connection(MD_WS, 
                                sslopt=sslopt, 
                                header=headers)
        con.send(json.dumps(message))
        while True:
            response = con.recv()
            if 'ping' in response:
                pong = response.replace('ping', 'pong')
                con.send(pong)
            print(response)

    # send order

    def new_order(order_id, 
              symbol, 
              order_type, 
              quantity, 
              Limit_price,
             order_side, 
             venue, 
             time_inforce):

        return self.http_request("order.insertOrderLite", {
            "accountId": self.account_id,
            "orderId": order_id,
            "venue": venue,
            "orderInfo": {
                "symbol": symbol,
                "orderType": order_type,
                "quantity": quantity,
                "limitPrice": limit_price,
                "orderSide": order_side,
                "timeInForce": time_inforce
             },
         })


    def cancel_order(order_id, venue):
        return http_request("order.cancelOrderLite", {
            "accountId": self.account_id,
            "venue": venue,
            "orderId": order_id,
        })



    print(Subscribe Market Data)
    sub_md(msg)

    print('send order')
    order_id = "foo"
    res = new_order(order_id, 
                                 "BTCUSDT", 
                                  "LIMIT", 
                                  "0.02", "9980.00", 
                                  "BUY", 
                                  venue, 
                                  3)
    print(res)

Further technical information and examples for all Trading API methods are as follows:

Create New Order

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1",
  "orderId": "000000011584603011942221",
  "orderInfo": {
    "symbol": "BTCUSD",
    "orderType": "LIMIT",
    "timeInForce": 1,
    "orderSide": "BUY",
    "limitPrice": "100",
    "quantity": "1.12"
  }
}

Response:

{
  "accountId": "STA-VENUE1_00000001",
  "venue":"VENUE1",
  "orderId": "000000011584603011942221",
  "symbol": "BTCUSD",
  "orderType": "LIMIT",
  "orderSide": "BUY",
  "limitPrice": 100,
  "quantity": 1.12,
  "filledAveragePrice": 0,
  "filledCumulativeQuantity": 0,
  "timeInForce": 1,
  "openQuantity": 1.12,
  "orderStatus": "PENDING_SUBMIT",
  "createdAt": 1584603012164,
  "updatedAt":  1584603012164,
}

Make a new order request:

Method:

method: order.insertOrderLite

Request:

Parameter Description
accountId account ID
venue venue name
orderId order ID
symbol symbol
orderType order type, LIMIT or MARKET
timeInForce specifies how long the order remains in effect, GTC, IOC, PostOnly
orderSide order side, BUY or SELL
limitPrice limit price
quantity quantity
total Amount of quote asset to spend, required when orderSide is BUY, orderType = MARKET

Order ID needs to be in the this format: **account id plus 13 digit of timestamp + 3 digit of random number.

Response:

Parameter Description
accountId sub account ID
venue venue name
orderId order ID
symbol symbol
orderType order type, LIMIT or MARKET
orderSide order side, BUY or SELL
limitPrice limit price, not available for market order
quantity quantity
filledAveragePrice average fill price
filledCumulativeQuantity accumulated fill quantity
openQuantity open quantity to be filled
orderStatus order status
createdAt order creation timestamp
updatedAt order update timestamp
cancelledUpdatedAt if it is cancelled, cancellation timestamp
filledUpdatedAt last filled timestamp

Order Type:

Order Type Description
LIMIT Limit Order
MARKET Market Order*

*Only 5 exchanges support market order now, they are Binance(US), Coinbase(pro), Huobi, Kucoin, Okex, others will be coming soon.

Time In Force:

Time In Force Description
1 GTC (Good Till Canceled)
2 GTD (Good Till Date), temporarily not supported
3 IOC (Immediate Or Cancel)
7 Post Only (The order should only make liquidity)

Order Side:

Order Side Description
BUY buy order
SELL sell order

Order Status:

Order Status Explanation
PENDING_SUBMIT order has been sent but not confirmed
SUBMITTED order has been accepted and stay active
PART_FILLED final status, partially filled order
FILLED final status, completely filled order
CANCELLED final status, order has been cancelled
REJECTED final status, order has been rejected

Cancel an Order

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1",
  "orderId": "000000011584603011942221"
}

Response:

{
  //Same as new order response
}

Request Cancel an Order,cancelledUpdatedAt in Order will be updated.

Note: An order can only be cancelled when status is not PENDING_SUBMIT,and cancelledUpdatedAt is null.

Method:

method: order.cancelOrderLite

Request:

Parameter Description
accountId Account ID
venue venue name
orderId Order ID

Response:

Same as new order response.

Get an Order

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1",
  "orderId": "000000011584603011942221"
}

Response:

{
  //Same as new order response
}

Method:

method: order.queryOrderInfoLite

Request:

Parameter Description
accountId account ID
venue venue name
orderId order ID

Response:

Same as new order response.

Query Multiple Orders by IDs

Request:

{
  "accountId": "STA-0000001",
  "orderIdList": ["000000121574697605570321","000000121574697754664817"]
}

Response:

[
  {
     //Same as new order response
  },
  {
     //Same as new order response
  }
]

Method:

method: order.listOrderInfoLite

Request:

Parameter Description
accountId account ID
orderIdList the total number of order ID cannot exceed 500

Response:

Same as new order response.

Query All Open Orders

Request:

{
  "accountId": "STA-00000001"
}

Response:

[
  {
  "accountId": "STA-VENUE1_00000001",
  "venue":"VENUE1",
  "orderId": "000000011584603011942221",
  "symbol": "BTCUSD",
  "orderType": "LIMIT",
  "orderSide": "BUY",
  "limitPrice": 100,
  "quantity": 1.12,
  "filledAveragePrice": 0,
  "filledCumulativeQuantity": 0,
  "timeInForce": 1,
  "openQuantity": 1.12,
  "orderStatus": "PENDING_SUBMIT",
  "createdAt": 1584603012164,
  "updatedAt":  1584603012164,
},
  {
  "accountId": "STA-VENUE1_00000001",
  "venue":"VENUE1",
  "orderId": "000000011584603011942227",
  "symbol": "BTCUSD",
  "orderType": "LIMIT",
  "orderSide": "SELL",
  "limitPrice": 110,
  "quantity": 1.12,
  "filledAveragePrice": 0,
  "filledCumulativeQuantity": 0,
  "timeInForce": 1,
  "openQuantity": 1.12,
  "orderStatus": "SUBMITTED",
  "createdAt": 1584603012164,
  "updatedAt":  1584603012164,
}
]

Method:

method: order.listOpenOrderLite

Request:

Parameter Description
accountId account ID

Response:

Same as new order response.

Query All Completed Orders

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1",
  "startTime": 1537857271784,
  "endTime": 1537857271784,
  "limit": 100,
  "forward": True,
  "baseAsset": null,
  "quoteAsset": null,
  "orderSide": null,
  "orderStatus": null
}

Response:

[
  {
     //Same as new order response
  }
  {
     //Same as new order response
  }
]

Query all filled orders, cancelled orders, and rejected orders. The time period should be within recent 48 hours, if more records are needed, please contact our customer service to apply.

Method:

method: order.listCompletedOrderLite

Request:

Parameter Description
accountId account ID
venue venue name (optional)
startTime start time
endTime end time
limit total number of orders, max is 500
forward true for forward, false for backward. (optional)
baseAsset base asset. for example, for BTCUSD,it is BTC. (optional)
quoteAsset quote asset,For BTCUSD,it is USD. (optional)
orderSide order side: BUY, SELL. (optional)
orderStatus order status: FILLED, CANCELLED. (optional)

Response:

Same as new order response.

Query Order Fills

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1",
  "startDateTime": 1537857271784
}

Response:


[
  {   
    "accountId": "STA-VENUE1_00000001",   
    "venue":"VENUE1",   
    "orderId": "000000011584603011942221",   
    "symbol": "BTCUSD",   
    "orderType": "LIMIT",   
    "timeInForce": 3,   
    "orderSide": "BUY",   
    "limitPrice": 9000,   
    "quantity": 0.01,   
    "filledAveragePrice": 0,   
    "filledCumulativeQuantity": 0,   
    "openQuantity": 0,   
    "orderStatus": "FILLED",   
    "createdAt": 1584603012164,   
    "updatedAt":  1584603012164,   
    "cancelledUpdatedAt": null,   
    "filledUpdatedAt": null ,
    "lastCommission": 0.0450,
    "lastCommissionCurrency": "USD",
    "lastFilledQuantity": 0.01,
    "lastFilledPrice": 9000,
    "isTaker": true
  }
]

Get a list of recent fills, only max number of 1000 records within 2 minutes will be returned.

Method:

method: order.listDetailLite

Request:

Parameter Description
accountId account ID
venue venue name
startDateTime start time

Response:

Same as new order response.

Request:

{   
  "accountId": "STA-00000001",   
  "venue":"VENUE1",   
  "orderId": "000000011584603011942221"
}

Response


[
  {   
    "accountId": "STA-VENUE1_00000001",   
    "venue":"VENUE1",   
    "orderId": "000000011584603011942221",   
    "symbol": "BTCUSD",   
    "orderType": "LIMIT",   
    "timeInForce": 3,   
    "orderSide": "BUY",   
    "limitPrice": 9000,   
    "quantity": 0.01,   
    "filledAveragePrice": 0,   
    "filledCumulativeQuantity": 0,   
    "openQuantity": 0,   
    "orderStatus": "FILLED",  
    "createdAt": 1584603012164,   
    "updatedAt":  1584603012164,   
    "cancelledUpdatedAt": null,   
    "filledUpdatedAt": null ,
    "lastCommission": 0.0450,
    "lastCommissionCurrency": "USD",
    "lastFilledQuantity": 0.01,
    "lastFilledPrice": 9000,
    "isTaker": true
  }
]

Method:

method: order.readerOrderDetail

Request:

Parameter Description
accountId account ID
venue venue name
orderId order ID

Response:

Same as new order response.

Parameter Description
lastCommission trading fees happen in this fill
lastCommissionCurrency the currency of the trading fee
isTaker this field indicates if the fill was the result of a liquidity provider or liquidity taker. TRUE indicates Taker and FALSE indicates Maker

Query Currenct Fee Rate

Request:

{
  "accountId": "STA-00000001",
  "venue": "VENUE1",
  "symbol": "BTCUSDT"
}

Response:

{
    "accountId": "STA-VENUE1_00000001",
    "tradingVolume": 121.1001,
    "takeFee": 0.003,
    "makeFee": 0,
    "specialRate": 0
}

Method:

method: order.getCommissionRate

Request:

Parameter Description
accountId account ID
venue VENUE1
symbol symbol

Response:

Parameter Description
accountId account ID
tradingVolume cumulative trading volume within 30 days
takeFee taker fee
makeFee maker fee
specialRate special discount of trading fee

Order Status Push Notice

Optionally, one can query for order state changes via an HTTP API or Websocket API and will receive a stream of full order state changes back.

The HTTP API is as follows:

HTTP API

Request:

{
  "accountId": "STA-0000001",
  "startDateTime": null
}

Response:

[
  {
    "logTimestamp" : 1552116459512,
    "payload" : {
      "accountId" : "STA-00000001",
      "venue":"VENUE1",
      "orderId" : "000000121574697605570321",
      "symbol" : "BTCUSD",
      "orderType" : "LIMIT",
      "timeInForce": 1,
      "orderSide" : "BUY",
      "limitPrice" : 100.0,
      "quantity" : 1.12,
      "filledAveragePrice" : 0,
      "filledCumulativeQuantity" : 0,
      "openQuantity" : 0.001,
      "orderStatus" : "PENDING_SUBMIT",
      "createdAt" : 1537857271784,
      "updatedAt" : 1537857271784,
      "cancelledUpdatedAt" : null,
      "filledUpdatedAt" : null,
      "lastFilledQuantity" : null,
      "lastFilledPrice" : null,
      "lastFilledCreatedAt" : null,
      "lastCommission" : 0.112,
      "lastCommissionCurrency" : "USD",
      "isTaker": true
    }
  },
    {
   "logTimestamp" : 1552116459536,
   "payload" : {
     "accountId" : "ST-00000001",
     "venue":"VENUE1",
     "orderId" : "000000121574697605570321",
     "symbol" : "BTCUSD",
     "orderType" : "LIMIT",
     "timeInForce": 1,
     "orderSide" : "BUY",
     "limitPrice" : 100.0,
     "quantity" : 1.12,
     "filledAveragePrice" : 100.0,
     "filledCumulativeQuantity" : 1.12,
     "openQuantity" : 0,
     "orderStatus" : "FILLED",
     "createdAt" : 1537857271784,
     "updatedAt" : 1537857271784,
     "cancelledUpdatedAt" : null,
     "filledUpdatedAt" : 1552116459467,
     "lastFilledQuantity" : 1.12,
     "lastFilledPrice" : 100.0,
     "lastFilledCreatedAt" : 1537857271784,
     "lastCommission" : 0.112,
     "lastCommissionCurrency" : "USD",
     "isTaker": true
  }
]

Method:

method: order.streamDetail

Request:

Parameter Description
accountId account ID
startDateTime order start time

Response:

Parameter Description
lastFilledQuantity last filled quantity
lastFilledPrice last filled price
lastFilledCreatedAt last filled time
lastCommission trading fees happen in this fill
lastCommissionCurrency the currency of the trading fee
isTaker this field indicates if the fill was the result of a liquidity provider or liquidity taker. TRUE indicates Taker and FALSE indicates Maker

The Websocket API is as follows:

WebSocket API

Payload:

{
  {
   "logTimestamp" : 1552116459536,
   "payload" : {
     "accountId" : "ST-00000001",
     "venue":"VENUE1",
     "orderId" : "000000121574697605570321",
     "symbol" : "BTCUSD",
     "orderType" : "LIMIT",
     "timeInForce": 1,
     "orderSide" : "BUY",
     "limitPrice" : 100.0,
     "quantity" : 1.12,
     "filledAveragePrice" : 100.0,
     "filledCumulativeQuantity" : 1.12,
     "openQuantity" : 0,
     "orderStatus" : "FILLED",
     "createdAt" : 1552116459467,
     "updatedAt" : 1552116459467,
     "cancelledUpdatedAt" : null,
     "filledUpdatedAt" : 1552116459467,
     "lastCommission" : 0.112,
     "lastCommissionCurrency" : "USD",
     "lastFilledQuantity" : 1.12,
     "lastFilledPrice" : 100.0,
     "lastFilledCreatedAt" : 1552116459467,
     "isTaker": true
  }
}

Order update notice can be obtained through WebSocket:

Method:

wss://api.apifiny.com/gx/openApi/v1?signature={signature}&body={body}&p=webSocket

Note: Need to add one parameter in url:&p=webSocket

Method:

method: order.streamDetail

Base Information API

There is a further set of API’s to discover basic information about venues and assets that Apifiny Connect supports.

Query List Venues

Request:

{}

Response:

[
  {
    'exchange ': 'VENUE1',
    'status': 'enabled'
  },
  {
    'exchange ': 'VENUE2',
    'status': 'enabled'
  },
  ... ...
  {
    'exchange ': 'VENUE24',
    'status ': 'disabled'
  }
]

Method:

method: utils.listVenueInfoLite

Request:

None

Response:

Parameter Description
exchange name of the exchange
status exchange status, enabled or disabled

Query List Currencies

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1"
}

Response:

[
  {
    "currency": "BTC",
    "currencyPrecision": 9,
    "status": "NOT_DEPOSIT_WITHDRAW",
    "withdrawMaxAmount": 1000000,
    "withdrawMinAmount": 0.004,
    "withdrawMinFee": 0.0005,
    "nextStatus": null,
    "nextStatusAt": null,
    "coin": "BTCUSD"
  },
  {
    "currency": "ETH",
    "currencyPrecision": 8,
    "status": "NOT_DEPOSIT_WITHDRAW",
    "withdrawMaxAmount": 10000,
    "withdrawMinAmount": 2,
    "withdrawMinFee": 0.001,
    "nextStatus": null,
    "nextStatusAt": null,
    "coin": "ETHUSD"
  }
]

List known currencies.

Method:

method: utils.listCurrencyLite

Request:

Parameter Description
accountId account ID
venue venue name

Response:

Parameter Description
currency currency
currencyPrecision currency precision
status current status, DEPOSIT_WITHDRAW or NOT_DEPOSIT_WITHDRAW or DEPOSIT_NOT_WITHDRAW or NOT_DEPOSIT_NOT_WITHDRAW
withdrawMaxAmount max withdraw amount
withdrawMinAmount min withdraw amount
withdrawMinFee min withdraw fee
nextStatus next status
nextStatusAt next status time

currency status:

status explanation
DEPOSIT_WITHDRAW deposit and withdrawal are both allowed
NOT_DEPOSIT_WITHDRAW deposit is not allowed, withdrawal is allowed
DEPOSIT_NOT_WITHDRAW deposit is allowed, but withdrawal is not allowed
NOT_DEPOSIT_NOT_WITHDRAW deposit and withdrawal are both not allowed

Query List Symbols

Request:

{
  "accountId": "STA-00000001",
  "venue":"VENUE1"
}

Response:

[
  {
    "symbol":"EOSETH",
    "baseAsset":"EOS",
    "baseAssetPrecision": 8,
    "quoteAsset":"ETH",
    "quotePrecision": 8,
    "minPrice":0.01,
    "maxPrice":99999,
    "minQuantity":0.01,
    "maxQuantity":99999,
    "tickSize":0.01,
    "stepSize":0.0001,
    "minNotional": 1,
    "maxNotional": 1000,
    "status": "enabled"
  },
  {
    "symbol":"BCHUSDT",
    "baseAsset":"BCH",
    "baseAssetPrecision": 8,
    "quoteAsset":"USDT",
    "quotePrecision": 8,
    "minPrice":0.01,
    "maxPrice":99999,
    "minQuantity":0.01,
    "maxQuantity":99999,
    "tickSize":0.01,
    "stepSize":0.0001,
    "minNotional": 1,
    "maxNotional": 1000,
    "status": "enabled"
  }
]

Get a list of available trading pairs supportted in this venue.

Method:

method: utils.listSymbolInfoLite

Request:

Parameter Description
accountId account ID
venue venue name

Response:

Parameter Description
symbol symbol
baseAsset base asset
baseAssetPrecision baseAsset precision
quoteAsset quote asset,the right side of the symbol
quotePrecision quote precision
minPrice min price for the symbol
maxPrice max price for the symbol
minQuantity min quantity for the symbol
maxQuantity max quantity for the symbol
tickSize min price increment for the symbol
stepSize min quantity increment for the symbol
minNotional minimum notional value allowed for an order on a symbol. An order's notional value is the price * quantity
maxNotional maximum notional value allowed for an order on a symbol. An order's notional value is the price * quantity
status enabled or disabled

Query Current Timestamp of Server

Request:

{}

Response:

1552112542263

Get the API server time.

Method:

method: utils.currentTimeMillis

Request:

None

Response:

The server timestamp

FIX API

FIX (Financial Information eXchange) is a standard protocol which can be used to enter orders, submit cancel requests, and receive fills. Users of the FIX API will typically have existing software using FIX for order management. Users who are not familiar with FIX should first consider using the REST API.

FIX API can be implemented using QuickFIX with the following language support:

Configuration information are as follows:

Configuration for quickfix

FIX API ENDPOINT URL

fix.api.apifiny.com:1443

For those co-location venues, endpoint URLs see Co-location URLs.

Users of the FIX API will have to apply a seperate set of API Access Key, please contact us to apply, our team will get back to you within 1 working day.

Quickfix Configuration

Quickfix configuration sample codes:

[default]
ConnectionType=initiator
SenderCompID=STA-00000001
TargetCompID=APIFINY
SocketConnectHost=fix.api.apifiny.com
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
ReconnectInterval=5
UseDataDictionary=Y
ResetSeqNumFlag=Y
ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=Y

[session]
BeginString=FIX.4.2
SocketConnectPort=1443

Here is an optional Python sample codes for login using quickfix:

Logon

 def toAdmin(self, message, sessionID):
        if message.getHeader().getField(35) is "A":
            key = 'XXXX'
            signature = get_signature('new_gbbo_order', 'STA-00000015', 'STA-00000015','STA-00000015', key)
            message.setField(fix.RawDataLength(len(signature)))
            message.setField(fix.RawData(signature))
        ...

get_signature is as following:

def get_signature(method, account_id, secret_key_id, params, secret_key):
    now = datetime.datetime.now()
    expect_time = now + datetime.timedelta(seconds=30)
    params_json_string = json.dumps(params) if isinstance(params, dict) else params
    digest = hashlib.sha256(params_json_string.encode()).hexdigest()
    signature = jwt.encode({
        'accountId': account_id,
        'secretKeyId': secret_key_id,
        'digest': digest,
        'method': method,
        'exp': int(expect_time.timestamp()),
    }
        , secret_key)
    # print(str(signature, encoding='utf-8'))
    return str(signature, encoding='utf-8')

Add JWT encrypted token in toAdmin.

Users of the FIX API will have to apply a seperate set of API Access Key, please contact us to apply, our team will get back to you within 1 working day.

New Order

    msg = quickfix42.NewOrderSingle()
    msg.setField(fix.ClOrdID(order_id)) # generated order id:00000015+13digt time stamp + 3 digit random number
    msg.setField(fix.Symbol(symbol)) # symbol:BTCUSDT
    msg.setField(fix.HandlInst('1'))
    msg.setField(fix.OrdType(fix.OrdType_LIMIT)) # OrdType:limit
    msg.setField(fix.TransactTime())
    msg.setField(fix.Side(side))
    msg.setField(fix.Price(price))
    msg.setField(fix.Account(account_id))
    msg.setField(fix.OrderQty(qty))
    msg.setField(fix.SecurityExchange("VENUE1"))
    msg.setField(fix.Text("new Order"))
    quickfix.Session.sendToTarget(msg, application.sessionID)

New Order message is following in :

Cancel Order

    msg = quickfix42.OrderCancelRequest()
    msg.setField(fix.OrigClOrdID(order_id))
    msg.setField(fix.ClOrdID(order_id))
    msg.setField(fix.Symbol(symbol))
    msg.setField(fix.TransactTime())
    msg.setField(fix.Side(side))
    msg.setField(fix.Account(account_id))
    msg.setField(fix.Text("Cancel Order"))
    msg.setField(fix.SecurityExchange("VENUE1"))

Cancel ordermessage:

Execution Report

Execution Report message Sent by the broker/gateway when an order is accepted, rejected, filled, or canceled.

Tag Name Description
11 ClOrdID Only present on order acknowledgements, ExecType=New (150=0)
37 OrderID OrderID from the ExecutionReport with ExecType=New (150=0)
17 ExecId Unique identifier of execution message
55 Symbol Symbol of the original order
54 Side Must be 1 to buy or 2 to sell
32 LastShares Amount filled (if ExecType=1). Also called LastQty as of FIX 4.3
44 Price Price of the fill if ExecType indicates a fill, otherwise the order price
38 OrderQty OrderQty as accepted
60 TransactTime Time the event occurred
150 ExecType 1 for Partially fill and 2 for fill
39 OrdStatus Order status as of the current message

ExecType VALUES

ExecType Description
0 NEW, Ack
1 PARTIAL_FILL
2 FILL
4 CANCELED
8 REJECTED

Query order status

    msg = quickfix42.OrderStatusRequest()
    msg.setField(fix.ClOrdID(order_id))
    msg.setField(fix.Symbol(symbol))
    msg.setField(fix.Side(side))
    msg.setField(fix.Account(account_id))
    msg.setField(fix.SecurityExchange("VENUE1"))

query order message is as following:

Status/Error Codes

There are two categories of error codes, one set generated by HTTP, typically by a server for a client request, and the other category is a set of Apifiny Connect application status/error codes.

HTTP Error code

HTTP status codes are divided into 5 ranges as follows:

Some of the most common HTTP error codes include:

HTTP 403 - too many errors and IP is blocked

HTTP 502 - service is not available

Apifiny Connect Status/Error Codes

Apifiny Connect status/error codes are returned as a hexadecimal number. The number on the farthest right delineates client side errors (designated by the hexadecimal number A) from server side errors (designated by the hexadecimal number B).

Client side errors should be corrected at the client and the request resubmitted. Server side errors will have a max retry count as well as a resubmit interval of 50 ms. Persistent resubmissions will result in suspension of the submitting IP.

Error Code Explanation Hexadecimal Error Code
65548 common error 0x01000C
65562 general request error, please check if the parameters in request are correct. 0x01001A
65579 general server side error, retry or contact customer service. 0x01002B
65595 server busy please wait 0x01003B
65658 IP is not in the whitelist 0x01007A
131098 Account_SessionStopped 0x02001A
131099 create account error 0x02001B
131114 Request too often, please try later 0x02002A
131115 Account doesn't exist, please verify account ID. 0x02002B
131130 Sorry, you are not permitted to use this service, please contact your business manager. 0x02003A
131162 Account status doesn't satisfy request, please verify account status. 0x02005A
131178 SQL execution error, duplicate primary key 0x02006A
196634 token error 0x03001A
196650 session error 0x03002A
196666 session extension validation Error 0x03003A
196682 sso token error 0x03004A
196698 session type error 0x03005A
262170 withdraw address not exist 0x04001A
262186 the number of withdraw addresses rearches limit 0x04002A
262202 Util_Unknown_Symbol 0x04003A
262218 Util_Unknown_Currency 0x04004A
262250 Util_Unknown_CoinType 0x04006A
262266 Util_Unknown_Coin 0x04007A
262299 Util_Create_Withdraw_Address_Error 0x04009B
262427 A connection issue encountered, please try again 0x04011B
262443 You have reach your daily withdrawal limit, please try next day 0x04012B
5243242 Order doesn't exist, please change order ID, Execute Fail 0x050016A
327706 Order ID doesn't exist, please recreate order id. 0x05001A
327722 Order_OriginalOrderIdDuplicate 0x05002A
327723 New order failure,retry or contact customer service. 0x05002B
327738 Order_OpenOrderNotExist 0x05003B
327738 Order doesn't exist, please change order ID. 0x05003A
327741 This exchange is currently under maitenance or not supported yet. 0x05003D
327754 Order_CancelPendingSubmitWait 0x05004A
327755 cancel order error, need to contact customer service. 0x05004B
327786 timeout for new order or other request, please wait and retry. 0x05005A
327786 orderSide parameter error 0x05006B
327786 too many open orders, cannot create new order, need to delete some orders and retry. 0x05006A
327802 order id repeat 0x05007B
327802 cannot cancel order under current order status, need confirm order status and retry or abandon request. 0x05007A
327818 Order create failed, incorrect timestamp format 0x05008A
327818 timeout for cancel order operation, need wait and retry. 0x05008A
327834 Order create failed, timestamp error 0x05009A
327836 Order_Detail_Not_Exist 0x05009C
327946 Order_Status_Not_Pending_Submit_Cancel 0x05010A
327948 Order_Log_Not_Exist order 0x05010C
327962 the number of new order within 24 hours exceed limit, please contact customer service. 0x05011A
327978 order id rule error 0x05012A
328010 the order is being cancelled, please verify order status. 0x05014A
328026 order cannot be cancelled when in Pending_Submit status,please wait for status changed to submitted to cancel order.( if order status is still pending submit after 10 minutes, please contact customer service. ) 0x05015A
328042 Order_GBBO_Error 0x05016A
328058 SOM_Request_Error 0x05017A
328074 Your account has reached the trade amount limitation 0x05018A
393242 Asset_AvailableNotEnough. 0x06001A
393242 withdraw ticket error, please check or create a withdraw ticket first. 0x06001B
393258 Not enough asset available. Please verify if there is enough asset in account. 0x06002A
393274 asset free frozen not enough 0x06003A
393290 asset reduce frozen not enough 0x06004A
393306 Order_Cancel_TimeOut_Error 0x06005A
393322 Asset_Activity_Submitted_Not_Exist 0x06006A
393338 Asset_Query_Deposit_Address_Error 0x06007A
393354 Assets in this currency are insufficient or non-existent 0x06008A
393355 Asset_Activity_Completed_TxId_Error 0x06008B
393372 Asset_Log_Not_Exist 0x06009C
393482 Order_Create_TimeOut_Error 0x06010A
393514 Asset_Activity_Id_Exist 0x06012A
393530 Conversion between two currencies is not supported 0x06013A
2097162 Signature Error 0x20000A
2097163 Permission denied. Invalid API-key or permissions for action. key 0x20000B
2097178 No matching market 0x20001A

Download Demo

Click Python Sample to download demo Codes.

Change log

04/28/21

04/23/21