| | |
| | | import threading |
| | | |
| | | from api.outside_api_command_manager import ActionCallback |
| | | from huaxin_client import l1_subscript_codes_manager |
| | | from huaxin_client.client_network import SendResponseSkManager |
| | | from strategy import strategy_params_settings, env_info |
| | | from strategy.env_info import RealTimeEnvInfo |
| | | from strategy.strategy_variable_factory import DataLoader |
| | | from third_data.history_k_data_manager import TradeDateManager |
| | | from third_data.kpl_block_manager import KPLCodeJXBlocksManager |
| | | from utils import socket_util, middle_api_protocol, tool |
| | | |
| | | |
| | |
| | | # 如果在16:00之后采用下一个交易日 |
| | | day = tool.get_now_date_str() |
| | | fdata["history_data"]["k_bars_count"] = env_info.get_history_k_bars(day) |
| | | |
| | | day = tool.get_now_date_str() |
| | | fdata["history_data"]["kpl_code_jx_blocks_count"] = env_info.get_kpl_code_jx_blocks(day) |
| | | |
| | | |
| | | return {"code": 0, "data": fdata, "msg": "测试结果"} |
| | | |
| | | def __on_update_leading_limit_up_datas(self): |
| | |
| | | threading.Thread(target=lambda: update(), daemon=True).start() |
| | | return {"code": 0} |
| | | |
| | | def __on_update_kpl_code_jx_blocks_datas(self): |
| | | """ |
| | | 更新开盘啦精选板块数据 |
| | | @return: |
| | | """ |
| | | |
| | | def update(): |
| | | codes = set() |
| | | codes_sh, codes_sz = l1_subscript_codes_manager.get_codes() |
| | | codes |= set([x.decode() for x in codes_sh]) |
| | | codes |= set([x.decode() for x in codes_sz]) |
| | | KPLCodeJXBlocksManager(day, codes).start_download_blocks() |
| | | # 如果在16:00之前采用当前日期 |
| | | day = tool.get_now_date_str() |
| | | threading.Thread(target=lambda: update(), daemon=True).start() |
| | | return {"code": 0} |
| | | |
| | | def OnCommonRequest(self, client_id, request_id, data): |
| | | ctype = data["ctype"] |
| | | result_json = {} |
| | |
| | | del data["ctype"] |
| | | result_json = self.__on_set_settings(data) |
| | | elif ctype == 'get_env': |
| | | # 获取环境数据 |
| | | result_json = self.__on_get_env(data.get("history")) |
| | | elif ctype == 'update_leading_limit_up_datas': |
| | | # 更新领涨数据 |
| | | result_json = self.__on_update_leading_limit_up_datas() |
| | | elif ctype == 'update_kpl_code_jx_blocks_datas': |
| | | # 更新开盘啦精选数据 |
| | | result_json = self.__on_update_kpl_code_jx_blocks_datas() |
| | | self.send_response(result_json, client_id, request_id) |