Show DTE badge in the strategy page title strip
Adds a blue "23 DTE" badge next to the strategy name in the header (or "14 / 42 DTE" when active legs span multiple expiries — calendar/diagonal). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,7 @@
|
|||||||
<h2 class="page-title">Strategy P/L Analyzer</h2>
|
<h2 class="page-title">Strategy P/L Analyzer</h2>
|
||||||
<div class="text-secondary mt-1" x-show="legs.length > 0" x-cloak>
|
<div class="text-secondary mt-1" x-show="legs.length > 0" x-cloak>
|
||||||
<span class="badge bg-purple-lt fs-6 me-2" x-text="strategyName"></span>
|
<span class="badge bg-purple-lt fs-6 me-2" x-text="strategyName"></span>
|
||||||
|
<span class="badge bg-blue-lt fs-6 me-2" x-show="dteSummary" x-text="dteSummary"></span>
|
||||||
<span x-show="symbols.length <= 1" x-text="symbol"></span><span x-show="symbols.length <= 1"> · </span>
|
<span x-show="symbols.length <= 1" x-text="symbol"></span><span x-show="symbols.length <= 1"> · </span>
|
||||||
<span x-text="legs.length + ' leg' + (legs.length===1?'':'s')"></span> ·
|
<span x-text="legs.length + ' leg' + (legs.length===1?'':'s')"></span> ·
|
||||||
Spot <strong class="mono" x-text="spot > 0 ? '$'+spot.toFixed(2) : '—'"></strong>
|
Spot <strong class="mono" x-text="spot > 0 ? '$'+spot.toFixed(2) : '—'"></strong>
|
||||||
@@ -513,6 +514,14 @@
|
|||||||
if (d < 1) return '<1d';
|
if (d < 1) return '<1d';
|
||||||
return Math.round(d) + 'd';
|
return Math.round(d) + 'd';
|
||||||
},
|
},
|
||||||
|
get dteSummary() {
|
||||||
|
const uniq = [...new Set(this.activeLegs.map(l => l.expiry))];
|
||||||
|
if (uniq.length === 0) return '';
|
||||||
|
const days = uniq.map(e => Math.max(0, Math.round(legDTE({expiry:e}))));
|
||||||
|
if (days.length === 1) return days[0] + ' DTE';
|
||||||
|
days.sort((a,b) => a - b);
|
||||||
|
return days.join(' / ') + ' DTE';
|
||||||
|
},
|
||||||
|
|
||||||
get legsView() {
|
get legsView() {
|
||||||
return this.legs.map(l => {
|
return this.legs.map(l => {
|
||||||
|
|||||||
Reference in New Issue
Block a user