Skip to main content

Create Order via WebSocket

To create orders on Rails platform, use the WebSocket v2 API and subscribe to the Order Creation Stream. This new WebSocket API supports every request and notification from the legacy Order Creation WebSocket. The specifications and behavior remain the same.

Order Creation Workflow

Order creation is done by submitting a Create Order request. You will receive two responses in sequence:
  • Acknowledgment: Confirms the request was received and validates basic parameters
  • Confirmation: Confirms the order was accepted and created in the order book
Key differences:
AcknowledgmentConfirmation
Bodyorder created, pending acceptanceorder accepted
Order Statuspendingactive
Status Code202200
API Quota UsedIncludedNot included
Note that a unique clientRequestId can be used to correlate acknowledgment, confirmation, and any error responses for a single request.

Order Types

Limit Orders

Limit orders allow you to specify an exact price at which you want to trade. They provide price certainty but execution is not guaranteed. Key Characteristics:
  • Order executes only at the specified price or better
  • May remain open in the order book until filled or cancelled
  • Can use post-only option to ensure maker status
Post-Only Option: When set to true, the order will only be created if it does not match with an existing order in the order book. This ensures you are always the maker and never the taker. If the order would match immediately, you’ll receive normal acknowledgment and confirmation responses, but followed by Order Rejected Notifications.

Market Orders

Market orders prioritize execution speed over price certainty. They execute immediately against the best available prices in the order book. Key Characteristics:
  • Execute immediately at the best available market prices
  • Use maxSlippage parameter to control price deviation (defaults to 0.02)
  • Any unfilled quantity is automatically cancelled after execution
Slippage Protection:
  • Buy orders: Fill price never exceeds expectedPrice × (1 + maxSlippage)
  • Sell orders: Fill price never goes below expectedPrice × (1 - maxSlippage)
Request Field Differences from Limit Orders:
FieldLimit Order ValueMarket Order Value
tradeTypelimitmarket
postOnlytrue or falseNot supported
maxSlippageNot supported0 - 1 inclusive
priceStrict priceExpected price

IOC (Immediate-Or-Cancel) Orders

IOC orders can be achieved by creating a market order with maxSlippage of 0. They execute as much as possible immediately and cancel any unfilled portion.

Order Limits and Restrictions

Maximum Open Orders Per Market

See Rate Limits page for details.

Price and Quantity Restrictions

  • Price bounds: Orders must be within 50% of current index price
  • Market-specific limits: Each market has tick size, lot size, and minimum order value requirements. See Product Specifications for details.

Receive Window

All order creation requests must be processed within a 2-second receive window. Requests exceeding this timeframe are rejected with error message receive window exceeded, order rejected. Key points:
  • Only applies to order creation, not cancellation
  • Frequent rejections may indicate that you are submitting requests too quickly
  • Reduce submission rate when encountering this error

Leverage and Cross-Margin

Rails uses a cross-leverage approach where leverage is applied at the account level rather than per-trade. This means all positions share the same leverage multiplier.

Supported Leverage Values

  • Supported values: 1, 2, 3, 4, 5
  • Default leverage is 1 if not explicitly set
  • Update leverage using the Update Leverage WebSocket request

Leverage Update Workflow

Leverage updates follow an acknowledgment → confirmation pattern similar to order creation:
AcknowledgmentConfirmation
Bodyleverage update in progress, pending approvalleverage updated successfully
Status Code202200