pub enum Expr {
Show 50 variants
Data {
name: String,
},
Const {
value: f64,
},
Average {
of: Box<Expr>,
n: usize,
},
Ema {
of: Box<Expr>,
n: usize,
},
Std {
of: Box<Expr>,
n: usize,
},
Rsi {
of: Box<Expr>,
n: usize,
},
PctChange {
of: Box<Expr>,
n: usize,
},
Rise {
of: Box<Expr>,
n: usize,
},
Shift {
of: Box<Expr>,
n: usize,
},
RollingMax {
of: Box<Expr>,
n: usize,
},
Atr {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
n: usize,
},
Natr {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
n: usize,
},
WillR {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
n: usize,
},
Cci {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
n: usize,
},
StochK {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
n: usize,
},
StochD {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
n: usize,
d: usize,
},
AroonUp {
high: Box<Expr>,
n: usize,
},
AroonDown {
low: Box<Expr>,
n: usize,
},
Adx {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
n: usize,
},
PlusDi {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
n: usize,
},
MinusDi {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
n: usize,
},
Obv {
close: Box<Expr>,
volume: Box<Expr>,
},
Mfi {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
volume: Box<Expr>,
n: usize,
},
Vwap {
high: Box<Expr>,
low: Box<Expr>,
close: Box<Expr>,
volume: Box<Expr>,
n: usize,
},
Fall {
of: Box<Expr>,
n: usize,
},
IsLargest {
of: Box<Expr>,
n: usize,
},
IsSmallest {
of: Box<Expr>,
n: usize,
},
Sustain {
of: Box<Expr>,
nwindow: usize,
nsatisfy: Option<usize>,
},
IsEntry {
of: Box<Expr>,
},
IsExit {
of: Box<Expr>,
},
Gt {
l: Box<Expr>,
r: Box<Expr>,
},
Lt {
l: Box<Expr>,
r: Box<Expr>,
},
Ge {
l: Box<Expr>,
r: Box<Expr>,
},
Le {
l: Box<Expr>,
r: Box<Expr>,
},
And {
l: Box<Expr>,
r: Box<Expr>,
},
Or {
l: Box<Expr>,
r: Box<Expr>,
},
Add {
l: Box<Expr>,
r: Box<Expr>,
},
Sub {
l: Box<Expr>,
r: Box<Expr>,
},
Mul {
l: Box<Expr>,
r: Box<Expr>,
},
Div {
l: Box<Expr>,
r: Box<Expr>,
},
Neg {
of: Box<Expr>,
},
Ceil {
of: Box<Expr>,
},
Rank {
of: Box<Expr>,
pct: bool,
ascending: bool,
},
Mask {
of: Box<Expr>,
by: Box<Expr>,
},
HoldUntil {
entry: Box<Expr>,
exit: Box<Expr>,
nstocks_limit: Option<usize>,
rank: Option<Box<Expr>>,
stop_loss: Option<f64>,
take_profit: Option<f64>,
trail_stop: Option<f64>,
trail_stop_activation: Option<f64>,
},
Rebalance {
of: Box<Expr>,
freq: Option<String>,
on: Option<Box<Expr>>,
},
Neutralize {
of: Box<Expr>,
by: Vec<Expr>,
add_const: bool,
},
NeutralizeIndustry {
of: Box<Expr>,
add_const: bool,
},
IndustryRank {
of: Box<Expr>,
categories: Option<Vec<String>>,
},
GroupbyCategory {
of: Box<Expr>,
agg: String,
},
}Variants§
Data
A raw input series by name (e.g. close, pe, revenue_growth).
Const
A constant scalar value, broadcast across the panel.
Average
Simple moving average of of over n days.
Ema
Exponential moving average of of over n days.
Std
Rolling standard deviation of of over n days.
Rsi
Relative Strength Index of of over n days.
PctChange
Percentage change of of over n days.
Rise
1 where of rose for n consecutive days, else 0.
Shift
of lagged forward by n days.
RollingMax
Rolling maximum of of over n days.
Atr
Average True Range over n days from high/low/close.
Natr
Normalized ATR (percent) over n days.
WillR
Williams %R over n days.
Cci
Commodity Channel Index over n days.
StochK
Stochastic %K over n days.
StochD
Stochastic %D: d-day average of %K over n days.
AroonUp
Aroon Up over n days from high.
AroonDown
Aroon Down over n days from low.
Adx
Average Directional Index over n days.
PlusDi
Plus Directional Indicator (+DI) over n days.
MinusDi
Minus Directional Indicator (−DI) over n days.
Obv
On-Balance Volume from close and volume.
Mfi
Money Flow Index over n days.
Vwap
Volume-Weighted Average Price over n days from high/low/close/volume.
Fall
1 where of fell for n consecutive days, else 0.
IsLargest
1 for the n highest values per row (cross-section), else 0.
IsSmallest
1 for the n lowest values per row (cross-section), else 0.
Sustain
1 where of held true at least nsatisfy times within the last nwindow rows.
IsEntry
1 on the row where of turns false→true (rising edge).
IsExit
1 on the row where of turns true→false (falling edge).
Gt
1 where l is greater than r, else 0.
Lt
1 where l is less than r, else 0.
Ge
1 where l is greater than or equal to r, else 0.
Le
1 where l is less than or equal to r, else 0.
And
Logical AND of two boolean panels.
Or
Logical OR of two boolean panels.
Add
Element-wise l + r.
Sub
Element-wise l − r.
Mul
Element-wise l × r.
Div
Element-wise l ÷ r.
Neg
Negation (−of).
Ceil
Ceiling of of.
Rank
Cross-sectional rank of of per row; pct for 0..1 percentile, ascending sets direction.
Mask
of kept only where by is true; elsewhere dropped.
HoldUntil
Stateful rotation: enter on entry, exit on exit, hold up to nstocks_limit (prioritised by rank), with optional stop_loss/take_profit/trail_stop/trail_stop_activation.
Fields
Rebalance
Hold of, refreshing on calendar freq (W/ME/QE) or on dates where on is true.
Neutralize
Cross-sectionally regress of against the by factors, optionally adding a constant.
NeutralizeIndustry
Neutralize of within each industry/sector.
IndustryRank
Rank of within each industry, optionally limited to categories.
GroupbyCategory
Aggregate of within each industry using agg (e.g. mean).