Administrator
2024-07-16 62354a43f4bf58d0e9fdd78ba4ea1b911d95456b
bug修复
2个文件已修改
17 ■■■■ 已修改文件
main.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/sell_strategy.py 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.py
@@ -412,7 +412,7 @@
                    pass
                code = result[0]
                # 正股需要加载板块
                if code.find("11") != 0 and code.find("12") != 0:
                if tool.is_stock(code):
                    # 正股代码
                    limit_up_price = tool.get_limit_up_price(code, result[8])
                    # 涨幅大于5%才开始获取板块
trade/sell_strategy.py
@@ -1,13 +1,22 @@
"""
卖出策略
"""
import threading
import time
from code_attribute import target_codes_manager
from log_module import async_log_util
from log_module.log import logger_trade, logger_debug
from records import huaxin_trade_record_manager
from trade import huaxin_sell_util
from trade import huaxin_sell_util, huaxin_trade_data_update
from trade.buy_strategy import BuyStrategyDataManager
from utils import tool
def __refresh_trade_data(delays=1):
    time.sleep(delays)
    huaxin_trade_data_update.add_deal_list()
    huaxin_trade_data_update.add_position_list()
def process_market_info(market, buyStrategyDataManager: BuyStrategyDataManager):
@@ -50,10 +59,12 @@
        if down_rate <= threshold_rate:
            return
        # 降幅触发强平机制,已跌停价卖出
        limit_down_price = round( float(tool.get_limit_down_price(cb_code, market[8])),3)
        limit_down_price = round(float(tool.get_limit_down_price(cb_code, market[8])), 3)
        result = huaxin_sell_util.start_sell(cb_code, left_volume, 1, None,
                                             limit_down_price,
                                             market[1], blocking=False)
        # 强平之后刷新
        threading.Thread(target=lambda : __refresh_trade_data, daemon=True).start()
        async_log_util.info(logger_trade, f"平仓API卖结果: {result}")
    except Exception as e:
        logger_debug.exception(e)