Fetch_Data_Stock_CHN_StockList.py 文件源码

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

项目:StockRecommendSystem 作者: doncat99 项目源码 文件源码
def getStocksList_CHN(root_path):
    try:
        df = queryStockList(root_path, "DB_STOCK", "SHEET_CHN")
        df.index = df.index.astype(str).str.zfill(6)
    except Exception as e:
        df = pd.DataFrame()

    if df.empty == False: return df

    stock_info = ts.get_stock_basics()
    listData = pd.DataFrame(stock_info)
    listData['daily_update'] = '1970-07-01'
    listData['weekly_update'] = '1970-07-01'
    listData['monthly_update'] = '1970-07-01'
    listData['news_update'] = '1970-07-01'
    listData.index.name = 'symbol'
    listData = listData.reset_index()

    #listData.index.name = 'symbol'
    #listData.index = listData.index.astype(str).str.zfill(6) #[str(symbol).zfill(6) for symbol in listData.index] #listData.index.astype(str).str.zfill(6)
    #print(listData.index)
    #listData['symbol'] = listData['symbol'].str.strip()

    storeStockList(root_path, "DB_STOCK", "SHEET_CHN", listData)
    df = queryStockList(root_path, "DB_STOCK", "SHEET_CHN")

    if df.empty == False: df.index = df.index.astype(str).str.zfill(6)
    return df
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号