예제 #1
0
파일: usdata.py 프로젝트: codelol/pstock
    def fetchdata(self, frequency = 'daily'):
        touchFolder()
        wpool = WorkPool(10)
        if frequency == 'daily':
            if len(self.datasets_daily) != 0:
                return
            self.missing_daily = []
            for sym in tqdm(self.watchlist, desc='daily chart', unit=' Symbol'):
                wpool.start_work(self.update_daily, sym)
            self.daily_data_updated = True

        elif frequency == 'weekly':
            if len(self.datasets_weekly) != 0:
                return
            self.missing_weekly = []
            for sym in tqdm(self.watchlist, desc='weekly chart', unit=' Symbol'):
                wpool.start_work(self.update_weekly, sym)
        wpool.wait_for_all()
예제 #2
0
    def run(self):
        self.all_rule_results = {}

        wpool = WorkPool(10)
        self.wpool = wpool
        for sym in self.symbols:
            wpool.start_work(self.run_rules_for_sym, sym)
        wpool.wait_for_all()

        # rulenames = ['一类买点', '二类买点', '反弹', '新高']
        rulenames = ['一类买点', 'MACD底部背驰', '新高', '反弹']
        rules_with_results = [r for r in rulenames if r in self.all_rule_results.keys()]
        for name in rules_with_results:
            symbolStr = ' '.join(self.all_rule_results[name])
            print(name + ': '+ symbolStr)

        if len(self.missing_data) > 0:
            print('missing data: ' + str(self.missing_data))

        if len(self.missing_analysis) > 0:
            print('skipped symbols: ' + str(self.missing_analysis))