Market-to-Limit Orders: Taking Liquidity While Limiting Price Sweeps
Summary
A market-to-limit order begins by taking liquidity like a market order. After its first execution, any remaining quantity becomes a limit order at the price of that fill. This lets a trader pursue an immediate fill while preventing the remainder from sweeping through deeper order-book levels. If the market moves away from the fill price, the resting quantity may remain unfilled.
The document presents thin order books and larger orders where limiting additional market impact matters as potential use cases. It illustrates how to create the order in Rust and Python for a USD/JPY forex instrument, with optional settings such as time in force, reduce-only status, and display quantity. It does not provide execution data or compare outcomes against other order types. Actual fill behavior and market impact depend on venue rules, liquidity, and price movement, so the order type trades certainty of completion for a constraint on the price of the remainder.
Key ideas
- The order initially executes as a market order to take available liquidity.\nAny unfilled quantity rests as a limit order at the first fill price.\nThe resting remainder can avoid sweeping deeper book levels but may not execute if prices move away.\nThin books and larger orders are suggested use cases where limiting further market impact matters.\nThe document explains order construction but provides no empirical execution comparison.
Tags
Full text
# Market-To-Limit
# Market-To-Limit
`FIX OrdType <40>=K` (Market With Left Over as Limit)
A *Market-To-Limit* order submits as a *Market* order. After the first fill, any unfilled quantity
rests as a *Limit* order at that fill price.
## Use cases
Use a *Market-To-Limit* order to take liquidity at the best available price without sweeping deeper
levels. This can suit thin books or larger orders where limiting further market impact matters. Any
remainder can stay unfilled if the market moves away from the first fill price.
## Example
In the following example we create a *Market-To-Limit* order on the Interactive Brokers
[IdealPro](https://ibkr.info/node/1708) Forex ECN to BUY 200,000 USD using JPY:
```rust tab="Rust"
use nautilus_model::{
enums::{OrderSide, TimeInForce},
identifiers::InstrumentId,
types::Quantity,
};
let order = self.order().market_to_limit(
InstrumentId::from("USD/JPY.IDEALPRO"),
OrderSide::Buy,
Quantity::from(200_000),
Some(TimeInForce::Gtc), // optional (default GTC)
None, // expire_time
Some(false), // reduce_only (default false)
None, // quote_quantity (default false)
None, // display_qty (default full display)
None, // exec_algorithm_id
None, // exec_algorithm_params
None, // tags
None, // client_order_id
);
```
```python tab="Python"
from nautilus_trader.model import InstrumentId
from nautilus_trader.model import MarketToLimitOrder
from nautilus_trader.model import OrderSide
from nautilus_trader.model import Quantity
from nautilus_trader.model import TimeInForce
order: MarketToLimitOrder = self.order_factory.market_to_limit(
instrument_id=InstrumentId.from_str("USD/JPY.IDEALPRO"),
order_side=OrderSide.BUY,
quantity=Quantity.from_int(200_000),
time_in_force=TimeInForce.GTC, # <-- optional (default GTC)
reduce_only=False, # <-- optional (default False)
display_qty=None, # <-- optional (default None which indicates full display)
tags=None, # <-- optional (default None)
)
```
See the
[`MarketToLimitOrder` API reference](/docs/python-api-latest/model/orders.html#nautilus_trader.model.MarketToLimitOrder)
for further details.
## Related guides
- [Orders](index.md) - Order concepts, execution instructions, and the order factory.
- [Execution](../execution/) - How orders reach the venue and fills are handled.Shown in full with attribution under the source's licence. Licence: LGPL-3.0
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.