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
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import TradeExecutionPanel from '../../components/TradeExecutionPanel.js'
|
||||
import PositionsPanel from '../../components/PositionsPanel.js'
|
||||
import PendingOrdersPanel from '../../components/PendingOrdersPanel.js'
|
||||
import TradesHistoryPanel from '../../components/TradesHistoryPanel.js'
|
||||
|
||||
export default function TradingPage() {
|
||||
const [selectedSymbol, setSelectedSymbol] = useState('SOL')
|
||||
@@ -85,6 +87,9 @@ export default function TradingPage() {
|
||||
{/* Open Positions */}
|
||||
<PositionsPanel />
|
||||
|
||||
{/* Pending Orders */}
|
||||
<PendingOrdersPanel />
|
||||
|
||||
{/* Portfolio Overview */}
|
||||
<div className="card card-gradient p-6">
|
||||
<h2 className="text-xl font-bold text-white mb-4">Wallet Overview</h2>
|
||||
@@ -129,6 +134,9 @@ export default function TradingPage() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Recent Trades */}
|
||||
<TradesHistoryPanel />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user