mizarlabs.transformers.microstructural_features package

Submodules

mizarlabs.transformers.microstructural_features.first_generation module

class mizarlabs.transformers.microstructural_features.first_generation.BeckersParkinsonVolatility(window: int = 20, high_column_name: str = 'high', low_column_name: str = 'low')[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Get Bekker-Parkinson volatility from gamma and beta in Corwin-Schultz algorithm, (p.286, Snippet 19.2).

See page 284 of Advances in Financial Machine Learning by Marcos Lopez de Prado for additional information.

Parameters
  • window (int) – The window size

  • high_column_name (str, optional) – The name of the high column

  • low_column_name (str, optional) – The name of the low column

fit(X, y=None, **fit_params)[source]
transform(X: pandas.core.frame.DataFrame)numpy.ndarray[source]
class mizarlabs.transformers.microstructural_features.first_generation.CorwinSchultzSpread(window: int = 20, high_column_name: str = 'high', low_column_name: str = 'low')[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Corwin Schultz spread estimator.

See page 284 of Advances in Financial Machine Learning by Marcos Lopez de Prado for additional information.

Parameters
  • window (int) – The window size

  • high_column_name – The name of the high column

  • low_column_name (str, optional) – The name of the low column

fit(X, y=None, **fit_params)[source]
transform(X: pandas.core.frame.DataFrame)numpy.ndarray[source]
class mizarlabs.transformers.microstructural_features.first_generation.ParkinsonVolatility(window: int = 20, high_column_name: str = 'high', low_column_name: str = 'low')[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

High low volatility estimator developed by Parkinson (1980).

Parameters
  • window (int) – The window size

  • high_column_name (str, optional) – The name of the high column

  • low_column_name (str, optional) – The name of the low column

fit(X, y=None, **fit_params)[source]
transform(X: pandas.core.frame.DataFrame)numpy.ndarray[source]
class mizarlabs.transformers.microstructural_features.first_generation.RollImpact(window: int = 20, close_column_name: str = 'close', quote_asset_volume_column_name: str = 'quote_asset_volume')[source]

Bases: mizarlabs.transformers.microstructural_features.first_generation.RollMeasure

Derivate from Roll Measure which takes into account dollar volume traded.

See page 282 of Advances in Financial Machine Learning by Marcos Lopez de Prado for additional information.

Parameters
  • window (int) – The window size

  • close_column_name (str, optional) – The name of the close column

  • quote_asset_volume_column_name (str, optional) – The name quote asset column column

fit(X, y=None, **fit_params)[source]
transform(X: pandas.core.frame.DataFrame)numpy.ndarray[source]
class mizarlabs.transformers.microstructural_features.first_generation.RollMeasure(window: int = 20, close_column_name: str = 'close')[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Implement the roll measure which gives the estimate of effective bid-ask spread.

See page 282 of Advances in Financial Machine Learning by Marcos Lopez de Prado for additional information.

Parameters
  • window (int) – The window size

  • close_column_name (str, optional) – The name of the close column

fit(X, y=None, **fit_params)[source]
transform(X: pandas.core.frame.DataFrame)numpy.ndarray[source]

mizarlabs.transformers.microstructural_features.second_generation module

class mizarlabs.transformers.microstructural_features.second_generation.AmihudLambda(window: int = 20, close_column_name: str = 'close', quote_asset_volume_column_name: str = 'quote_asset_volume')[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Amihud Lambda liquidity estimator (p.288).

See page 288 of Advances in Financial Machine Learning by Marcos Lopez de Prado for additional information.

Parameters
  • window (int) – The window size

  • close_column_name (str, optional) – The name of the close column

  • quote_asset_volume_column_name (str, optional) – The name of the quote asset volume column

fit(X, y=None, **fit_params)[source]
transform(X: pandas.core.frame.DataFrame)numpy.ndarray[source]
class mizarlabs.transformers.microstructural_features.second_generation.HasbrouckLambda(window: int = 20, close_column_name: str = 'close', quote_asset_volume_column_name: str = 'quote_asset_volume')[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Hasbrouck Lambda price impact estimator(p.289).

See page 289 of Advances in Financial Machine Learning by Marcos Lopez de Prado for additional information.

Parameters
  • window (int) – The window size

  • close_column_name (str, optional) – The name of the close column

  • quote_asset_volume_column_name (str, optional) – The name of the quote asset volume column

fit(X, y=None, **fit_params)[source]
transform(X: pandas.core.frame.DataFrame)numpy.ndarray[source]
class mizarlabs.transformers.microstructural_features.second_generation.KyleLambda(window: int = 20, close_column_name: str = 'close', base_asset_volume_column_name: str = 'base_asset_volume')[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Kyle lambda liquidity estimator (p.286).

See page 286 of Advances in Financial Machine Learning by Marcos Lopez de Prado for additional information.

Parameters
  • window (int) – The window size

  • close_column_name (str, optional) – The name of the close column

  • base_asset_volume_column_name (str, optional) – The name of the base asset volume column

fit(X, y=None, **fit_params)[source]
transform(X: pandas.core.frame.DataFrame)numpy.ndarray[source]

mizarlabs.transformers.microstructural_features.vpin module

class mizarlabs.transformers.microstructural_features.vpin.VPIN(window: int = 20, base_asset_volume_column_name: str = 'base_asset_volume', base_asset_buy_volume_column_name: str = 'base_asset_buy_volume', base_asset_sell_volume_column_name: str = 'base_asset_sell_volume')[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Implement the Volume-Synchronized Probability of Informed Trading.

We assume that the index of the dataframe in input is based on the close time

See page 292 of Advances in Financial Machine Learning by Marcos Lopez de Prado for additional information.

Parameters
  • window (int) – The window size used for the calculation of the VPIN

  • base_asset_volume_column_name (str, optional) – name of the column where the volume (sum of the base asset quantity per trade) of the time bar is stored, defaults to config.BASE_ASSET_VOLUME

  • base_asset_buy_volume_column_name (str, optional) – name of the column where the volume (sum of the buy base asset quantity per trade) of the time bar is stored, defaults to config.BASE_ASSET_BUY_VOLUME

  • base_asset_sell_volume_column_name (str, optional) – name of the column where the volume (sum of the sell base asset quantity per trade) of the time bar is stored, defaults to config.BASE_ASSET_SELL_VOLUME

fit(X, y=None, **fit_params)[source]
transform(X: pandas.core.frame.DataFrame)numpy.ndarray[source]

Module contents