Treat option-option amplitude as a maximum cap.

Reject opens when range exceeds the setting; update UI and docs labels.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-07 16:35:39 +08:00
parent 7d21bc26c7
commit eaf94448a2
9 changed files with 78 additions and 20 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ class Settings(BaseSettings):
martingale_max_doubles: int = 3 # 最多翻倍次数(如 2→4→8→16 为 3 次)
# 对冲模式:perp_option=永期(默认)| option_option=期期
hedge_mode: str = "perp_option"
oo_amplitude_pct: float = 1.5 # 振幅最 %(回看窗内高低)
oo_amplitude_pct: float = 1.5 # 振幅最 %(回看窗内高低;超过则不开
oo_amplitude_hours: float = 12.0 # 振幅回看小时
oo_min_option_hours: float = 24.0 # 期期:最短剩余到期小时
oo_min_leverage: float = 200.0 # 期期:单腿最低杠杆
+1 -1
View File
@@ -118,7 +118,7 @@ def build_oo_pick_core(
amp = amplitude or fetch_amplitude_hl_for_runtime(amplitude_hours)
if amp is None:
return None
if float(amp.range_pct) + 1e-12 < float(amplitude_pct):
if float(amp.range_pct) > float(amplitude_pct) + 1e-12:
return None
if spot <= 0:
spot = float(amp.mid)
+8 -8
View File
@@ -442,7 +442,7 @@ class StrategySession:
return self._apply_pair(pair, mark=float(mark), idx=idx)
def align_oo_instruments(self) -> OptionPair | None:
"""期期监控:按振幅高低点选虚值 Call/Put(展示用;振幅不足仍对齐候选)。"""
"""期期监控:按振幅高低点选虚值 Call/Put(展示用;振幅超限仍对齐候选)。"""
from ..exchange.candles import fetch_amplitude_hl_for_runtime
from .oo_selection import select_oo_pair
@@ -465,8 +465,8 @@ class StrategySession:
"mid": float(amp.mid),
"range_pct": float(amp.range_pct),
"hours": float(amp_hours),
"min_pct": float(amp_pct),
"ok": float(amp.range_pct) + 1e-12 >= float(amp_pct),
"max_pct": float(amp_pct),
"ok": float(amp.range_pct) <= float(amp_pct) + 1e-12,
}
contracts = self.ex.list_option_contracts(s.option_inst_family)
skip = _skip_expiry_ymds_for_next()
@@ -518,9 +518,9 @@ class StrategySession:
if amp is None:
logger.info("oo: amplitude candles unavailable")
return None
if float(amp.range_pct) + 1e-12 < float(amp_pct):
if float(amp.range_pct) > float(amp_pct) + 1e-12:
logger.info(
"oo: amplitude %.3f%% < need %.3f%% (H=%.2f L=%.2f)",
"oo: amplitude %.3f%% > max %.3f%% (H=%.2f L=%.2f)",
amp.range_pct,
amp_pct,
amp.high,
@@ -584,7 +584,7 @@ class StrategySession:
"mid": float(amp.mid),
"range_pct": float(amp.range_pct),
"hours": float(amp_hours),
"min_pct": float(amp_pct),
"max_pct": float(amp_pct),
"ok": True,
}
self._apply_pair(pair, mark=underlying, idx=idx)
@@ -837,8 +837,8 @@ class StrategySession:
"mid": float(amp.mid),
"range_pct": float(amp.range_pct),
"hours": float(amp_hours),
"min_pct": float(_amp_pct),
"ok": float(amp.range_pct) + 1e-12 >= float(_amp_pct),
"max_pct": float(_amp_pct),
"ok": float(amp.range_pct) <= float(_amp_pct) + 1e-12,
}
contracts = self.ex.list_option_contracts(self.settings.option_inst_family)
picked = select_oo_pair(