Bond Investment Evaluator

Bond Investment Evaluator

Analyze key metrics to determine the value of a bond investment.

Input Bond Parameters

Analysis for USA Corp Bond

Projected Cash Flow (Coupon Payments)

Bond: ${state.inputs.bondName}
Date: ${new Date().toLocaleDateString()}

Key Performance Indicators

Current Yield
${kpis.currentYield.toFixed(2)}%
Yield to Maturity (Est.)
${kpis.ytm.toFixed(2)}%
Present Value
$${kpis.presentValue.toFixed(2)}

Valuation Summary

This bond appears to be:
${valuation.toUpperCase()}
(at a ${state.inputs.marketRate}% market rate)

Projected Cash Flow

`; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); 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' }); pdf.addImage(imgData, 'PNG', 0, 0, pdf.internal.pageSize.getWidth(), (canvas.height * pdf.internal.pageSize.getWidth()) / canvas.width); pdf.save(`${state.inputs.bondName.replace(/\s+/g, '_')}_Analysis.pdf`); } catch(e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download Analysis Statement'; pdfTemplate.classList.add('invisible'); } } downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- runAnalysis(); switchTab(0); });
Scroll to Top