fix: remove leverage from position history and fix max drawdown calculation

- Remove leverage column from position history table
- Fix max drawdown calculation using virtual starting equity
- Add formula tooltips for all statistics metrics
- Remove leverage parameter from pnlPct calculation
This commit is contained in:
tinkle-community
2025-12-28 21:03:37 +08:00
parent 0f3ba1382a
commit 1c32c2ab08
3 changed files with 856 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ package trader
import (
"database/sql"
"math"
"nofx/store"
"testing"
"time"
@@ -382,7 +383,8 @@ func TestHyperliquidBugScenario(t *testing.T) {
}
expectedTotalPnL := 4.72 + 5.0 // Sum of both close trades
if totalPnL != expectedTotalPnL {
// Use tolerance for floating point comparison
if math.Abs(totalPnL-expectedTotalPnL) > 0.01 {
t.Errorf("Expected total PnL %.2f, got %.2f", expectedTotalPnL, totalPnL)
}
}