close_open_gap

qf_lib.common.utils.close_open_gap.close_open_gap.close_open_gap(prices_df: PricesDataFrame, initial_price: int = 1, transaction_cost_percentage: float = 0, transaction_cost_value: float = 0) PricesSeries[source]

Calculates price changes during the night gap (opening price compared to closing price from the previous day). May be interpreted as performance of strategy based on buying at close and selling at next open.

Parameters:
  • prices_df – PricesDataFrame of at least 2 series: PriceField.Open and PriceField.Close

  • initial_price – initial price of the timeseries. If no price will be specified, then it will be assumed to be 1.

  • transaction_cost_percentage – cost of a single transaction [%]; percentage of the transaction value by default set to 0 can’t have a non-zero value if transaction_cost_value is set!

  • transaction_cost_value – cost of a single transaction [currency of examined asset] by default set to 0 can’t have a non-zero value if transaction_cost_percentage is set!

Returns:

price changes

Return type:

PricesSeries