Skip to main content

Overview

This page documents 7 operators (role: various).

Quick Reference


WeightsToPositions

Convert L1-normalized weights to target notional positions. Multiplies each weight by the book size to produce notional position values. Book size can be provided as a fixed value or looked up from the runtime context. Positions below min_position are zeroed out. Formula: position_i = w_i * book_size; zero if |position_i| < min_position. Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

Full compute() implementation — no hidden logic.
Source: apps/trading/operators/transform/position.py

TurnoverConstraint

Constrain target weights to a maximum turnover budget. Computes the one-way turnover between target and current weights. If turnover exceeds the limit, linearly scales the trade toward the target so that the resulting turnover equals max_turnover. Formula: turnover = sum(|w_target - w_current|) / 2; if turnover > max: w = w_current + (max / turnover) * (w_target - w_current) Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

Full compute() implementation — no hidden logic.
Source: apps/trading/operators/transform/position.py

TradeBarrier

Apply a fixed trade barrier to suppress small weight changes. For each symbol, if the absolute weight change from the current position is smaller than the threshold, the current weight is kept. This reduces unnecessary turnover caused by noise. Current weights are derived from live state positions. Formula: current_w_i = (position_i * price_i) / book_size; if |target_w_i - current_w_i| < threshold: keep current_w_i, else use target_w_i. Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

Full compute() implementation — no hidden logic.
Source: apps/trading/operators/transform/position.py

AdaptiveTradeBarrier

Apply a volatility-adaptive trade barrier to suppress noise-driven turnover. Instead of a fixed threshold, the barrier adapts per symbol based on its current volatility. In low-volatility regimes the barrier is higher (more filtering); in high-volatility regimes it is lower (allowing larger real moves through). The threshold is clamped to [min_threshold, max_threshold]. Formula: threshold_i = clip(k * volatility_i, min_threshold, max_threshold); if |target_w_i - current_w_i| < threshold_i: keep current_w_i. Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

Full compute() implementation — no hidden logic.
Source: apps/trading/operators/transform/position.py

TCOptimizedWeights

Transaction-cost aware optimal weights using L1 soft-thresholding. Solves the optimization: maximize alpha’w - lambda_tc * ||w - w_prev||_1. The closed-form solution applies soft-thresholding to the weight change: If target_w[i] > current_w[i] + lambda_tc: w[i] = target_w[i] - lambda_tc If target_w[i] < current_w[i] - lambda_tc: w[i] = target_w[i] + lambda_tc Otherwise: w[i] = current_w[i] (no trade) After adjustment, weights are L1-normalized to sum(|w|) = 1. Formula: delta_i = target_i - current_i; w_i = target_i - sign(delta_i)*lambda_tc if |delta_i| > lambda_tc, else current_i. Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

Full compute() implementation — no hidden logic.
Source: apps/trading/operators/transform/position.py

PositionLimits

Apply absolute and concentration-based position limits. Clips each position to an absolute notional cap and/or a maximum fraction of total book size. Both limits are applied independently: the absolute limit first, then the concentration limit if a book size is available in context. Formula: result_i = clip(x_i, -max_pos, max_pos); if max_concentration: result_i = clip(result_i, -max_concbook, max_concbook). Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

Full compute() implementation — no hidden logic.
Source: apps/trading/operators/transform/position.py

NotionalToQuantity

Convert notional position values to asset quantities using prices. Divides each notional value by its corresponding price to get a raw quantity, then rounds to the nearest lot size. Prices are obtained from the runtime context. Formula: qty_i = round(notional_i / price_i / lot_size) * lot_size Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

Full compute() implementation — no hidden logic.
Source: apps/trading/operators/transform/position.py

Operator Protocol

How operators implement the compute() interface

StatefulGraph

How operators compose into a DAG