NAV Navbar
json

Trade Service Api

this collections of api can be used to fetch price, and place an order, and get batch of orders.


System Healthy Check

GET /trader/v2/api/healthy

Request sample


curl -X GET  https://mapi.matrixport.com/trader/v2/api/healthy

Response Data


{
    "code": 0,
    "message": "success"
}

You can check the system's staus according to the rsp of this api.

ratelimit: 10 requests/second.

Query parameters

None

Response Data

Parameter Type Description
code Number 0,normal; not 0, system unavailable
message String msg

Symbol Information

GET /trader/v2/api/symbols-info

Query trading symbol information.

ratelimit: 10 requests/second.

Request sample


curl -X GET  https://mapi.matrixport.com/trader/v2/api/symbols-info  -H ' {"Content-Type": "application/json", "X-Bit-Access-Key": "ak-1a7d7df3-1f57-4bc4-adfb-224ef6ff0056"} '

Response Data

{
  "code": 0,
  "message": "success",
  "data": [{
    "pair": "BTCUSDT",
    "base_currency": "BTC",
    "quote_currency": "USDT",
    "quote_precision": 2,
    "base_precision": 6,
    "base_min_amount": "0.0001",
    "base_max_amount": "50",
    "quote_min_amount": "20",
    "quote_max_amount": "5000000"
  }]
}

Query parameters

None

Response Data

Parameter Type Description
pair String symbol, eg. BTCUSDT
base_currency String base currency, eg. BTC
quote_currency String quote currency, eg. USDT
base_precision String precision of base quantity
quote_precision String precision of quote quantity
base_min_amount String minimum order quantity of base currency
base_max_amount String maximum order quantity of base currency
quote_min_amount String minimum order quantity of quote currency
quote_max_amount String maximum order quantity of quote currency

Get Quote

GET /trader/v2/api/rfq-price

Request sample


curl -X GET  https://mapi.matrixport.com/trader/v2/api/rfq-price  -H ' {"Content-Type": "application/json", "X-Bit-Access-Key": "ak-1a7d7df3-1f57-4bc4-adfb-224ef6ff0056"} ' -d ' {"symbol": "BTCUSDT", "cash": 1800, "qty": 0.001, "side": 0, "timestamp": 1653557003000, "signature": "bf5b1f358aea68dab532f68714a1a512c90330c78c23c3143cd5550562a20d68"} '

Response Data


{
    "code": 0,
    "message": "success",
    "data": {
        "symbol": "BTCUSDT",
        "price_id": "727252627538346195",
        "price": "7134.01",
        "expire_ts": 1653557010245,
        "countdown_ts": 5500,
        "qty": "0.25231251",
        "cash": "1800"
    }
}

You can fetch price of the target pair. It should be noted that, Two parameters in qty and cash, ONLY one is required and can be provided, if both are provided, both must be greater than 0, and only cash will be treated as valid.

ratelimit: 20 requests/second.

Query parameters

Parameter Type mandatory default Description
symbol String true pair, eg. BTCUSDT
side Integer true Side
cash BigDecimal false quoteQty, eg. amount of USDT in BTCUSDT
qty BigDecimal false baseQty, eg. amount of BTC in BTCUSDT

Response Data

Parameter Type Description
symbol String pair, eg. BTCUSDT
qty String baseQty, eg. amount of BTC in BTCUSDT
cash String quoteQty, eg. amount of USDT in BTCUSDT
price_id String quote result id, used in order placing
price String
expire_ts long expire timestamp of the price
countdown_ts long ttl of the price, eg. 5 seconds

Place An Order

POST /trader/v2/api/rfq-place

Request sample

curl -X POST  https://mapi.matrixport.com/trader/v2/api/rfq-place  -H ' {"Content-Type": "application/json", "X-MatrixPort-Access-Key": "ak-1a7d7df3-1f57-4bc4-adfb-224ef6ff0056"} ' -d ' {"symbol": "BTCUSDT", "client_order_id": "clordid0.12694683670148055", "side": 0, "price_id": "727252627538346195", "qty": "0.25231251", "biz_src": 1, "timestamp": 1653557004000, "signature": "898f729551a58c65732cbd4b86a52605a9ac1164453b2ed487c2c54aebf18d2d"} '

Response Data


{
    "code": 0,
    "message": "success",
    "data": {
        "client_order_id": "clordid0.12694683670148055",
        "order_id": 727252632480574865,
        "create_ts": 1653557004914,
        "status": 101,
        "filled_price": "7134.01",
        "filled_qty": "0.25231251",
        "filled_cash": "1800",
        "place_price": "7134.01",
        "place_qty": "0.25231251",
        "place_cash": "1800",
        "user_id": "603704"
    }
}

