Order Types
Reference for all order types supported by the FluxPerp matching engine.
FluxPerp supports five order types. All orders are submitted to the matching engine via the REST API or WebSocket. The engine processes them in priority order: market first, then limit by price-time, then conditional triggers.
Market
A market order fills immediately against the best available resting liquidity. If the order size exceeds the top-of-book depth, it walks the book and fills at progressively worse prices.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
market | string | yes | — | Market identifier, e.g. SOL-PERP |
side | "long" | "short" | yes | — | Direction of the trade |
type | "market" | yes | — | Must be "market" |
size | number | yes | — | Position size in base units (e.g. SOL) |
leverage | number | yes | — | Desired leverage, 1–50 |
reduceOnly | boolean | no | false | If true, order will only reduce an existing position, never open or increase |
Market orders are not guaranteed to fill at the displayed mark price. Use slippageTolerance to protect against large fills.
await client.placeOrder({
market: "BTC-PERP",
side: "long",
type: "market",
size: 0.01,
leverage: 20,
slippageTolerance: 0.005, // 0.5% max slippage
});Limit
A limit order rests in the order book until filled, cancelled, or expired. It will only fill at the specified price or better.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
market | string | yes | — | Market identifier |
side | "long" | "short" | yes | — | Direction of the trade |
type | "limit" | yes | — | Must be "limit" |
size | number | yes | — | Order size in base units |
price | number | yes | — | Limit price in USDC |
leverage | number | yes | — | Desired leverage, 1–50 |
timeInForce | "GTC" | "IOC" | "FOK" | "GTD" | no | GTC | Time-in-force policy |
expiry | number | no | — | Unix timestamp (seconds). Required when timeInForce is GTD |
postOnly | boolean | no | false | Reject the order if it would immediately match (maker-only) |
reduceOnly | boolean | no | false | Only reduce an existing position |
Time-in-force
| Value | Behavior |
|---|---|
GTC | Rests in book until filled or cancelled |
IOC | Fill what's available immediately, cancel the rest |
FOK | Fill the entire size immediately or cancel entirely |
GTD | Rest until expiry timestamp, then cancel |
await client.placeOrder({
market: "ETH-PERP",
side: "short",
type: "limit",
size: 0.5,
price: 3900.00,
leverage: 5,
timeInForce: "GTD",
expiry: Math.floor(Date.now() / 1000) + 3600, // 1 hour from now
postOnly: true,
});Stop Market
A stop market order is dormant until the mark price crosses the triggerPrice. At that point it becomes a market order and fills at the best available price.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
market | string | yes | — | Market identifier |
side | "long" | "short" | yes | — | Direction of the trade |
type | "stopMarket" | yes | — | Must be "stopMarket" |
size | number | yes | — | Order size in base units |
triggerPrice | number | yes | — | Price at which the order activates |
leverage | number | yes | — | Desired leverage |
reduceOnly | boolean | no | false | Reduce-only flag |
Stop orders trigger on mark price, not last trade price. Mark price is derived from oracle feeds with a dampening window. In extreme volatility, mark price may differ from trade price by 0.1–0.5%.
Stop Limit
A stop limit order activates when mark price crosses triggerPrice, then places a limit order at price.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
market | string | yes | — | Market identifier |
side | "long" | "short" | yes | — | Direction of the trade |
type | "stopLimit" | yes | — | Must be "stopLimit" |
size | number | yes | — | Order size in base units |
triggerPrice | number | yes | — | Price that activates the order |
price | number | yes | — | Limit price placed after trigger |
leverage | number | yes | — | Desired leverage |
timeInForce | "GTC" | "IOC" | "FOK" | no | GTC | TIF for the activated limit order |
Unlike stop market orders, stop limit orders guarantee a price floor. The trade-off is that the order may not fill if the market moves through the limit price too quickly.
Take Profit
A take profit order activates when mark price reaches triggerPrice in the profit direction.
// Open a long, then immediately set a take-profit
const position = await client.placeOrder({
market: "SOL-PERP",
side: "long",
type: "market",
size: 10,
leverage: 5,
});
await client.placeOrder({
market: "SOL-PERP",
side: "short", // closing a long requires a short order
type: "takeProfit",
size: 10,
triggerPrice: 200.00,
reduceOnly: true,
});Conditional orders (stop, take profit) are held in the matching engine's conditional queue, not the live order book. They are not visible to other market participants until triggered.