| | |
| | | elif code_list_type == outside_api_command_manager.CODE_LIST_GREEN: |
| | | if operate == outside_api_command_manager.OPERRATE_SET: |
| | | gpcode_manager.GreenListCodeManager().add_code(code) |
| | | gpcode_manager.WantBuyCodesManager().add_code(code) |
| | | name = gpcode_manager.get_code_name(code) |
| | | if not name: |
| | | results = HistoryKDatasUtils.get_gp_codes_names([code]) |
| | |
| | | gpcode_manager.CodesNameManager.add_first_code_name(code, results[code]) |
| | | elif operate == outside_api_command_manager.OPERRATE_DELETE: |
| | | gpcode_manager.GreenListCodeManager().remove_code(code) |
| | | gpcode_manager.WantBuyCodesManager().remove_code(code) |
| | | elif operate == outside_api_command_manager.OPERRATE_GET: |
| | | codes = gpcode_manager.GreenListCodeManager().list_codes_cache() |
| | | datas = [] |
| | |
| | | order_begin_pos = OrderBeginPosInfo(buy_single_index=0, buy_exec_index=0) |
| | | l2_data_util.load_l2_data(code) |
| | | total_datas = l2_data_util.local_today_datas.get(code) |
| | | if not total_datas: |
| | | continue |
| | | trade_index, is_default = transaction_progress.TradeBuyQueue().get_traded_index(code) |
| | | if trade_index is None: |
| | | trade_index = 0 |
| | |
| | | elif ctype == "set_per_code_buy_money": |
| | | # 设置单只票的买入金额 |
| | | money = data["money"] |
| | | if money > 30000: |
| | | raise Exception("最多只能设置3w") |
| | | if money > 50000: |
| | | raise Exception("最多只能设置5w") |
| | | constant.BUY_MONEY_PER_CODE = money |
| | | self.send_response({"code": 0, "data": {"money": constant.BUY_MONEY_PER_CODE}}, client_id, request_id) |
| | | elif ctype == "get_per_code_buy_money": |
| | |
| | | # 设置买入金额和数量 |
| | | normal = data["normal"] |
| | | radical = data["radical"] |
| | | 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 = { |
| | |
| | | data = { |
| | | "normal": BuyMoneyAndCountSetting().get_normal_buy_setting(), |
| | | "radical": BuyMoneyAndCountSetting().get_radical_buy_setting(), |
| | | "moneys": constant.AVAILABLE_BUY_MONEYS |
| | | "moneys": constant.AVAILABLE_BUY_MONEYS, |
| | | "default_buy_money": constant.BUY_MONEY_PER_CODE |
| | | } |
| | | self.send_response({"code": 0, "data": data, "msg": f""}, |
| | | client_id, |