FluxPerpdocs
Core Concepts

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.

ParameterTypeRequiredDefaultDescription
marketstringyesMarket identifier, e.g. SOL-PERP
side"long" | "short"yesDirection of the trade
type"market"yesMust be "market"
sizenumberyesPosition size in base units (e.g. SOL)
leveragenumberyesDesired leverage, 1–50
reduceOnlybooleannofalseIf 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.

ParameterTypeRequiredDefaultDescription
marketstringyesMarket identifier
side"long" | "short"yesDirection of the trade
type"limit"yesMust be "limit"
sizenumberyesOrder size in base units
pricenumberyesLimit price in USDC
leveragenumberyesDesired leverage, 1–50
timeInForce"GTC" | "IOC" | "FOK" | "GTD"noGTCTime-in-force policy
expirynumbernoUnix timestamp (seconds). Required when timeInForce is GTD
postOnlybooleannofalseReject the order if it would immediately match (maker-only)
reduceOnlybooleannofalseOnly reduce an existing position

Time-in-force

ValueBehavior
GTCRests in book until filled or cancelled
IOCFill what's available immediately, cancel the rest
FOKFill the entire size immediately or cancel entirely
GTDRest 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.

ParameterTypeRequiredDefaultDescription
marketstringyesMarket identifier
side"long" | "short"yesDirection of the trade
type"stopMarket"yesMust be "stopMarket"
sizenumberyesOrder size in base units
triggerPricenumberyesPrice at which the order activates
leveragenumberyesDesired leverage
reduceOnlybooleannofalseReduce-only flag
Warning

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.

ParameterTypeRequiredDefaultDescription
marketstringyesMarket identifier
side"long" | "short"yesDirection of the trade
type"stopLimit"yesMust be "stopLimit"
sizenumberyesOrder size in base units
triggerPricenumberyesPrice that activates the order
pricenumberyesLimit price placed after trigger
leveragenumberyesDesired leverage
timeInForce"GTC" | "IOC" | "FOK"noGTCTIF 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,
});
Note

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.

On this page