Esempio n. 1
0
    def schedule_function(self,
                          func,
                          date_rule=None,
                          time_rule=None,
                          half_days=True,
                          check_args=False):
        """
        Schedules a function to be called with some timed rules.
        """
        # Defaults to every day 30 minutes before close.
        date_rule = date_rule or DateRuleFactory.every_day()
        time_rule = time_rule or TimeRuleFactory.market_close(minutes=30)

        self.add_event(
            make_eventrule(date_rule, time_rule, half_days),
            func,
            check_args=check_args,
        )
Esempio n. 2
0
    def schedule_function(self,
                          func,
                          date_rule=None,
                          time_rule=None,
                          half_days=True):
        """
        Schedules a function to be called with some timed rules.
        """
        if self.sim_params.data_frequency != 'minute':
            raise IncompatibleScheduleFunctionDataFrequency()

        # Defaults to every day 30 minutes before close.
        date_rule = date_rule or DateRuleFactory.every_day()
        time_rule = time_rule or TimeRuleFactory.market_close(minutes=30)

        self.add_event(
            make_eventrule(date_rule, time_rule, half_days),
            func,
        )