| | |
| | | code_list_type = data["code_list_type"] |
| | | operate = data["operate"] |
| | | code = data.get("code") |
| | | if code and not tool.is_can_buy_code(code): |
| | | raise Exception(f"不是可以交易的代码:{code}") |
| | | fresult = {"code": 0} |
| | | if code_list_type == outside_api_command_manager.CODE_LIST_WANT: |
| | | if operate == outside_api_command_manager.OPERRATE_SET: |
| | | gpcode_manager.WantBuyCodesManager().add_code(code) |
| | | # 加想买单要从黑名单移除 |
| | | l2_trade_util.remove_from_forbidden_trade_codes(code) |
| | | name = gpcode_manager.get_code_name(code) |
| | | if not name: |
| | | results = HistoryKDatasUtils.get_gp_codes_names([code]) |
| | |
| | | white = gpcode_manager.WhiteListCodeManager().is_in_cache(code) |
| | | black = l2_trade_util.is_in_forbidden_trade_codes(code) |
| | | pause_buy = gpcode_manager.PauseBuyCodesManager().is_in_cache(code) |
| | | |
| | | must_buy = gpcode_manager.MustBuyCodesManager().is_in_cache(code) |
| | | desc_list = [] |
| | | if want: |
| | | desc_list.append("【想买单】") |
| | |
| | | desc_list.append("【黑名单】") |
| | | if pause_buy: |
| | | desc_list.append("【暂不买】") |
| | | if must_buy: |
| | | desc_list.append("【红名单】") |
| | | |
| | | result = {"code": 0, "data": {"code_info": (code, code_name), "desc": "".join(desc_list)}} |
| | | self.send_response(result, client_id, request_id) |
| | | except Exception as e: |
| | |
| | | # 设置买入金额和数量 |
| | | normal = data["normal"] |
| | | radical = data["radical"] |
| | | BuyMoneyAndCountSetting().set_normal_buy_data(normal[0],json.loads( normal[1])) |
| | | BuyMoneyAndCountSetting().set_radical_buy_data(radical[0],json.loads( radical[1])) |
| | | BuyMoneyAndCountSetting().set_normal_buy_data(normal[0], json.loads(normal[1])) |
| | | BuyMoneyAndCountSetting().set_radical_buy_data(radical[0], json.loads(radical[1])) |
| | | data = { |
| | | "normal": BuyMoneyAndCountSetting().get_normal_buy_setting(), |
| | | "radical": BuyMoneyAndCountSetting().get_radical_buy_setting() |
| | |
| | | # 设置买入金额和数量 |
| | | data = { |
| | | "normal": BuyMoneyAndCountSetting().get_normal_buy_setting(), |
| | | "radical": BuyMoneyAndCountSetting().get_radical_buy_setting() |
| | | "radical": BuyMoneyAndCountSetting().get_radical_buy_setting(), |
| | | "moneys":constant.AVAILABLE_BUY_MONEYS |
| | | } |
| | | self.send_response({"code": 0, "data": data, "msg": f""}, |
| | | client_id, |