Order Types

CoreMatch natively supports limit (LMT) and stop-limit (STL) orders. CoinJar Exchange also provides simulated market (MKT) orders by generating a series of IOC limit orders. These generated orders are not blocking or atomic.

Limit (LMT) orders

A limit order specifies the maximum price a buyer will pay or the minimum price a seller will accept.

Limit orders support the following time-in-force options:

  • Good Till Cancelled (GTC): The order remains on the order book until it is completely filled or cancelled.

  • Immediate Or Cancel (IOC): The order fills immediately to the extent possible and any remaining portion is cancelled. If partially filled, the remaining size is not
    revealed to the market.

  • Maker Or Cancel (MOC): The order is cancelled immediately if any part of it would fill on entry. If cancelled, no order information is revealed to the market.

Market (MKT) orders

Market orders are simulated by generating a series of IOC limit orders against available liquidity.

Because these orders are generated sequentially, the operation is not blocking or atomic. Available liquidity and prices may change while the market order is being
processed.

Stop-limit (STL) orders

A stop-limit order combines a trigger price with a limit price:

  • trigger_price determines when the order is activated.
  • price is the limit price used after activation.
  • time_in_force must be GTC.

An accepted stop-limit order initially has a status of active. While active, it is not placed on the order book and cannot receive fills, but the required funds are
reserved.

Mark price

Stop-limit orders are triggered using the product's mark price, rather than its last trade price alone.

The mark price is calculated as:

mark_price = median(best_bid, best_ask, last_trade_price)

For a normal, uncrossed order book, this is equivalent to constraining the last trade price to the current bid–ask spread:

best bidbest asklast trade pricemark price
99101100100
99101105101
991019599

Therefore:

  • If the last trade is between the best bid and best ask, the mark price is the last trade price.
  • If the last trade is above the best ask, the mark price is the best ask.
  • If the last trade is below the best bid, the mark price is the best bid.

This prevents a single trade outside the current spread from moving the mark price beyond the best available bid or ask. A new mark price can only be calculated when the
best bid, best ask, and last trade price are all available.

Whenever the calculated mark price changes, active stop-limit orders are evaluated:

  • A buy stop-limit order triggers when mark_price is greater than or equal to trigger_price.
  • A sell stop-limit order triggers when mark_price is less than or equal to trigger_price.

The mark price only determines when a stop-limit order is triggered. It is not the execution price and does not guarantee that the order will fill at the trigger price.

After triggering

Once triggered, the stop-limit order behaves like a GTC limit order using its specified price:

  • A buy order can execute at its limit price or lower.
  • A sell order can execute at its limit price or higher.
  • The order may fill completely, fill partially and book the remaining quantity, or book without receiving a fill.
  • Execution is not guaranteed.

Triggering does not create a new order. The original oid is retained, type remains STL, and trigger_price remains available after triggering.

Trigger-price rounding

The submitted trigger_price is rounded to the product's tick size:

  • Buy trigger prices are rounded up.
  • Sell trigger prices are rounded down.

The trigger_price returned by the API is the rounded value used to evaluate the order's trigger condition.

Limit-price bounds

A stop-limit order's limit price is validated relative to its rounded trigger price:

  • For a buy order, price must be strictly less than 125% of trigger_price.
  • For a sell order, price must be strictly greater than 80% of trigger_price.

An order at exactly either boundary is rejected.


Did this page help you?