Orders
All trading on Margin Trade happens through a central limit order book (CLOB). Orders are matched based on price-time priority, just like on traditional exchanges — but every trade is settled transparently onchain.
This section outlines the order types, order options, and order book mechanics available on Margin Trade.
Order Types
Market Order
Executes immediately at the best available market price. Market orders prioritize speed of execution over price precision and will match against existing resting limit orders in the book.
Use when: You need immediate execution and accept minor slippage.
Limit Order
Places an order to buy or sell at a specific price or better. If the market doesn’t reach your limit price, the order remains resting on the order book until filled or canceled.
Use when: You want precise control over execution price.
Stop Market Order (coming soon)
A market order that activates once the market reaches your specified stop price. Commonly used as a stop loss or take profit trigger to protect against large losses or lock in gains.
Use when: You want automatic execution once a price threshold is hit.
Stop Limit Order (coming soon)
A limit order that becomes active once the stop price is reached. Once triggered, it will execute at your chosen limit price or better — not worse.
Use when: You want to limit losses or capture profits but control the worst price you receive.
Scale Order (coming soon)
Places multiple limit orders across a set price range to build or unwind a position gradually. Useful for layering entries or exits to average into volatile markets.
TWAP (Time-Weighted Average Price) Order (coming soon)
Executes a large order over time by splitting it into smaller suborders. Each suborder executes every 30 seconds, targeting an even distribution of execution. Suborders have a maximum slippage limit of 3%.
TWAP Logic:
Execution target =
(elapsed time ÷ total time) × total sizeIf a suborder doesn’t fill (due to spread or low liquidity), later suborders increase in size — up to 3× the normal suborder amount.
TWAPs aim to minimize market impact and slippage during execution.
Use when: You need to execute large trades discreetly or avoid moving the market.
Order Options (coming soon)
Reduce Only
Ensures the order can only reduce or close an existing position. If placing the order would open a position in the opposite direction, it will be rejected.
Good-Til-Cancel (GTC)
The default resting order type. Remains active until it’s fully filled or manually canceled.
Immediate or Cancel (IOC)
Executes all or part of an order immediately; any unfilled portion is canceled. Useful for quick fills without resting on the book.
Post Only (Add Liquidity Only, ALO)
Adds liquidity to the order book but does not execute immediately. If the order would fill instantly, it is automatically canceled.
Take Profit (TP) / Stop Loss (SL)
Automated orders linked to an open position:
TP triggers a market order when the target profit price is reached.
SL triggers a market order when the maximum loss threshold is reached. Both TP and SL can be configured with specific trigger prices and position sizes.
Order Book
The Margin Trade Order Book functions like a traditional centralized exchange — but operates fully onchain for transparency and fairness.
Orders are matched and prioritized as follows:
Price Priority: Best price executes first (highest bid, lowest ask).
Time Priority: Among orders at the same price, the earliest placed order executes first.
All prices and quantities must conform to the asset’s tick size.
Matching Process
Each order passes a margin check before placement. When a trade occurs:
Both maker and taker margins are verified in real-time.
The clearing engine updates account balances, positions, and unrealized PnL instantly.
Funding payments and fees are applied automatically at the next settlement interval.
This ensures consistent margining and settlement even during high volatility or rapid order flow.
Execution Flow
Orders are submitted and validated.
Margin is checked for sufficient collateral.
Orders enter the book and are sorted by price-time priority.
Matches are executed atomically.
Results are final — all trades are settled onchain with deterministic finality within the same transaction.
Last updated

