Skip to main content

Add Order

POST 

/private/AddOrder

Place a new order.

Note: See the AssetPairs endpoint for details on the available trading pairs, their price and quantity precisions, order minimums, available leverage, etc.

API Key Permissions Required: Orders and trades - Create & modify orders

Request

Body

required
    nonce int32required

    Nonce used in construction of API-Sign header

    userref int32

    User reference id

    userref is an optional user-specified integer id that can be associated with any number of orders. Many clients choose a userref corresponding to a unique integer id generated by their systems (e.g. a timestamp). However, because we don't enforce uniqueness on our side, it can also be used to easily group orders by pair, side, strategy, etc. This allows clients to more readily cancel or query information about orders in a particular group, with fewer API calls by using userref instead of our txid, where supported.

    ordertype ordertype (string)required

    Possible values: [market, limit, iceberg, stop-loss, take-profit, stop-loss-limit, take-profit-limit, trailing-stop, trailing-stop-limit, settle-position]

    Order type

    type stringrequired

    Possible values: [buy, sell]

    Order direction (buy/sell)

    volume stringrequired

    Order quantity in terms of the base asset

    Note: Volume can be specified as 0 for closing margin orders to automatically fill the requisite quantity.

    displayvol string

    For iceberg orders only, it defines the quantity to show in the book while the rest of order quantity remains hidden. Minimum value is 1 / 15 of volume.

    pair stringrequired

    Asset pair id or altname

    price string

    Price:

    • Limit price for limit and iceberg orders
    • Trigger price for stop-loss, stop-loss-limit, take-profit, take-profit-limit, trailing-stop and trailing-stop-limit orders

    Notes:

    • Relative Prices: Either price or price2 can be preceded by +, -, or # to specify the order price as an offset relative to the last traded price. + adds the amount to, and - subtracts the amount from the last traded price. # will either add or subtract the amount to the last traded price, depending on the direction and order type used. Prices can also be suffixed with a % to signify the relative amount as a percentage, rather than an absolute price difference.
    • Trailing Stops: Must use a relative price for this field, namely the + prefix, from which the direction will be automatic based on if the original order is a buy or sell (no need to use - or #). The % suffix also works for these order types to use a relative percentage price.
    price2 string

    Secondary Price:

    • Limit price for stop-loss-limit, take-profit-limit and trailing-stop-limit orders Note:
    • Trailing Stops: Must use a relative price for this field, namely one of the + or - prefixes. This will provide the offset from the trigger price to the limit price, i.e. +0 would set the limit price equal to the trigger price. The % suffix also works for this field to use a relative percentage limit price.
    trigger string

    Possible values: [index, last]

    Default value: last

    Price signal used to trigger stop-loss, stop-loss-limit, take-profit, take-profit-limit, trailing-stop and trailing-stop-limit orders Notes:

    • This trigger type will also be used for any associated conditional close orders.
    • To keep triggers serviceable, the last price will be used as fallback reference price during connectivity issues with external index feeds.
    leverage string

    Amount of leverage desired (default: none)

    reduce_only boolean

    If true, order will only reduce a currently open position, not increase it or open a new position.

    stptype string

    Possible values: [cancel-newest, cancel-oldest, cancel-both]

    Default value: cancel-newest

    Self trade prevention behavior definition:

    • cancel-newest - if self trade is triggered, arriving order will be canceled
    • cancel-oldest - if self trade is triggered, resting order will be canceled
    • cancel-both - if self trade is triggered, both arriving and resting orders will be canceled
    oflags oflags (string)

    Comma delimited list of order flags

    • post post-only order (available when ordertype = limit)
    • fcib prefer fee in base currency (default if selling)
    • fciq prefer fee in quote currency (default if buying, mutually exclusive with fcib)
    • nompp disable market price protection for market orders
    • viqc order volume expressed in quote currency. This option is supported only for buy market orders. Also not available on margin orders.
    timeinforce string

    Possible values: [GTC, IOC, GTD]

    Default value: GTC

    Time-in-force of the order to specify how long it should remain in the order book before being cancelled. GTC (Good-'til-cancelled) is default if the parameter is omitted. IOC (immediate-or-cancel) will immediately execute the amount possible and cancel any remaining balance rather than resting in the book. GTD (good-'til-date), if specified, must coincide with a desired expiretm.

    starttm string

    Scheduled start time, can be specified as an absolute timestamp or as a number of seconds in the future:

    • 0 now (default)
    • <n> = unix timestamp of start time
    • +<n> = schedule start time <n> seconds from now
      • Note that URL encoding of the + character changes it to a space, so please use %2b followed by the number of seconds instead of +
    expiretm string

    Expiry time on GTD orders can be set up to one month in future, it is specified as an absolute timestamp or as a number of seconds from now:

    • 0 no expiration (default)
    • <n> = unix timestamp of expiration time
    • +<n> = expire <n> seconds from now, minimum 5 seconds
      • Note that URL encoding of the + character changes it to a space, so please use %2b followed by the number of seconds instead of +
    close[ordertype] string

    Possible values: [limit, iceberg, stop-loss, take-profit, stop-loss-limit, take-profit-limit, trailing-stop, trailing-stop-limit]

    Conditional close order type

    Note: Conditional close orders are triggered by execution of the primary order in the same quantity and opposite direction, but once triggered are independent orders that may reduce or increase net position

    close[price] string

    Conditional close order price

    close[price2] string

    Conditional close order price2

    deadline string

    RFC3339 timestamp (e.g. 2021-04-01T00:18:45Z) after which the matching engine should reject the new order request, in presence of latency or order queueing: min now() + 2 seconds, max now() + 60 seconds.

    validate boolean

    Validate inputs only. Do not submit order.

Responses

Order added.

Schema
    result object
    descr object

    Order description info

    order string

    Order description

    close string

    Conditional close order description, if applicable

    txid string[]

    Transaction IDs for order
    (if order was added successfully)

    error array[]
Loading...