// ── DASHBOARD API — reads this workflow's own static data ── const sd = $getWorkflowStaticData('global'); const now = Date.now(); const pos = sd.position || null; return [{ json: { ts: new Date().toISOString(), capital: +(sd.capital || 285).toFixed(2), position: pos ? { symbol: pos.symbol, entry: pos.entry || 0, qty: +(pos.qty || 0).toFixed(6), tradeValue: +(pos.tradeValue || 0).toFixed(2), tpPct: +(pos.tpPct * 100).toFixed(3), slPct: +(pos.slPct * 100).toFixed(3), highWater: pos.highWater || pos.entry || 0, entryTime: pos.entryTime || null, holdMins: pos.entryTime ? +((now - new Date(pos.entryTime).getTime()) / 60000).toFixed(1) : 0, score: pos.entryScore || 0 } : null, stats: { trades: sd.trades || 0, todayTrades: sd.todayTrades || 0, wins: sd.wins || 0, losses: sd.losses || 0, winRate: (sd.trades||0) > 0 ? +((sd.wins||0) / (sd.trades||1) * 100).toFixed(1) : 0, pnl: +(sd.pnl || 0).toFixed(2), pendingFill: !!sd.pendingFill, lastLossAgo: sd.lastLossTime ? Math.round((now - sd.lastLossTime) / 60000) : null }, history: (sd.tradeHistory || []) }}];