def local_run(self, trade_date): total_data = self.loadon_data(trade_date) storage_engine = StorageEngine(self._url) result = self.process_calc_factor(total_data, trade_date) storage_engine.update_destdb('factor_earning_expectation', trade_date, result) print('----')
def local_run(self, trade_date): print('当前交易日: %s' % trade_date) tic = time.time() tp_solvency = self.loading_data(trade_date) print('data load time %s' % (time.time() - tic)) storage_engine = StorageEngine(self._url) result = self.process_calc_factor(trade_date, tp_solvency) print('cal_time %s' % (time.time() - tic)) storage_engine.update_destdb(str(self._methods[-1]['packet'].split('.')[-1]), trade_date, result)
def local_run(self, trade_date): total_data = self.loadon_data(trade_date) mkt_df = self.calc_factor_by_date(total_data, trade_date) storage_engine = StorageEngine(self._url) for method in self._methods: result = self.process_calc_factor(method['packet'], method['class'], mkt_df, trade_date) storage_engine.update_destdb(str(method['packet'].split('.')[-1]), trade_date, result)
def local_run(self, trade_date): print('当前交易日; %s' % trade_date) tic = time.time() valuation_sets, sw_industry, pe_sets = self.loading_data(trade_date) print('data load time %s' % (time.time() - tic)) # 保存 storage_engine = StorageEngine(self._url) result = self.process_calc_factor(trade_date, valuation_sets, pe_sets, sw_industry) print('cal_time %s' % (time.time() - tic)) storage_engine.update_destdb(str(self._methods[-1]['packet'].split('.')[-1]), trade_date, result) print('----------------->')
def local_run(self, trade_date): print('当前交易日: %s' % trade_date) tic = time.time() ttm_operation_capacity = self.loading_data(trade_date) print('data load time %s' % (time.time() - tic)) storage_engine = StorageEngine(self._url) result = self.process_calc_factor(trade_date, ttm_operation_capacity) print('cal_time %s' % (time.time() - tic)) storage_engine.update_destdb( str(self._methods[-1]['packet'].split('.')[-1]), trade_date, result) # storage_engine.update_destdb('factor_operation_capacity', trade_date, result) # def remote_run(self, trade_date): # total_data = self.loading_data(trade_date) # #存储数据 # session = str(int(time.time() * 1000000 + datetime.datetime.now().microsecond)) # cache_data.set_cache(session, 'alphax', total_data.to_json(orient='records')) # distributed_factor.delay(session, json.dumps(self._methods), self._name) # # def distributed_factor(self, total_data): # mkt_df = self.calc_factor_by_date(total_data,trade_date) # result = self.calc_factor('alphax.alpha191','Alpha191',mkt_df,trade_date) # @app.task # def distributed_factor(session, trade_date, packet_sets, name): # calc_engines = CalcEngine(name, packet_sets) # content = cache_data.get_cache(session, factor_name) # total_data = json_normalize(json.loads(content)) # calc_engines.distributed_factor(total_data) # # # @app.task() # def factor_calculate(**kwargs): # print("management_kwargs: {}".format(kwargs)) # date_index = kwargs['date_index'] # session = kwargs['session'] # content1 = cache_data.get_cache(session + str(date_index) + "1", date_index) # ttm_operation_capacity = json_normalize(json.loads(str(content1, encoding='utf8'))) # ttm_operation_capacity.set_index('security_code', inplace=True) # print("len_tp_management_data {}".format(len(ttm_operation_capacity))) # calculate(date_index, ttm_operation_capacity)
def distributed_factor(self, total_data, trade_date): storage_engine = StorageEngine(self._url) result = self.process_calc_factor(total_data, trade_date) storage_engine.update_destdb('factor_earning_expectation', trade_date, result) print('----')