Order Book Technical Reference

Limit Order Definition and Partial Execution

A limit order is an instruction from a trader to buy or sell a specified quantity of an asset at a specified price or better. The order will only be executed if the market price meets the conditions set by the trader.

Let us define:

  • PlimitP_{\text{limit}}: the limit price set by the trader.

  • PmarketP_{\text{market}}: the current market price.

  • QorderQ_{\text{order}}: the total quantity of the asset in the order.

For a buy limit order, the condition for execution is:

Pmarketā‰¤PlimitP_{\text{market}} \leq P_{\text{limit}}

For a sell limit order, the condition for execution is:

Pmarketā‰„PlimitP_{\text{market}} \geq P_{\text{limit}}

If the respective condition is met, the order is executed for the available quantity at the best available price up to PlimitP_{\text{limit}} for buys or down to PlimitP_{\text{limit}} for sells.

Partial Fill and Remaining Order

When a limit order is partially filled, only a portion of the order's total quantity is executed. The remaining unfilled quantity remains in the order book at the original limit price until it is fully filled or canceled.

Let us define:

  • QinitialQ_{\text{initial}}: the initial quantity specified in the limit order.

  • QfilledQ_{\text{filled}}: the quantity that has been executed (filled).

  • QremainingQ_{\text{remaining}}: the remaining quantity after partial fill.

The relationship between these quantities is:

Qremaining=Qinitialāˆ’QfilledQ_{\text{remaining}} = Q_{\text{initial}} - Q_{\text{filled}}

The limit price PlimitP_{\text{limit}} remains unchanged after partial execution.

Price Calculation and Asset Quantities

In the context of exchanging assets, the price and quantities are represented as follows:

  • QofferQ_{\text{offer}}: the quantity of the asset being offered (e.g., currency being sold).

  • QaskQ_{\text{ask}}: the quantity of the asset being asked for (e.g., currency being bought).

  • PP: the price at which the exchange occurs, defined as:

P=QofferQaskP = \frac{Q_{\text{offer}}}{Q_{\text{ask}}}

After a partial fill, the quantities are updated:

  • CofferC_{\text{offer}}: the amount of the offered asset that has been executed.

  • CaskC_{\text{ask}}: the amount of the asked asset that has been received in exchange.

  • Qofferā€²=Qofferāˆ’CofferQ'_{\text{offer}} = Q_{\text{offer}} - C_{\text{offer}}: the updated offered quantity.

  • Qaskā€²=Qaskāˆ’CaskQ'_{\text{ask}} = Q_{\text{ask}} - C_{\text{ask}}: the updated asked quantity.

The price $P$ remains unchanged for the remaining unfilled portion:

P=QofferQask=Qofferā€²Qaskā€²P = \frac{Q_{\text{offer}}}{Q_{\text{ask}}} = \frac{Q'_{\text{offer}}}{Q'_{\text{ask}}}

Summary

After a limit order is partially filled, the unfilled portion of the order remains active in the order book at the same limit price PlimitP_{\text{limit}}. The execution continues to adhere to the original conditions until the entire order is filled or canceled. The consistent price PP ensures that the ratio of the offered and asked quantities remains constant for the remaining order.

This mechanism allows traders to maintain control over the price at which they buy or sell an asset, even if their order cannot be filled immediately in its entirety.

Last updated