Features (fynance.features)

Financial features: metrics, indicators, scaling, moving averages, moving standard deviations and rolling functions.

Filters

Kalman filter with RTS smoother and maximum-likelihood parameter estimation.

Filters
Indicators

Bollinger Band, CCI, Hull Moving Average, MACD, RSI.

Indicators
Metrics

Annualized return and volatility, Calmar ratio, Sharpe ratio, maximum drawdown, Z-score and more.

Metrics
Momentums

Simple, exponential and weighted moving averages and standard deviations.

Momentums
Rolling functions

Rolling minimum and rolling maximum.

Rolling Functions
Scale

Standardization, normalization and their rolling versions.

Scale

Notation

Common parameters across modules:

  • X — time-series of returns, prices or indexed values. One- or two-dimensional. For 2D arrays, axis=0 (default) means each row is an observation at time t and each column is a different time-series.

  • w — size of the lagged window, e.g. a simple moving average of X is noted \(sma^w_t(X) = \frac{1}{w} \sum^{w-i}_{i=0} X_{t-i}\).

  • kind — method for moving average and/or standard deviation: simple ('s'), weighted ('w') or exponential ('e').

  • slow_w, fast_w — size of the lagged windows for long and short moving averages/standard deviations.

  • period — number of periods per year (e.g. 252 for daily trading days, 365 for daily calendar).

  • axis — axis along which the computation is performed (relevant only for 2D arrays).

  • dtype — output data type. Only numerical types are allowed (float, double, int, np.float16, etc.). Default is None (inferred from X).