mirror of
https://github.com/silencesdg/mt5_python_ea_suite.git
synced 2026-08-01 21:27:44 +00:00
feat: 远程MT5数据源 + 信号对冲/回撤锁仓模块
新增: - core/risk/hedge.py: 对冲管理器 - 信号对冲: 加权信号反向超阈值→半仓反向 - 回撤锁仓: 浮亏超-0.3%→全仓锁死 - 自动解锁: 信号回正/对冲止盈0.5% 改动: - run/backtest.py: 支持远程数据源回测 - run/realtime.py: 远程/本地双模式 - core/risk/position.py: 集成HedgeManager - core/risk/controller.py: 传递weighted_signal - execution/realtime_trader.py: 传入加权信号 - core/data/live.py, utils.py: MetaTrader5懒加载(ARM兼容) - config.py: HEDGE_CONFIG, REMOTE配置, INITIAL_CAPITAL=1944 今日实盘: 9单, +7.4% (944→088)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from core.risk.market_state import MarketStateAnalyzer
|
||||
from core.risk.position import PositionManager
|
||||
from logger import logger
|
||||
|
||||
|
||||
class RiskController:
|
||||
@@ -16,8 +17,11 @@ class RiskController:
|
||||
def process_trading_signal(self, direction, current_price, signal_strength=0.0):
|
||||
return self.position_manager.open_position(direction, current_price, signal_strength)
|
||||
|
||||
def monitor_positions(self, current_price, dry_run=False):
|
||||
self.position_manager.monitor_positions(current_price, dry_run)
|
||||
def monitor_positions(self, current_price, dry_run=False, weighted_signal=0.0):
|
||||
self.position_manager.monitor_positions(current_price, dry_run, weighted_signal)
|
||||
# 对冲摘要日志
|
||||
if self.position_manager.hedge_manager and self.position_manager.hedge_manager.active_hedges > 0:
|
||||
logger.info(f"🔒 活跃对冲: {self.position_manager.hedge_manager.active_hedges} 个")
|
||||
|
||||
def sync_state(self):
|
||||
self.position_manager.update_equity()
|
||||
|
||||
Reference in New Issue
Block a user