Changed around line 1
+ document.addEventListener('DOMContentLoaded', function() {
+ // Initialize the trading chart
+ const ctx = document.getElementById('tradingChart').getContext('2d');
+
+ // Simulate real-time data updates
+ setInterval(updateStats, 5000);
+ setInterval(updateTrades, 3000);
+
+ // Initialize with some data
+ updateStats();
+ updateTrades();
+ });
+
+ function updateStats() {
+ // Simulate real-time stat updates
+ document.getElementById('daily-profit').textContent =
+ (Math.random() * 5).toFixed(2) + '%';
+
+ document.getElementById('active-trades').textContent =
+ Math.floor(Math.random() * 20);
+
+ document.getElementById('total-profit').textContent =
+ '$' + (Math.random() * 5000).toFixed(2);
+ }
+
+ function updateTrades() {
+ const tradesContainer = document.getElementById('recent-trades');
+ const trades = generateMockTrades(5);
+
+ tradesContainer.innerHTML = trades.map(trade => `
+
+ ${trade.pair}
+ ${trade.type}
+ ${trade.amount}
+
+ ${trade.profit > 0 ? '+' : ''}${trade.profit}%
+
+
+ `).join('');
+ }
+
+ function generateMockTrades(count) {
+ const pairs = ['BTC/USDT', 'ETH/USDT', 'BNB/USDT', 'SOL/USDT'];
+ const trades = [];
+
+ for(let i = 0; i < count; i++) {
+ trades.push({
+ pair: pairs[Math.floor(Math.random() * pairs.length)],
+ type: Math.random() > 0.5 ? 'شراء' : 'بيع',
+ amount: (Math.random() * 1000).toFixed(2) + ' USDT',
+ profit: (Math.random() * 10 - 5).toFixed(2)
+ });
+ }
+
+ return trades;
+ }