Institutional Investment Flow Analyzer

Institutional Investment Flow Analyzer

Analyze institutional capital flows across market sectors.

Select Analysis Period

Sector Flow Analysis

Export Sector Rotation Analysis

Generate a professional PDF of the investment flow analysis for your records.

${topOutflow.sector}

$${topOutflow.netFlow.toFixed(1)}B

Net Market Flow

Total

$${netMarketFlow.toFixed(1)}B

`; const tableRows = sectorDetails.map(d => ` ${d.sector} $${d.inflow.toFixed(1)}B $${d.outflow.toFixed(1)}B $${d.netFlow.toFixed(1)}B`).join(''); document.getElementById('flow-table-container').innerHTML = `${tableRows}
SectorInflowOutflowNet Flow
`; const ctx = document.getElementById('flow-chart').getContext('2d'); if (flowChart) flowChart.destroy(); flowChart = new Chart(ctx, { type: 'bar', data: { labels: sectorDetails.map(d => d.sector), datasets: [{ label: 'Net Flow ($B)', data: sectorDetails.map(d => d.netFlow), backgroundColor: sectorDetails.map(d => d.netFlow >= 0 ? '#16a34a' : '#dc2626'), }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { display: false } }, indexAxis: 'y', scales: { x: { ticks: { color: '#334155' }, grid: { color: '#e2e8f0' } }, y: { ticks: { color: '#334155' }, grid: { display: false } } } } }); } // --- PDF GENERATION --- async function generatePdfReport() { downloadPdfBtn.disabled = true; downloadPdfBtn.textContent = 'Generating...'; const { periodLabel, totalInflow, totalOutflow, netMarketFlow, sectorDetails } = analysisResults; const tableRows = sectorDetails.map(d => `${d.sector}$${d.inflow.toFixed(1)}B$${d.outflow.toFixed(1)}B$${d.netFlow.toFixed(1)}B`).join(''); const reportHtml = `

Sector Rotation Analysis

Investment Flow Report for ${periodLabel}

TOTAL INFLOW
$${totalInflow.toFixed(1)}B
TOTAL OUTFLOW
$${totalOutflow.toFixed(1)}B
NET MARKET FLOW
$${netMarketFlow.toFixed(1)}B
Net Flow by Sector
Detailed Sector Breakdown
${tableRows}
SectorInflowOutflowNet Flow
`; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); const pdfChartOptions = { animation: { duration: 0 }, maintainAspectRatio: false, plugins: { legend: { display: false } }, indexAxis: 'y', scales: { x: { ticks: { color: '#334155' }, grid: { color: '#e2e8f0' } }, y: { ticks: { color: '#334155' }, grid: { display: false } } } }; new Chart(document.getElementById('pdf-flow-chart'), { type: 'bar', data: flowChart.data, options: pdfChartOptions }); setTimeout(async () => { try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-report-container'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(), pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('Institutional_Flow_Report.pdf'); } catch (e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download PDF Report'; pdfTemplate.classList.add('invisible'); pdfTemplate.innerHTML = ''; } }, 500); } // --- EVENT LISTENERS --- analyzeBtn.addEventListener('click', analyzeFlows); downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- switchTab(0); });
Scroll to Top