| | |
| | | logger_real_place_order_position, logger_device |
| | | from output import l2_output_util |
| | | from third_data import kpl_util, history_k_data_manager, huaxin_l1_data_manager, third_blocks_manager, kpl_data_manager |
| | | from third_data.code_plate_key_manager import CodePlateKeyBuyManager, KPLCodeJXBlockManager, RealTimeKplMarketData, \ |
| | | from third_data.code_plate_key_manager import KPLCodeJXBlockManager, \ |
| | | RadicalBuyBlockManager |
| | | from third_data.history_k_data_manager import HistoryKDataManager |
| | | from third_data.history_k_data_util import JueJinApi, HistoryKDatasUtils |
| | |
| | | real_place_order_after_num += val["num"] |
| | | |
| | | # 获取当日的量比 |
| | | volume_rate = code_volumn_manager.get_volume_rate(code) |
| | | volume_rate = code_volumn_manager.CodeVolumeManager().get_volume_rate(code) |
| | | |
| | | # 是否需要注意 |
| | | need_pay_attention = (total_left_count <= 10 or total_left_num * float( |
| | |
| | | default_buy_money = data["default_buy_money"] |
| | | if int(default_buy_money) not in constant.AVAILABLE_BUY_MONEYS: |
| | | raise Exception("默认金额不在预设金额内") |
| | | constant.BUY_MONEY_PER_CODE = default_buy_money |
| | | BuyMoneyAndCountSetting().set_normal_buy_data(normal[0], json.loads(normal[1])) |
| | | BuyMoneyAndCountSetting().set_radical_buy_data(radical[0], json.loads(radical[1])) |
| | | data = { |
| | |
| | | self.send_response({"code": 0, "data": data, "msg": f""}, |
| | | client_id, |
| | | request_id) |
| | | elif ctype == "get_place_order_settings": |
| | | # 获取买入下单设置 |
| | | data = { |
| | | "radical_buy": {"price": (constant.MIN_CODE_RADICAL_BUY_PRICE, constant.MAX_CODE_RADICAL_BUY_PRICE), |
| | | "zyltgb": constant.RADICAL_BUY_ZYLTGB_AS_YI_RANGES}} |
| | | self.send_response({"code": 0, "data": data, "msg": f""}, |
| | | client_id, |
| | | request_id) |
| | | elif ctype == "set_place_order_settings": |
| | | radical_buy = data.get("radical_buy") |
| | | if radical_buy: |
| | | radical_buy = json.loads(radical_buy) |
| | | constant.MIN_CODE_RADICAL_BUY_PRICE = radical_buy["price"][0] |
| | | constant.MAX_CODE_RADICAL_BUY_PRICE = radical_buy["price"][1] |
| | | constant.RADICAL_BUY_ZYLTGB_AS_YI_RANGES = radical_buy["zyltgb"] |
| | | self.send_response({"code": 0, "data": {}, "msg": f""}, |
| | | client_id, |
| | | request_id) |
| | | elif ctype == "get_buy_open_limit_up_codes": |
| | | # 获取隔夜单排1的代码 |
| | | codes = gpcode_manager.BuyOpenLimitUpCodeManager().get_codes() |
| | | if not codes: |
| | | codes = set() |
| | | self.send_response({"code": 0, "data": list(codes), "msg": f""}, |
| | | client_id, |
| | | request_id) |
| | | |
| | | elif ctype == "set_buy_open_limit_up_codes": |
| | | # 设置隔夜单排1的代码 |
| | | codes = data.get("codes") |
| | | codes = json.loads(codes) |
| | | gpcode_manager.BuyOpenLimitUpCodeManager().set_codes(set(codes)) |
| | | self.send_response({"code": 0, "data": list(codes), "msg": f""}, |
| | | client_id, |
| | | request_id) |
| | | except Exception as e: |
| | | logging.exception(e) |
| | | logger_debug.exception(e) |