mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-01 10:01:21 +08:00
Fixed critical issues in historical trade record and performance analysis: 1. PnL Calculation: Changed from percentage-only to actual USDT amount - Now correctly calculates: positionValue × priceChange% × leverage - Previously: 100U@5% and 1000U@5% both showed 5.0 - Now: Properly reflects different position sizes and leverage 2. Position Tracking: Added quantity and leverage to open position records - Store complete trade data for accurate PnL calculation - Previously only stored: side, openPrice, openTime - Now includes: quantity, leverage for proper accounting 3. Position Key: Fixed to distinguish long/short positions - Changed from symbol to symbol_side (e.g., BTCUSDT_long) - Prevents conflicts when holding both long and short positions 4. Sharpe Ratio: Replaced custom Newton's method with math.Sqrt - Simplified standard deviation calculation - More reliable and maintainable Impact: Win rate, profit factor, and Sharpe ratio now based on accurate USDT amounts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>