Merger Arbitrage Strategy Simulator (Conceptual Calculator)
Deal Setup
Deal Terms & Current Prices
$
$
$
Stock portion for Mixed Deal uses Exchange Ratio and Acquirer Price from "All Stock Deal" section above.
$
Arbitrage Strategy & Assumptions
%
%
Interest on capital used for the trade, if applicable.
$
e.g., total brokerage fees for entry & exit.
Deal Failure Scenario
$
Price the target stock might drop to if the deal breaks.
Profitability Analysis
Analysis results will appear here.
Enter deal and strategy details, then click 'Analyze Strategy'.
"; return; } const r = mastr_results.calculations; const i = mastr_results.inputs; resultsArea.innerHTML = `Arbitrage Analysis Summary
Deal Value per Target Share: ${mastr_formatCurrency(r.dealValuePerShare)}
Current Target Share Price: ${mastr_formatCurrency(i.currentTargetPrice)}
Gross Spread per Share: ${mastr_formatCurrency(r.spreadPerShare)}
Capital Deployed (Target Shares): ${mastr_formatCurrency(r.capitalDeployed)}
Success Scenario (Prob: ${i.probSuccess.toFixed(0)}%)
Gross Profit: ${mastr_formatCurrency(r.grossProfitIfSuccess)}
Cost of Capital (for ${i.timeToCompletionMonths} mths): ${mastr_formatCurrency(r.costOfCapital)}
Other Transaction Costs: ${mastr_formatCurrency(i.otherTxCosts)}
Net Profit if Success: ${mastr_formatCurrency(r.netProfitIfSuccess)}
Failure Scenario (Prob: ${(100-i.probSuccess).toFixed(0)}%)
Target Price if Deal Fails: ${mastr_formatCurrency(i.failedDealTargetPrice)}
Loss on Shares (vs. Current Price): ${mastr_formatCurrency(r.lossIfFailureAmount)}
Net Loss if Failure (incl. costs): ${mastr_formatCurrency(r.netLossIfFailure)}
Probabilistic & Annualized Outlook
Expected Return (Value): ${mastr_formatCurrency(r.expectedReturnValue)}
Expected Return (% on Capital Deployed): ${mastr_formatPercent(r.expectedReturnPercent)}
Annualized Expected Return (%): ${mastr_formatPercent(r.annualizedExpectedReturnPercent)}
Risk/Reward Ratio (Profit / |Loss|): ${isFinite(r.riskRewardRatio) ? r.riskRewardRatio.toFixed(2) : 'N/A (No Loss or Infinite)'}
`;
resultsArea.style.display = 'block';
const pdfBtn = document.getElementById('mastr_downloadPdfButton');
if(pdfBtn) pdfBtn.style.display = 'block';
}
// --- PDF Generation ---
function mastr_downloadPDF() {
if (!mastr_results) { alert("Please analyze the strategy 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 r = mastr_results.calculations;
const i = mastr_results.inputs;
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;
}
function addPair(label, value, size=9) { addLine(`${label}: ${value}`, size); }
addLine(`Merger Arbitrage Strategy Analysis: ${i.targetName} by ${i.acquirerName}`, 16, 'bold', 0, 5);
addLine(`Announcement Date: ${i.annDate || 'N/A'} | Report Date: ${new Date().toLocaleDateString()}`, 8, 'italic', 0, 5);
addLine("Deal Terms & Market Prices:", 11, 'bold', 0, 3);
addPair("Deal Type", i.dealType.charAt(0).toUpperCase() + i.dealType.slice(1));
if (i.dealType === 'cash') addPair("Offer Price per Share", mastr_formatCurrency(i.offerPriceCash));
if (i.dealType === 'stock' || i.dealType === 'mixed') {
addPair("Exchange Ratio", i.exchangeRatio.toString());
addPair("Acquirer Stock Price (at analysis)", mastr_formatCurrency(i.acquirerPriceStockDeal));
if (i.dealType === 'mixed') addPair("Cash Portion per Share", mastr_formatCurrency(i.cashPortionMixed));
}
addPair("Calculated Deal Value per Share", mastr_formatCurrency(r.dealValuePerShare));
addPair("Current Target Stock Price", mastr_formatCurrency(i.currentTargetPrice));
addPair("Gross Spread per Share", mastr_formatCurrency(r.spreadPerShare), 9);
y+=3;
addLine("Strategy Inputs & Assumptions:", 11, 'bold', 0, 3);
addPair("Target Shares to Buy", i.sharesToBuy.toString());
addPair("Capital Deployed (Target Shares)", mastr_formatCurrency(r.capitalDeployed));
addPair("Probability of Deal Success", mastr_formatPercent(i.probSuccess));
addPair("Est. Time to Completion", `${i.timeToCompletionMonths} months`);
addPair("Annualized Cost of Capital", mastr_formatPercent(i.annualizedCostOfCapital));
addPair("Other Transaction Costs", mastr_formatCurrency(i.otherTxCosts));
addPair("Target Stock Price if Deal Fails", mastr_formatCurrency(i.failedDealTargetPrice));
y+=5;
addLine("Profitability Analysis:", 14, 'bold', 0, 4);
let data = [
["Scenario", "Details", "Value"],
["Success (Prob. " + i.probSuccess.toFixed(0) + "%)", "Gross Profit", mastr_formatCurrency(r.grossProfitIfSuccess)],
["", "Cost of Capital", mastr_formatCurrency(r.costOfCapital)],
["", "Other Tx Costs", mastr_formatCurrency(i.otherTxCosts)],
["", "Net Profit if Success", mastr_formatCurrency(r.netProfitIfSuccess)],
["Failure (Prob. " + (100-i.probSuccess).toFixed(0) + "%)", "Loss on Shares (vs Current)", mastr_formatCurrency(r.lossIfFailureAmount)],
["", "Net Loss if Failure (incl. costs)", mastr_formatCurrency(r.netLossIfFailure)],
["Probabilistic", "Expected Return (Value)", mastr_formatCurrency(r.expectedReturnValue)],
["", "Expected Return (%)", mastr_formatPercent(r.expectedReturnPercent)],
["", "Annualized Expected Return (%)", mastr_formatPercent(r.annualizedExpectedReturnPercent)],
["Metrics", "Risk/Reward Ratio", isFinite(r.riskRewardRatio) ? r.riskRewardRatio.toFixed(2) : 'N/A'],
];
if (typeof doc.autoTable === 'function') {
doc.autoTable({
startY: y, head: [data[0]], body: data.slice(1), theme: 'grid',
headStyles: {fillColor:[75,85,99]}, styles:{fontSize:9, cellPadding:1.5},
columnStyles: {0:{fontStyle:'bold'}, 2:{halign:'right'}}
});
y = doc.lastAutoTable.finalY + 7;
} else { data.forEach(row => addLine(row.join(' | '), 9)); y+=5;}
addLine("Note: This is a conceptual simulator based on user-defined inputs. It does not constitute financial advice. All calculations are pre-tax.", 7, 'italic');
doc.save(`MergerArbitrage_${i.targetName.replace(/\s+/g, '_')}.pdf`);
}