Changed around line 1
+ document.addEventListener('DOMContentLoaded', function() {
+ // Mobile menu toggle
+ const menuToggle = document.querySelector('.menu-toggle');
+ const navLinks = document.querySelector('.nav-links');
+
+ menuToggle.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ });
+
+ // Sample stock data (in real application, this would come from an API)
+ const stocks = [
+ { symbol: 'AAPL', name: 'Apple Inc.', price: 150.25, change: 2.5 },
+ { symbol: 'MSFT', name: 'Microsoft', price: 285.30, change: 1.8 },
+ { symbol: 'GOOGL', name: 'Alphabet', price: 2750.15, change: -0.5 },
+ { symbol: 'AMZN', name: 'Amazon', price: 3300.45, change: 1.2 }
+ ];
+
+ // Populate stock cards
+ const stockCards = document.getElementById('stockCards');
+ stocks.forEach(stock => {
+ const card = document.createElement('div');
+ card.className = 'stock-card';
+ card.innerHTML = `
+
${stock.symbol}
+
$${stock.price.toFixed(2)}
+ ${stock.change >= 0 ? '+' : ''}${stock.change}%
+
+ `;
+ stockCards.appendChild(card);
+ });
+
+ // Create trend chart
+ const ctx = document.getElementById('trendChart').getContext('2d');
+ const gradient = ctx.createLinearGradient(0, 0, 0, 400);
+ gradient.addColorStop(0, 'rgba(52, 152, 219, 0.3)');
+ gradient.addColorStop(1, 'rgba(52, 152, 219, 0)');
+
+ function drawChart() {
+ ctx.beginPath();
+ ctx.moveTo(0, 200);
+ for(let i = 0; i < 400; i++) {
+ ctx.lineTo(i, 200 + Math.sin(i/30) * 50 + Math.random() * 20);
+ }
+ ctx.strokeStyle = '#3498db';
+ ctx.lineWidth = 2;
+ ctx.stroke();
+
+ ctx.lineTo(400, 400);
+ ctx.lineTo(0, 400);
+ ctx.fillStyle = gradient;
+ ctx.fill();
+ }
+
+ drawChart();
+
+ // Update market data periodically
+ function updateMarketData() {
+ document.getElementById('marketOverview').textContent =
+ 'Market showing strong bullish trends with technology sector leading gains.';
+
+ document.getElementById('sectorPerformance').innerHTML = `
+ `;
+ }
+
+ updateMarketData();
+ setInterval(updateMarketData, 60000); // Update every minute
+ });