| | |
| | | logger_trade, logger_trade_position_api_request, logger_request_api, \ |
| | | logger_real_place_order_position, logger_device |
| | | from output import l2_output_util |
| | | from third_data import kpl_data_manager, kpl_util, history_k_data_manager |
| | | from third_data import kpl_data_manager, kpl_util, history_k_data_manager, huaxin_l1_data_manager |
| | | from third_data.code_plate_key_manager import CodePlateKeyBuyManager |
| | | from third_data.history_k_data_manager import HistoryKDataManager |
| | | from third_data.history_k_data_util import JueJinApi, HistoryKDatasUtils |
| | | from third_data.kpl_data_manager import KPLDataManager |
| | | from third_data.kpl_limit_up_data_manager import CodeLimitUpSequenceManager |
| | | from third_data.kpl_util import KPLDataType |
| | | from trade import trade_manager, l2_trade_util |
| | | from trade import trade_manager, l2_trade_util, trade_data_manager |
| | | import l2_data_util as l2_data_util_old |
| | | |
| | | from trade.huaxin import huaxin_trade_api, huaxin_trade_data_update, \ |
| | |
| | | raise Exception("尚未获取到现价") |
| | | # 获取买1金额 |
| | | price = round(float(current_price), 2) |
| | | buy1_info = L1DataManager.current_buy1_dict.get(code) |
| | | buy1_info = huaxin_l1_data_manager.get_buy1_info(code) |
| | | if buy1_info and buy1_info[0] * buy1_info[1] > 50 * 10000: |
| | | # 如果买1在50w以上就加一档 |
| | | price += 0.01 |
| | |
| | | gpcode_manager.MustBuyCodesManager().remove_code(code) |
| | | elif operate == outside_api_command_manager.OPERRATE_GET: |
| | | codes = gpcode_manager.MustBuyCodesManager().list_code_cache() |
| | | datas = [] |
| | | for code in codes: |
| | | name = gpcode_manager.get_code_name(code) |
| | | datas.append(f"{name}:{code}") |
| | | fresult = {"code": 0, "data": datas} |
| | | 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) |
| | | name = gpcode_manager.get_code_name(code) |
| | | if not name: |
| | | results = HistoryKDatasUtils.get_gp_codes_names([code]) |
| | | if results: |
| | | gpcode_manager.CodesNameManager.add_first_code_name(code, results[code]) |
| | | elif operate == outside_api_command_manager.OPERRATE_DELETE: |
| | | gpcode_manager.GreenListCodeManager().remove_code(code) |
| | | elif operate == outside_api_command_manager.OPERRATE_GET: |
| | | codes = gpcode_manager.GreenListCodeManager().list_codes_cache() |
| | | datas = [] |
| | | for code in codes: |
| | | name = gpcode_manager.get_code_name(code) |
| | |
| | | except Exception as e: |
| | | self.send_response({"code": 1, "msg": str(e)}, client_id, request_id) |
| | | elif ctype == "get_delegated_buy_code_infos": |
| | | account_available_money = trade_manager.AccountAvailableMoneyManager().get_available_money_cache() |
| | | account_available_money = trade_data_manager.AccountMoneyManager().get_available_money_cache() |
| | | # 获取委托中的代码 |
| | | # current_delegates = huaxin_trade_record_manager.DelegateRecordManager().list_current_delegates() |
| | | current_delegates, update_time = huaxin_trade_record_manager.DelegateRecordManager.list_by_day( |
| | |
| | | limit_up_data = kpl_data_manager.KPLLimitUpDataRecordManager.record_code_dict.get(code) |
| | | # 获取当前板块 |
| | | try: |
| | | can_buy_result = CodePlateKeyBuyManager.can_buy(code) |
| | | if can_buy_result: |
| | | if can_buy_result[0]: |
| | | fdata['block'] = ",".join( |
| | | [f"{x[0]}-{x[1] + 1}({x[2]}&{x[3] - x[2]})" for x in can_buy_result[0]]) |
| | | else: |
| | | if can_buy_result[1]: |
| | | if limit_up_data: |
| | | fdata['block'] = f"{limit_up_data[5]}-独苗" |
| | | else: |
| | | fdata['block'] = f"独苗" |
| | | limit_up_sequence = CodeLimitUpSequenceManager.get_current_limit_up_sequence(code) |
| | | if limit_up_sequence: |
| | | fdata['block'] = f"{limit_up_sequence[0]}-{limit_up_sequence[1]}({limit_up_sequence[2]}&{limit_up_sequence[2] - limit_up_sequence[3]})" |
| | | except: |
| | | pass |
| | | # 获取涨停时间 |
| | |
| | | elif ctype == "get_buy_block_mode": |
| | | # 获取买入板块的模式 |
| | | can_buy_unique_block = TradeBlockBuyModeManager().can_buy_unique_block() |
| | | self.send_response({"code": 0, "data": {"unique_block": 1 if can_buy_unique_block else 0 }, "msg": f""}, client_id, |
| | | self.send_response({"code": 0, "data": {"unique_block": 1 if can_buy_unique_block else 0}, "msg": f""}, |
| | | client_id, |
| | | request_id) |
| | | |
| | | elif ctype == "set_buy_unique_block_mode": |