ddql_optimal_execution.preprocessing.Preprocessor

class ddql_optimal_execution.preprocessing.Preprocessor(n_periods: int, QV: bool = True, normalize_price: bool = True, volume: bool = True)[source]

This class is used to preprocess the data before it is fed into the environment. It splits the data into periods and optionally calculates the QV and normalizes the price.

n_periods

an integer representing the number of periods in the time series data. It is the number of trading actions agents can take. QV : bool QV stands for “Quadratic Variation” and is a measure of volatility. This parameter is a boolean value that determines whether the QV should be calculated or not. If set to True, the QV will be calculated and added to the DataFrame.

normalize_price : bool A boolean parameter that determines whether the price data should be normalized or not. If set to True, the price data will be normalized to have a mean of 0 and a standard deviation of 1 after substracting the first price value.

__call__(df)[source]

This function splits a pandas DataFrame into periods based on a specified number of periods, and optionally calculates the QV and normalizes the price.

Type

int

__init__(n_periods: int, QV: bool = True, normalize_price: bool = True, volume: bool = True) None[source]

This is a constructor function that initializes the object with the given parameters.

Parameters
  • n_periods (int) – an integer representing the number of periods in the time series data. It is the number of trading actions agents can take.

  • QV (bool, optional) – QV stands for “Quadratic Variation” and is a measure of volatility. This parameter is a boolean

  • True (value that determines whether the QV should be calculated or not. If set to) –

  • be (the QV will) –

  • DataFrame. (calculated and added to the) –

  • normalize_price (bool, optional) – A boolean parameter that determines whether the price data should be normalized or not. If set to

  • True

  • substracting (the price data will be normalized to have a mean of 0 and a standard deviation of 1 after) –

  • value. (the first price) –

Methods

__init__(n_periods[, QV, normalize_price, ...])

This is a constructor function that initializes the object with the given parameters.