Fetch_Data_Stock_CHN_Weekly.py 文件源码

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

项目:StockRecommendSystem 作者: doncat99 项目源码 文件源码
def getSingleStockByTime(symbol, from_date, till_date):
    start = from_date.split('-')
    start_y, start_m, start_d = start[0], start[1], start[2] # starting date

    end = till_date.split('-')
    end_y, end_m, end_d = end[0], end[1], end[2] # until now

    repeat_times = 1
    message = ""
    df = pd.DataFrame()

    for _ in range(repeat_times): 
        try:
            data = ts.get_k_data(symbol, ktype='W')
            data.sort_index(ascending=True, inplace=True)
            return data, ""
        except Exception as e:
            message = symbol + " fetch exception: " + str(e)
            continue   
    return df, message
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号