Administrator
2024-07-16 62354a43f4bf58d0e9fdd78ba4ea1b911d95456b
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)