mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 08:46:58 +08:00
feat: add trading stats to AI context and one-click deployment data clearing
- Add historical trading statistics to AI decision context with language detection - Remove win rate from metrics, focus on profit factor, sharpe ratio, win/loss ratio - Add option to clear trading data tables during one-click deployment - Add sqlite to Docker runtime for container-based data clearing
This commit is contained in:
@@ -469,6 +469,15 @@ func (s *PositionStore) GetPositionStats(traderID string) (map[string]interface{
|
||||
func (s *PositionStore) GetFullStats(traderID string) (*TraderStats, error) {
|
||||
stats := &TraderStats{}
|
||||
|
||||
// First check how many rows exist
|
||||
var count int
|
||||
if err := s.db.QueryRow(`SELECT COUNT(*) FROM trader_positions WHERE trader_id = ? AND status = 'CLOSED'`, traderID).Scan(&count); err == nil {
|
||||
if count == 0 {
|
||||
// No closed positions, return empty stats
|
||||
return stats, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Query all closed positions
|
||||
rows, err := s.db.Query(`
|
||||
SELECT realized_pnl, fee, exit_time
|
||||
|
||||
Reference in New Issue
Block a user