Пример #1
0
def run(conf={}):
    logging.info("Start compute app.")
    logging.debug("Compute init conf is %s" % str(conf))
    date=conf.get('date',Date.getDate())
    stock=conf.get("stock",Stock(conf))
    extract = Extract(conf = conf)
    extract.extract(project = "fromDetailToAdv", stock = stock, date = date)
    stock.data.dump()
    return True
Пример #2
0
def run(conf={}):
    date = Date.getInstantDate() #instant date 应该Date.getDate +1,key的编码问题
    conf['date']=date

    logging.info("start downloading instant data.Date is %s" % conf['date'])
    downloader = Downloader(conf = conf)
    downloader.download("instant")

    logging.info("start computing instant data.Date is %s"% conf['date'])
    stock=Stock(conf)
    extract = Extract(conf = conf)
    extract.extract(project = "instant", stock = stock, date = date)

    logging.info("start instant strategic data.Date is %s" %conf['date'])
    strategic_conf ={}
    strategic_conf.update(conf)
    strategic_conf['stock']=stock
    strategic = Strategic(conf = strategic_conf)
    strategicResult = strategic.compute()
    Dumper.dump(path = os.path.join(conf.get("SYS_HOME"),conf.get("INSTANT_DATA_PATH"),"strategic.json"),data = strategicResult)

    logging.info("Start Bayes statistics.Date is %s"% conf['date'])
    conf['strategic']=strategic
    bayesHandler = Bayes(conf)
    bayes = bayesHandler.posterior()
    Dumper.dump(path = os.path.join(conf.get("SYS_HOME"),conf.get("INSTANT_DATA_PATH"),"bayes.json"),data = bayes)

    logging.info("Start report.Date is %s"% conf['date'])
    report = Report(conf = conf)
    report.compute(strategic = strategic , statistics = bayes)
    print report

    #profile
    profile_conf =  {"stock":stock,"date":date}
    profile_conf.update(conf)
    profile = Profile(profile_conf)
    profile.viewProfile()

    path = os.path.join(conf.get("SYS_HOME"),conf.get("INSTANT_REPORT_DATA_PATH"))
    Dumper.dump(path = path,data = report.data)
    return report.data