Administrator
2024-03-01 f01bb646b68659b60ef63c2a7a50de8d37ec9fd7
G撤参数修改/定时拉取持仓
5个文件已修改
33 ■■■■ 已修改文件
constant.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/cancel_buy_strategy.py 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_api.py 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_server.py 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constant.py
@@ -136,6 +136,8 @@
# G撤单
G_CANCEL_RATE = 0.39
# 行情好时的撤单比例
G_CANCEL_RATE_FOR_GOOD_MARKET = 0.49
# 华鑫L2的卡位数量
l2/cancel_buy_strategy.py
@@ -23,6 +23,7 @@
from log_module import async_log_util
from trade.deal_big_money_manager import DealOrderNoManager
from trade.sell.sell_rule_manager import TradeRuleManager
from trade.trade_manager import MarketSituationManager
from utils import tool
from l2.transaction_progress import TradeBuyQueue
from trade import trade_queue_manager, l2_trade_factor, trade_record_log_util
@@ -818,6 +819,14 @@
            l2_log.l_cancel_debug(code, f"计算撤单比例出错:{e}")
        return round(base_rate, 2), False
    # 获取L后成交太快的撤单比例
    @classmethod
    def get_fast_deal_cancel_rate(cls, code):
        must_buy_cancel_rate = cls.__MustBuyCodesManager.get_cancel_rate_cache(code)
        if must_buy_cancel_rate is not None:
            return must_buy_cancel_rate
        return constant.L_CANCEL_FAST_DEAL_RATE
    # 设置板块涨停数量(除开自己)
    @classmethod
    def set_block_limit_up_count(cls, reason_codes_dict):
@@ -1283,7 +1292,7 @@
        if real_place_order_index_info and real_place_order_index_info[1]:
            return False, "没获取到真实的下单位"
        threshold_rate = constant.L_CANCEL_FAST_DEAL_RATE
        threshold_rate = LCancelRateManager.get_fast_deal_cancel_rate(code)
        rate = orgin_deal_data[0] / (total_l_down_not_deal_num[0] * 100)
        if rate > threshold_rate:
            limit_up_price = float(gpcode_manager.get_limit_up_price(code))
@@ -1860,7 +1869,11 @@
                if cancel_data:
                    canceled_indexes.add(cancel_data["index"])
            cancel_rate = round(len(canceled_indexes) / len(watch_indexes), 2)
            if cancel_rate > constant.G_CANCEL_RATE:
            threshhold_rate = constant.G_CANCEL_RATE
            situation = MarketSituationManager().get_situation_cache()
            if situation == MarketSituationManager.SITUATION_GOOD:
                threshhold_rate = constant.G_CANCEL_RATE_FOR_GOOD_MARKET
            if cancel_rate > threshhold_rate:
                canceled_indexes_list = list(canceled_indexes)
                canceled_indexes_list.sort()
                return True, total_datas[canceled_indexes_list[-1]], f"撤单比例:{cancel_rate}"
l2/l2_data_manager_new.py
@@ -1038,8 +1038,8 @@
                return False, True, f"股价创新高或者逼近前高且30天内有涨停,当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[1]}"
        if HighIncreaseCodeManager().is_in(code):
            if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < 0.8:
                return False, True, f"5天内3次涨停,量未达到80%({cls.volume_rate_info[code][0]})"
            if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < 0.59:
                return False, True, f"5天内3次涨停,量未达到59%({cls.volume_rate_info[code][0]})"
        msg_list = []
        if is_in_strong_time:
            msg_list.append("强势10分钟")
trade/huaxin/huaxin_trade_api.py
@@ -75,6 +75,9 @@
            if str(order.direction) == str(huaxin_util.TORA_TSTP_D_Sell):
                # 刷新持仓列表
                huaxin_trade_data_update.add_position_list()
                if huaxin_util.is_deal(order.orderStatus):
                    # 如果成交了需要刷新委托列表
                    huaxin_trade_data_update.add_delegate_list("卖成交")
            TradeResultProcessor.process_buy_order(order)
            need_watch_cancel = TradeResultProcessor.process_sell_order(order)
            if need_watch_cancel:
trade/huaxin/huaxin_trade_server.py
@@ -15,6 +15,7 @@
import numpy
import psutil
import requests
import schedule
import huaxin_client.constant
@@ -650,7 +651,7 @@
                logging.exception(e1)
    # 撤长期没有成交的单
    def __cancel_not_deal_order(self, code, order_ref, timeout=2):
    def __cancel_not_deal_order(self, code, order_ref, timeout=3):
        time.sleep(timeout)
        # 撤买单
        huaxin_trade_api.cancel_order(1, code, "", orderRef=order_ref)
@@ -1643,6 +1644,10 @@
def __init():
    # 持仓刷新
    huaxin_trade_data_update.add_position_list()
    # 定时持仓刷新
    schedule.every().day.at("09:00:00").do(huaxin_trade_data_update.add_position_list)
    schedule.every().day.at("09:10:00").do(huaxin_trade_data_update.add_position_list)
    threading.Thread(target=schedule.run_pending, daemon=True).start()
def run(queue_strategy_r_trade_w, queue_l1_w_strategy_r, queue_strategy_w_trade_r, queue_strategy_w_trade_r_for_read,