diff --git a/frontend/src/components/crypto/CryptoStatsRow.tsx b/frontend/src/components/crypto/CryptoStatsRow.tsx
index 9d78908..258ce9c 100644
--- a/frontend/src/components/crypto/CryptoStatsRow.tsx
+++ b/frontend/src/components/crypto/CryptoStatsRow.tsx
@@ -28,9 +28,15 @@ function computeTotals(holdings: CryptoHolding[]): Totals {
for (const holding of holdings) {
if (holding.value !== null) totalValue += Number(holding.value);
if (holding.cost_basis !== null) totalCostBasis += Number(holding.cost_basis);
- if (holding.profit_loss_percent === null) continue;
- if (best === null || holding.profit_loss_percent > best.profit_loss_percent!) best = holding;
- if (worst === null || holding.profit_loss_percent < worst.profit_loss_percent!) worst = holding;
+ // Best/Worst Performer compare coins against *each other* by market
+ // price move (24h % change), not against what the user personally paid
+ // — a coin someone bought yesterday at the top can still be "best
+ // performer" here if it's simply up the most of anything they hold
+ // today, independent of their own entry price/timing.
+ if (holding.price_change_24h === null) continue;
+ const change = Number(holding.price_change_24h);
+ if (best === null || change > Number(best.price_change_24h)) best = holding;
+ if (worst === null || change < Number(worst.price_change_24h)) worst = holding;
}
const totalProfitLoss = totalValue - totalCostBasis;
@@ -52,14 +58,14 @@ function StatTile({ label, children }: { label: string; children: ReactNode }) {
function PerformerTile({ label, holding }: { label: string; holding: CryptoHolding | null }) {
const { t } = useTranslation();
- if (holding === null || holding.profit_loss_percent === null) {
+ if (holding === null || holding.price_change_24h === null) {
return (
—
{t("crypto.stats.since", { name: holding.name })}
+{t("crypto.stats.change24h")}
); } diff --git a/frontend/src/lib/i18n.ts b/frontend/src/lib/i18n.ts index 68db599..369759e 100644 --- a/frontend/src/lib/i18n.ts +++ b/frontend/src/lib/i18n.ts @@ -158,7 +158,7 @@ const ru = { "crypto.stats.costBasisHint": "сумма покупок по факту", "crypto.stats.bestPerformer": "Лучший рост", "crypto.stats.worstPerformer": "Худшее падение", - "crypto.stats.since": "с момента покупки {{name}}", + "crypto.stats.change24h": "изменение цены за 24ч", "roi.calculator.title": "Калькулятор ROI", "roi.calculator.investmentLabel": "Сумма инвестиции", @@ -619,7 +619,7 @@ const en: Record