获取真实的交易日期,其中,第三个参数towards是表示向前/向后推
    towards=1 日期向后迭代
    towards=-1 日期向前迭代
    @ yutiansut

def QA_util_get_real_date(date, trade_list=trade_date_sse, towards=-1):
    """
    获取真实的交易日期,其中,第三个参数towards是表示向前/向后推
    towards=1 日期向后迭代
    towards=-1 日期向前迭代
    @ yutiansut

    """
    date = str(date)[0:10]
    if towards == 1:
        while date not in trade_list:
            date = str(
                datetime.datetime.strptime(str(date)[0:10],
                                           '%Y-%m-%d') +
                datetime.timedelta(days=1)
            )[0:10]
        else:
            return str(date)[0:10]
    elif towards == -1:
        while date not in trade_list:
            date = str(
                datetime.datetime.strptime(str(date)[0:10],
                                           '%Y-%m-%d') -
                datetime.timedelta(days=1)
            )[0:10]
        else:
            return str(date)[0:10]