mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-07 03:07:56 +08:00
683ae58563
Critical bug fix in Sharpe Ratio calculation logic: Problem: - Previously calculated equity as TotalBalance + TotalUnrealizedProfit - This was incorrect because TotalBalance already stores TotalEquity - TotalUnrealizedProfit actually stores TotalPnL (not unrealized profit) - This caused: equity = 2 * TotalEquity - InitialBalance (wrong!) Root cause: - Field naming mismatch between AccountSnapshot and actual stored values - TotalBalance field actually contains TotalEquity (wallet + unrealized) - TotalUnrealizedProfit field actually contains TotalPnL (equity - initial) Solution: - Use TotalBalance directly as it already represents complete account equity - Added clear comments explaining the field name vs content mismatch - Sharpe Ratio now correctly calculates risk-adjusted returns Impact: - Sharpe Ratio values are now mathematically accurate - AI performance assessment is now reliable - No changes needed to data storage or API layer Co-Authored-By: tinkle-community <tinklefund@gmail.com>