コード例 #1
0
ファイル: stock_bot.py プロジェクト: cocasema/stock_bot
    def setup(self):
        super().setup()
        self.log.info('Setting up')

        self.test_mode = os.getenv('TEST') != None
        if self.test_mode:
            self.log.warn('Test mode')

        provider = self.config[self.Meta.label].get(
            'provider', 'google').lower()
        self.provider = {'google': GoogleFinance,
                         'yahoo': YahooFinance}[provider](self.log)
        self.slack_client = slack.create(self.test_mode, self.log, self.config)

        if not self.test_mode:
            days = [
                schedule.every(1).monday,
                schedule.every(1).tuesday,
                schedule.every(1).wednesday,
                schedule.every(1).thursday,
                schedule.every(1).friday,
            ]
            time = self.config['schedule']['time']
            for day in days:
                day.at(time).do(self.update)
        else:
            schedule.every(10).seconds.do(self.update)
コード例 #2
0
ファイル: stock_bot.py プロジェクト: cocasema/stock_bot
    def setup(self):
        super().setup()
        self.log.info('Setting up')

        self.test_mode = os.getenv('TEST') != None
        if self.test_mode:
            self.log.warning('Test mode')

        provider = self.config[self.Meta.label].get('provider',
                                                    'alpha_vantage').lower()
        provider_options = self.config[self.Meta.label].get(
            'provider_options', '')
        provider_options = dict(
            item.split('=') for item in provider_options.split(';'))
        self.provider = {
            'google': GoogleFinance,
            'yahoo': YahooFinance,
            'alpha_vantage': AlphaVantage
        }[provider](self.log, provider_options)
        self.slack_client = slack.create(self.test_mode, self.log, self.config)

        if not self.test_mode:
            days = [
                schedule.every(1).monday,
                schedule.every(1).tuesday,
                schedule.every(1).wednesday,
                schedule.every(1).thursday,
                schedule.every(1).friday,
            ]
            time = self.config['schedule']['time']
            for day in days:
                day.at(time).do(self.update)
        else:
            schedule.every(10).seconds.do(self.update)
コード例 #3
0
    def setup(self):
        super().setup()
        self.log.info('Setting up')

        self.test_mode = os.getenv('TEST') != None
        if self.test_mode:
            self.log.warn('Test mode')

        self.yahoo_finance = YahooFinance(self.log)
        self.slack_client = slack.create(False, self.log, self.config)

        if not self.test_mode:
            days = [
                schedule.every(1).monday,
                schedule.every(1).tuesday,
                schedule.every(1).wednesday,
                schedule.every(1).thursday,
                schedule.every(1).friday,
            ]
            for day in days:
                day.at('13:00').do(self.update)
        else:
            schedule.every(10).seconds.do(self.update)
コード例 #4
0
ファイル: stock_bot.py プロジェクト: ilduganov/stock_bot
    def setup(self):
        super().setup()
        self.log.info("Setting up")

        self.test_mode = os.getenv("TEST") != None
        if self.test_mode:
            self.log.warn("Test mode")

        self.yahoo_finance = YahooFinance(self.log)
        self.slack_client = slack.create(False, self.log, self.config)

        if not self.test_mode:
            days = [
                schedule.every(1).monday,
                schedule.every(1).tuesday,
                schedule.every(1).wednesday,
                schedule.every(1).thursday,
                schedule.every(1).friday,
            ]
            for day in days:
                day.at("13:00").do(self.update)
        else:
            schedule.every(10).seconds.do(self.update)