From b52da96ba015711b820a744f2921369edf6fff81 Mon Sep 17 00:00:00 2001 From: Dione Date: Thu, 11 Jun 2026 10:47:44 +0000 Subject: [PATCH] Fix avg buy price calculation by iterating snapshots oldest-first --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 4e0f2b7..da477d5 100644 --- a/index.html +++ b/index.html @@ -1331,7 +1331,7 @@ function calculateCurrentHoldings() { const snaps = addressSnapshots[addr] || []; if (snaps.length < 2) return; let prevBtc = 0; - snaps.forEach(snap => { + snaps.slice().reverse().forEach(snap => { const currentDate = snap.block_timestamp.slice(0, 10); const currentBtc = getTokenAmount(snap?.wallet?.cbBTC, 'cbBTC') + getTokenAmount(snap?.collateral?.cbBTC, 'cbBTC'); const delta = currentBtc - prevBtc;