| | |
| | | from code_attribute import global_data_loader, code_volumn_manager, first_target_code_data_processor |
| | | from code_attribute.code_data_util import ZYLTGBUtil |
| | | from db import redis_manager_delegate as redis_manager |
| | | from log_module import async_log_util |
| | | from log_module.log import logger_l2_codes_subscript |
| | | from third_data import kpl_data_manager, kpl_api |
| | | from trade import current_price_process_manager |
| | |
| | | l2_codes_queue.clear() |
| | | |
| | | @classmethod |
| | | def push(cls, datas,request_id=None): |
| | | l2_codes_queue.put_nowait((int(time.time()), datas,request_id)) |
| | | def push(cls, datas, request_id=None): |
| | | l2_codes_queue.put_nowait((int(time.time()), datas, request_id)) |
| | | logger_l2_codes_subscript.info("加入L2代码处理队列:数量-{}", len(datas)) |
| | | # cls.__get_redis().lpush(cls.__L2_CODE_KEY, json.dumps()) |
| | | |
| | |
| | | |
| | | @classmethod |
| | | def set_level_1_codes_datas(cls, datas, request_id=None): |
| | | logger_l2_codes_subscript.info(f"({request_id})接受到L1的数据,开始预处理") |
| | | async_log_util.info(logger_l2_codes_subscript, f"({request_id})接受到L1的数据,开始预处理") |
| | | yesterday_codes = kpl_data_manager.get_yesterday_limit_up_codes() |
| | | # 订阅的代码 |
| | | flist = [] |
| | |
| | | continue |
| | | # 获取自由流通市值 |
| | | if code not in global_util.zyltgb_map: |
| | | __start_time = time.time() |
| | | zylt = kpl_api.getZYLTAmount(code) |
| | | async_log_util.info(logger_l2_codes_subscript, |
| | | f"{request_id} {code}获取自由流通市值耗时-{round((time.time() - __start_time) * 1000)}ms") |
| | | if zylt: |
| | | # 保存自由流通股本 |
| | | ZYLTGBUtil.save_async(code, zylt // 10000, 1) |
| | |
| | | "zyltgb": zyltgb // 10000, "zyltgbUnit": 1} |
| | | flist.append(fitem) |
| | | code_volumn_manager.set_today_volumns(temp_volumns) |
| | | logger_l2_codes_subscript.info(f"{request_id}接受到L1的数据,预处理完成") |
| | | async_log_util.info(logger_l2_codes_subscript, f"{request_id}接受到L1的数据,预处理完成") |
| | | try: |
| | | tick_datas = first_target_code_data_processor.process_first_codes_datas(flist, request_id) |
| | | current_price_process_manager.accept_prices(tick_datas,request_id) |
| | | current_price_process_manager.accept_prices(tick_datas, request_id) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | |