Hedge Fund Market Signal Generator

Hedge Fund Market Signal Generator

Simulate quantitative trading signals from multiple data sources.

Awaiting Signal Configuration

Navigate to the configuration tab to select an asset, analysis models, and risk parameters.

${currentData.finalSignal}

Signal Confidence

${currentData.confidence}%

Signal Rationale

${rationaleCards}
`; downloadSection.classList.remove('hidden'); showTab(1); }; generateBtn.addEventListener('click', generateSignal); // --- 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; pdf.setFont('helvetica', 'bold'); pdf.setFontSize(20); pdf.text("Market Signal Memorandum", pageWidth / 2, y, { align: 'center' }); y += 20; pdf.setFont('helvetica', 'normal'); pdf.setFontSize(10); pdf.text(`CONFIDENTIAL | FOR INTERNAL USE ONLY | ${today.toISOString()}`, pageWidth / 2, y, { align: 'center' }); y += 30; pdf.autoTable({ startY: y, theme: 'grid', head: [['Parameter', 'Selection']], body: [ ['Asset:', userInputs.assetName], ['Risk Tolerance:', userInputs.risk], ['Analysis Models:', userInputs.models.join(', ')], ], didDrawPage: (data) => { y = data.cursor.y; } }); y += 20; pdf.autoTable({ startY: y, theme: 'plain', body: [ [{ content: 'Generated Signal:', styles: { fontStyle: 'bold', fontSize: 14 } }, { content: currentData.finalSignal, styles: { fontStyle: 'bold', fontSize: 18 } }], [{ content: 'Signal Confidence:', styles: { fontStyle: 'bold', fontSize: 14 } }, { content: `${currentData.confidence}%`, styles: { fontStyle: 'bold', fontSize: 18 } }], ], didDrawPage: (data) => { y = data.cursor.y; } }); y += 30; pdf.setFont('helvetica', 'bold'); pdf.setFontSize(16); pdf.text("Signal Rationale", margin, y); y += 20; currentData.rationales.forEach(r => { const splitText = pdf.splitTextToSize(r.text, pageWidth - margin * 2 - 10); if (y + 20 + splitText.length * 12 > pdf.internal.pageSize.getHeight() - margin) { pdf.addPage(); y = margin; } pdf.setFont('helvetica', 'bold'); pdf.setFontSize(11); pdf.text(r.source, margin, y); y += 15; pdf.setFont('helvetica', 'normal'); pdf.setFontSize(10); pdf.text(splitText, margin + 10, y); y += splitText.length * 12 + 15; }); pdf.save(`Market-Signal-${userInputs.asset.toUpperCase()}.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