Algorithms API
The Algorithms API provides execution algorithms that break large orders into smaller slices to minimize market impact and achieve better average prices.Key Features
- Time-sliced execution: TWAP and TimePace spread orders evenly over time
- Multi-level orders: Ladder places limit orders at multiple price levels
- Aggressive fills: Sweep uses IOC orders for immediate execution
- Spread trading: Two-leg execution for basis/arb trades with risk management
- Anti-gaming: Randomization of size and timing to avoid detection
- Limit price guardrails: Won’t execute beyond your price limit
- TCA metrics: Arrival price, VWAP, slippage tracking
- Full lifecycle: Start, pause, resume, cancel algorithms
Algorithm Types
| Algorithm | Status | Description |
|---|---|---|
twap | Available | Time-Weighted Average Price - executes evenly over time |
ladder | Available | Places limit orders at multiple price levels |
sweep | Available | Aggressive fill - hits all available liquidity with IOC orders |
timepace | Available | Fixed quantity per interval, no catch-up |
spread | Available | Two-leg spread/basis trade execution |
POST /oems/algorithms/start
Start a new execution algorithm.Request Body (JSON)
| Parameter | Type | Required | Description |
|---|---|---|---|
algorithm_type | string | Yes | Algorithm type: twap, ladder, sweep, timepace, spread |
symbol | string | Yes | Trading pair (e.g., “BTC/USDC”) |
side | string | Yes | buy or sell |
quantity | number | Yes | Total quantity to execute |
exchange_account_ids | array | Yes | List of exchange account IDs |
limit_price | number | No | Won’t execute beyond this price |
params | object | Yes | Algorithm-specific parameters (see below) |
TWAP Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
duration_seconds | int | required | Total execution time in seconds |
interval_seconds | int | required | Time between slices |
aggression | string | "neutral" | passive, neutral, aggressive, auto |
randomize_size | bool | true | +/-20% size randomization |
randomize_timing | bool | true | +/-30% timing randomization |
catch_up_enabled | bool | true | Catch up if falling behind |
max_catch_up_pct | int | 200 | Max catch-up as % of interval size |
- Use
passiveaggression for large orders to minimize market impact - Enable
catch_up_enabledto ensure full quantity is executed - Set
limit_priceas a safety guardrail - Longer durations reduce market impact but increase timing risk
Ladder Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
num_levels | int | required | Number of price levels (1-20) |
price_spacing_bps | number | 10 | Spacing between levels in basis points |
size_distribution | string | "equal" | equal, linear, exponential |
start_price | number | market mid | Starting price for the ladder |
end_price | number | - | End price (overrides spacing if set) |
cancel_on_fill_pct | number | - | Cancel remaining levels when X% filled |
cancel_on_price_move_bps | number | - | Cancel all if mid-price moves X bps |
reprice_on_move_bps | number | - | Recalculate levels if mid moves X bps |
| Distribution | Behavior | Use Case |
|---|---|---|
equal | Same quantity at each level | Standard ladder |
linear | More quantity at better prices | Favor fills near mid-price |
exponential | Much more at best prices | Aggressive near-touch accumulation |
- Use
lineardistribution to concentrate size near market price - Set
cancel_on_fill_pctto 70-80% to capture most fills without overfilling - Use
reprice_on_move_bpsfor volatile markets to keep levels relevant - Keep
num_levelsat 3-10 for most use cases
Sweep Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
urgency | string | "aggressive" | Aggression level for pricing |
limit_price | number | - | Maximum price for buys, minimum for sells |
use_sor | bool | true | Route across multiple venues via SOR |
max_slippage_bps | number | 50 | Max slippage from arrival price before blocking |
max_retries | int | 3 | Number of retry rounds if not fully filled |
- Sweep is the simplest algorithm - use it when you need immediate fills
- All slices are IOC (Immediate-or-Cancel) - unfilled portions cancel immediately
- Set
max_slippage_bpsto protect against adverse price movement - Use
max_retries> 0 for illiquid markets where one pass may not fill
TimePace Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
quantity_per_interval | number | required | Fixed quantity per interval |
interval_seconds | int | required | Seconds between intervals |
limit_price | number | - | Skip interval if price is beyond limit |
aggression | string | "neutral" | passive, neutral, aggressive |
randomize_size | bool | true | Randomize quantity per interval |
randomize_size_pct | number | 10 | Randomization percentage |
- Use TimePace when you want predictable, fixed-size executions
- Set
limit_priceto skip intervals during adverse price moves - Unlike TWAP, skipped intervals do NOT accumulate - choose TimePace for strict pacing
- Runs until total_quantity is filled or the algorithm is cancelled
Spread Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
anchor_symbol | string | required | Primary leg symbol |
contra_symbol | string | required | Hedge leg symbol |
anchor_exchange_account_ids | array | required | Exchange accounts for anchor leg |
contra_exchange_account_ids | array | required | Exchange accounts for contra leg |
risk_quantity | number | required | Max unhedged exposure |
lead_mode | string | "anchor" | Which leg posts first: anchor or contra |
aggression | string | "neutral" | Aggression for posting leg |
sweep_trigger_mode | string | "immediate" | Hedge trigger: immediate, disabled, threshold |
sweep_threshold_pct | number | 0 | Spread % threshold for threshold mode |
pause_offset_pct | number | - | Pause if spread exceeds this % |
reprice_increment_bps | number | 10 | Reprice increment in bps |
spread_offset_pct | number | 0 | Target spread offset |
| Mode | Behavior |
|---|---|
immediate | Hedge with IOC order as soon as lead leg fills |
disabled | Hedge with limit order (passive) |
threshold | Use IOC only when spread exceeds sweep_threshold_pct |
- Set
risk_quantityconservatively - it limits max unhedged exposure - Use
immediatesweep trigger for tight risk management - Set
pause_offset_pctto stop trading when the spread widens beyond tolerance - The algorithm completes when BOTH legs are fully filled
- Use different exchange accounts for each leg for cross-venue basis trades
Aggression Levels
Applies to TWAP, Ladder, TimePace, and Spread algorithms.| Level | Description | Use Case |
|---|---|---|
passive | 25% into spread | Minimize market impact, patient execution |
neutral | Midpoint | Balanced approach |
aggressive | 75% into spread | Prioritize fills over price |
auto | Dynamic (TWAP only) | Adjusts based on fill progress |
GET /oems/algorithms/
Get the status and progress of an algorithm.Path Parameters
| Parameter | Type | Description |
|---|---|---|
order_id | string | Algorithm order ID |
Request Example
Response Example
POST /oems/algorithms//pause
Pause a running algorithm. Stops generating new slices but keeps open orders.Request Example
Response Example
POST /oems/algorithms//resume
Resume a paused algorithm.Request Example
Response Example
POST /oems/algorithms//cancel
Cancel an algorithm. Cancels all open child orders.Request Example
Response Example
GET /oems/algorithms//slices
Get all child orders (slices) for an algorithm.Request Example
Response Example
GET /oems/algorithms
List all algorithms.Query Parameters
| Parameter | Type | Description |
|---|---|---|
status | string | Filter by status: RUNNING, PAUSED, COMPLETED, CANCELLED, FAILED |
algorithm_type | string | Filter by type: twap, ladder, sweep, timepace, spread |
symbol | string | Filter by trading pair |
side | string | Filter by buy or sell |
limit | int | Max results (default: 50, max: 200) |
offset | int | Pagination offset |
Request Example
GET /oems/algorithms/by-status/
List algorithms by status.Request Example
GET /oems/algorithms/by-account/
List algorithms for a specific exchange account.Request Example
Algorithm Status Lifecycle
| Status | Description |
|---|---|
PENDING | Created but not started |
RUNNING | Actively executing slices |
PAUSED | Temporarily stopped by user |
COMPLETED | All quantity filled |
CANCELLED | Stopped by user |
FAILED | Error occurred |
TCA Metrics (Transaction Cost Analysis)
Each algorithm tracks execution quality metrics:| Metric | Description |
|---|---|
arrival_price | Market mid-price when algorithm started |
vwap | Volume-weighted average fill price |
slippage_bps | Difference between arrival and fill price (basis points) |
fill_percentage | Percentage of order filled |
total_fees | Total trading fees incurred |
Calculating Implementation Shortfall
Error Handling
| Error | Cause | Resolution |
|---|---|---|
DAILY_LIMIT_EXCEEDED | Order would exceed daily limit | Reduce quantity or wait until tomorrow |
MIN_ORDER_SIZE | Slice below exchange minimum | Algorithm skips tiny slices automatically |
SYMBOL_NOT_PERMITTED | Account can’t trade this pair | Check exchange account permissions |
EXCHANGE_ERROR | Exchange rejected order | Check error message for details |
Daily Limit Behavior
When an algorithm hits the daily trading limit:- Remaining slices are rejected
- Algorithm is paused automatically
- Check
/oems/execution/daily-limitfor current limit status
Choosing an Algorithm
| Scenario | Algorithm | Why |
|---|---|---|
| Minimize market impact over time | twap | Spreads execution evenly, catches up if behind |
| Fixed-pace execution, no catch-up | timepace | Predictable pacing, skipped intervals stay skipped |
| Fill entire order NOW | sweep | IOC execution with retry logic |
| Accumulate at multiple price levels | ladder | Posts limit orders across a price range |
| Basis/arb trade across venues | spread | Two-leg execution with risk management |
TWAP vs TimePace
| Feature | TWAP | TimePace |
|---|---|---|
| Catch-up on missed intervals | Yes | No |
| Fixed end time | Yes (duration-based) | No (runs until filled) |
| Size per interval | Calculated from total/intervals | User-specified |
| Use case | Fill X quantity in Y time | Send Z quantity every N seconds |

