AI-Powered Earnings Surprise & Stock Movement Predictor

AI-Powered Earnings Surprise & Stock Movement Predictor

Leverage AI to analyze market sentiment and predict post-earnings stock reactions.

Company & Earnings Data

${surprisePercent.toFixed(2)}%

(${surprise >= 0 ? 'Beat' : 'Miss'} by $${Math.abs(surprise).toFixed(2)})

Calculated AI Score

${totalScore.toFixed(2)}

Based on all context factors

AI Rationale:

    ${reasons.map(reason => `
  • ${reason}
  • `).join('')}
`; }; /** * Handles PDF download functionality. */ window.downloadPDF = async () => { if (typeof window.jspdf === 'undefined' || typeof window.html2canvas === 'undefined') { console.error("PDF generation library not loaded."); alert('PDF generation library not loaded. Please try again later.'); return; } if (!elements.pdfContent) { console.error("PDF content container not found."); return; } const { jsPDF } = window.jspdf; try { const canvas = await html2canvas(elements.pdfContent, { scale: 2, backgroundColor: null }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgWidth = canvas.width; const imgHeight = canvas.height; const ratio = imgWidth / imgHeight; const finalImgWidth = pdfWidth - 20; // A4 width with 10mm margins const finalImgHeight = finalImgWidth / ratio; pdf.addImage(imgData, 'PNG', 10, 10, finalImgWidth, finalImgHeight); pdf.save(`AI_Prediction_Report_${elements.ticker.value.toUpperCase() || 'STOCK'}.pdf`); } catch (error) { console.error('Error generating PDF:', error); alert('An error occurred while generating the PDF.'); } }; // --- EVENT LISTENERS --- elements.prevButton.addEventListener('click', () => navigateTabs(-1)); elements.nextButton.addEventListener('click', () => navigateTabs(1)); // --- INITIALIZATION --- changeTab(1); });
Scroll to Top