Skip to main content

Overview

This page documents 6 operators (role: various).

Quick Reference


MeanVarianceOptimizer

Mean-Variance (Markowitz) portfolio optimization. Computes optimal weights by maximizing expected return for a given level of risk aversion. Solves the unconstrained quadratic program and L1-normalizes the result. Formula: w_raw = Sigma^{-1} * mu / lambda; w = w_raw / sum(|w_raw|) Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

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

RiskParityOptimizer

Risk Parity portfolio weights proportional to inverse volatility. Allocates weight to each asset inversely proportional to its volatility, so that each asset contributes equally to portfolio risk. Volatilities below min_vol are floored to avoid extreme weights. Formula: w_i = (1 / vol_i) / sum(1 / vol) Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

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

ClipWeights

Clip portfolio weights to bounds and optionally renormalize. Constrains each weight to [lower, upper] and optionally rescales so that sum(|w_i|) = 1 after clipping. This enforces per-asset weight limits while maintaining full investment. Formula: w_i = clip(w_i, lower, upper); if renormalize: w_i = w_i / sum(|w|) Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

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

MaxPositions

Limit the number of positions to the top K by absolute weight. Keeps only the top-N symbols ranked by absolute weight value and zeros out the rest. Optionally renormalizes the surviving weights so that sum(|w_i|) = 1. Algorithm: sort symbols by |w_i| descending, keep top N, zero the rest. Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

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

EqualWeight

Equal weight allocation across symbols based on signal sign. Assigns equal absolute weight to every valid symbol, using the sign of the input signal to determine direction (long or short). In long-only mode, only symbols with positive signal values receive weight. Formula: w_i = sign(x_i) / N, where N is the number of active positions. Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

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

TailSelector

Quintile-spread portfolio: long top percentile, short bottom percentile. Ranks the input signal cross-sectionally, assigns +1 to symbols in the top quantile and -1 to symbols in the bottom quantile, and zeros out the middle. This produces a dollar-neutral long-short portfolio concentrated on the strongest and weakest signals. With 30 symbols and long_pct=short_pct=0.2, the top 6 symbols get +1 (long) and the bottom 6 get -1 (short). The remaining 18 are zeroed out. Feed the output through L1Norm for proper weight normalization. Role: UNKNOWN | Ephemeral: No

Parameters

Usage

Source Code

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

Operator Protocol

How operators implement the compute() interface

StatefulGraph

How operators compose into a DAG