NAV

Exchange Server

The Exchange Server is a high-performance backend system optimized for cryptocurrency trading. It supports up to 10,000 trades per second and provides real-time data notifications through WebSocket.

Architecture

The Matching Services is identified as “Service layer” in the diagram above.

Architecture

Code Structure

Required Components

Core Libraries

Modules

Deployment and Installation

TBD

Compilation

TBD

Exchange Server API

Request Format

Request

Response

General Error Codes

Code Description
1 Invalid argument
2 Internal error
3 Service unavailable
4 Method not found
5 Service timeout

Market API

Add New Market

Method: market.add

URL:

http://example.com/

Parameters

The market.add method requires the following parameters:

Parameter Type Description
name String The name of the market (e.g., “BTC_USDT”).
stock String The name of the stock asset to be traded (e.g., “BTC”).
money String The name of the money asset used for trading (e.g., “USDT”).
is_listed Integer Indicates if the market is listed (0 = not listed, 1 = listed).
min_amount String The minimum amount for trading in this market (e.g., “0.01”).

Example Request with Python:

import requests

url = "http://example.com/"
payload = {
    "method": "market.add",
    "params": {
        "name": "BTC_USDT",        # Market name
        "stock": "BTC",            # Stock asset name
        "money": "USDT",           # Money asset name
        "is_listed": 1,            # Listed flag
        "min_amount": "0.01"       # Minimum amount for trading
    },
    "id": 3
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Example Request with curl:

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.add","params": {"name": "BTC_USDT", "stock": "BTC", "money": "USDT", "is_listed": 1,"min_amount": "0.01"},"id": 3}'

Response Type:

json

Example Response:

The response confirms that the market was successfully added with all the provided details.

{
    "error": null,
    "result": [
        {
            "id": 1,
            "name": "BTC_USDT",
            "stock": "BTC",
            "money": "USDT",
            "stock_prec": 8,
            "money_prec": 8,
            "min_amount": "0.01",
            "is_listed": 1,
            "hide_percent": 1
        }
    ],
    "id": 3
}

Response Fields:

Field Type Description
id Integer The unique ID of the market.
name String The name of the market.
stock String The stock asset in the market.
money String The money asset in the market.
stock_prec Integer The precision of the stock asset (e.g., 8 decimals).
money_prec Integer The precision of the money asset (e.g., 8 decimals).
min_amount String The minimum amount for trading in this market.
is_listed Integer Indicates if the market is listed (0 = not listed, 1 = listed).
hide_percent Integer Percentage visibility control (e.g., 1).

Update Market

Method: market.update

URL:

http://example.com/

Parameters

The market.update method requires the following parameters:

Parameter Type Description
name String The name of the market to be updated (e.g., “BTC_USDT”).
is_listed Integer Indicates if the market is listed (0 = not listed, 1 = listed) (optional).
stock_prec Integer The precision of the stock asset (optional, e.g., 8 decimals for BTC).
money_prec Integer The precision of the money asset (optional, e.g., 8 decimals for USDT).
min_amount String The minimum amount for trading in this market (optional, e.g., “0.01”).
type Integer The type of the market (optional).
mp_type Integer The type of price multiplier (optional).
hide_percent Integer The percentage of visibility (optional, e.g., 1).

Example Request with Python:

import requests

url = "http://example.com/"
payload = {
    "method": "market.update",
    "params": {
        "name": "BTC_USDT",        # Market name
        "is_listed": 1,            # Listed flag (optional)
        "stock_prec": 8,           # Stock precision (optional)
        "money_prec": 8,           # Money precision (optional)
        "min_amount": "0.01",      # Minimum amount (optional)
        "type": 1,                 # Market type (optional)
        "mp_type": 2,              # Price multiplier type (optional)
        "hide_percent": 1          # Visibility percentage (optional)
    },
    "id": 4
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Example Request with curl:

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.update","params": {"name": "BTC_USDT", "is_listed": 1, "stock_prec": 8, "money_prec": 8, "min_amount": "0.01", "type": 1, "mp_type": 2, "hide_percent": 1},"id": 4}'

Response Type:

json

Example Response:

The response confirms that the market was successfully updated with all the provided details.

{
    "error": null,
    "result": [
        {
            "id": 1,
            "name": "BTC_USDT",
            "stock": "BTC",
            "money": "USDT",
            "stock_prec": 8,
            "money_prec": 8,
            "min_amount": "0.01",
            "is_listed": 1,
            "hide_percent": 1
        }
    ],
    "id": 4
}

Response Fields:

Field Type Description
id Integer The unique ID of the market.
name String The name of the market.
stock String The stock asset in the market.
money String The money asset in the market.
stock_prec Integer The precision of the stock asset (e.g., 8 decimals).
money_prec Integer The precision of the money asset (e.g., 8 decimals).
min_amount String The minimum amount for trading in this market.
is_listed Integer Indicates if the market is listed (0 = not listed, 1 = listed).
hide_percent Integer Percentage visibility control (e.g., 1).

Market Data

import requests

url = "http://example.com/"
payload = {
    "method": "market.last",
    "params": ["BTC_USDT"],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.last", "params": ["BTC_USDT"], "id": 1}'

The above command returns JSON structured like this:

{
    "error": null,
    "result": "66858.22000000",
    "id": 1
}

Method: market.last

Parameters

Example Request with curl , python:

Response Type:

json

Executed History

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.deals", "params": ["BTC_USDT", 100, 0], "id": 1}'
import requests

url = "http://example.com/"
payload = {
    "method": "market.deals",
    "params": ["BTC_USDT", 100, 0],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

The above command returns JSON structured like this:

{
    "error": null,
    "result": [
        {
            "id": 1156,
            "time": 1729176270.0424521,
            "price": "66896",
            "amount": "0.00517",
            "type": "sell"
        },
        {
            "id": 1155,
            "time": 1729176269.7379661,
            "price": "66896",
            "amount": "0.00149",
            "type": "sell"
        },
        ...
    ],
    "id": 1
}

Method: market.deals

Parameters

Example Request with curl , python:

Response Type:

json

User Executed History

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.user_deals", "params": [1, "BTC_USDT", 0, 100], "id": 1}'
import requests

url = "http://example.com/"
payload = {
    "method": "market.user_deals",
    "params": [1, "BTC_USDT", 0, 100],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

The above command returns JSON structured like this:

{
  "error": null,
  "result": {
    "offset": 0,
    "limit": 100,
    "records": [
      {
        "id": 5,
        "time": 1492697636.238869,
        "user": 1,
        "side": 1,
        "role": 2,
        "amount": "0.1000",
        "price": "7000.00",
        "deal": "0.1000",
        "fee": "0.0002"
      }
    ]
  },
  "id": 1
}

Method: market.user_deals

Parameters

Example Request with curl , python:

Response Type:

json

KLine Data

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.kline", "params": ["BTC_USDT", 1492358400, 1492697636, 60], "id": 1}'
import requests

url = "http://example.com/"
payload = {
    "method": "market.kline",
    "params": ["BTC_USDT", 1492358400, 1492697636, 60],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

The above command returns JSON structured like this:

{
  "error": null,
  "result": {
    "offset": 0,
    "limit": 100,
    "total": 0,
    "records": [[1492358400, "7000.00", "8000.00", "8100.00", "6800.00", "1000.00", "123456.78", "BTC_USDT"]]
  },
  "id": 1
}

Method: market.kline

Parameters

Example Request with curl , python:

Response Type:

json

Market Status

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.status", "params": ["BTC_USDT", 86400], "id": 1}'
import requests

url = "http://example.com/"
payload = {
    "method": "market.status",
    "params": ["BTC_USDT", 86400],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

The above command returns JSON structured like this:

{
    "error": null,
    "result": {
        "period": 86400,
        "last": "67072.02",
        "open": "66840",
        "close": "67072.02",
        "high": "67093.99",
        "low": "66723.99",
        "volume": "44.25752",
        "deal": "2957454.346129"
    },
    "id": 1
}

Method: market.status

Parameters

Example Request with curl , python:

Response Type:

json

Market Status Today

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.status_today", "params": ["BTC_USDT"], "id": 1}'
import requests

url = "http://example.com/"
payload = {
    "method": "market.status_today",
    "params": ["BTC_USDT"],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

The above command returns JSON structured like this:

{
    "error": null,
    "result": {
        "open": "66840",
        "last": "67082.74",
        "high": "67093.99",
        "low": "66723.99",
        "volume": "45.01224",
        "deal": "3008080.3095034"
    },
    "id": 1
}

Method: market.status_today

Parameters

Example Request with curl , python:

Response Type:

json

Market List

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.list", "params": [], "id": 1}'
import requests

url = "http://example.com/"
payload = {
    "method": "market.list",
    "params": [],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

The above command returns JSON structured like this:

{
    "error": null,
    "result": [
        {
            "name": "BTC_USDT",
            "stock": "BTC",
            "money": "USDT",
            "fee_prec": 4,
            "stock_prec": 8,
            "money_prec": 8,
            "min_amount": "1e-8"
        }
    ],
    "id": 1
}

Method: market.list

Parameters

Example Request with curl , python:

Response Type:

json

Market Summary

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "market.summary", "params": [], "id": 1}'
import requests

url = "http://example.com/"
payload = {
    "method": "market.summary",
    "params": [],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

The above command returns JSON structured like this:

{
    "error": null,
    "result": [
        {
            "name": "BTC_USDT",
            "ask_count": 0,
            "ask_amount": "0",
            "bid_count": 1,
            "bid_amount": "1e-8"
        }
    ],
    "id": 1
}

Method: market.summary

Parameters

Example Request with curl , python:

Response Type:

json

Asset API

Add New Asset

Method: asset.add

URL:

http://example.com/

Parameters

The asset.add method requires the following parameters:

Parameter Type Description
name String The name of the asset (e.g., “BTC”).
is_listed Integer Indicates if the asset is listed (0 = no, 1 = yes).
prec_save Integer The precision for saving the asset (e.g., 20).
prec_show Integer The precision for displaying the asset (e.g., 8).
type Integer The type of the asset (e.g., 1 for normal assets).

Example Request with Python:

import requests

url = "http://example.com/"
payload = {
    "method": "asset.add",
    "params": {
        "name": "BTC",
        "is_listed": 1,
        "prec_save": 20,
        "prec_show": 8,
        "type": 1
    },
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Example Request with curl:

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "asset.add", "params":{"name": "BTC", "is_listed": 1, "prec_save": 20, "prec_show": 8,  "type": 1 }, "id": 1}'

Response Type:

json

The response confirms that the asset was successfully added, with the assigned ID and specified parameters.

{
    "error": null,
    "result": [
        {
            "id": 5,
            "name": "BTC",
            "prec_save": 20,
            "prec_show": 8,
            "type": 1,
            "is_listed": 1
        }
    ],
    "id": 1
}

Update Asset

Method: asset.update

URL:

http://example.com/

Parameters

The asset.update method requires the following parameters:

Parameter Type Description
name String The current name of the asset to be updated (e.g., “TUSD”).
new_name String The new name for the asset (optional, e.g., “USDT”).
is_listed Integer Updated listing status of the asset (0 = not listed, 1 = listed).

Example Request with Python:

import requests

url = "http://example.com/"
payload = {
    "method": "asset.update",
    "params": {
        "name": "TUSD",        # Current asset name
        "new_name": "USDT",    # Optional new name for the asset
        "is_listed": 1         # Updated listing status
    },
    "id": 2
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Example Request with curl:

curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "asset.update","params": {"name": "TUSD","new_name": "USDT",  "is_listed": 1},"id": 2}'

Response Type:

json

Example Response:

The response confirms that the asset was successfully updated, with the updated details such as name, precision values, type, and listing status.

{
    "error": null,
    "result": [
        {
            "id": 5,
            "name": "BTC",
            "prec_save": 20,
            "prec_show": 8,
            "type": 1,
            "is_listed": 1
        }
    ],
    "id": 2
}

Asset Inquiry

import requests

url = "http://example.com/"
payload = {
    "method": "balance.query",
    "params": [1, "BTC"],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "balance.query", "params": [1, "BTC"], "id": 1}'

The above command returns JSON structured like this:

{
  "error": null,
  "result": {
    "BTC": {
      "available": "1.10000000",
      "freeze": "9.90000000"
    }
  },
  "id": 1
}

Method: balance.query

Parameters

Example Request with curl, python:

Response Type:

json

Asset Update

import requests

url = "http://example.com/"
payload = {
    "method": "balance.update",
    "params": [1, "BTC", "deposit", 100, "-1.2345", {}],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "balance.update", "params": [1, "BTC", "deposit", 100, "-1.2345", {}], "id": 1}'

The above command returns JSON structured like this:

{
  "error": null,
  "result": "success",
  "id": 1
}

Method: balance.update

Parameters

Example Request with curl, python:

Response Type:

json

Asset List

import requests

url = "http://example.com/"
payload = {
    "method": "asset.list",
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "asset.list", "params": [], "id": 1}'

The above command returns JSON structured like this:

{
    "error": null,
    "result": [
        {
            "id": 5,
            "name": "BTC",
            "prec": 8,
            "prec_save": 20,
            "is_listed": 1,
            "type": 1
        },
        {
            "id": 3,
            "name": "ETH",
            "prec": 8,
            "prec_save": 20,
            "is_listed": 1,
            "type": 1
        },
        {
            "id": 6,
            "name": "USDT",
            "prec": 8,
            "prec_save": 20,
            "is_listed": 1,
            "type": 1
        }
    ],
    "id": 1
}

Method: asset.list

Parameters

Example Request with curl, python:

Response Type:

json

Asset Summary

import requests

url = "http://example.com/"
payload = {
    "method": "asset.summary",
    "params": [],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "asset.summary", "params": [], "id": 1}'

The above command returns JSON structured like this:

{
    "error": null,
    "result": [
        {
            "name": "ETH",
            "total_balance": "0",
            "available_count": 0,
            "available_balance": "0",
            "freeze_count": 0,
            "freeze_balance": "0"
        },
        {
            "name": "BTC",
            "total_balance": "0",
            "available_count": 0,
            "available_balance": "0",
            "freeze_count": 0,
            "freeze_balance": "0"
        },
        {
            "name": "USDT",
            "total_balance": "10100",
            "available_count": 1,
            "available_balance": "10099.99991992",
            "freeze_count": 1,
            "freeze_balance": "0.00008008"
        }
    ],
    "id": 1
}

Method: asset.summary

Parameters

Example Request with curl, python:

Response Type:

json

Matching API

Place Limit Order

import requests

url = "http://example.com/"
payload = {
    "method": "order.put_limit",
    "params": [1, "BTC_USDT", 1, "10", "8000", "0.002", "0.001", "web"],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "order.put_limit", "params": [1, "BTC_USDT", 1, "10", "8000", "0.002", "0.001", "web"], "id": 1}'

The above command returns JSON structured like this:

> The above command returns JSON structured like this:
```json
{
    "error": null,
    "result": {
        "id": 1,
        "market_id": 1,
        "market": "BTC_USDT",
        "source": "web",
        "type": 1,
        "side": 1,
        "user": 1,
        "ctime": 1729162600.930465,
        "mtime": 1729162600.930465,
        "fee_type": 0,
        "price": "8000",
        "amount": "10",
        "taker_fee": "0.002",
        "maker_fee": "0.001",
        "left": "10",
        "deal_stock": "0",
        "deal_money": "0",
        "deal_fee": "0",
        "defi_fee": "0",
        "defi_deal_fee": "0",
        "detail": null
    },
    "id": 1
}

Method: order.put_limit

Parameters

Example Request with curl, python:

Response Type:

json


Place Market Order

import requests

url = "http://example.com/"
payload = {
    "method": "order.put_market",
    "params": [1, "BTC_USDT", 1, "10", "0.002", "web"],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "order.put_market", "params": [1, "BTC_USDT", 1, "10", "0.002", "web"], "id": 1}'

The above command returns JSON structured like this:

{
  "result": {
    "order_id": 200,
    "market": "BTC_USDT",
    "side": 1,
    "amount": "10.0000"
  },
  "id": 1
}

Method: order.put_market

Parameters

Example Request with curl, python:

Response Type:

json

Cancel Order

import requests

url = "http://example.com/"
payload = {
    "method": "order.cancel",
    "params": [1, "BTC_USDT", 100],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "order.cancel", "params": [1, "BTC_USDT", 100], "id": 1}'

The above command returns JSON structured like this:

{
  "result": {
    "order_id": 100,
    "status": "cancelled"
  },
  "id": 1
}

Method: order.cancel

Parameters

Example Request with curl, python:

Response Type:

json

Order Depth

import requests

url = "http://example.com/"
payload = {
    "method": "order.depth",
    "params": ["BTC_USDT", 10, "1"],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "order.depth", "params": ["BTC_USDT", 10, "1"], "id": 1}'

The above command returns JSON structured like this:

{
  "error": null,
  "result": {
    "asks": [
      ["8000.00", "9.6250"]
    ],
    "bids": [
      ["7000.00", "0.1000"]
    ]
  },
  "id": 1
}

Method: order.depth

Parameters

Example Request with curl, python:

Response Type:

json

Pending Orders

import requests

url = "http://example.com/"
payload = {
    "method": "order.pending",
    "params": [1, "BTC_USDT", 0, 100],
    "id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST http://example.com/ \
-H "Content-Type: application/json" \
-d '{"method": "order.pending", "params": [1, "BTC_USDT", 0, 100], "id": 1}'

The above command returns JSON structured like this:

{
    "error": null,
    "result": {
        "offset": 0,
        "limit": 100,
        "total": 1,
        "records": [
            {
                "id": 1,
                "market": "BTC_USDT",
                "source": "web",
                "type": 1,
                "side": 2,
                "user": 1,
                "ctime": 1729162600.930465,
                "mtime": 1729162600.930465,
                "fee_type": 0,
                "price": "8000",
                "amount": "1e-8",
                "taker_fee": "0.002",
                "maker_fee": "0.001",
                "left": "1e-8",
                "deal_stock": "0e-64",
                "deal_money": "0e-64",
                "deal_fee": "0e-64",
                "defi_fee": "0e-64",
                "defi_deal_fee": "0e-64",
                "detail": null
            }
        ]
    },
    "id": 1}

Method: order.pending

Parameters

Example Request with curl, python:

Response Type:

json

Errors

General Error Codes

Code Description
1 Invalid argument
2 Internal error
3 Service unavailable
4 Method not found
5 Service timeout

weight: 7 title: “Exchange Server Matching API” language_tabs:


WebSocket Server API Documentation

The API is based on JSON-RPC over WebSocket protocol. Repeated subscriptions for the same data type will cancel previous subscriptions.

Request and Response Structures

Request:

Response:

Notification:

Error Codes

Authorization API

ID Verification (Web)

Example WebSocket Request:

{
    "method": "server.auth",
    "params": ["your_token", "web"],
    "id": 1020
}

Response:

{
    "error": null,
    "result": "authenticated",
    "id": 1020
}

System API

PING

Example WebSocket Request:

{
    "method": "server.ping",
    "params": [],
    "id": 1000
}

Response:

{
    "error": null,
    "result": "pong",
    "id": 1000
}

System Time

Example WebSocket Request:

{
    "method": "server.time",
    "params": [],
    "id": 1001
}

Response:

{
    "error": null,
    "result": 1694000000,
    "id": 1001
}

Market API

Market Inquiry

Example WebSocket Request:

{
    "method": "kline.query",
    "params": ["BTC_USDT", 1492358400, 1492444800, 60],
    "id": 1004
}

Response:

{
    "error": null,
    "result": [
        [1492358400, "7000.00", "8000.0", "8100.00", "6800.00", "1000.00", "123456.00", "BTC_USDT"]
    ],
    "id": 1004
}

Market Subscription

Example WebSocket Request:

{
    "method": "kline.subscribe",
    "params": ["BTC_USDT", 60],
    "id": 1005
}

Response:

{
    "error": null,
    "result": "subscribed",
    "id": 1005
}

Cancel Subscription

Example WebSocket Request:

{
    "method": "kline.unsubscribe",
    "params": [],
    "id": 1006
}

Response:

{
    "error": null,
    "result": "unsubscribed",
    "id": 1006
}

Price API

Acquire Latest Price

Example WebSocket Request:

{
    "method": "price.query",
    "params": ["BTC_USDT"],
    "id": 1007
}

Response:

{
    "error": null,
    "result": "7000.00",
    "id": 1007
}

Latest Price Subscription

Example WebSocket Request:

{
    "method": "price.subscribe",
    "params": ["BTC_USDT", "ETH_USDT"],
    "id": 1008
}

Response:

{
    "error": null,
    "result": "subscribed",
    "id": 1008
}

Market Status API

Acquire Market Status

Example WebSocket Request:

{
    "method": "state.query",
    "params": ["BTC_USDT", 86400],
    "id": 1009
}

Response:

{
  "error": null,
  "result": {
    "period": 86400,
    "last": "65000",
    "open": "0",
    "close": "0",
    "high": "0",
    "low": "0",
    "volume": "0",
    "deal": "0"
  },
  "id": 1009
}

Deal API

Acquire Latest Executed List

Example WebSocket Request:

{
    "method": "deals.query",
    "params": ["BTC_USDT", 50, 0],
    "id": 1010
}

Response:

{
    "error": null,
    "result": [
        {
            "id": 1,
            "time": 1622540000,
            "price": "7000.00",
            "amount": "0.5",
            "type": "buy"
        },
        ...
    ],
    "id": 1010
}

Latest Order List Subscription

Example WebSocket Request:

{
    "method": "deals.subscribe",
    "params": ["BTC_USDT"],
    "id": 1011
}

Response:

{
    "error": null,
    "result": "subscribed",
    "id": 1011
}

Cancel Subscription

Example WebSocket Request:

{
    "method": "deals.unsubscribe",
    "params": [],
    "id": 1012
}

Response:

{
    "error": null,
    "result": "unsubscribed",
    "id": 1012
}

Depth API

Acquire Depth

Example WebSocket Request:

{
    "method": "depth.query",
    "params": ["BTC_USDT", 10, "1"],
    "id": 1013
}

Response:

{
    "error": null,
    "result": {
        "asks": [["8000.00", "9.6250"]],
        "bids": [["7000.00", "0.1000"]]
    },
    "id": 1013
}

Depth Subscription

Example WebSocket Request:

{
    "method": "depth.subscribe",
    "params": ["BTC_USDT", 10, "1"],
    "id": 1014
}

Response:

{
    "error": null,
    "result":

 "subscribed",
    "id": 1014
}

Order API (Authentication Required)

Unexecuted Order Inquiry

Example WebSocket Request:

{
    "method": "order.query",
    "params": ["BTC_USDT", 0, 10],
    "id": 1015
}

Response:

{
    "error": null,
    "result": [
        {"id": 1, "market": "BTC_USDT", "amount": "1.5", "price": "7000.00", "status": "open"},
        ...
    ],
    "id": 1015
}

Executed Order Inquiry

Example WebSocket Request:

{
    "method": "order.history",
    "params": ["BTC_USDT", 1620000000, 1625000000, 0, 10, 1],
    "id": 1016
}

Response:

{
    "error": null,
    "result": [
        {"id": 2, "market": "BTC_USDT", "amount": "2.0", "price": "7100.00", "status": "filled"},
        ...
    ],
    "id": 1016
}

Asset API (Authentication Required)

Asset Inquiry

Example WebSocket Request:

{
    "method": "asset.query",
    "params": ["BTC", "ETH"],
    "id": 1017
}

Response:

{
    "error": null,
    "result": {
        "BTC": {"available": "1.5", "freeze": "0.5"},
        "ETH": {"available": "10.0", "freeze": "2.0"}
    },
    "id": 1017
}

Asset History

Example WebSocket Request:

{
    "method": "asset.history",
    "params": ["BTC", null, 1620000000, 1625000000, 0, 10],
    "id": 1018
}

Response:

{
    "error": null,
    "result": [
        {"asset": "BTC", "available": "1.5", "freeze": "0.5", "timestamp": 1622540000},
        ...
    ],
    "id": 1018
}