Alternative Investment Strategy Builder

Alternative Investment Strategy Builder

No Strategy Generated

Complete the input tabs to build your alternative investment strategy.

Please select at least one asset class.

'; initialMessage.classList.add('hidden'); resultsContainer.classList.remove('hidden'); pdfButtonContainer.classList.add('hidden'); return; } const baseWeights = BASE_ALLOCATIONS[risk]; const horizonAdjustments = HORIZON_ADJUSTMENTS[horizon]; let adjustedWeights = {}; let totalWeight = 0; selectedAssets.forEach(asset => { const adjusted = baseWeights[asset] * horizonAdjustments[asset]; adjustedWeights[asset] = adjusted; totalWeight += adjusted; }); const finalAllocation = {}; if (totalWeight > 0) { for (const asset in adjustedWeights) { finalAllocation[asset] = (adjustedWeights[asset] / totalWeight) * 100; } } lastStrategyData = { investorName, horizon, risk, allocation: finalAllocation }; // Display logic let chartHtml = '
'; for (const [asset, percent] of Object.entries(finalAllocation)) { chartHtml += `
${asset} ${percent.toFixed(1)}%
`; } chartHtml += '
'; resultsContainer.innerHTML = `

Recommended Strategy

For: ${investorName} (${risk.charAt(0).toUpperCase() + risk.slice(1)} Profile, ${horizon.charAt(0).toUpperCase() + horizon.slice(1)}-Term Horizon)

${chartHtml} `; initialMessage.classList.add('hidden'); resultsContainer.classList.remove('hidden'); pdfButtonContainer.classList.remove('hidden'); }; downloadPdfBtn.addEventListener('click', () => { if (!lastStrategyData) return; const { jsPDF } = window.jspdf; const { investorName, horizon, risk, allocation } = lastStrategyData; const doc = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pageW = doc.internal.pageSize.getWidth(); const margin = 50; let y = 0; // PDF Header doc.setFillColor('#fefce8'); // yellow-50 doc.rect(0, 0, pageW, 70, 'F'); doc.setFont('helvetica', 'bold'); doc.setFontSize(22); doc.setTextColor('#713f12'); // yellow-900 doc.text('Alternative Investment Strategy Brief', margin, 45); y = 100; // Investor Profile Section doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor('#1f2937'); doc.text('Investor Profile Summary', margin, y); y += 20; const profileBody = [ ['Investor/Fund Name', investorName], ['Risk Appetite', risk.charAt(0).toUpperCase() + risk.slice(1)], ['Investment Horizon', `${horizon.charAt(0).toUpperCase() + horizon.slice(1)}-Term`], ]; doc.autoTable({ startY: y, head: [['Profile Attribute', 'Specification']], body: profileBody, theme: 'grid', headStyles: { fillColor: '#ca8a04' }, }); y = doc.autoTable.previous.finalY + 30; // Allocation Section doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor('#1f2937'); doc.text('Recommended Strategic Allocation', margin, y); y += 25; // Allocation Chart const chartX = margin + 150; const chartWidth = pageW - margin - chartX - 20; const barHeight = 18; for (const [asset, percent] of Object.entries(allocation)) { doc.setFontSize(10); doc.setTextColor('#374151'); doc.text(asset, margin, y + barHeight / 2 + 4); doc.setFillColor('#f3f4f6'); doc.rect(chartX, y, chartWidth, barHeight, 'F'); const barLength = (percent / 100) * chartWidth; doc.setFillColor(ASSET_CLASSES[asset].pdfColor); doc.rect(chartX, y, barLength, barHeight, 'F'); doc.setFontSize(9); doc.setTextColor('#ffffff'); doc.text(`${percent.toFixed(1)}%`, chartX + 5, y + barHeight / 2 + 3); y += barHeight + 10; } // Footer const date = `Strategy Generated: ${new Date().toLocaleDateString('en-US')}`; doc.setFontSize(9); doc.setTextColor('#9ca3af'); doc.text(date, pageW / 2, doc.internal.pageSize.getHeight() - 20, { align: 'center' }); doc.save(`Alternative_Strategy_${investorName.replace(/\s/g, '_')}.pdf`); }); showTab(0); });
Scroll to Top