OHLC#

class quantflow.ta.ohlc.OHLC(*, serie: str, period: str | timedelta, index_column: str = 'index', parkinson_variance: bool = False, garman_klass_variance: bool = False, rogers_satchell_variance: bool = False, percent_variance: bool = False)#

Aggregates OHLC data over a given period and serie

Optionally calculates the range-based variance estimators for the serie. Range-based estimator are called like that because they are calculated from the difference between the period high and low.

Methods:

garman_klass

Adds Garman Klass variance estimator column to the dataframe

parkinson

Adds parkinson variance column to the dataframe

rogers_satchell

Adds Rogers Satchell variance estimator column to the dataframe

var_column

Returns a polars expression for the OHLC column

Attributes:

garman_klass_variance

add Garman Klass variance column

index_column

column to group by

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

parkinson_variance

add Parkinson variance column

percent_variance

log-transform the variance columns

period

down-sampling period, e.g. 1h, 1d, 1w.

rogers_satchell_variance

add Rogers Satchell variance column

serie

serie to aggregate

garman_klass(df: DataFrame | DataFrame) DataFrame#

Adds Garman Klass variance estimator column to the dataframe

This requires the serie high and low columns to be present.

parkinson(df: DataFrame | DataFrame) DataFrame#

Adds parkinson variance column to the dataframe

This requires the serie high and low columns to be present

rogers_satchell(df: DataFrame | DataFrame) DataFrame#

Adds Rogers Satchell variance estimator column to the dataframe

This requires the serie high and low columns to be present.

var_column(suffix: str) Expr#

Returns a polars expression for the OHLC column

garman_klass_variance: bool#

add Garman Klass variance column

index_column: str#

column to group by

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

parkinson_variance: bool#

add Parkinson variance column

percent_variance: bool#

log-transform the variance columns

period: str | timedelta#

down-sampling period, e.g. 1h, 1d, 1w

rogers_satchell_variance: bool#

add Rogers Satchell variance column

serie: str#

serie to aggregate