| | |
| | | import inited_data |
| | | import outside_api_command_manager |
| | | from cancel_strategy.s_l_h_cancel_strategy import SCancelBigNumComputer, LCancelRateManager, \ |
| | | CancelRateHumanSettingManager |
| | | CancelRateHumanSettingManager, LCancelBigNumComputer, LDownCancelWatchIndexStatisticManager |
| | | from code_attribute import gpcode_manager, code_volumn_manager, zyltgb_util, code_nature_analyse |
| | | from code_attribute.code_data_util import ZYLTGBUtil |
| | | from code_attribute.code_l1_data_manager import L1DataManager |
| | |
| | | from trade.sell import sell_manager |
| | | from trade.sell.sell_rule_manager import TradeRuleManager, SellRule |
| | | from trade.trade_data_manager import RadicalBuyDealCodesManager |
| | | from trade.trade_manager import TradeTargetCodeModeManager, AutoCancelSellModeManager |
| | | from trade.trade_manager import TradeTargetCodeModeManager, AutoCancelSellModeManager, CodesContinueBuyMoneyManager |
| | | from settings.trade_setting import MarketSituationManager, TradeBlockBuyModeManager |
| | | from utils import socket_util, data_export_util, tool, huaxin_util, output_util, global_util, init_data_util |
| | | from servers import server_util |
| | |
| | | [huaxin_util.TORA_TSTP_OST_Accepted, huaxin_util.TORA_TSTP_OST_PartTraded]) |
| | | fdatas = [] |
| | | if current_delegates: |
| | | codes_set = set() |
| | | for c in current_delegates: |
| | | try: |
| | | if int(c["direction"]) != huaxin_util.TORA_TSTP_D_Buy: |
| | | continue |
| | | code = c["securityID"] |
| | | if code in codes_set: |
| | | continue |
| | | orderSysID = c.get("orderSysID") |
| | | codes_set.add(code) |
| | | code_name = gpcode_manager.get_code_name(code) |
| | | # 获取下单位置信息 |
| | | order_begin_pos = TradePointManager().get_buy_compute_start_data_cache(code) |
| | |
| | | expire_rate = "未知" |
| | | try: |
| | | referer_volume = code_volumn_manager.CodeVolumeManager().get_radical_buy_refer_volume( |
| | | code, limit_up_price) |
| | | code, float(limit_up_price)) |
| | | today_volumn = code_volumn_manager.CodeVolumeManager().get_today_volumn_cache(code) |
| | | if referer_volume == today_volumn: |
| | | expire_rate = "100%" |
| | |
| | | fdata['mode'] = -1 |
| | | except: |
| | | pass |
| | | |
| | | # L后囊括快照 |
| | | try: |
| | | current_info = LCancelBigNumComputer().statistic_l_down_watch_indexes_info(code) |
| | | last_info = LDownCancelWatchIndexStatisticManager().get_statistic_info(code) |
| | | fdata['l_down_watch_indexes_info'] = {} |
| | | if current_info: |
| | | fdata['l_down_watch_indexes_info']['current'] = current_info |
| | | if last_info: |
| | | fdata['l_down_watch_indexes_info']['last'] = last_info |
| | | except: |
| | | pass |
| | | fdatas.append(fdata) |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | |
| | | client_id, |
| | | request_id) |
| | | return |
| | | TotalDealBigOrderThresholdMoneyManager().set_money(code, int(money), trade_manager.CodesTradeStateManager().get_trade_state_cache(code)) |
| | | TotalDealBigOrderThresholdMoneyManager().set_money(code, int(money), |
| | | trade_manager.CodesTradeStateManager().get_trade_state_cache( |
| | | code)) |
| | | |
| | | # 如果是加红状态,且大单不够就需要移红 |
| | | if gpcode_manager.MustBuyCodesManager().is_in_cache(code): |
| | | deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, gpcode_manager.get_limit_up_price_as_num(code)) |
| | | deal_big_order_info = radical_buy_data_manager.get_total_deal_big_order_info(code, |
| | | gpcode_manager.get_limit_up_price_as_num( |
| | | code)) |
| | | if deal_big_order_info[0] > 0: |
| | | gpcode_manager.MustBuyCodesManager().remove_code(code) |
| | | trade_record_log_util.add_common_msg(code, "移红", f"大单阈值修改({money})") |
| | |
| | | # 设置L后撤单比例 |
| | | code = data.get("code") |
| | | rate = data.get("rate") |
| | | if rate < 0 or rate > 1: |
| | | if rate < 0 or rate > 2: |
| | | self.send_response({"code": 1, "msg": "比例范围不在0-1之间"}, |
| | | client_id, |
| | | request_id) |
| | | return |
| | | rate = round(rate, 2) |
| | | old_rate = LCancelRateManager().get_cancel_rate(0)[0] |
| | | # L后数据快照 |
| | | last_info = LCancelBigNumComputer().statistic_l_down_watch_indexes_info(code) |
| | | LDownCancelWatchIndexStatisticManager().set_statistic_info(code, last_info) |
| | | CancelRateHumanSettingManager().set_l_down(code, rate) |
| | | # L后重新囊括 |
| | | if rate < old_rate: |
| | | # 改小才能重新囊括 |
| | | LCancelBigNumComputer().re_compute_l_down_watch_indexes(code) |
| | | self.send_response({"code": 0, "data": {}}, |
| | | client_id, |
| | | request_id) |
| | | |
| | | elif ctype == "get_continue_buy_info": |
| | | # 设置L后撤单比例 |
| | | code = data.get("code") |
| | | money = CodesContinueBuyMoneyManager().get_continue_buy_money(code) |
| | | if money is None: |
| | | money = 0 |
| | | self.send_response({"code": 0, "data": {"money": money, "money_list": constant.AVAILABLE_BUY_MONEYS}}, |
| | | client_id, |
| | | request_id) |
| | | elif ctype == "set_continue_buy_money": |
| | | # 设置L后撤单比例 |
| | | code = data.get("code") |
| | | money = data.get("money") |
| | | if money <= 0: |
| | | # 表示移除续买金额 |
| | | CodesContinueBuyMoneyManager().remove_continue_buy_money(code) |
| | | self.send_response({"code": 0, "data": {}}, |
| | | client_id, |
| | | request_id) |
| | | return |
| | | if money not in constant.AVAILABLE_BUY_MONEYS: |
| | | self.send_response({"code": 1, "msg": f"金额({money})没在{constant.AVAILABLE_BUY_MONEYS}中"}, |
| | | client_id, |
| | | request_id) |
| | | return |
| | | CodesContinueBuyMoneyManager().set_continue_buy_money(code, money) |
| | | l2_trade_util.remove_from_forbidden_trade_codes(code) |
| | | self.send_response({"code": 0, "data": {}}, |
| | | client_id, |
| | | request_id) |