River conditional and algorithmic orders#
A River gateway can hold parent orders that it turns into ordinary native Seesaw placements when their condition holds: stop and reverse-stop orders, take-profit and stop-loss exits linked to a parent, iceberg, pegged and smart-taker orders. The gateway enforces the parent's condition; every child it submits is an ordinary order that the program checks like any other. Read Trade through a River gateway first for connection and request signing.
Parent orders are created with POST /v1/complex-orders, the
createRiverComplexOrderClient client of @seesaw/core (and its Python and Rust
counterparts), seesaw river create --order-file <path>, or the River orders
screen of the web and Android apps when the operator configures a gateway. Every
request carries a river_id (the listing) and exactly one parameter object.
Stop and reverse-stop orders#
A conditional_order_params object with conditional_order_type STOP or
REVERSE_STOP activates its trigger_order (a LIMIT or MARKET child) when
the listing's committed trade price crosses stop_order_price:
| Type | Buy child activates when | Sell child activates when |
|---|---|---|
STOP | price ≥ trigger | price ≤ trigger |
REVERSE_STOP | price ≤ trigger | price ≥ trigger |
{
"river_id": 12,
"conditional_order_params": {
"conditional_order_type": "STOP",
"stop_order_price": "0.4000",
"trigger_order": { "order_type": "MARKET", "qty": "25", "buy_flag": false }
}
}
A trigger needs a fresh committed trade and a current indexer cursor. Triggering and on-chain cancellation are not atomic with trades you make elsewhere: the native balance and expiry checks stay the final boundary.
Take-profit and stop-loss exits#
TP and SL conditionals follow the same table (TP like REVERSE_STOP, SL
like STOP) and may name a parent with parent_river_order_id or
parent_complex_order_id. A linked exit:
- waits until the parent has filled in full;
- sizes against the parent's filled quantity, minus what its siblings reserve;
- cancels its siblings when it activates, so a filled take-profit retires the matching stop-loss.
A TP with a LIMIT child needs no fresh trade to activate; the other triggers
do. Create the exits separately from the parent; inline attachments on
simple-order creation are not supported.
Iceberg orders#
iceberg_order_params splits total_qty into displayed children of
displayed_qty at limit_price on the listing's price and quantity grid, and
places the next child after one fills, until the total is done. post_only,
reload_delay_s and cancel_order_on_pause are optional.
Pegged orders#
peg_order_params keeps one child resting at the external best bid (for a buy)
or best ask (for a sell). The gateway excludes its own child from the reference
book, so it does not chase itself, and keeps every one-tick step inside
min_price and max_price. max_qty_level, post_only and
peg_min_stay_time_s are optional.
Smart-taker orders#
smart_taker_order_params waits until the indexed opposite side shows at least
min_qty of depth at or inside limit_price, then submits one price-bounded IOC
for the remaining quantity. min_qty may exceed the order quantity. The IOC
keeps the price limit, and can fill less if liquidity changes before it lands.
Restarts and recovery#
The gateway stores each parent and child intent in a durable SQLite store before
it signs, keyed by the parent and the child sequence, and keeps conditional state
in its own store. A restarted worker resumes from that record: it reconciles a
child it already signed and broadcast by its signature and generation, and does
not sign or send it again. Use seesaw river get <id> and seesaw river list to
inspect parents, and seesaw river cancel <id> to request cancellation.
Limits#
These workers are locally tested and are not a production signoff. Cross-venue routing, nested complex parents and hosted River features are not supported. For a stop that needs no gateway, see stop losses, which uses a keeper and a pre-signed sell.