×
Step 1: Define Your Primary Portfolio
Provide details about your main portfolio to allow the AI to generate a suitable hedging strategy.
Step 2: AI Hedging Analysis
The system is analyzing your portfolio against market factors to generate an optimal hedge.
Initializing analysis...
Step 3: Recommended Hedging Portfolio
AI-Generated Hedge Recommendation
Portfolio Value
$0
Hedge Allocation
0%
Total Hedge Value
$0
Recommended Asset Allocation
| Hedging Asset | Weight (%) | Value ($) |
|---|
Complete the AI Analysis to see your recommendation.
${rationale}
`; } // --- Utility Functions --- function formatAsUSD(amount) { return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(amount); } function generatePdf() { if (!analysisComplete) { showMessage("Please run the AI Analysis before downloading the PDF."); return; } const { jsPDF } = window.jspdf; const content = document.getElementById('pdf-content'); const pdfButton = document.getElementById('pdf-download-button'); if (pdfButton) pdfButton.style.display = 'none'; html2canvas(content, { scale: 2, backgroundColor: '#ffffff' }).then(canvas => { if (pdfButton) pdfButton.style.display = 'block'; const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgProps = pdf.getImageProperties(imgData); const imgRatio = imgProps.height / imgProps.width; let imgWidth = pdfWidth - 20; // margin let imgHeight = imgWidth * imgRatio; if (imgHeight > pdfHeight - 20) { imgHeight = pdfHeight - 20; imgWidth = imgHeight / imgRatio; } const x = (pdfWidth - imgWidth) / 2; const y = 10; pdf.addImage(imgData, 'PNG', x, y, imgWidth, imgHeight); pdf.save('AI_Hedge_Recommendation.pdf'); }).catch(err => { console.error('PDF generation error:', err); if (pdfButton) pdfButton.style.display = 'block'; }); }