You can place an order with the required parameters.

ratelimit: 10 requests/second.

Query parameters

Parameter Type mandatory default Description
symbol String true pair, eg. BTCUSDT
side Integer true Side
qty BigDecimal true baseQty
price_id String true
client_order_id String true custom order id

Response Data

Parameter Type Description
client_order_id String custom order id
order_id long id that M-site generated.
create_ts long order create timestamp
status int true
filled_price String filleAvgPrice
filled_qty String filledBaseQty
filled_cash String filledQuoteQty
place_price String
place_qty String
place_cash String
user_id String

query one order

GET /trader/v2/api/order

Request sample

curl -X GET  https://mapi.matrixport.com/trader/v2/api/order  -H ' {"Content-Type": "application/json", "X-MatrixPort-Access-Key": "ak-1a7d7df3-1f57-4bc4-adfb-224ef6ff0056"} ' -d ' {"order_id": 727252632480574865, "client_order_id": "clordid0.12694683670148055", "timestamp": 1653557004000, "signature": "1ffb6a71e535d2debeba9f271b639f490a91df57166c3100174ea91b476bdf2e"} '

Response Data


{
    "code": 0,
    "message": "success",
    "data": {
        "client_order_id": "clordid0.12694683670148055",
        "order_id": 727252632480574865,
        "user_id": "603704",
        "symbol": "BTCUSDT",
        "base_currency": "BTC",
        "quote_currency": "USDT",
        "side": 0,
        "price_id": "727252627538346195",
        "qty": "0.25231251",
        "cash": "1800",
        "price": "7134.01",
        "filled_qty": "0.25231251",
        "filled_cash": "1800",
        "filled_price": "7134.01",
        "create_ts": 1653557004914,
        "status": 101
    }
}

You can get one order according to order_id or client_order_id.

ratelimit: 10 requests/second.

Query parameters

Parameter Type mandatory default Description
order_id Long true "" id that M-site generated.
client_order_id String true "" custom order id

Response Data

Parameter Type Description
client_order_id String Description
order_id long id that M-site generated.
user_id String
symbol String pair, eg. BTCUSDT
base_currency String eg. BTC
quote_currency String eg. USDT
side int Side
price_id String
qty String order placing base amount
cash String order placing quote amount
price String order placing price
filled_qty String
filled_cash String
filled_price String
create_ts long order create timestamp
complete_ts Long order filled timestamp
status int Status
err_code Integer
err_msg String

Query Orders

GET /trader/v2/api/orders

Request sample


curl -X GET  https://mapi.matrixport.com/trader/v2/api/orders  -H ' {"Content-Type": "application/json", "X-Bit-Access-Key": "ak-1a7d7df3-1f57-4bc4-adfb-224ef6ff0056"} ' -d ' {"symbol": "BTCUSDT", "start_time": 1653470603000, "end_time": 1653557003000, "limit": 10, "timestamp": 1653557004000, "signature": "23f5341497fce8247b53eb1f56c0008c57dfcb7cfdf28630e08d5f1039502d98"} '

Response Data

{
    "code": 0,
    "message": "success",
    "data": [
        {
            "client_order_id": "clordid0.9462529337241995",
            "order_id": 727321993425776308,
            "user_id": "42",
            "symbol": "BTCUSDT",
            "base_currency": "BTC",
            "quote_currency": "USDT",
            "side": 0,
            "price_id": "727321987430780640",
            "qty": "0.2512454",
            "cash": "1800",
            "price": "7164.31002",
            "filled_qty": "0.2512454",
            "filled_cash": "1800",
            "filled_price": "7164.31002",
            "create_ts": 1653573541852,
            "complete_ts": 1653573542650,
            "status": 3
        }
    ]
}

You can query all orders corresponding to the params you provide.

ratelimit: 10 requests/second.

Query parameters

Parameter Type mandatory default Description
symbol String true pair, eg. BTCUSDT
start_time Long true 13 digit timestamp
end_time Long true 13 digit timestamp
limit Integer false 1 max records in query, default 1,max 100

Response Data

Parameter Type Description
client_order_id String Description
order_id long id that M-site generated.
user_id String
symbol String pair, eg. BTCUSDT
base_currency String eg. BTC
quote_currency String eg. USDT
side int Side
price_id String
qty String order placing base amount
cash String order placing quote amount
price String order placing price
filled_qty String
filled_cash String
filled_price String
create_ts long order create timestamp
complete_ts Long order filled timestamp
status int Status
err_code Integer
err_msg String

Enums

Side

Side {
    0 = BUY,
    1 = SELL
}

Status

Status {
    101 = processing;
    2 = trade completed, not settled;
    3 = trade completed, settled;
    5 = cancelled
}

Error codes