コード例 #1
0
ファイル: fuquan.py プロジェクト: yangchanghua/gcandle
def stock_to_qfq(data, verbose=False):
    start = str(data.index.levels[0].min())[0:10]
    end = str(data.index.levels[0].max())[0:10]

    code = data.index.levels[1][0]
    xdxr_data = SECURITY_DATA_READ_SERVICE.read_fq_info(code, start, end)

    return do_prices_qfq(bfq_data=data, xdxr_data=xdxr_data, verbose=verbose)
コード例 #2
0
def update_qfq_for_single_code(code, start, end):
    max_qfq_date = DB_CLIENT.read_max_date_for(code, DAY_QFQ_REPO)
    if max_qfq_date is None:
        calc_qfq_and_update(code, start, end)
    else:
        fq_info = SECURITY_DATA_READ_SERVICE.read_fq_info(code, start, end)
        if fq_info is None:
            copy_stock_day_directly(code, start, end)
        else:
            max_fq_info_date = fq_info.index.levels[0].max()
            if str(max_fq_info_date)[0:10] < max_qfq_date:
                copy_stock_day_directly(code, start, end)
            else:
                print("Recreate needed for {}, max qfq date={}, max fq info date={}".format(code, max_qfq_date, max_fq_info_date))
                re_calc_qfq_and_overwrite(code, start, end)