Execution API
The Execution API provides strategy evaluation against current market data. It supports stateful execution with position persistence, stop-loss/take-profit order management, and risk controls. Setpersist=false for dry-run evaluation without affecting database state.
Base URL
Endpoints
Evaluate Strategy by ID
POST /api/v1/execution/evaluate/{strategy_id}
Evaluates a persisted strategy with current market data:
- Loads strategy with execution_config and execution_state
- Loads open positions and their orders from database
- Evaluates exit conditions (SL, TP, signals, time-based) for open positions
- Evaluates entry signals for new positions
- Returns order objects (existing SL/TP or new market orders)
| Parameter | Type | Required | Description |
|---|---|---|---|
persist | boolean | No | Persist orders and trades to database (default: true) |
Evaluate Strategy by Object
POST /api/v1/execution/evaluate
Evaluate a strategy using a JSON object instead of a persisted strategy ID. Useful for testing draft strategies or one-off evaluations.
Bulk Evaluate Strategies
POST /api/v1/execution/evaluate/bulk
Evaluates multiple strategies in a single request. Market data is fetched once per unique (asset, timeframe) pair and shared across all strategies.
Order Types
| Side | Description |
|---|---|
enter_long | Open a new long position |
exit_long | Close an existing long position |
| Order Type | Description |
|---|---|
market | Execute at current market price |
stop_loss | Exit when price falls below threshold |
take_profit | Exit when price rises above threshold |
Use Cases
Real-Time Signal Monitoring
Dry-Run Validation
Test strategy signals without persisting changes:Cooldown Configuration
The execution engine readscooldown_config from the strategy’s execution_config to determine per-timeframe loss streak limits and cooldown durations. When a cooldown trips, new entries for that asset are blocked for a number of bars equal to the window that tripped.
| Key | Description |
|---|---|
short_loss_limit | Losses in short_window_bars that trip the short-tier cooldown |
long_loss_limit | Losses in long_window_bars that trip the long-tier cooldown |
short_window_bars | Rolling lookback AND cooldown duration (bars) for the short tier |
long_window_bars | Rolling lookback AND cooldown duration (bars) for the long tier |
execution_config.time_based_exits.max_hold_bars, not by cooldown_config.
The engine selects the entry keyed to the strategy’s primary timeframe. If cooldown_config is absent or the timeframe key is missing, it falls back to the legacy flat keys (cooldown_bars, daily_momentum_limit, weekly_momentum_limit) and emits a deprecation warning.
See the Risk Management guide for full tuning details.