コード例 #1
0
ファイル: algorithm.py プロジェクト: KarenRubin/zipline
    def schedule_function(self, func, date_rule=None, time_rule=None, half_days=True):
        """
        Schedules a function to be called with some timed rules.
        """
        date_rule = date_rule or DateRuleFactory.every_day()
        time_rule = (
            (time_rule or TimeRuleFactory.market_open())
            if self.sim_params.data_frequency == "minute"
            else
            # If we are in daily mode the time_rule is ignored.
            zipline.utils.events.Always()
        )

        self.add_event(make_eventrule(date_rule, time_rule, half_days), func)
コード例 #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.
        """
        date_rule = date_rule or DateRuleFactory.every_day()
        time_rule = ((time_rule or TimeRuleFactory.market_open())
                     if self.sim_params.data_frequency == 'minute' else
                     # If we are in daily mode the time_rule is ignored.
                     zipline.utils.events.Always())

        self.add_event(
            make_eventrule(date_rule, time_rule, half_days),
            func,
        )
コード例 #3
0
ファイル: algorithm.py プロジェクト: iamaris/zipline
    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()

        date_rule = date_rule or DateRuleFactory.every_day()
        time_rule = time_rule or TimeRuleFactory.market_open()

        self.add_event(
            make_eventrule(date_rule, time_rule, half_days),
            func,
        )
コード例 #4
0
ファイル: algorithm.py プロジェクト: MridulS/zipline
    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,
        )
コード例 #5
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()

        date_rule = date_rule or DateRuleFactory.every_day()
        time_rule = time_rule or TimeRuleFactory.market_open()

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