Add martingale mode for risk-based percent sizing.

Enable in settings (default off): after N consecutive loss days, double the effective risk_loss_pct up to a configurable max; blocked when base pct > 3%.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-07 09:55:29 +08:00
parent 3d1f9f3d50
commit 0f552eb50e
9 changed files with 476 additions and 10 deletions
+4
View File
@@ -76,6 +76,10 @@ class Settings(BaseSettings):
min_option_leverage: float = 100.0 # 现价/卖一权利金 下限
# 以损定仓权利金口径:actual=盘口卖一;selection=指数/选约杠杆(控节奏,默认)
risk_leverage_basis: str = "selection"
# 倍投:默认关;仅以损定仓+亏损幅度%且基础幅度≤3% 可开
martingale_enabled: bool = False
martingale_start_after_loss_days: int = 2 # 连续亏损 N 天后开始翻倍
martingale_max_doubles: int = 3 # 最多翻倍次数(如 2→4→8→16 为 3 次)
atm_open_offset_enabled: bool = False # 开仓 ATM 偏差限制开关(默认关)
max_atm_open_offset: float = 3.0 # 开启后:|ATM行权价−标的| 上限(点)
# 固定方向:关=现有 ATM/比价规则;开=指定永续多/空,期权 Put/Call 且须实值或平值