Frontend changes:
- Update TradeOutcome interface with new fields:
- quantity: Position size
- leverage: Leverage multiplier
- position_value: Total position value
- margin_used: Margin required
- Add position details display in trade cards:
- Quantity (with 4 decimal precision)
- Leverage (shown as "50x")
- Position Value (shown as "$10000.00")
- Margin Used (shown as "$200.00")
Visual design:
- 2x2 grid layout for position details
- Color coding: Leverage in gold, Margin in purple
- Conditional rendering with fallback "-" for missing data
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add missing fields to TradeOutcome:
- Quantity: Position size
- Leverage: Leverage multiplier
- PositionValue: Total position value (quantity × openPrice)
- MarginUsed: Margin required (positionValue / leverage)
This provides complete trade information for analysis and display.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Major fixes:
1. Trade History data loss issue
- Root cause: Open records outside analysis window caused close matching failures
- Solution: Pre-populate position state by reading 3x window of historical records
- Ensures long-term positions (>5 hours) generate correct trade records
2. P&L calculation errors
- Remove incorrect leverage multiplication from absolute P&L
- Correct calculation: Futures P&L = quantity × price difference
- Leverage only affects P&L percentage (relative to margin)
3. Other fixes
- Break-even trades (pnl=0) no longer misclassified as losses
- Perfect strategy shows Profit Factor as 999.0 instead of 0.0
- Expand analysis window from 20 to 100 cycles (5 hours)
Files changed:
- logger/decision_logger.go: Core matching and calculation logic
- api/server.go: API analysis window
- trader/auto_trader.go: AI decision analysis window
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
## Features
- Add full Aster DEX integration with Binance-compatible API
- Support Web3 authentication with API wallet system
- Add comprehensive Aster integration guide (ASTER_INTEGRATION.md)
- Add example Aster configuration (config.aster.example.json)
## Bug Fixes
- Fix precision error (code -1111) for all order types
- Implement proper float-to-string conversion with exchange precision
- Add automatic precision fetching from /exchangeInfo endpoint
- Remove trailing zeros from formatted values
## Documentation
- Update README.md with Aster quick start guide
- Add detailed setup instructions for creating API wallet
- Include troubleshooting FAQ and security best practices
- Update core features to mention three supported exchanges
## Technical Details
- Added formatFloatWithPrecision() helper function
- Updated all order functions to use proper precision formatting
- Added precision logging for debugging
- Fully backward compatible with existing configurations
Closes #[issue number if applicable]