Skip to content

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.


A client builds an order with:

  • token_id — the outcome being traded.
  • sideBUY or SELL.
  • price — the limit price, usually between 0.00 and 1.00.
  • size — the number of shares.
  • order_typeGTC, GTD, FOK, or FAK.
  • expiration — Unix timestamp for GTD, otherwise 0.
  • 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.


Orders are submitted to:

Terminal window
POST https://api.openfish.me/order

Before 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.


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:

TypeBehavior
GTCRests until filled or cancelled
GTDRests until filled, cancelled, or expired
FOKMust fully fill immediately or reject
FAKFills available quantity immediately and cancels the rest

Post-only orders are rejected if they would immediately take liquidity.


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.


Orders:

StatusMeaning
LIVEResting on the book
MATCHEDFully filled immediately
CANCELEDCancelled, expired, rejected, or fully removed

Trades:

StatusMeaning in off-chain mode
MATCHEDTrade matched and ledger changes recorded
MINED / CONFIRMEDCompatibility statuses that can be advanced by background workers
FAILEDSettlement 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.


Users can cancel live orders through:

Terminal window
DELETE https://api.openfish.me/order
DELETE https://api.openfish.me/orders
DELETE https://api.openfish.me/cancel-all
DELETE https://api.openfish.me/cancel-market-orders

Cancellation releases locked platform meme or outcome shares back to the free ledger balance.


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.


The public openfish.me product should be documented as ledger-settled trading.