Exchange

HTTP response codes

NOTE: Before parsing response body check its response code and Content-Type header.

Errors

Error has various text if "msg" has value MSG. The text depends on the request the error is returned for.

Rejected API Key

{"code":-2015, "msg":"Invalid API-key, IP, or permissions for action"}

Invalid Signature

{"code":-1022, "msg":"Signature for this request is not valid"}

Invalid Parameter

{"code":-1130, "msg": MSG}

Unknown error

{"code":-1000, "msg":"An unknown error occured while processing the request"}

Invalid Timestamp

{"code":-1021, "msg":"Timestamp for this request is outside of the recvWindow."}

No Such Order

{"code":-2013, "msg":"Order does not exist"}

New Order Rejected

{"code":-2010, "msg": MSG}

General Information on Endpoints

General Info on Limits

Session limits

Endpoint security type

Security Type Description
USER_DATA Endpoint requires sending a valid API-Key and signature.
MARKET_DATA Endpoint requires sending a valid API-Key.

Timing security

SIGNED Endpoint Example for POST /order

Here is a step-by-step example of how to send a vaild signed payload from the
Linux command line using echo, openssl, and curl.

Key Value
apiKey vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A
secretKey NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j
Parameter Value
symbol LTCBTC
side BUY
type LIMIT
timeInForce GTC
quantity 1
price 0.1
recvWindow 5000
timestamp 1499827319559
[linux]$ echo -n "symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559" | openssl dgst -sha256 -hmac "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
(stdin)= c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71
(HMAC SHA256)
[linux]$ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://blackmoon.net/trade/api/v1/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000&timestamp=1499827319559&signature=c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71'

Technical endpoints

Ping [GET /ping]

Test connectivity to the Rest API.

Response 200 (application/json)

Body

{}

Server time [GET /time]

Test connectivity to the Rest API and get the current server time.

Response 200 (application/json)

Body

{"serverTime":1571315545616}

Market Data endpoints

Trades [GET /trades]

Get recent trades

Query parameters

name type description
symbol string
limit int, optional default 500. Max 1000

Response 200 (application/json)

Body

[
    {
        "id": 21360934,
        "isBuyer": false,
        "price": "0.016331",
        "qty": "1",
        "quoteQty": "0.016331",
        "time": 1568899463409
    },
    {
        "id": 21361952,
        "isBuyer": false,
        "price": "0.016331",
        "qty": "1",
        "quoteQty": "0.016331",
        "time": 1569484928821
    }
]

Old trade lookup [GET /historicalTrades]

Get older trades.

Query parameters

name type description
symbol string
limit int, optional default 500. Max 1000
fromId int, optional default 0
startTime int, optional time in milliseconds
endTime int, optional time in milliseconds

Response 200 (application/json)

Body

[
    {
        "id": 21360934,
        "isBuyer": false,
        "price": "0.016331",
        "qty": "1",
        "quoteQty": "0.016331",
        "time": 1568899463409
    },
    {
        "id": 21361952,
        "isBuyer": false,
        "price": "0.016331",
        "qty": "1",
        "quoteQty": "0.016331",
        "time": 1569484928821
    }
]

Order book [GET /depth]

Get older trades.

Query parameters

name type description
symbol string

Response 200 (application/json)

Body

{
    "bids": [
        [
            "4.00000000",     // PRICE
            "431.00000000"    // QTY
        ]
    ],
    "asks": [
        [
            "4.00000200",
            "12.00000000"
        ]
    ]
}

Symbol order book ticker [GET /ticker/bookTicker]

Best price/qty on the order book for a symbol or symbols.

Query parameters

name type description
symbol string

Response 200 (application/json)

Body

{
    "askPrice": "0.016245",
    "askQty": "1",
    "bidPrice": "0.0001",
    "bidQty": "0.54",
    "symbol": "ETH/BTC"
}

Exchange information [GET /exchangeInfo]

Current exchange trading rules and symbol information

Response 200 (application/json)

Body

{
    "timezone": "UTC",
    "serverTime": 1571238236407,
    "symbols": [
        {
            "symbol": "BMxT20_EUR",
            "status": "TRADING",
            "baseAsset": "bmxt20",
            "baseAssetPrecision": 8,
            "quoteAsset": "eur",
            "quotePrecision": 8,
            "orderTypes": [
                "LIMIT",
                "MARKET",
                "STOP"
            ],
            "isSpotTradingAllowed": true,
            "isMarginTradingAllowed": false,
            "filters": null
        },
        {
            "symbol": "BMxT20_ETH",
            "status": "TRADING",
            "baseAsset": "bmxt20",
            "baseAssetPrecision": 8,
            "quoteAsset": "eth",
            "quotePrecision": 8,
            "orderTypes": [
                "LIMIT",
                "MARKET",
                "STOP"
            ],
            "isSpotTradingAllowed": true,
            "isMarginTradingAllowed": false,
            "filters": null
        }
    ]
}

Symbol price ticker [GET /ticker/price]

Latest price for a symbol or symbols.

Query parameters

