Moonbase Docs

Create a new order

Create a new order.

Requires authentication.

POST
/api/v1/orders
NOVA-KEY<token>

In: header

NOVA-SECRET<token>

In: header

type?string

Order type. Default is LIMIT.

Default"LIMIT"
Value in"LIMIT" | "MARKET" | "STOP" | "TWAP"
sidestring

Side of the book to place order on. Either BUY or SELL.

Default"BUY"
Value in"BUY" | "SELL"
product_idstring

Product to place order on. (BTC-VND, ETH-VND, SOL-VND).

stp?string

Self-trade prevention flag. Either cancel_taker or cancel_maker.

Default"CANCEL_TAKER"
Value in"CANCEL_TAKER" | "CANCEL_MAKER" | "CANCEL_BOTH"
limit_pricestring

The max or min price limit to buy or sell at. For market order or order with exact_quote_size, limit price must be 0.

base_sizestring

Amount to buy or sell. Must be 0 if quote size is provided.

quote_size?string

MARKET orders using quote_size specifies the amount the user wants to spend (when buying) or receive (when selling) the quote asset; the correct base_size will be determined based on the market liquidity and quote_size. Only available for market order. Must be 0 if base size is provided.

exact_quote_size?string

For LIMIT orders, exact_quote_size is the total quote amount the user expects to spend (when buying) or receive (when selling) base_size amount of base asset, inclusive of all fees. The limit_price will be calculated from exact_quote_size, base_size, and fees. Any remaining quote amount after the fill will be charged. When exact_quote_size is provided, the order must be LIMIT and the time in force must be FOK.

time_in_force?string

How long the open order should be active for. Either GTC, IOC, or FOK. Default is GTC. For market order, time in force must be IOC.

Default"GTC"
Value in"GTC" | "IOC" | "FOK" | "GTT"
post_only?boolean

Post-only flag. If true, order will be rejected if it would take liquidity. Optional, default is false. For market order, post only must be false.

order_stop_type?string

Order stop type. Could be NONE, TAKE_PROFIT or STOP_LOSS. Default is STOP_NONE.

Default"STOP_NONE"
Value in"STOP_NONE" | "STOP_LOSS" | "TAKE_PROFIT"
stop_trigger_price?string

The last traded price at which the stop order will be triggered.

client_order_id?string

A unique id among open orders. It can contain alphanumeric characters and some symbols (:, -, _). Case-insensitive. Optional.

expired_at?string

Order expiry time in nanosecond for time in force GTT, mandatory when time_in_force set to GTT.

Formatint64
scheduled_at?string

Order scheduled time in nanosecond.

Formatint64
wait?boolean

If this is true, the response will be sent only after the order is properly processed (instead of return immediately as "pending" as before) by the matching engine". The order status in the response will be "open", "done" or "accepted". Note that the http status code is still 200 OK when order is (created then) rejected by matching engine, the client should use order status field to know what happened with the order (put on book, partially filled, fully filled, etc).

Response Body

application/json

application/json

curl -X POST "https://api.moonbase.vn/api/v1/orders" \  -H "Content-Type: application/json" \  -d '{    "side": "BUY",    "product_id": "string",    "limit_price": "string",    "base_size": "string"  }'
{
  "order": {
    "order_id": "string",
    "client_order_id": "string",
    "user_id": "string",
    "status": "SUBMITTED",
    "done_reason": "string",
    "product_id": "string",
    "side": "BUY",
    "type": "LIMIT",
    "time_in_force": "GTC",
    "post_only": "false",
    "stp": "CANCEL_TAKER",
    "limit_price": "string",
    "base_size": "string",
    "quote_size": "string",
    "exact_quote_size": "string",
    "average_fill_price": "string",
    "filled_base_size": "string",
    "filled_quote_size": "string",
    "maker_fee_rate": "string",
    "taker_fee_rate": "string",
    "fee_asset_id": "string",
    "created_at": "string",
    "updated_at": "string",
    "cancel_requested_at": "string",
    "expired_at": "string",
    "scheduled_at": "string",
    "trades": [
      {
        "id": "string",
        "price": "string",
        "size": "string",
        "liquidity_indicator": "MAKER",
        "time": "string",
        "fee_asset": "string",
        "fee_amount": "string"
      }
    ]
  }
}
{
  "code": 0,
  "message": "string",
  "details": [
    {
      "@type": "string",
      "property1": null,
      "property2": null
    }
  ]
}