def create_stock(code, start, end, cover): master = Master.env(code) freq = Freq.env(code) if not os.path.exists(master.dir): os.makedirs(master.dir) if (not master.exist) or cover: master.create(start, end) master.flush() click.echo("Create master %s" % code) if (not freq.exist) or cover: freq.create() freq.flush() click.echo("Create freq %s" % code)
def check(self): if not os.path.exists(self.env.file_root): click.echo('File root dir: %s does not exist' % self.env.file_root) return else: for code in self.env.stocks: if Master.env(code).exist: click.echo("%s master OK" % code) else: click.echo("%s master missing" % code) if Freq.env(code).exist: click.echo("%s freq OK" % code) else: click.echo("%s freq missing" % code)
def iter_freq(self, freq): for code in self.field: yield Freq.env(code), self.env.db_manager[code, freq], Master.env( code), self.env.db_manager[code]
def iter_main(self): for code in self.field: yield Master.env(code), self.env.db_manager[code]