meta.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:strategy 作者: kanghua309 项目源码 文件源码
def load_tushare_df(df_type):
    file = 'ts.' + df_type + '.dat'
    try:
        obj = pickle.load(open(file,"rb"))
    except:
        #print("---load in the fly",df_type)
        if df_type == "basic":
           obj = ts.get_stock_basics()
        elif df_type == "sme":
           obj = ts.get_sme_classified()
        elif df_type == "gem":
           obj=ts.get_gem_classified()
        elif df_type == "industry":
           #print(ts, pickle)
           obj = ts.get_industry_classified() #?????,??2800??,?????3326,??????? get_stock_basics
        elif df_type == "st":
           obj = ts.get_st_classified()
        else:
            raise Exception("Error TSshare Type!!!")
        pickle.dump(obj,open(file,"wb",0))
    else:
        #print("***Read from file %s" % df_type)
        pass
    return obj
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号