NAV Navbar
json

Changelogs

Version Time Content
V0.1 2021 Jun 7 First version of Dual-Ccy API

Dual-Ccy Product

Get User Assets

GET /dual/api/v1/assets

ratelimit: 10 requests/second.

Query parameters

None

curl "https://mapi.matrixport.com/dual/api/v1/assets?timestamp=1628647842000&signature=5ef34f9cf22328390bb9282131c40dfbe9dca86c2b30c9c4d9acab1130fdfc14"

Response

{
    "code": 0, 
    "message": "OK", 
    "data": [
        {
            "currency": "BTC", 
            "available_balance": "9860.38245547", 
            "balance": "9860.38245547", 
            "frozen_balance": "0"
        }
    ]
}

Response

Parameter Type Required Default Description
currency string true
available_balance string true
balance string true
frozen_balance string true

Get Dual products

GET /dual/api/v1/products

ratelimit: 10 requests/second.

Query parameters

Parameter Type Required Description
category int true category
curl "https://mapi.matrixport.com/dual/api/v1/products?category=1&timestamp=1627021721000&signature=d58a54d7921187bf81a0e9d028cf460f70c3c83faba7f0e9abee054e7f7bfcd1"

Response

{
    "code": 0, 
    "message": "OK", 
    "data": [
        {
            "id": 6488234, 
            "name": "Dual Currency-BTC-2265", 
            "category": "1", 
            "instrument": "BTC-30JUL21-34000-C", 
            "striking_price": "34000", 
            "cp_type": 0, 
            "min_qty": "0.01", 
            "rule": "<p>Rule description</p>", 
            "profit_rule": "<p><span style=\"font-size: 14px;\">Income rule</span></p>", 
            "finish_time": 1627632000000, 
            "risk": "Risk Warning", 
            "status": 1, 
            "description": "", 
            "real_profit": "0.0108", 
            "year_profit": "0.5631", 
            "kyc_limit": 0, 
            "diff_day": 7, 
            "step": "0.01", 
            "type": 0, 
            "quantity": "222.6"
        }
    ]
}

Response

Parameter Type Required Default Description
id int true product id
name string true
category int true
instrument string true
striking_price string true
cp_type int true 0 call 1 put
min_qty string true min buy quantity (base currency or usdc)
rule string false product rule description
profit_rule string false product profit rule description
finish_time long true instrument settlement timestamp
risk string false product risk description
status int true Product Status
description string true
real_profit string true product real profit
year_profit string true year profit
kyc_limit int true
diff_day int true settlement time and now interval days
step string true quantity increase step
type int true product type(0 default)
quantity string true left quantity can buy
diff_day_str string true app tenor string
is_popular bool true app fire icon displayed

Place Order

POST /dual/api/v1/place/order

ratelimit: 5 requests/second.

Query parameters

Parameter Type Required Description
pid int true product id
quantity string true xxxBase or xxxUsdc
biz_order_id string true business order id (max 40 character)
curl -H "Content-Type:application/json" -X POST --data '{"pid":6550241,,,,"biz_order_id":"test","quantity":"0.1","timestamp":1628909085000,"signature":9117bd1e5587e8318456e52e091136f1eb84ffebc1f2b9656573344962acc81a}' https://mapi.matrixport.com/dual/api/v1/place/order

Response

{
    "code": 0, 
    "message": "OK", 
    "data": {
        "quantity": "0.1", 
        "order_id": "615286996410847240", 
        "biz_order_id": "test",
        "create_time": 1626862329785, 
        "complete_time": 1626941289677, 
        "settle_time": 1626941289178, 
        "status": 0, 
        "order_type": 0, 
        "base_currency": "BTC", 
        "settle_currency": "USDC", 
        "striking_price": "32000", 
        "settle_amount": "160832", 
        "pid": 6475805, 
        "category": 1, 
        "instrument": "BTC-22JUL21-32000-C", 
        "name": "Dual Currency-BTC-3346", 
        "finish_time": 1626940800000, 
        "real_profit": "0.0052000000000000", 
        "year_profit": "1.89800000", 
        "classify": 0,
        "settle_price": ""
    }
}

Response

