def QA_fetch_quotations(date=datetime.date.today(), db=DATABASE):
    '获取全部实时5档行情的存储结果'
    try:
        collections = db.get_collection(
            'realtime_{}'.format(date))
        data = pd.DataFrame([item for item in collections.find(
            {}, {"_id": 0}, batch_size=10000)])
        return data.assign(date=pd.to_datetime(data.datetime.apply(lambda x: str(x)[0:10]))).assign(datetime=pd.to_datetime(data.datetime)).set_index(['datetime', 'code'], drop=False).sort_index()
    except Exception as e:
        raise e
def QA_fetch_quotations ( date = datetime . date . today ( ) , db = DATABASE ) : try : collections = db . get_collection ( 'realtime_{}' . format ( date ) ) data = pd . DataFrame ( [ item for item in collections . find ( { } , { "_id" : 0 } , batch_size = 10000 ) ] ) return data . assign ( date = pd . to_datetime ( data . datetime . apply ( lambda x : str ( x ) [ 0 : 10 ] ) ) ) . assign ( datetime = pd . to_datetime ( data . datetime ) ) . set_index ( [ 'datetime' , 'code' ] , drop = False ) . sort_index ( ) except Exception as e : raise e
获取全部实时5档行情的存储结果