Machine Learning Financial News Aggregator

Machine Learning Financial News Aggregator

AI-powered sentiment analysis on curated financial news.

Awaiting Data Configuration

Navigate to the configuration tab to select a market sector and news sources to analyze.

Source: ${article.source} | Confidence: ${article.confidence}%

${article.summary}

`).join(''); dashboardContent.innerHTML = `

News Analysis for ${userInputs.sectorName}

Analysis complete on ${today.toLocaleDateString('en-US', { dateStyle: 'long' })}

Overall Market Sentiment

${currentData.overallSentiment}

${articleCards}
`; downloadSection.classList.remove('hidden'); showTab(1); }; aggregateBtn.addEventListener('click', aggregateNews); // --- PDF DOWNLOAD --- const downloadPDF = () => { if (!currentData) return; const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const btnText = getElem('pdf-btn-text'); const btnSpinner = getElem('pdf-btn-spinner'); btnText.classList.add('hidden'); btnSpinner.classList.remove('hidden'); downloadPdfBtn.disabled = true; try { const pageWidth = pdf.internal.pageSize.getWidth(); const margin = 40; let y = margin; // --- Header --- pdf.setFont('helvetica', 'bold'); pdf.setFontSize(22); pdf.text("Financial News Briefing", pageWidth / 2, y, { align: 'center' }); y += 20; pdf.setFont('helvetica', 'normal'); pdf.setFontSize(11); pdf.text(`Sector: ${userInputs.sectorName} | Date: ${today.toLocaleDateString('en-US')}`, pageWidth / 2, y, { align: 'center' }); y += 35; // --- Summary Section --- pdf.setFont('helvetica', 'bold'); pdf.setFontSize(16); pdf.text("Overall Sentiment Analysis", margin, y); y += 20; pdf.setFont('helvetica', 'normal'); pdf.setFontSize(12); pdf.text(`The aggregated news flow for the ${userInputs.sectorName} sector indicates a prevailing sentiment of:`, margin, y); y += 18; pdf.setFont('helvetica', 'bold'); pdf.setFontSize(18); pdf.text(currentData.overallSentiment, margin, y); y += 40; // --- Articles Table --- const tableData = currentData.articles.map(article => [ article.source, article.title, article.sentiment, `${article.confidence}%` ]); pdf.autoTable({ startY: y, head: [['Source', 'Headline', 'Sentiment', 'Confidence']], body: tableData, theme: 'striped', headStyles: { fillColor: [29, 78, 216] }, // blue-700 didDrawPage: (data) => { y = data.cursor.y; } }); pdf.save(`Financial-News-Briefing-${userInputs.sectorName}.pdf`); } catch(e) { console.error("PDF Generation failed:", e); } finally { btnText.classList.remove('hidden'); btnSpinner.classList.add('hidden'); downloadPdfBtn.disabled = false; } }; downloadPdfBtn.addEventListener('click', downloadPDF); });
Scroll to Top