Order Types

4rho supports advanced order types for sophisticated trading strategies.

Time-in-Force (TIF)

Controls how long an order remains active.

TIFNameBehavior
GTCGood Till CancelRemains open until explicitly cancelled (default)
GTDGood Till DateRemains open until cancelled or the expiry time
FOKFill or KillMust be fully filled immediately, or rejected
FAKFill and KillFills as much as possible; remainder cancelled

GTC (Default)

{
  "time_in_force": "GTC",
  ...
}

The order rests on the book until you cancel it or it's fully filled.

GTD

{
  "time_in_force": "GTD",
  "expiration": 1709222400,
  ...
}

The order rests on the book until the expiration unix timestamp. GTD requires a valid expiration field. A background worker checks for expired GTD orders every 5 seconds.

FOK

{
  "time_in_force": "FOK",
  ...
}

The order must be fully filled against existing resting orders immediately. If the full quantity cannot be matched, the entire order is rejected. No partial fills.

FAK (IOC)

{
  "time_in_force": "FAK",
  ...
}

Fills as much as possible against resting orders. Any unfilled remainder is immediately cancelled. At least one fill must occur or the order is rejected.

Post-Only

{
  "post_only": true,
  ...
}

A post-only order is rejected if it would immediately match against an existing order (i.e., cross the spread). This guarantees the order will be a maker order, earning maker fees rather than paying taker fees.

Use post-only for passive market making strategies where you always want to provide liquidity rather than take it.

Self-Trade Prevention (STP)

Self-trade prevention is always on and not configurable. When an incoming order would match against a resting order from the same wallet address or the same account, the matcher skips that resting order and continues — your order never fills against itself. This is applied unconditionally to every order; there is no stp_mode field to select a strategy.

Self-trade detection is based on the maker wallet address and the account that owns it (so multiple linked wallets on one account are also prevented from self-matching).

The stp_mode field is not supported. Submitting a non-empty stp_mode returns 422 Unprocessable Entity. Designated market makers who intentionally provide liquidity on both sides of a book use an API key with the allow_self_trade flag, which disables the skip so both sides can fill.

Cancel-Replace

Atomically cancel an existing order and place a new one. If the cancellation fails (e.g., order already filled), the new order is not placed.

POST /v1/orders/cancel-replace

See Orders for details.

Order Amend

Modify the price or quantity of a resting order without cancelling and re-placing.

PUT /v1/orders/:hash/amend

Time priority rules:

  • If only the quantity decreases, the order keeps its time priority
  • If the price changes or quantity increases, the order loses its time priority (moved to back of queue at the new price level)

See Orders for details.