name type description
symbol string, optional name of symbol the price for

Response 200 (application/json)

Body

{"name":"ETH/BTC","price":"0.016331"}

if symbol is not pointed

[{"name":"ETH/BTC","price":"0.016331"}, {"name":"BTC_EUR","price":"7281.98"}]

Account endpoints

Parameters are valid for all endpoints in the section.
They are should be in Query parameters if request is GET or DELETE or Request parameters if request is POST.

name type description
timstamp int client time in milleseconds
recvWindow int, optional duration the client request valid for
signature string hmac sha256 of query/request parameters

New order [POST /order]

Send in a new order.

Request (application/x-www-form-urlencoded)

Request parameters

name type description
symbol string name of symbol
side string BUY / SELL
type string MARKET / LIMIT / STOP
quantity string -
price string, optional required if type is LIMIT
stopPrice string, optional required if type is STOP

Response 200 (application/json)

Body

{
    "clientOrderId": "http-62514612-1765-4802-9d5b-f1215052aa95",
    "cummulativeQuoteQty": "0",
    "executedQty": "0",
    "orderId": "118388120",
    "origQty": "1",
    "price": "1",
    "side": "BUY",
    "status": "ORDER_STATUS_ACCEPTED",
    "symbol": "ETH/BTC",
    "timeInForce": "GOOD_TILL_CANCEL",
    "type": "LIMIT"
}

Query order [GET /order]

Check an order’s status.

Query Parameters

name type description
orderId int

Body

{
    "symbol": "ETH/BTC",
    "orderId": 118418425,
    "clientOrderId": "fdd76bf4-18e6-471e-b89d-4ebd56f53696",
    "price": "1",
    "origQty": "1",
    "executedQty": "0",
    "cummulativeQuoteQty": "0",
    "status": "ORDER_STATUS_ACCEPTED",
    "type": "LIMIT",
    "side": "SELL"
}

Cancel order [DELETE /order]

Cancel an active order.

Query Parameters

name type description
orderId int

Response 200 (application/json)

Body

{
    "clientOrderId": "http-62514612-1765-4802-9d5b-f1215052aa95",
    "cummulativeQuoteQty": "0",
    "executedQty": "0",
    "orderId": "118388120",
    "origQty": "1",
    "price": "1",
    "side": "BUY",
    "status": "ORDER_STATUS_CANCELLED",
    "symbol": "ETH/BTC",
    "timeInForce": "GOOD_TILL_CANCEL",
    "type": "LIMIT"
}

Current open orders [GET /openOrders]

Get all open orders on a symbol. Careful when accessing this with no symbol. Limit of orders you get is 500.

Query parameters

name type description
symbol string, optional

Body

[
    {
        "clientOrderId": "01203024-daae-40a4-93c6-a08ae92afb52",
        "cummulativeQuoteQty": "0",
        "executedQty": "0",
        "orderId": 118417767,
        "origQty": "1",
        "price": "1",
        "side": "SELL",
        "status": "ORDER_STATUS_ACCEPTED",
        "symbol": "ETH/BTC",
        "type": "LIMIT"
    },
    {
        "clientOrderId": "fdd76bf4-18e6-471e-b89d-4ebd56f53696",
        "cummulativeQuoteQty": "0",
        "executedQty": "0",
        "orderId": 118418425,
        "origQty": "1",
        "price": "1",
        "side": "SELL",
        "status": "ORDER_STATUS_ACCEPTED",
        "symbol": "ETH/BTC",
        "type": "LIMIT"
    }
]

All orders [GET /allOrders]

Get all account orders; active, canceled, or filled.

Query parameters

name type description
symbol string
limit int, optional default 500. Max 1000
orderId int, optional default 0
startTime int, optional time in milliseconds
endTime int, optional time in milliseconds

Body

[
    {
        "clientOrderId": "01203024-daae-40a4-93c6-a08ae92afb52",
        "cummulativeQuoteQty": "0",
        "executedQty": "0",
        "orderId": 118417767,
        "origQty": "1",
        "price": "1",
        "side": "SELL",
        "status": "ORDER_STATUS_CANCELLED",
        "symbol": "ETH/BTC",
        "type": "LIMIT"
    },
    {
        "clientOrderId": "fdd76bf4-18e6-471e-b89d-4ebd56f53696",
        "cummulativeQuoteQty": "0",
        "executedQty": "0",
        "orderId": 118418425,
        "origQty": "1",
        "price": "1",
        "side": "SELL",
        "status": "ORDER_STATUS_ACCEPTED",
        "symbol": "ETH/BTC",
        "type": "LIMIT"
    }
]

Account Information [GET /account]

Get current account information.

Response 200 (application/json)

Body

{
    "accountType": "SPOT",
    "balances": [
        {
            "asset": "btc",
            "free": "0.57590015",
            "locked": "0"
        },
        {
            "asset": "eth",
            "free": "34.97",
            "locked": "0"
        },
        {
            "asset": "ltc",
            "free": "0.46",
            "locked": "0"
        }
    ],
    "updateTime": 1565092306814
}