OnBeforeMarketOpenSignalGeneration

class qf_lib.backtesting.strategies.signal_generators.OnBeforeMarketOpenSignalGeneration(strategy: qf_lib.backtesting.strategies.abstract_strategy.AbstractStrategy)[source]

Bases: object

Wrapper, which facilitates the subscription process of the Strategy to the BeforeMarketOpenEvent. After the creation of a strategy object, in order to proceed with the signal generation and orders placement every day at the BeforeMarketOpenEvent, it is necessary to encapsulate the strategy in the following way:

strategy = ExampleStrategy(trading_session) OnBeforeMarketOpenSignalGeneration(strategy)

This will ensure, that every day (from Monday to Friday) before the market open time, the calculate_and_place_orders will be executed.

It requires the trigger_time of the BeforeMarketOpenEvent event to be set properly set, by calling the set_trigger_time function before using the OnBeforeMarketOpenSignalGeneration.