Order Lifecycle
Openfish uses a central limit order book with signed orders and internal ledger settlement. In the current openfish.me deployment, matched trades update Openfish ledger balances.
1. Create And Sign
Section titled “1. Create And Sign”A client builds an order with:
token_id— the outcome being traded.side—BUYorSELL.price— the limit price, usually between0.00and1.00.size— the number of shares.order_type—GTC,GTD,FOK, orFAK.expiration— Unix timestamp forGTD, otherwise0.nonce/salt— replay protection.
The order is signed before submission. The CLOB verifies the signer and L2 API authentication before the order can enter the book.
2. Submit To CLOB
Section titled “2. Submit To CLOB”Orders are submitted to:
POST https://api.openfish.me/orderBefore accepting the order, the server checks:
- Signature validity.
- L2 authentication.
- Trading mode and market status.
- Tick size and minimum size.
- Sufficient platform meme balance for buys.
- Sufficient outcome share balance for sells.
For ordinary app trading, users need a wallet identity, API credentials, and available Openfish ledger balance.
3. Match Or Rest
Section titled “3. Match Or Rest”The matching engine applies price-time priority:
- Bids sort by highest price first, then oldest order first.
- Asks sort by lowest price first, then oldest order first.
If the incoming order crosses the book, it fills against resting liquidity. If it does not cross and the order type permits resting, the remaining quantity stays live until it fills, expires, or is cancelled.
Order type behavior:
| Type | Behavior |
|---|---|
GTC | Rests until filled or cancelled |
GTD | Rests until filled, cancelled, or expired |
FOK | Must fully fill immediately or reject |
FAK | Fills available quantity immediately and cancels the rest |
Post-only orders are rejected if they would immediately take liquidity.
4. Ledger Settlement
Section titled “4. Ledger Settlement”When a trade matches, the CLOB updates balances in its internal ledger.
For a buyer taking a sell order:
- Buyer platform meme is debited.
- Buyer outcome shares are credited.
- Seller outcome shares are debited.
- Seller platform meme is credited.
- Fees and rebates are recorded according to market configuration.
For a seller taking a buy order, the same asset movement happens in the opposite direction.
This settlement is the normal path for the current meme/off-chain deployment.
5. Trade And Order Status
Section titled “5. Trade And Order Status”Orders:
| Status | Meaning |
|---|---|
LIVE | Resting on the book |
MATCHED | Fully filled immediately |
CANCELED | Cancelled, expired, rejected, or fully removed |
Trades:
| Status | Meaning in off-chain mode |
|---|---|
MATCHED | Trade matched and ledger changes recorded |
MINED / CONFIRMED | Compatibility statuses that can be advanced by background workers |
FAILED | Settlement or bookkeeping failed |
On-chain settlement statuses may still appear in code or admin views because the codebase keeps optional on-chain support. They should not be interpreted as a requirement for normal openfish.me trading.
6. Cancel
Section titled “6. Cancel”Users can cancel live orders through:
DELETE https://api.openfish.me/orderDELETE https://api.openfish.me/ordersDELETE https://api.openfish.me/cancel-allDELETE https://api.openfish.me/cancel-market-ordersCancellation releases locked platform meme or outcome shares back to the free ledger balance.
7. Resolution Impact
Section titled “7. Resolution Impact”When a market is resolved:
- Open orders on the market are cancelled.
- Winning outcome shares are settled according to the final outcome.
- Losing outcome shares become worthless.
- User balances are updated in the ledger.
See Resolution for the current resolution model.
Optional On-Chain Mode
Section titled “Optional On-Chain Mode”The public openfish.me product should be documented as ledger-settled trading.