Time in Force
time_in_force (TIF) controls how long an order is eligible to execute before it expires or is cancelled.
Available Options
| TIF | Description |
|---|---|
GTC | Good Till Cancelled — rests in the book until filled or manually cancelled. |
GTT | Good Till Time — rests until expiry_time (nanosecond epoch) and is then auto-cancelled. |
IOC | Immediate or Cancel — fills what it can immediately; cancels the unfilled remainder. |
FOK | Fill or Kill — must fill completely and immediately, or the entire order is cancelled with no fills. |
GTT replaces the earlier GTD naming — they are the same semantics.
GTC
{
"symbol": "BTC-USDC-PERP",
"side": "buy",
"type": "limit",
"quantity": 0.1,
"price": 95000,
"time_in_force": "GTC"
}
GTT
Requires expiry_time as a nanosecond epoch timestamp.
{
"symbol": "BTC-USDC-PERP",
"side": "buy",
"type": "limit",
"quantity": 0.1,
"price": 95000,
"time_in_force": "GTT",
"expiry_time": 1839975000000000000
}
Expiry is enforced at matching time — an order will not fill after expiry_time even if a match was otherwise possible. Expired orders emit a cancelled event with cancel_reason: "GTT_EXPIRED" (see Orders Channel).
IOC
Best paired with market and aggressive limit orders.
{
"symbol": "BTC-USDC-PERP",
"side": "buy",
"type": "market",
"quantity": 0.1,
"time_in_force": "IOC"
}
Unfilled remainder is auto-cancelled with cancel_reason: "IOC_REMAINDER".
FOK
Use when partial fills are unacceptable.
{
"symbol": "BTC-USDC-PERP",
"side": "buy",
"type": "limit",
"quantity": 0.1,
"price": 95000,
"time_in_force": "FOK"
}
If the full size cannot be filled immediately, the order is rejected (no fills occur) with reject_reason: "INSUFFICIENT_LIQUIDITY".
TIF vs Execution Attributes
time_in_force controls when an order is eligible. It is distinct from Execution Attributes (aon, min_fill_size), which control how each fill is constrained.