Commit Graph

7 Commits

Author SHA1 Message Date
mindesbunister
befe860188 Fix API URL handling for Docker deployment
- Replace hardcoded localhost URLs with dynamic host detection from request headers
- Supports both development (localhost:3001) and Docker (localhost:9000 -> 3000) environments
- Uses host header to determine correct protocol and port for internal API calls
- Updated execute-dex, validate, and orders APIs to use dynamic baseUrl
- Ensures proper API communication in containerized environments
2025-07-16 16:24:26 +02:00
mindesbunister
fb8d361020 fix: Update trading API routes for enhanced functionality
API Route Improvements:
- Enhanced execute-dex route for better DEX trade execution
- Improved validation route for comprehensive trade validation
- Better error handling and response formatting
- Supporting infrastructure for Jupiter-style trading interface

These changes complement the new chart trading interface with more robust backend processing.
2025-07-16 16:21:43 +02:00
mindesbunister
ffa3c5c8e1 CRITICAL FIX: Resolve trade validation amountUSD passing issue
- Fixed execute-dex API to extract and forward amountUSD parameter from request body
- Updated AIAnalysisPanel to pass amountUSD in executeTrade function call
- Fixed port references in validation and execute-dex APIs to use current dev server port
- Resolves issue where amountUSD was undefined in validation causing incorrect balance calculations
- Added comprehensive logging for debugging trade data flow
- Tested successfully: 5 USD trade now validates correctly instead of requiring 832.5 USD
2025-07-16 16:20:28 +02:00
mindesbunister
b7e4801e45 feat: Complete Jupiter-style trading interface with navigation integration
Major accomplishments:
- Fully restored complete Jupiter Perps-style trading interface
- Added Chart Trading page to main navigation menu with 📈 icon
- Complete real trading functionality with live wallet balances
- Professional leverage controls (1x-100x) with risk warnings
- Working token selection dropdowns with balance display
- Real-time position management and P&L tracking
- Integration with backend APIs for DEX and perp trading
- Stop Loss and Take Profit functionality
- Live market data and price updates

- Clean, modern UI matching Jupiter's design aesthetic
- Symbol selection dropdown with live prices and % changes
- Advanced leverage slider with quick-select buttons
- Trade form with 'You're paying' and 'You're receiving' sections
- MAX button for using full token balance
- Real trade execution with confirmation alerts
- Position table with close functionality
- Risk warnings for high leverage positions

- Added Chart Trading link between Trading and Automation
- Professional icon and description
- Maintains consistent styling with other nav items
- Direct access to advanced trading interface

Ready for production use with real trading capabilities.
2025-07-16 16:19:26 +02:00
mindesbunister
ab717ea2fb Fix trading modal balance calculation and improve symbol parsing
- Fixed TradeModal to send both positionSizeSOL (amount) and amountUSD in tradingData
- Improved symbol parsing with better fallbacks and enhanced logging
- Updated validation API to use amountUSD directly instead of amount * price calculation
- Resolves issue where 10 USD position was incorrectly requiring 1665 USD balance
- Enhanced error handling and debug logging for better troubleshooting
2025-07-16 16:07:54 +02:00
mindesbunister
ac50d9622c Enhance trading system: real wallet validation, auto-discovery, and hot reloading
- Update trade validation to use real wallet balances from /api/wallet/balance
- Enhance wallet API to auto-discover all major SPL tokens (USDC, USDT, etc.)
- Improve AIAnalysisPanel to better extract and pass AI values to TradeModal
- Configure Docker Compose for hot reloading with proper volume mounts
- Remove hardcoded balance fallbacks in favor of live wallet data

Result: Trading validation now uses accurate real-time wallet balances
2025-07-16 11:37:20 +02:00
mindesbunister
b0b63d5db0 Fix critical balance validation and add comprehensive trading features
- Fixed CoinGecko API rate limiting with fallback SOL price (68.11)
- Corrected internal API calls to use proper Docker container ports
- Fixed balance validation to prevent trades exceeding wallet funds
- Blocked 0.5 SOL trades with only 0.073 SOL available (~2.24)

- Added persistent storage for positions, trades, and pending orders
- Implemented limit order system with auto-fill monitoring
- Created pending orders panel and management API
- Added trades history tracking and display panel
- Enhanced position tracking with P&L calculations
- Added wallet balance validation API endpoint

- Positions stored in data/positions.json
- Trade history stored in data/trades.json
- Pending orders with auto-fill logic
- Real-time balance validation before trades

- All trades now validate against actual wallet balance
- Insufficient balance trades are properly blocked
- Added comprehensive error handling and logging
- Fixed Docker networking for internal API calls

- SPOT and leveraged trading modes
- Limit orders with price monitoring
- Stop loss and take profit support
- DEX integration with Jupiter
- Real-time position updates and P&L tracking

 Tested and verified all balance validation works correctly
2025-07-14 17:19:58 +02:00