Market Sentiment Dashboard

Market Sentiment Dashboard

Analyze the market's mood with simulated news, social, and volatility data.

Overall Market Sentiment

News Sentiment

Social Media Trend

Volatility Index (VIX)

Fear & Greed Index

Simulated Data Streams

Recent News Headlines

Social Media Trends

Export Market Intelligence Report

Generate a professional PDF of the market sentiment analysis for your records.

${item.headline || item.post}

`).join(''); }; renderFeed('news-feed', analysisResults.newsFeed); renderFeed('social-feed', analysisResults.socialFeed); } // --- PDF GENERATION --- async function generatePdfReport() { downloadPdfBtn.disabled = true; downloadPdfBtn.textContent = 'Generating...'; const renderTableRows = (data) => data.map(item => `${item.headline || item.post}${item.score.toFixed(0)}`).join(''); const reportHtml = `

Market Intelligence Briefing

Report for: ${dateInput.value}

OVERALL SENTIMENT
${(analysisResults.overallSentiment > 65 ? 'Greed' : (analysisResults.overallSentiment < 35 ? 'Fear' : 'Neutral'))} (${analysisResults.overallSentiment.toFixed(0)})
NEWS SENTIMENT
${analysisResults.newsScore.toFixed(0)}
VOLATILITY (VIX)
${analysisResults.vix.toFixed(2)}
Key News Drivers
${renderTableRows(analysisResults.newsFeed)}
HeadlineSentiment Score
Key Social Media Trends
${renderTableRows(analysisResults.socialFeed)}
PostSentiment Score
`; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-page'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(), pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save(`Market_Sentiment_Report_${dateInput.value}.pdf`); } catch (e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download PDF Report'; pdfTemplate.classList.add('invisible'); pdfTemplate.innerHTML = ''; } } // --- EVENT LISTENERS --- dateInput.addEventListener('change', analyzeSentiment); downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- dateInput.value = new Date().toISOString().split('T')[0]; analyzeSentiment(); switchTab(0); });
Scroll to Top