Add ATM open-offset toggle default off.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -131,6 +131,7 @@ export type PlanState = {
|
||||
leverage: number;
|
||||
min_option_hours: number;
|
||||
min_option_leverage: number;
|
||||
atm_open_offset_enabled?: boolean;
|
||||
max_atm_open_offset?: number;
|
||||
can_open: boolean;
|
||||
last_error: string | null;
|
||||
@@ -180,6 +181,7 @@ export type StrategySettings = {
|
||||
leverage: number;
|
||||
min_option_hours: number;
|
||||
min_option_leverage: number;
|
||||
atm_open_offset_enabled: boolean;
|
||||
max_atm_open_offset: number;
|
||||
close_bid_mark_max_pct: number;
|
||||
perp_qty_eth: number;
|
||||
|
||||
@@ -197,8 +197,10 @@ export default function PlanPage() {
|
||||
<span>选约条件</span>
|
||||
<span className="mono">
|
||||
剩余≥{fmt(plan?.min_option_hours, 0)}h · 期权杠杆≥
|
||||
{fmt(plan?.min_option_leverage, 0)}x · ATM偏差≤
|
||||
{fmt(plan?.max_atm_open_offset ?? 3, 0)}
|
||||
{fmt(plan?.min_option_leverage, 0)}x
|
||||
{plan?.atm_open_offset_enabled
|
||||
? ` · ATM偏差≤${fmt(plan?.max_atm_open_offset ?? 3, 0)}`
|
||||
: " · ATM偏差关"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="kv">
|
||||
@@ -418,9 +420,13 @@ export default function PlanPage() {
|
||||
if (strike == null || px == null) return "—";
|
||||
const abs = Math.abs(strike - px);
|
||||
const sign = strike - px > 0 ? "+" : "";
|
||||
const delta = `${sign}${(strike - px).toFixed(0)}`;
|
||||
if (!plan?.atm_open_offset_enabled) {
|
||||
return `${delta} · 偏差限制关`;
|
||||
}
|
||||
const lim = plan?.max_atm_open_offset ?? 3;
|
||||
const ok = abs <= lim + 1e-9;
|
||||
return `${sign}${(strike - px).toFixed(0)} · 开仓${ok ? "可" : "不可"}(|Δ|≤${lim})`;
|
||||
return `${delta} · 开仓${ok ? "可" : "不可"}(|Δ|≤${lim})`;
|
||||
})()}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -31,6 +31,7 @@ export default function SettingsPage() {
|
||||
const [leverage, setLeverage] = useState(3);
|
||||
const [minHours, setMinHours] = useState(12);
|
||||
const [minOptLev, setMinOptLev] = useState(100);
|
||||
const [atmOffOn, setAtmOffOn] = useState(false);
|
||||
const [maxAtmOff, setMaxAtmOff] = useState(3);
|
||||
const [closeDevPct, setCloseDevPct] = useState(30);
|
||||
const [perpQty, setPerpQty] = useState(1);
|
||||
@@ -51,6 +52,7 @@ export default function SettingsPage() {
|
||||
setLeverage(s.leverage ?? 3);
|
||||
setMinHours(s.min_option_hours ?? 12);
|
||||
setMinOptLev(s.min_option_leverage ?? 100);
|
||||
setAtmOffOn(s.atm_open_offset_enabled === true);
|
||||
setMaxAtmOff(s.max_atm_open_offset ?? 3);
|
||||
setCloseDevPct(s.close_bid_mark_max_pct ?? 30);
|
||||
setPerpQty(s.perp_qty_eth ?? 1);
|
||||
@@ -109,6 +111,7 @@ export default function SettingsPage() {
|
||||
leverage,
|
||||
min_option_hours: minHours,
|
||||
min_option_leverage: minOptLev,
|
||||
atm_open_offset_enabled: atmOffOn,
|
||||
max_atm_open_offset: maxAtmOff,
|
||||
close_bid_mark_max_pct: closeDevPct,
|
||||
perp_qty_eth: perpQty,
|
||||
@@ -260,6 +263,21 @@ export default function SettingsPage() {
|
||||
onChange={(e) => setMinOptLev(Number(e.target.value))}
|
||||
/>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label htmlFor="atmoffOn">开仓 ATM 偏差限制</label>
|
||||
<select
|
||||
id="atmoffOn"
|
||||
className="mono"
|
||||
value={atmOffOn ? "1" : "0"}
|
||||
onChange={(e) => setAtmOffOn(e.target.value === "1")}
|
||||
>
|
||||
<option value="0">关闭(默认)</option>
|
||||
<option value="1">开启</option>
|
||||
</select>
|
||||
<p className="settings-hint">
|
||||
关闭时不限制 |ATM − 现价|;开启后超过下方点数则不开仓。
|
||||
</p>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label htmlFor="atmoff">开仓 ATM 最大偏差(点)</label>
|
||||
<input
|
||||
@@ -268,11 +286,12 @@ export default function SettingsPage() {
|
||||
type="number"
|
||||
step="0.5"
|
||||
min="0"
|
||||
disabled={!atmOffOn}
|
||||
value={maxAtmOff}
|
||||
onChange={(e) => setMaxAtmOff(Number(e.target.value))}
|
||||
/>
|
||||
<p className="settings-hint">
|
||||
|ATM 行权价 − 标的价| 超过该值则不开仓。默认 3;币安行权价步进较粗时可能长时间无开仓机会。
|
||||
仅在上方开关开启时生效。默认 3;币安行权价步进较粗时可能长时间无开仓机会。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user