Distressed Debt Investing Analysis Tool (Conceptual Simulator)

Distressed Debt Investment Details

$
%

Define Recovery Scenarios

Define potential outcomes for the distressed debt. Probabilities must sum to 100%.

Total Probability: 0%

Analysis & Expected Outcomes

Analysis results will appear here.

Scenario Outcome Details:

Scenario outcomes table appears here.

Enter investment and scenario details, then click 'Analyze Investment'.

"; tableContainer.innerHTML = '

Scenario outcomes table appears here.

'; return; } const res = ddias_model.analysisResults; resultsSection.innerHTML = `

Overall Probabilistic Expected Outcome

Total Purchase Cost: ${ddias_formatCurrency(res.purchaseCostTotal)}
Expected Net Profit/Loss: ${ddias_formatCurrency(res.overallExpectedNetProfit)}
Expected ROI: ${ddias_formatPercent(res.overallExpectedROI)}
Expected Annualized ROI: ${ddias_formatPercent(res.overallAnnualizedExpectedROI)}

Best Case Scenario Profit: ${ddias_formatCurrency(res.bestCaseProfit)}
Worst Case Scenario Profit/Loss: ${ddias_formatCurrency(res.worstCaseLoss)}
`; let tableHTML = ``; res.scenarioOutcomes.forEach(s => { tableHTML += ``; }); tableHTML += `
ScenarioProb. (%)Recov. Val ($)Net Recov. ($)Time (Yrs)P&L ($)ROI (%)Ann. ROI (%)
${s.name} ${ddias_formatPercent(s.probability,0)} ${ddias_formatCurrency(s.recoveryValue)} ${ddias_formatCurrency(s.netRecovery)} ${s.timeToRecoveryYears.toFixed(1)} ${ddias_formatCurrency(s.profitLoss)} ${ddias_formatPercent(s.roiPercent)} ${ddias_formatPercent(s.annualizedRoiPercent)}
`; tableContainer.innerHTML = tableHTML; const pdfBtn = document.getElementById('ddias_downloadPdfButton'); if(pdfBtn) pdfBtn.style.display = 'block'; } // --- PDF Generation --- function ddias_downloadPDF() { if (!ddias_model.analysisResults) { alert("Please analyze investment first."); return; } if (typeof window.jspdf === 'undefined' || typeof window.jspdf.jsPDF === 'undefined') { alert('Core PDF library (jsPDF) is not loaded.'); console.error('jsPDF library not found.'); return; } const { jsPDF: JSPDF } = window.jspdf; const doc = new JSPDF(); if (typeof doc.autoTable !== 'function') { alert('PDF Table plugin (jsPDF-AutoTable) not loaded correctly. Tables in PDF may be missing.'); console.error('doc.autoTable is not a function.'); } let y = 15; const m = 15; const cw = doc.internal.pageSize.getWidth() - (2 * m); const res = ddias_model.analysisResults; const inputs = res.inputsSnapshot || ddias_model; // Use snapshot if taken during analysis function addLine(text, size, style = 'normal', indent = 0, spacing = 2.5) { if (y > 275) { doc.addPage(); y = m; } doc.setFontSize(size); doc.setFont(undefined, style); const lines = doc.splitTextToSize(text, cw - indent); doc.text(lines, m + indent, y); y += (lines.length * (size * 0.35)) + spacing; } addLine(`Distressed Debt Investment Analysis: ${inputs.investment.instrumentName || 'N/A'}`, 16, 'bold', 0, 5); addLine(`Report Date: ${new Date().toLocaleDateString()}`, 9, 'italic', 0, 5); addLine("Investment Setup:", 11, 'bold', 0, 3); let setupData = [ ["Face Value of Holding:", ddias_formatCurrency(inputs.investment.faceValue)], ["Purchase Price (% of Face):", ddias_formatPercent(inputs.investment.purchasePricePercent,1)], ["Calculated Purchase Cost:", ddias_formatCurrency(res.purchaseCostTotal)], ["Position in Capital Structure:", inputs.investment.capStructurePosition], ]; if(typeof doc.autoTable === 'function') { doc.autoTable({startY: y, body: setupData, theme: 'plain', styles:{fontSize:9, cellPadding:1.2}, columnStyles:{0:{fontStyle:'bold'}}}); y = doc.lastAutoTable.finalY + 5; } else { setupData.forEach(row => addLine(`${row[0]} ${row[1]}`, 9)); y+=5;} addLine("Recovery Scenario Analysis:", 11, 'bold', 0, 3); const head = [['Scenario', 'Prob.(%)', 'Recov.Val($)', 'Net Recov.($)', 'Time(Yrs)', 'P&L($)', 'ROI(%)', 'Ann.ROI(%)']]; const body = res.scenarioOutcomes.map(s => [ s.name, s.probability.toFixed(0), ddias_formatCurrency(s.recoveryValue), ddias_formatCurrency(s.netRecovery), s.timeToRecoveryYears.toFixed(1), ddias_formatCurrency(s.profitLoss), ddias_formatPercent(s.roiPercent), ddias_formatPercent(s.annualizedRoiPercent) ]); if (typeof doc.autoTable === 'function') { doc.autoTable({startY: y, head: head, body: body, theme: 'grid', headStyles:{fillColor:[75,85,99], fontSize:8}, styles:{fontSize:7.5, cellPadding:1, halign:'right', overflow:'linebreak'}, columnStyles:{0:{halign:'left', fontStyle:'bold'}}}); y = doc.lastAutoTable.finalY + 6; } else { addLine("Scenario table cannot be generated (plugin issue).", 8, 'italic'); y+=5; } addLine("Overall Probabilistic Expected Results:", 12, 'bold', 0, 4); let overallData = [ ["Expected Net Profit/Loss:", ddias_formatCurrency(res.overallExpectedNetProfit)], ["Expected ROI (%):", ddias_formatPercent(res.overallExpectedROI)], ["Expected Annualized ROI (%):", ddias_formatPercent(res.overallAnnualizedExpectedROI)], ["Best Case Scenario Profit:", ddias_formatCurrency(res.bestCaseProfit)], ["Worst Case Scenario Profit/Loss:", ddias_formatCurrency(res.worstCaseLoss)], ]; if (typeof doc.autoTable === 'function') { doc.autoTable({startY: y, body: overallData, theme: 'plain', styles:{fontSize:9, cellPadding:1.2}, columnStyles:{0:{fontStyle:'bold'}}}); y = doc.lastAutoTable.finalY + 7; } else { overallData.forEach(row => addLine(`${row[0]} ${row[1]}`, 9)); y+=5; } addLine("Note: This is a conceptual simulator based on user-defined inputs and probabilities. It does not constitute financial advice.", 7, 'italic'); doc.save(`DistressedDebt_Analysis_${inputs.investment.instrumentName.replace(/\s+/g, '_')}.pdf`); }
Scroll to Top