Portfolio Liquidity Risk Analyzer
Enter Portfolio Assets
Categorize each asset's liquidity based on how quickly it can be converted to cash without significant price loss:
- High Liquidity: Very quick (e.g., 1-2 days, minimal price impact). Ex: Cash, major market stocks, money market funds.
- Medium Liquidity: Reasonable timeframe (e.g., few days to weeks, some price impact possible if rushed). Ex: Mid-cap stocks, many corporate bonds, popular ETFs.
- Low Liquidity: May take significant time (weeks, months+) and/or require price discount. Ex: Direct real estate, private equity, collectibles.
Portfolio Liquidity Analysis
Liquidity Breakdown by Category
Observations & Points to Consider
This tool provides a qualitative assessment of portfolio liquidity based on your inputs and classifications. It does not use real-time market data. For financial advice, consult a qualified professional.
${this.formatCurrency(totalPortfolioValue)}
Weighted Average Liquidity Score
${this.formatScore(portfolioWeightedAvgLiquidityScore)} (Max 3.0 for High)
Liquidity Breakdown by Category
`; ['High', 'Medium', 'Low'].forEach(level => { const percentOfPortfolio = totalPortfolioValue > 0 ? (liquidityCategoryValues[level] / totalPortfolioValue) * 100 : 0; this.elements.liquidityBreakdownContainer.innerHTML += `
${level} Liquidity:
`;
});
this.generateObservations(portfolioWeightedAvgLiquidityScore, liquidityCategoryValues, totalPortfolioValue);
this.elements.resultsSection.style.display = 'block';
},
generateObservations: function(avgScore, categoryValues, totalValue) {
let observationsHtml = '
${percentOfPortfolio.toFixed(1)}%
Observations & Points to Consider
- ';
let hasObservations = false;
const lowLiquidityPercent = totalValue > 0 ? (categoryValues.Low / totalValue) * 100 : 0;
const mediumLiquidityPercent = totalValue > 0 ? (categoryValues.Medium / totalValue) * 100 : 0;
if (avgScore < 1.5 && !isNaN(avgScore)) {
observationsHtml += `
- Your portfolio's weighted average liquidity score (${this.formatScore(avgScore)}) is relatively low. This suggests a significant portion may be in less liquid assets, which could be challenging to sell quickly without potential price impact. `; hasObservations = true; } else if (avgScore < 2.5 && avgScore >= 1.5 && !isNaN(avgScore)) { observationsHtml += `
- Your portfolio has a moderate weighted average liquidity score (${this.formatScore(avgScore)}). Consider reviewing the balance between liquid and less liquid assets based on your cash flow needs. `; hasObservations = true; } else if (avgScore >= 2.5 && !isNaN(avgScore)){ observationsHtml += `
- Your portfolio has a relatively high weighted average liquidity score (${this.formatScore(avgScore)}), suggesting a good portion is in assets that can likely be converted to cash more easily. `; hasObservations = true; } if (lowLiquidityPercent > 30) { observationsHtml += `
- A significant portion (${lowLiquidityPercent.toFixed(1)}%) of your portfolio is in assets you've classified as 'Low Liquidity'. This could pose a risk if you need to access a large amount of cash unexpectedly. `; hasObservations = true; } else if (lowLiquidityPercent > 15) { observationsHtml += `
- Your portfolio contains a notable portion (${lowLiquidityPercent.toFixed(1)}%) of 'Low Liquidity' assets. Be mindful of your potential cash needs. `; hasObservations = true; } if ( (lowLiquidityPercent + mediumLiquidityPercent) > 70 && lowLiquidityPercent <= 30 ) { // High medium and some low observationsHtml += `
- A large part of your portfolio is in 'Medium' or 'Low' liquidity assets. Ensure you have a plan for accessing funds if needed, as selling these assets might take time or incur costs. `; hasObservations = true; } if (!hasObservations && !isNaN(avgScore)) { observationsHtml += `
- Your portfolio's liquidity distribution, based on your classifications, does not trigger immediate concentration alerts. `; } else if (isNaN(avgScore)){ observationsHtml += `
- Could not calculate a liquidity score due to input data. `; } observationsHtml += '
- Regularly review your liquidity needs (e.g., for emergencies, upcoming large purchases) and ensure your portfolio structure aligns with them. '; observationsHtml += '
Portfolio Liquidity Risk Analysis Report
`; pdfHtml += `Summary
`;
pdfHtml += `
`;
pdfHtml += `Total Portfolio Value: ${this.formatCurrency(totalPortfolioValue, false)}
`;
pdfHtml += `Weighted Average Liquidity Score: ${weightedAvgScore.replace(' (Max 3.0 for High)','')}
`;
pdfHtml += `Asset Breakdown & Liquidity Assessment
| Asset Name | Value Invested ($) | Weight (%) | Liquidity Level | Liquidity Score | Weighted Score |
|---|---|---|---|---|---|
| ${asset.name} | ${this.formatCurrency(asset.value, false)} | ${(asset.weight * 100).toFixed(2)} % | ${asset.liquidityLevel} | ${asset.liquidityScore} | ${asset.weightedScore.toFixed(3)} |
Liquidity Distribution
`;
['High', 'Medium', 'Low'].forEach(level => {
const percentOfPortfolio = totalPortfolioValue > 0 ? (liquidityCategoryValues[level] / totalPortfolioValue) * 100 : 0;
pdfHtml += `
`;
const observationsClone = this.elements.observationsContainer.cloneNode(true);
observationsClone.querySelector('h4').remove();
pdfHtml += `% in ${level} Liquidity: ${percentOfPortfolio.toFixed(1)} %
`;
});
pdfHtml += `Observations & Points to Consider
${observationsClone.innerHTML}
`;
pdfHtml += `This analysis is qualitative, based on your asset classifications and values. For financial advice, consult a professional.
`;
pdfExportContainer.innerHTML = pdfHtml;
document.body.appendChild(pdfExportContainer);
try {
const canvas = await html2canvas(pdfExportContainer, { scale: 1.5, useCORS: true, logging: false });
document.body.removeChild(pdfExportContainer);
const imgData = canvas.toDataURL('image/png');
const { jsPDF } = window.jspdf;
const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' });
const pdfWidth = pdf.internal.pageSize.getWidth();
const pdfHeight = pdf.internal.pageSize.getHeight();
const imgProps = pdf.getImageProperties(imgData);
const imgWidth = pdfWidth - 40;
const imgHeight = (imgProps.height * imgWidth) / imgProps.width;
let heightLeft = imgHeight;
let position = 20;
pdf.addImage(imgData, 'PNG', 20, position, imgWidth, imgHeight);
heightLeft -= (pdfHeight - 40);
while (heightLeft > 0) {
position = heightLeft - imgHeight;
pdf.addPage();
pdf.addImage(imgData, 'PNG', 20, position, imgWidth, imgHeight);
heightLeft -= (pdfHeight - 40);
}
pdf.save('Portfolio_Liquidity_Analysis.pdf');
} catch (error) {
console.error("Error generating PDF:", error);
alert("An error occurred while generating the PDF.");
if (document.body.contains(pdfExportContainer)) document.body.removeChild(pdfExportContainer);
}
}
};
document.addEventListener('DOMContentLoaded', function() {
plrApp.init();
});
