Order types
An order type tells Loaf how and when to fill your order, from a simple Market order to stops, linked pairs and timed cancels. The three tables below list every order type, time in force and order control. The sections after them explain the types that need more detail.
Order types
| Market | Fills at once at the best available prices, up to a protective price limit TBC. Anything unfilled is cancelled. |
| Limit | Buys at or below your price, or sells at or above it. Any unfilled part can rest on the book. |
| Stop Market | When the price reaches your stop, places a protected limit order. |
| Stop Limit | When the price reaches your stop, places a limit order at the price you set. |
| Take Market | When the price reaches your target, places a protected limit order. |
| Take Limit | When the price reaches your target, places a limit order at the price you set. |
| OCO (one cancels the other) | Links two orders, so that when one executes, the other is cancelled. |
| TP/SL bracket | Attaches a take-profit and a stop-loss to an entry order. When one leg executes, the other is cancelled. |
Time in force
Time in force sets how long an order stays live.
| Time in force | The order stays live |
|---|---|
| Good-till-cancelled (GTC) | Until it fills, you cancel it, or it expires. |
| Immediate-or-cancel (IOC) | Only at once: it fills what it can, and the rest is cancelled. |
| Fill-or-kill (FOK) | Only at once and only in full: it fills completely or is cancelled. |
| Post-only | On the book only. It never takes liquidity. |
In the trading app, a Limit order is GTC, or post-only when you tick Post-only. IOC and FOK are available through the API.
Every order also has an expiry. No order stays live for more than about 46 days. In the trading app, the order confirmation shows when your order expires. An order still on the book at that time is cancelled. Through the API, a bot signs each order’s expiry, so it can end an order at a time it chooses. Loaf fills the order only until 72 hours before that signed expiry, and then cancels it. See Orders.
Order controls
| Reduce-only | On perps, the order can only shrink or close a position, never open or add to one. |
| Cancel-replace | Amends an open order’s price or size in one step. |
| Cancel-all | Cancels all your open orders at once. |
| Cancel-after | A dead man’s switch that cancels your open orders unless you renew it within 10 to 120 seconds. |
| Batch orders | Through the API, sends up to 256 orders under one signature. |
| Self-trade prevention | Stops two of your own orders from matching. By default, the resting order is cancelled. See Self-trade prevention. |
Cancels keep working during a market halt or pause, so you can pull resting orders while trading is stopped (see Halts and price bands).
Cancel-after is a dead man’s switch, useful for automated trading. You set a timer between 10 and 120 seconds and renew it while your system runs. If a renewal does not arrive in time, Loaf cancels your open orders, so a lost connection cannot leave stale orders on the book.
Conditional and linked orders
These order types wait for a price or link orders together.
Stop and take orders
Stop and take orders wait until the price reaches a trigger price you set, then place an order for you. The price they watch is the last trade price on spot, or the mark price on perps. A stop usually limits a loss, and a take usually locks in a profit. On perps, the mark price is a median of several estimates of the perp’s fair price, kept within a band around the oracle price, so one trade on a thin book cannot trigger your order by itself.
| Goal | Order | Trigger price |
|---|---|---|
| Limit the loss on a holding or a long | Stop sell | Below the current price |
| Lock in profit on a holding or a long | Take sell | Above the current price |
| Limit the loss on a short, or buy on a rise | Stop buy | Above the current price |
| Lock in profit on a short, or buy on a fall | Take buy | Below the current price |
A Stop Limit or Take Limit places a limit order at the price you set. A Stop Market or Take Market places a protected limit order, not an unlimited market order.
The protective price limit caps how far from the trigger a Stop Market or Take Market can fill. If the price moves through that limit before the order fills, the rest is cancelled.
Warning. A Stop Market order is a protected limit, not an unlimited market order. In a fast move the price can pass its limit, and the stop may leave your position open.
OCO pairs and TP/SL brackets
OCO pairs and TP/SL brackets link a take-profit and a stop-loss, so that when one executes, the other is cancelled. Take profit and stop loss explains both.