Skip to main content

Time in Force

TL;DR

Time-in-force on Darknyx is expressed two ways: the order type decides whether an order may rest (limit rests; IOC and FOK do not), and expiry_slot decides how long a resting order lives. Order expiry is measured in Solana slots, not wall-clock time.

The two controls

ControlFieldEffect
May it rest?order_typelimit rests; ioc and fok execute immediately and never rest.
How long may it rest?expiry_slotThe slot past which a resting order auto-expires.

Every order carries an expiry_slot, bounded by the market's maximum so a note cannot be locked forever. A resting order is swept when the chain passes that slot.

Available behaviors

GTC: Good-til-Cancelled

A limit order with a far-future expiry_slot. It rests until it fills, you cancel it, or it eventually hits its (distant) expiry. This is the standard resting order.

GTT: Good-til-Time

A limit order with an expiry_slot chosen to match a wall-clock deadline. To place "good for the next ten minutes," read /time for the current slot and project your deadline onto a slot (Solana targets roughly 400 ms per slot). The SDK does this conversion for you:

expiry_slot = current_slot + ceil((deadline_ms - now_ms) / slot_ms)

When the chain passes expiry_slot, the order is swept and an expired event is emitted on the Orders Channel.

IOC: Immediate-or-Cancel

An ioc order. Fills what it can in its arrival batch, cancels the rest. Never rests, so expiry_slot is moot for it.

FOK: Fill-or-Kill

A fok order. Fills its whole size in its arrival batch or is dropped. Never rests and never partially fills.

Summary

TIFExpressed asRests?
GTClimit + far expiry_slotYes, until fill / cancel / expiry
GTTlimit + deadline-derived expiry_slotYes, until the deadline slot
IOCiocNo
FOKfokNo
Slots, not timestamps

Because settlement is on Solana, expiry is anchored to the chain's clock, the slot, so it stays consistent with on-chain state. /time gives you both the slot and the wall-clock instant so you can convert between them. See Order Types for how the type controls resting, and Execution Attributes for fill-size constraints.