Overview
Thesimulator.placeOrder endpoint places a simulated order in the exchange simulator. It supports both market and limit orders with configurable leverage and confidence levels.
Request
Parameters
The simulator account identifier. Defaults to
"default" if not provided. Use different account IDs to simulate multiple portfolios.Trading pair symbol (e.g.,
"BTC-USD", "ETH-USD"). Symbol is automatically trimmed of whitespace.Order quantity in base currency. Must be a positive number.
Order side. Accepts:
"buy", "sell", "long", or "short"."buy"and"long"are equivalent (open/increase long position)"sell"and"short"are equivalent (open/increase short position)
Order type. Accepts:
"market" or "limit"."market": Executes immediately at current market price"limit": Executes only at specified limit price or better
Limit price for limit orders. Required when
type is "limit". Must be a valid finite number.Alternative parameter for limit price. If both
limitPrice and price are provided, limitPrice takes precedence.Position leverage multiplier. Must be a positive number. Allows trading with borrowed funds.Example:
leverage: 5 means 5x leverage (controls 1000 margin).AI model confidence level for the trade decision. Used for analytics and tracking.
- Accepts values 0-1 (e.g.,
0.85) or 0-100 (e.g.,85) - Values >1 are automatically normalized by dividing by 100
- Invalid or zero values are stored as
null
Response
The created order object containing execution details, position changes, and account state.
Code Example
Behavior Details
Order Execution
- Market orders: Execute immediately at current simulator market price
- Limit orders: Execute only when market price reaches the limit price
- Order fills update the account’s positions, cash balance, and margin
Account ID Normalization
Account IDs are automatically normalized:- Empty strings or whitespace-only values default to
"default" - Trimmed to remove leading/trailing whitespace
- Use consistent account IDs to maintain separate portfolio states
Side Normalization
Theside parameter accepts multiple formats:
"buy"or"long"→ normalized to"buy"(increase long position)"sell"or"short"→ normalized to"sell"(increase short position)
Validation
- Symbol cannot be empty after trimming
- Quantity must be positive
- Limit price (if provided) must be a finite number
- Leverage (if provided) must be positive
- Validation errors throw descriptive error messages
Error Handling
Common errors:| Error | Cause | Solution |
|---|---|---|
"Simulation mode is disabled" | IS_SIMULATION_ENABLED=false | Enable simulation mode in environment config |
"Symbol is required" | Empty or whitespace-only symbol | Provide valid trading pair symbol |
"limitPrice must be a valid number" | Non-finite limit price | Provide valid numeric limit price |
"Failed to place order" | Simulator execution error | Check simulator logs, verify symbol exists, ensure sufficient margin |

