Order types
🛠️ Order Types & Execution Logic
📈 Market Orders
A market order executes immediately at the best available price for the specified position size. To manage slippage, users can set an average execution price limit—if liquidity is insufficient or the average price exceeds the limit, the order will be partially filled.
Execution Option:
Reduce-Only: Ensures the order only reduces the position size, never increasing exposure.
📉 Limit Orders
A limit order executes at the user-defined price or better. RocketFi supports advanced options like expiration settings and execution instructions.
Execution Options:
Post-Only: Ensures the order is placed as a maker. If it would immediately match with an existing order, it’s canceled to avoid taker fees.
Reduce-Only: Limits the order to reduce the position toward zero. If the order size exceeds the current position, the excess is canceled once the position reaches zero.
⏱️ Time-in-Force (TIF)
TIF settings define how long an order remains active:
Good ‘Til Time: The order stays valid until the specified expiration time. If not filled by then, it’s automatically canceled.
Immediate or Cancel (IOC): The order is canceled if not immediately filled. IOC orders never enter the order book.
🛑 Stop-Loss & Take-Profit Orders
Stop-Loss (SL): Triggers a sell (or buy) when the price hits a predefined level to limit losses.
Take-Profit (TP): Triggers a sell (or buy) to lock in gains once a target price is reached.
RocketFi also supports SL/TP Limit Orders, which combine trigger conditions with limit pricing for more control.
Trigger Conditions:
SL Sell / TP Buy: Triggered when
markPrice ≤ triggerPrice
SL Buy / TP Sell: Triggered when
markPrice ≥ triggerPrice
Execution Options:
Reduce-Only: Ensures the order only reduces the position. If the position reaches zero, remaining order size is canceled.
TIF Support: SL/TP limit orders can use Good ‘Til Time to set expiration.
📊 TWAP Orders (Time-Weighted Average Price)
TWAP orders aim to execute large trades gradually over a set duration to minimize market impact.
Execution Logic:
A new market order is placed every 30 seconds
Order Size =
total amount / (#orders)
#orders =
(execution duration / 30s) + 1
Execution Option:
Reduce-Only: Ensures trades only reduce the position. The TWAP order continues until expiration, but only executes if it moves the position toward zero.
🔍 Price Checks & Safeguards
RocketFi includes built-in checks to prevent erroneous or extreme pricing:
🧤 Fat Finger Prevention
Ask Orders: Price must be ≥
max(markPrice, bestBid) × 0.95
Bid Orders: Price must be ≤
min(markPrice, bestAsk) × 1.05
If bestBid
or bestAsk
is unavailable, only markPrice
is used.
These checks also apply to SL/TP limit orders, using triggerPrice
instead of markPrice
.
Last updated