From e0cbd798b6f90364df4966aebea7c3356942cb12 Mon Sep 17 00:00:00 2001 From: ojy Date: Wed, 13 May 2026 04:38:07 +0000 Subject: [PATCH] Auto-fetch live marks on strategy page open MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On opening the Strategy page, automatically pull the current spot, each leg's live mid (Mark column) and IV โ€” without touching entry prices. The Reload button still re-prices unlocked legs to the current mark. Clarified the legs table hint. Co-Authored-By: Claude Sonnet 4.6 --- frontend/strategy.html | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/frontend/strategy.html b/frontend/strategy.html index ba628f2..5d85ba8 100644 --- a/frontend/strategy.html +++ b/frontend/strategy.html @@ -118,7 +118,7 @@
-

Legs โ€” uncheck a leg to drop it from the chart

+

Legs โ€” Mark = live mid ยท ๐Ÿ”’ locks entry price ยท uncheck to drop from chart

Net : @@ -299,6 +299,8 @@ init() { this.reload(); + // pull live spot / marks / IVs on open (does NOT touch entry prices) + if (this.legs.length > 0 && this.symbol) this.reloadMarket(false); // re-sync if another tab changed the basket window.addEventListener('storage', (e) => { if (e.key === StrategyStore.KEY) this.reload(); }); }, @@ -438,9 +440,10 @@ this.reload(); this.flash('Leg added'); }, - // Re-fetch spot + each leg's current mark & IV. Unlocked legs also get - // their entry price reset to the current mark; locked legs keep their entry. - async reloadMarket() { + // Re-fetch spot + each leg's current mark & IV. + // When repriceUnlocked (default โ€” the Reload button), unlocked legs also + // get their entry price reset to the current mark; locked legs always keep it. + async reloadMarket(repriceUnlocked = true) { if (!this.symbol || this.legs.length === 0) return; this.refreshing = true; try { @@ -471,7 +474,7 @@ const mark = Math.round((o.midPrice ?? o.mid ?? o.bsPrice ?? 0) * 100) / 100; leg.currentMark = mark; if (o.iv > 0) leg.iv = o.iv; - if (!leg.locked && mark > 0) { leg.entryPrice = mark; relinked++; } + if (!leg.locked && repriceUnlocked && mark > 0) { leg.entryPrice = mark; relinked++; } updated++; } if (spot > 0) st.spotSnapshot = spot; @@ -480,11 +483,13 @@ if (spot > 0) this.spot = spot; if (this.dteOffset > this.maxDTE) this.dteOffset = this.maxDTE; this.$nextTick(() => this.renderChart()); - this.flash(updated > 0 - ? `Reloaded ${updated} leg${updated===1?'':'s'}${relinked?` (${relinked} re-priced)`:''} ยท spot $${(spot||this.spot).toFixed(2)}` - : 'Reloaded โ€” no matching contracts found in the current chain'); + if (repriceUnlocked) { + this.flash(updated > 0 + ? `Reloaded ${updated} leg${updated===1?'':'s'}${relinked?` (${relinked} re-priced)`:''} ยท spot $${(spot||this.spot).toFixed(2)}` + : 'Reloaded โ€” no matching contracts found in the current chain'); + } } catch (e) { - this.flash('Reload failed: ' + e.message); + if (repriceUnlocked) this.flash('Reload failed: ' + e.message); } finally { this.refreshing = false; }