From c919a1ea6befa709ba914d82d3ad2d610211623b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 4 Jan 2026 06:28:01 +0000 Subject: [PATCH 1/7] Switch portfolio snapshots from ETH to USD denomination - Add database migration (003_usd_networth.ts) to add usdValue column - Update cron job to fetch ETH/USD rate and store USD value in snapshots - Update frontend to use usdValue directly without conversion - Show chart for all currency settings (not just ETH) - Format chart tooltip values as USD --- client/src/hooks/useHono.ts | 16 +++++++-------- client/src/screens/Home.tsx | 4 ++-- server/src/app.ts | 21 +++++++++++++++++++- server/src/db/index.ts | 1 + server/src/db/migrations/003_usd_networth.ts | 13 ++++++++++++ server/src/db/migrator.ts | 3 ++- 6 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 server/src/db/migrations/003_usd_networth.ts diff --git a/client/src/hooks/useHono.ts b/client/src/hooks/useHono.ts index 73cd896..761fdae 100644 --- a/client/src/hooks/useHono.ts +++ b/client/src/hooks/useHono.ts @@ -110,19 +110,19 @@ export function useEthValuesByAccount() { } export function useNetworthTimeSeries() { - const { currency } = useCurrency() - const { data: fiat } = useFiat() - return useQuery({ - queryKey: ['networthTimeSeries', currency, fiat], + queryKey: ['networthTimeSeries'], queryFn: async () => { const res = await honoClient.balances.networth.$get() const json = await res.json() - return json.map((item) => ({ - ...item, - value: item.ethValue / (fiat?.getRate(currency) ?? 1), - })) + // Filter to only include entries with usdValue and map to chart format + return json + .filter((item) => item.usdValue != null) + .map((item) => ({ + ...item, + value: item.usdValue as number, + })) }, }) } diff --git a/client/src/screens/Home.tsx b/client/src/screens/Home.tsx index 9fb630b..9bf5821 100644 --- a/client/src/screens/Home.tsx +++ b/client/src/screens/Home.tsx @@ -64,8 +64,7 @@ export function Home() {