Functions and Operators
Functions and operators available in the formulas of the Alpha factor analysis tool. Expressions are case-insensitive; below, x and y denote time series, d denotes the number of periods, and {} denotes a placeholder.
Operators
+, -, *, /, >, and < are calculated with their standard meanings; == tests for equality, || denotes logical OR, and x ? y : z is the ternary conditional operator.
Functions
| Function | Description |
|---|---|
abs(x), log(x), sign(x) | Absolute value, logarithm, and sign functions |
rank(x) | Cross-sectional rank: at each point in time, ranks x across the symbols in the symbol pool and returns the percentile, in the range (0, 1]; tied values receive their average rank, and symbols with no data at that time are excluded from the ranking. The symbol pool consists of the multiple symbols selected on the web page, or the symbols specified by a formula prefix, for example binance.btc_usdt,binance.eth_usdt:rank(close); with only one symbol, the result is always 1 and the ranking has no practical meaning |
delay(x, d) | The value of x d periods ago |
sma(x, d) | The simple moving average of x over d periods |
correlation(x, y, d) | The correlation coefficient of x and y over the past d periods |
covariance(x, y, d) | The covariance of x and y over the past d periods |
scale(x, a) | Normalizes x so that sum(abs(x)) = a (a defaults to 1) |
delta(x, d) | The current value of x minus its value d periods ago |
signedpower(x, a) | Signed power: sign(x) * abs(x)^a; when x is negative, the result remains negative |
decay_linear(x, d) | The d-period linearly weighted moving average of x, with weights d, d-1, …, 1 (normalized) |
indneutralize(x, g) | Neutralization: subtracts the mean of the symbol pool at each point in time. No industry classification data is currently available, so g has no effect and the entire symbol pool is treated as a single group |
ts_{O}(x, d) | Applies operation O to x over the past d periods (O is min, max, etc.; see the rows below); d is converted to an integer |
ts_min(x, d), min(x, d) | The minimum value over the past d periods |
ts_max(x, d), max(x, d) | The maximum value over the past d periods |
ts_argmin(x, d) | The position of ts_min(x, d) |
ts_argmax(x, d) | The position of ts_max(x, d) |
ts_rank(x, d) | The rank (percentile) of x over the past d periods |
sum(x, d) | The cumulative sum over the past d periods |
product(x, d) | The cumulative product over the past d periods |
stddev(x, d) | The standard deviation over the past d periods |