Commit cf988166 authored by 李煜's avatar 李煜

str trade_data

parent 7d9c6260
......@@ -567,25 +567,25 @@ if __name__ == '__main__':
# cash flow
tp_cash_flow, ttm_cash_flow_sets = get_basic_cash_flow(date_index)
cache_data.set_cache(session4 + date_index + "1", date_index, tp_cash_flow.to_json(orient='records'))
cache_data.set_cache(session4 + date_index + "2", date_index, ttm_cash_flow_sets.to_json(orient='records'))
cache_data.set_cache(session4 + str(date_index) + "1", date_index, tp_cash_flow.to_json(orient='records'))
cache_data.set_cache(session4 + str(date_index) + "2", date_index, ttm_cash_flow_sets.to_json(orient='records'))
factor_cash_flow.factor_calculate.delay(date_index=date_index, session=session4)
time4 = time.time()
print('cash_flow_cal_time:{}'.format(time4 - time3))
# constrain
balance_sets, ttm_factors_sets = get_basic_constrain(date_index)
cache_data.set_cache(session5 + date_index + '1', date_index, balance_sets.to_json(orient='records'))
cache_data.set_cache(session5 + date_index + '2', date_index, ttm_factors_sets.to_json(orient='records'))
cache_data.set_cache(session5 + str(date_index) + '1', date_index, balance_sets.to_json(orient='records'))
cache_data.set_cache(session5 + str(date_index) + '2', date_index, ttm_factors_sets.to_json(orient='records'))
factor_constrain.factor_calculate.delay(date_index=date_index, session=session5)
time5 = time.time()
print('constrain_cal_time:{}'.format(time5 - time4))
# earning
# tp_earning, ttm_earning_5y, ttm_earning = get_basic_earning(date_index)
# cache_data.set_cache(session6 + date_index + "1", date_index, tp_earning.to_json(orient='records'))
# cache_data.set_cache(session6 + date_index + "2", date_index, ttm_earning_5y.to_json(orient='records'))
# cache_data.set_cache(session6 + date_index + "3", date_index, ttm_earning.to_json(orient='records'))
# cache_data.set_cache(session6 + str(date_index) + "1", date_index, tp_earning.to_json(orient='records'))
# cache_data.set_cache(session6 + str(date_index) + "2", date_index, ttm_earning_5y.to_json(orient='records'))
# cache_data.set_cache(session6 + str(date_index) + "3", date_index, ttm_earning.to_json(orient='records'))
# factor_earning.factor_calculate.delay(date_index=date_index, session=session6)
# time6 = time.time()
# print('earning_cal_time:{}'.format(time6 - time5))
......
......@@ -270,9 +270,8 @@ def factor_calculate(**kwargs):
date_index = kwargs['date_index']
session = kwargs['session']
cash_flow = FactorCashFlow('factor_cash_flow') # 注意, 这里的name要与client中新建table时的name一致, 不然回报错
content1 = cache_data.get_cache(session + date_index + "1", date_index)
content2 = cache_data.get_cache(session + date_index + "2", date_index)
content1 = cache_data.get_cache(session + str(date_index) + "1", date_index)
content2 = cache_data.get_cache(session + str(date_index) + "2", date_index)
tp_cash_flow = json_normalize(json.loads(str(content1, encoding='utf8')))
ttm_factor_sets = json_normalize(json.loads(str(content2, encoding='utf8')))
tp_cash_flow.set_index('symbol', inplace=True)
......
......@@ -189,8 +189,8 @@ def factor_calculate(**kwargs):
date_index = kwargs['date_index']
session = kwargs['session']
constrain = FactorConstrain('factor_constrain') # 注意, 这里的name要与client中新建table时的name一致, 不然回报错
content1 = cache_data.get_cache(session + date_index + '1', date_index)
content2 = cache_data.get_cache(session + date_index + '2', date_index)
content1 = cache_data.get_cache(session + str(date_index) + '1', date_index)
content2 = cache_data.get_cache(session + str(date_index) + '2', date_index)
balance_sets = json_normalize(json.loads(str(content1, encoding='utf8')))
ttm_factors_sets = json_normalize(json.loads(str(content2, encoding='utf8')))
balance_sets.set_index('symbol', inplace=True)
......
......@@ -599,9 +599,9 @@ def factor_calculate(**kwargs):
date_index = kwargs['date_index']
session = kwargs['session']
earning = FactorEarning('factor_earning') # 注意, 这里的name要与client中新建table时的name一致, 不然回报错
content1 = cache_data.get_cache(session + date_index + "1", date_index)
content2 = cache_data.get_cache(session + date_index + "2", date_index)
content3 = cache_data.get_cache(session + date_index + "3", date_index)
content1 = cache_data.get_cache(session + str(date_index) + "1", date_index)
content2 = cache_data.get_cache(session + str(date_index) + "2", date_index)
content3 = cache_data.get_cache(session + str(date_index) + "3", date_index)
tp_earning = json_normalize(json.loads(str(content1, encoding='utf8')))
ttm_earning_5y = json_normalize(json.loads(str(content2, encoding='utf8')))
ttm_earning = json_normalize(json.loads(str(content3, encoding='utf8')))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment