AI-Based Frontier Markets Stock Screener

AI-Based Frontier Markets Stock Screener

Discover undervalued opportunities in the world's fastest-growing economies.

Step 1: Define Your Screening Criteria

Select Frontier Markets

Generating AI analysis...

`; try { const payload = { contents: [{ role: "user", parts: [{ text: prompt }] }] }; const apiKey = ""; // Provided by Canvas const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${apiKey}`; const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); const result = await response.json(); let text = "Could not generate analysis. Please try again."; if (result.candidates && result.candidates[0].content && result.candidates[0].content.parts[0]) { text = result.candidates[0].content.parts[0].text; } aiContainer.innerHTML = text; } catch (error) { aiContainer.innerHTML = `

Error generating AI analysis.

`; } }; // --- PDF DOWNLOAD --- window.downloadPDF = async () => { const btn = document.getElementById('pdf-button-container').querySelector('button'); btn.disabled = true; btn.textContent = 'Generating...'; const { jsPDF } = window.jspdf; const content = document.getElementById('summary-for-pdf'); try { const canvas = await html2canvas(content, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'landscape', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); let imgWidth = pdfWidth - 20; let imgHeight = canvas.height * imgWidth / canvas.width; pdf.addImage(imgData, 'PNG', 10, 10, imgWidth, imgHeight); pdf.save(`Frontier_Markets_Analysis_${new Date().toISOString().slice(0, 10)}.pdf`); } finally { btn.disabled = false; btn.textContent = 'Download Analysis as PDF'; } }; // --- INITIALIZATION --- initCriteria(); changeTab(0); });
Scroll to Top