- Add PostgreSQL + SQLite hybrid database support with automatic switching
- Implement frontend AES-GCM + RSA-OAEP encryption for sensitive data
- Add comprehensive DatabaseInterface with all required methods
- Fix compilation issues with interface consistency
- Update all database method signatures to use DatabaseInterface
- Add missing UpdateTraderInitialBalance method to PostgreSQL implementation
- Integrate RSA public key distribution via /api/config endpoint
- Add frontend crypto service with proper error handling
- Support graceful degradation between encrypted and plaintext transmission
- Add directory creation for RSA keys and PEM parsing fixes
- Test both SQLite and PostgreSQL modes successfully
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
Major database migration to modernize the AI trading system:
• **Database Migration**:
- Add PostgreSQL 15 and Redis 7 services to docker-compose
- Create comprehensive PostgreSQL schema with proper indexes and triggers
- Implement DatabaseInterface for multi-database support
- Add automatic environment-based database selection
• **Infrastructure**:
- PostgreSQL: ACID transactions, better concurrency, JSON support
- Redis: High-performance caching layer (prepared for future use)
- Docker services with health checks and dependency management
- Persistent volumes for data safety
• **Code Refactoring**:
- Abstract database operations through DatabaseInterface
- Implement PostgreSQL-specific operations with proper syntax
- Update all SQL queries to support both SQLite and PostgreSQL
- Fix foreign key constraints and data type conversions
• **Migration Tools**:
- Automated data migration script from SQLite to PostgreSQL
- Complete backup and restore procedures
- One-click migration script with validation
• **Compatibility**:
- Backward compatible with existing SQLite deployments
- Environment variable driven database selection
- Preserved all existing functionality and data
🎯 Benefits: Better performance, scalability, and reliability for production deployments
Resolved conflicts in:
- api/server.go: Preserved beta_mode config and user permission checks
- manager/trader_manager.go: Kept optimized concurrent competition data with caching
Maintained all performance optimizations while merging new features from dev.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
## Performance Improvements:
- **Concurrent Processing**: Replace serial GetAccountInfo() calls with parallel goroutines
- **Timeout Control**: Add 3-second timeout per trader to prevent blocking
- **30-second Cache**: Implement competition data cache to reduce API calls
- **Error Handling**: Graceful degradation when API calls fail or timeout
## API Changes:
- Reduce top traders from 10 to 5 for better chart performance
- Update /api/equity-history-batch to use top 5 traders by default
- Add detailed logging for cache hits and performance monitoring
## Expected Performance Gains:
- First request: ~85% faster (from 25s to 3s for 50 traders)
- Cached requests: ~99.96% faster (from 25s to 10ms)
- Better user experience with consistent response times
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
Features:
- Limit leaderboard to top 50 traders sorted by PnL percentage
- Add top 10 traders endpoint for performance comparison
- Create batch equity history endpoint to optimize frontend performance
- Add public trader config endpoint without sensitive data
Security:
- Add user ownership validation for start/stop trader operations
- Prevent users from controlling other users' traders
- Maintain consistent error messages for security
Performance:
- Reduce API calls from 10 to 1 for performance comparison page
- Add data limits and error handling for batch operations
- Sort traders by performance across all endpoints
API Changes:
- GET /api/traders - now returns top 50 sorted traders
- GET /api/top-traders - new endpoint for top 10 traders
- GET /api/equity-history-batch - batch endpoint for multiple trader histories
- GET /api/traders/:id/public-config - public config without secrets
- POST /api/traders/:id/start - now validates user ownership
- POST /api/traders/:id/stop - now validates user ownership
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
Major changes:
- Add full Hyperliquid trading support (long/short, leverage, SL/TP)
- Create unified Trader interface for multi-exchange support
- Implement automatic precision handling for orders and prices
- Fix balance calculation and unrealized P&L display
- Add comprehensive configuration guide in README
New features:
- Support for both Binance and Hyperliquid exchanges
- Automatic order size precision based on szDecimals
- Price formatting with 5 significant figures
- Non-custodial trading with Ethereum private key
- Seamless exchange switching via configuration
Technical details:
- Add trader/interface.go for unified trader interface
- Add trader/hyperliquid_trader.go for Hyperliquid implementation
- Update manager and auto_trader to support multiple exchanges
- Add go-hyperliquid SDK dependency
- Fix precision errors (float_to_wire, invalid price)
Fixes:
- Correct calculation of wallet balance and unrealized P&L
- Proper handling of AccountValue vs TotalRawUsd
- Frontend display issues for total equity and P&L
Documentation:
- Add Hyperliquid setup guide in README
- Update config.json.example with both exchanges
- Add troubleshooting section for common errors
Tested with live trading on Hyperliquid mainnet.
No breaking changes - backward compatible with existing configs.
- Multi-AI competition mode (Qwen vs DeepSeek)
- Binance Futures integration
- AI self-learning mechanism
- Professional web dashboard
- Complete risk management system