Parameter Type Required Default Description
quantity string true
order_id string true
biz_order_id string true
create_time long true
complete_time long false
settle_time long false
status int true Order Status
order_type int true default 0
base_currency string true
settle_currency string false
striking_price string true
settle_amount string true
pid int true product id
category int true
instrument string true
name string true product name
finish_time long true
real_profit string true
year_profit string true
classify int true Classify
settle_price string true

Get Orders

GET /dual/api/v1/orders

ratelimit: 10 requests/second.

Query parameters

Parameter Type Required Description
order_id string false
biz_order_id string false business order id
status int false Order Status
start_time long false created start time (millisecond timestamp)
end_time long false created end time (millisecond timestamp)
base_currency string true
classify int false Classify
finish_time long false instrument settletime (millisecond timestamp)
limit int false default 20
offset int false default 0
curl "https://mapi.matrixport.com/dual/api/v1/orders?order_id=618203915149492407&timestamp=1628648187000&signature=905af0948e168cb4489841a44e2f85d5bdaea69cca5ddfdadc011a376c31a613"

Response

{
    "code": 0, 
    "message": "OK", 
    "data": [
        {
            "quantity": "5.0000000000000000", 
            "order_id": "615286996410847240", 
            "biz_order_id": "615286996410847240",
            "create_time": 1626862329785, 
            "complete_time": 1626941289677, 
            "settle_time": 1626941289178, 
            "status": 3, 
            "order_type": 0, 
            "base_currency": "BTC", 
            "settle_currency": "USDC", 
            "striking_price": "32000", 
            "settle_amount": "160832", 
            "pid": 6475805, 
            "category": 1, 
            "instrument": "BTC-22JUL21-32000-C", 
            "name": "Dual Currency-BTC-3346", 
            "finish_time": 1626940800000, 
            "real_profit": "0.0052000000000000", 
            "year_profit": "1.89800000", 
            "classify": 0,
            "settle_price": "33011"
        }
    ]
}

Response

Parameter Type Required Default Description
quantity string true
order_id string true
biz_order_id string true
create_time long true
complete_time long false
settle_time long false
status int true Order Status
order_type int true default 0
base_currency string true
settle_currency string false
striking_price string true
settle_amount string true
pid int true product id
category int true
instrument string true
name string true product name
finish_time long true
real_profit string true
year_profit string true
classify int true Classify
settle_price string true

Constant definitions

Dual Category

Category Description
1 Dual-BTC
2 Dip Hunter
3 Dual-BTC-U
7 Dual-ETH
9 Dual-ETH-U
18 Dual-BCH
20 Dual-BCH-U
35 Dual-SOL
36 Dual-SOL-U

Dual Classify

Classify Description
0 Dual-Ccy
4 Dip Hunter
6 Dual-Ccy-U

Order status

Status Description
0 Order initial state - temporary state
2 Product purchase done and waiting for settlement - before Settlement Time
3 Investment settled - after Settlement Time
4 Order is refunded
5 Order is cancelled

Product Status

Status Description
0 New status
1 Selling
2 Sell out
3 Down
others inner status,ignore

Errors

Error Handling

A clarification of Matrixport APIs:


When calling the APIs of Matrixport,the caller will get one of the following four types of results:

  1. A response indicating the request was successful
  2. A response indicating the request had been rejected
  3. A response indicating failed to get the processing result of the request
  4. Failed to receive a response (should be handled similarly to type 3, see below)

A result of type 3. happens when the frontend web servers of matrixport.com failed to receive a response from the matching engine in time (due to a network issue or a timeout). The response can be in the form of

  1. A HTTP response with status "504 - Gateway Timeout", when the failure was at the gateway layer.
  2. A HTTP response with status "200 - OK", but the JSON error code != 0
  3. Other forms of network errors if the failure was even before the gateway of matrixport.

When a result of type 3 happens, it is unknown to the caller whether the sent request has been received/processed/rejected by the matching engine. Therefore, the caller has to make another call to check the state of the order or the account to find out.

Error code list

Matrixport API error codes:

Error Code Description
0 Success (no error)
13510002 json parse data exception
13510003 argument required
13510004 verify signature failed
13510005 user info can not find
13510006 The service is temporarily unavailable
13510007 The limit maximum is 100
13031046 product is not exist
13031055 product status is invalidate
13031118 kyc is required
13031044 product is expired
13031092 step is not match
13031053 product status is sold out
13031051 product purchase quantity over the maximum
13031057 product will expire soon and not for sell
13031019 biz order already exists