diff --git a/app/dash/page.js b/app/dash/page.js index 5320fab..6eba980 100644 --- a/app/dash/page.js +++ b/app/dash/page.js @@ -11,7 +11,6 @@ export default function LiveDashboard() { const [trades, setTrades] = useState([]); const [loading, setLoading] = useState(true); const [toggling, setToggling] = useState(null); - const [activeTrade, setActiveTrade] = useState(null); useEffect(() => { const fetchState = async () => { @@ -156,7 +155,7 @@ export default function LiveDashboard() {

{s.name}

{s.config && (

- ${s.config.betSize || 1}/trade • {s.config.cooldownMs ? `${(s.config.cooldownMs/1000).toFixed(0)}s cd` : ''} + ${s.config.betSize || 1}/trade • {s.config.cooldownMs ? `${(s.config.cooldownMs / 1000).toFixed(0)}s cd` : ''}

)} @@ -304,6 +303,20 @@ function LiveOrderRow({ order, isOpen }) { const pnlColor = pnlVal == null ? 'text-gray-600' : pnlVal > 0 ? 'text-green-400' : pnlVal < 0 ? 'text-red-400' : 'text-gray-400'; + const priceRaw = Number(order.priceCents ?? order.price); + const priceCents = Number.isFinite(priceRaw) + ? (priceRaw > 0 && priceRaw <= 1 ? Math.round(priceRaw * 100) : Math.round(priceRaw)) + : null; + + const contractsRaw = Number(order.contracts ?? 1); + const contracts = Number.isFinite(contractsRaw) && contractsRaw > 0 ? contractsRaw : 1; + + const hasExpected = isOpen && priceCents != null && priceCents > 0 && priceCents < 100; + const grossPayout = hasExpected ? contracts : null; // $1 per winning contract + const cost = hasExpected ? (priceCents / 100) * contracts : null; + const winPnL = hasExpected ? grossPayout - cost : null; + const losePnL = hasExpected ? -cost : null; + return (
@@ -321,10 +334,26 @@ function LiveOrderRow({ order, isOpen }) { {pnlVal != null ? `${pnlVal >= 0 ? '+' : ''}$${pnlVal.toFixed(2)}` : 'open'}
+
{order.reason} {order.strategy}
+ + {hasExpected && ( +
+ + If win: +${winPnL.toFixed(2)} + + + If lose: ${losePnL.toFixed(2)} + + + Gross payout: ${grossPayout.toFixed(2)} + +
+ )} + {order.result && !isOpen && (
Result: {order.result}