Administrator
2024-10-09 b30e191d0347fc0dc61b48a0cd2b5d368ba8e95b
api/outside_api_command_callback.py
@@ -45,6 +45,7 @@
from third_data.third_blocks_manager import CodeThirdBlocksManager, SOURCE_TYPE_KPL, BlockMapManager
from trade import trade_manager, l2_trade_util, trade_data_manager, trade_constant
import l2_data_util as l2_data_util_old
from trade.buy_money_count_setting import BuyMoneyAndCountSetting
from trade.huaxin import huaxin_trade_api, huaxin_trade_data_update, \
    huaxin_trade_record_manager, huaxin_trade_order_processor, huaxin_sell_util
@@ -284,6 +285,8 @@
            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])
@@ -1230,7 +1233,7 @@
                source_origin_dict = copy.deepcopy(CodeThirdBlocksManager().get_source_blocks_origin(code))
                if not source_origin_dict:
                    source_origin_dict = {}
                kpl_blocks = KPLCodeJXBlockManager().get_jx_blocks_radical(code)
                kpl_blocks = RadicalBuyBlockManager.get_code_kpl_blocks(code)
                if kpl_blocks is None:
                    kpl_blocks = set()
                if not kpl_blocks:
@@ -1252,6 +1255,29 @@
                self.send_response({"code": 0, "data": data, "msg": f""},
                                   client_id,
                                   request_id)
            elif ctype == "set_buy_money_count_setting":
                # 设置买入金额和数量
                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]))
                data = {
                    "normal": BuyMoneyAndCountSetting().get_normal_buy_setting(),
                    "radical": BuyMoneyAndCountSetting().get_radical_buy_setting()
                }
                self.send_response({"code": 0, "data": data, "msg": f""},
                                   client_id,
                                   request_id)
            elif ctype == "get_buy_money_count_setting":
                # 设置买入金额和数量
                data = {
                    "normal": BuyMoneyAndCountSetting().get_normal_buy_setting(),
                    "radical": BuyMoneyAndCountSetting().get_radical_buy_setting(),
                    "moneys":constant.AVAILABLE_BUY_MONEYS
                }
                self.send_response({"code": 0, "data": data, "msg": f""},
                                   client_id,
                                   request_id)
        except Exception as e:
            logging.exception(e)
            logger_debug.exception(e)