| | |
| | | import constant |
| | | |
| | | from api.outside_api_command_manager import ActionCallback |
| | | from code_attribute import gpcode_manager |
| | | from huaxin_client import l1_subscript_codes_manager |
| | | from huaxin_client.client_network import SendResponseSkManager |
| | | from strategy import strategy_params_settings, env_info, strategy_manager |
| | | from strategy.env_info import RealTimeEnvInfo |
| | | from strategy.strategy_manager import PlateWhiteListManager |
| | | from strategy.strategy_params_settings import StrategyParamsSettingsManager, StrategyParamsSettings |
| | | from strategy.strategy_variable_factory import DataLoader |
| | | from third_data.history_k_data_manager import TradeDateManager |
| | | from third_data.kpl_block_manager import KPLCodeJXBlocksManager |
| | |
| | | OPERRATE_DELETE = 2 # 删除 |
| | | OPERRATE_GET = 3 # 获取 |
| | | OPERRATE_ADD = 4 # 新增 |
| | | |
| | | |
| | | class MyAPICallback(ActionCallback): |
| | | |
| | |
| | | def __on_plate_white_list(self, data): |
| | | operate = data["operate"] |
| | | if operate == OPERRATE_GET: |
| | | plates = PlateWhiteListManager().get_plates() |
| | | return {"code": 0, "data": list(plates)} |
| | | plates = PlateWhiteListManager().get_plates() |
| | | return {"code": 0, "data": list(plates)} |
| | | elif operate == OPERRATE_ADD: |
| | | plate = data["plate"] |
| | | PlateWhiteListManager().add_plate(plate) |
| | |
| | | plate = data["plate"] |
| | | PlateWhiteListManager().remove_plate(plate) |
| | | return {"code": 0} |
| | | |
| | | |
| | | |
| | | def OnCommonRequest(self, client_id, request_id, data): |
| | | ctype = data["ctype"] |
| | |
| | | elif ctype == 'get_place_order_records': |
| | | # 获取下单记录 |
| | | datas = trade_record_log_util.get_trade_records(trade_record_log_util.TYPE_PLACE_ORDER) |
| | | for data in datas: |
| | | data[3]["code_name"] = gpcode_manager.CodesNameManager().get_code_name(data[3]["code"]) |
| | | result_json = {"code": 0, "data": datas} |
| | | elif ctype == 'get_can_buy_plates': |
| | | # 获取可以买的板块 |
| | | settings: StrategyParamsSettings = StrategyParamsSettingsManager().get_settings() |
| | | try: |
| | | current_limit_up_plate_codes = strategy_manager.low_suction_strtegy.current_limit_up_plate_codes |
| | | plates = [plate for plate, codes in current_limit_up_plate_codes.items() if |
| | | len(codes) >= settings.limit_up_count_of_new_plate] |
| | | except: |
| | | plates = [] |
| | | result_json = {"code": 0, "data": plates} |
| | | |
| | | |
| | | |
| | | elif ctype == 'plate_white_list': |
| | | result_json = self.__on_plate_white_list(data) |
| | | self.send_response(result_json, client_id, request_id) |