feat(home): surface forward-test P&L on the dashboard
Adds a forward-test (paper-trading) net-P&L tile to the Home dashboard, shown only
once the worker has opened or settled any paper bet. Reuses the existing
IPaperTradingService aggregation (settled-only net + open count) so there is one
definition of the figure, and makes the H4 forward-test result visible from the
landing page instead of only its own route.
- DashboardSummary gains Paper{OpenCount,SettledCount,NetProfit,RoiPercent}
(default-valued, so existing constructions are unaffected) + HasPaperTrades;
DashboardSummaryService injects IPaperTradingService; Home tile + en/ru resx.
This commit is contained in:
@@ -24,6 +24,10 @@
|
||||
Delta="@AnomaliesDelta"
|
||||
Anomaly="true" />
|
||||
<StatCard Label="@L["Home.Stat.Coverage"]" Value="@_summary.SportsCovered.ToString()" />
|
||||
@if (_summary.HasPaperTrades)
|
||||
{
|
||||
<StatCard Label="@L["Home.Stat.ForwardPnl"]" Value="@PaperNet" Delta="@PaperDelta" />
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="m-grid--asym m-rise m-rise-3" style="margin-top: var(--m-space-6);">
|
||||
@@ -114,6 +118,22 @@
|
||||
? string.Format(CultureInfo.CurrentCulture, L["Home.Stat.NewToday"], _summary.AnomaliesToday)
|
||||
: null;
|
||||
|
||||
// Forward-test headline: settled-only net P&L, with open-bet count as the delta line.
|
||||
private string PaperNet
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_summary.PaperSettledCount == 0) return "—";
|
||||
var v = _summary.PaperNetProfit;
|
||||
var sign = v > 0m ? "+" : (v < 0m ? "-" : "");
|
||||
return sign + Math.Abs(v).ToString("0.00", CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
private string? PaperDelta => _summary.PaperOpenCount > 0
|
||||
? string.Format(CultureInfo.CurrentCulture, L["Home.Stat.ForwardOpen"], _summary.PaperOpenCount)
|
||||
: null;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user