Interbank Lending Risk Analysis Model
Bank's Financial Data
Risk Parameters & Weights
Warning: Total weights must add up to 100%.
Stress Test Scenario
Risk Analysis Results
Please enter your data and parameters, then click "Analyze Risk" to see the results.
Average Counterparty Rating: ${counterpartyRating.toFixed(0)} / 5
Overall Interbank Lending Risk Assessment:
${overallRiskScore.toFixed(2)} / 100
Risk Level: ${riskLevel}
${recommendation}
Stress Test Scenario Impact:
Additional Loan Losses (Simulated): $${capitalImpactFromNPL.toLocaleString('en-US', { maximumFractionDigits: 0 })}
Stressed CET1 Capital Ratio: ${stressedCET1Ratio.toFixed(2)}%
Liquidity Gap (under stress): $${liquidityGap.toLocaleString('en-US', { maximumFractionDigits: 0 })} (Negative indicates a deficit)
Note: This model provides a simplified, conceptual estimate of interbank lending risk. Real-world risk analysis involves highly complex, dynamic, and interconnected factors, requiring extensive data, advanced econometric models, and expert qualitative assessment. It should be used for illustrative purposes only and not as a substitute for professional financial analysis or regulatory compliance.
`; } // PDF Download Functionality downloadPdfBtn.addEventListener('click', function() { const { jsPDF } = window.jspdf; const doc = new jsPDF(); // Recalculate values for PDF to ensure consistency const totalAssets = getValidatedFloat(totalAssetsInput); const tier1Capital = getValidatedFloat(tier1CapitalInput); const liquidAssets = getValidatedFloat(liquidAssetsInput); const netCashOutflows = getValidatedFloat(netCashOutflowsInput); const nonPerformingLoans = getValidatedFloat(nonPerformingLoansInput); const totalLoans = getValidatedFloat(totalLoansInput); const interbankLoansGiven = getValidatedFloat(interbankLoansGivenInput); const interbankLoansReceived = getValidatedFloat(interbankLoansReceivedInput); const interbankInterestRate = getValidatedFloat(interbankInterestRateInput); const marketRiskFreeRate = getValidatedFloat(marketRiskFreeRateInput); const counterpartyRating = getValidatedFloat(counterpartyRatingInput); const lcrWeight = getValidatedFloat(lcrWeightInput) / 100; const cet1Weight = getValidatedFloat(cet1WeightInput) / 100; const nplWeight = getValidatedFloat(nplWeightInput) / 100; const interbankExposureWeight = getValidatedFloat(interbankExposureWeightInput) / 100; const interestSpreadWeight = getValidatedFloat(interestSpreadWeightInput) / 100; const counterpartyRatingWeight = getValidatedFloat(counterpartyRatingWeightInput) / 100; const stressNplIncrease = getValidatedFloat(stressNplIncreaseInput) / 100; const stressLiquidityShock = getValidatedFloat(stressLiquidityShockInput) / 100; const lcr = netCashOutflows > 0 ? (liquidAssets / netCashOutflows) * 100 : 0; const cet1Ratio = totalAssets > 0 ? (tier1Capital / totalAssets) * 100 : 0; const nplRatio = totalLoans > 0 ? (nonPerformingLoans / totalLoans) * 100 : 0; const interbankExposureRatio = totalAssets > 0 ? ((interbankLoansGiven + interbankLoansReceived) / totalAssets) * 100 : 0; const interestRateSpread = interbankInterestRate - marketRiskFreeRate; let scoreLCR = Math.max(0, Math.min(100, (100 - lcr) / 100 * 100)); if (lcr >= 100) scoreLCR = 0; let scoreCET1 = Math.max(0, Math.min(100, (8 - cet1Ratio) / 8 * 100)); if (cet1Ratio >= 12) scoreCET1 = 0; else if (cet1Ratio > 8) scoreCET1 = 20; let scoreNPL = Math.max(0, Math.min(100, nplRatio * 10)); let scoreInterbankExposure = Math.max(0, Math.min(100, interbankExposureRatio * 10)); let scoreInterestSpread = Math.max(0, Math.min(100, interestRateSpread / 5 * 100)); if (interestRateSpread <= 0) scoreInterestSpread = 0; let scoreCounterpartyRating = Math.max(0, Math.min(100, (5 - counterpartyRating) * 25)); let overallRiskScore = ( (scoreLCR * lcrWeight) + (scoreCET1 * cet1Weight) + (scoreNPL * nplWeight) + (scoreInterbankExposure * interbankExposureWeight) + (scoreInterestSpread * interestSpreadWeight) + (scoreCounterpartyRating * counterpartyRatingWeight) ); overallRiskScore = Math.max(0, Math.min(100, overallRiskScore)); const stressedNPLAmount = nonPerformingLoans * (1 + stressNplIncrease); const additionalLoanLosses = stressedNPLAmount - nonPerformingLoans; const capitalImpactFromNPL = additionalLoanLosses; const stressedNetCashOutflows = netCashOutflows * (1 + stressLiquidityShock); const additionalLiquidityNeed = stressedNetCashOutflows - netCashOutflows; const liquidityGap = liquidAssets - stressedNetCashOutflows; const stressedTier1Capital = tier1Capital - capitalImpactFromNPL; const stressedCET1Ratio = totalAssets > 0 ? (stressedTier1Capital / totalAssets) * 100 : 0; let riskLevel = "Low"; let recommendation = "The bank demonstrates strong resilience to interbank lending risks, with robust capital and liquidity positions. Continue prudent risk management practices and monitor market conditions."; if (overallRiskScore >= 70) { riskLevel = "Very High"; recommendation = "The bank faces very high interbank lending risk. Immediate action is required to address critical weaknesses in liquidity, capital, asset quality, and/or counterparty exposure. Consider reducing interbank activities, recapitalization, and intensive asset quality review."; } else if (overallRiskScore >= 50) { riskLevel = "High"; recommendation = "The bank faces high interbank lending risk. Significant vulnerabilities are present in its interbank profile. Review and strengthen liquidity buffers, enhance capital, improve asset quality, and diversify counterparty relationships. Stress test results indicate potential significant impact."; } else if (overallRiskScore >= 30) { riskLevel = "Medium"; recommendation = "The bank has moderate interbank lending risk. While generally stable, some areas require attention. Implement measures to reinforce liquidity and capital, actively manage NPLs, and continuously assess counterparty creditworthiness. Regular stress testing is advised."; } // PDF Content Setup doc.setFontSize(22); doc.setTextColor(30, 64, 138); // Dark Blue doc.text("Interbank Lending Risk Analysis Report", 105, 20, null, null, "center"); doc.setFontSize(12); doc.setTextColor(55, 65, 81); // Gray-700 let y = 30; // Bank Data Inputs Section doc.setFontSize(16); doc.setTextColor(30, 64, 138); // Dark Blue doc.text("1. Bank Data Inputs", 20, y += 15); doc.setFontSize(12); doc.setTextColor(55, 65, 81); // Gray-700 doc.autoTable({ startY: y + 5, head: [['Parameter', 'Value ($)']], body: [ ['Total Assets', `$${totalAssets.toLocaleString('en-US', { maximumFractionDigits: 0 })}`], ['Tier 1 Capital', `$${tier1Capital.toLocaleString('en-US', { maximumFractionDigits: 0 })}`], ['High-Quality Liquid Assets', `$${liquidAssets.toLocaleString('en-US', { maximumFractionDigits: 0 })}`], ['Projected Net Cash Outflows (30-day)', `$${netCashOutflows.toLocaleString('en-US', { maximumFractionDigits: 0 })}`], ['Non-Performing Loans', `$${nonPerformingLoans.toLocaleString('en-US', { maximumFractionDigits: 0 })}`], ['Total Loans', `$${totalLoans.toLocaleString('en-US', { maximumFractionDigits: 0 })}`], ['Interbank Loans Given', `$${interbankLoansGiven.toLocaleString('en-US', { maximumFractionDigits: 0 })}`], ['Interbank Loans Received', `$${interbankLoansReceived.toLocaleString('en-US', { maximumFractionDigits: 0 })}`], ['Average Interbank Lending Rate', `${interbankInterestRate.toFixed(2)}%`], ['Market Risk-Free Rate', `${marketRiskFreeRate.toFixed(2)}%`], ['Average Counterparty Credit Rating', `${counterpartyRating.toFixed(0)} / 5`] ], theme: 'grid', styles: { fillColor: [243, 244, 246] }, headStyles: { fillColor: [59, 130, 246], textColor: [255, 255, 255] }, margin: { left: 20, right: 20 } }); y = doc.autoTable.previous.finalY; // Risk Parameters & Weights Section doc.setFontSize(16); doc.setTextColor(30, 64, 138); doc.text("2. Risk Parameters & Weights", 20, y += 15); doc.setFontSize(12); doc.setTextColor(55, 65, 81); doc.autoTable({ startY: y + 5, head: [['Parameter', 'Value', 'Weight (%)']], body: [ ['LCR Weight', '-', (lcrWeight * 100).toFixed(0)], ['CET1 Capital Ratio Weight', '-', (cet1Weight * 100).toFixed(0)], ['NPL Ratio Weight', '-', (nplWeight * 100).toFixed(0)], ['Interbank Exposure Weight', '-', (interbankExposureWeight * 100).toFixed(0)], ['Interest Rate Spread Weight', '-', (interestSpreadWeight * 100).toFixed(0)], ['Counterparty Rating Weight', '-', (counterpartyRatingWeight * 100).toFixed(0)], ['Stress NPL Increase', `${(stressNplIncrease * 100).toFixed(0)}%`, '-'], ['Stress Liquidity Shock', `${(stressLiquidityShock * 100).toFixed(0)}%`, '-'] ], theme: 'grid', styles: { fillColor: [243, 244, 246] }, headStyles: { fillColor: [59, 130, 246], textColor: [255, 255, 255] }, margin: { left: 20, right: 20 } }); y = doc.autoTable.previous.finalY; // Key Financial Ratios Section doc.setFontSize(16); doc.setTextColor(30, 64, 138); doc.text("3. Key Financial Ratios", 20, y += 15); doc.setFontSize(12); doc.setTextColor(55, 65, 81); doc.autoTable({ startY: y + 5, head: [['Ratio', 'Value']], body: [ ['Liquidity Coverage Ratio (LCR)', `${lcr.toFixed(2)}%`], ['CET1 Capital Ratio', `${cet1Ratio.toFixed(2)}%`], ['Non-Performing Loan (NPL) Ratio', `${nplRatio.toFixed(2)}%`], ['Interbank Exposure (% of Assets)', `${interbankExposureRatio.toFixed(2)}%`], ['Interest Rate Spread', `${interestRateSpread.toFixed(2)}%`], ['Average Counterparty Rating', `${counterpartyRating.toFixed(0)} / 5`] ], theme: 'grid', styles: { fillColor: [243, 244, 246] }, headStyles: { fillColor: [59, 130, 246], textColor: [255, 255, 255] }, margin: { left: 20, right: 20 } }); y = doc.autoTable.previous.finalY; // Risk Analysis Results Section doc.setFontSize(16); doc.setTextColor(30, 64, 138); doc.text("4. Risk Analysis Results", 20, y += 15); doc.setFontSize(12); doc.setTextColor(55, 65, 81); let pdfRiskColor; if (riskLevel === "Very High") { pdfRiskColor = [153, 27, 27]; // Dark Red } else if (riskLevel === "High") { pdfRiskColor = [220, 38, 38]; // Red } else if (riskLevel === "Medium") { pdfRiskColor = [234, 88, 12]; // Orange } else { pdfRiskColor = [22, 163, 74]; // Green } doc.setTextColor(pdfRiskColor[0], pdfRiskColor[1], pdfRiskColor[2]); doc.text(`Overall Interbank Lending Risk Score: ${overallRiskScore.toFixed(2)} / 100`, 20, y += 10); doc.text(`Risk Level: ${riskLevel}`, 20, y += 8); doc.setTextColor(55, 65, 81); doc.setFontSize(12); doc.text("Recommendation:", 20, y += 15); const splitRecommendation = doc.splitTextToSize(recommendation, 170); doc.text(splitRecommendation, 20, y += 7); y += (splitRecommendation.length * 5) + 5; // Stress Test Results doc.setFontSize(16); doc.setTextColor(30, 64, 138); doc.text("5. Stress Test Scenario Impact", 20, y += 15); doc.setFontSize(12); doc.setTextColor(55, 65, 81); doc.autoTable({ startY: y + 5, head: [['Metric', 'Value ($)']], body: [ ['Additional Loan Losses (Simulated)', `$${additionalLoanLosses.toLocaleString('en-US', { maximumFractionDigits: 0 })}`], ['Stressed CET1 Capital Ratio', `${stressedCET1Ratio.toFixed(2)}%`], ['Liquidity Gap (under stress)', `$${liquidityGap.toLocaleString('en-US', { maximumFractionDigits: 0 })} (Negative indicates a deficit)`] ], theme: 'grid', styles: { fillColor: [243, 244, 246] }, headStyles: { fillColor: [59, 130, 246], textColor: [255, 255, 255] }, margin: { left: 20, right: 20 } }); y = doc.autoTable.previous.finalY; doc.setFontSize(10); doc.setTextColor(107, 114, 128); const disclaimer = "Note: This model provides a simplified, conceptual estimate of interbank lending risk. Real-world risk analysis involves highly complex, dynamic, and interconnected factors, requiring extensive data, advanced econometric models, and expert qualitative assessment. It should be used for illustrative purposes only and not as a substitute for professional financial analysis or regulatory compliance."; const splitDisclaimer = doc.splitTextToSize(disclaimer, 170); doc.text(splitDisclaimer, 20, y += 15); doc.save('Interbank_Lending_Risk_Report.pdf'); }); // Initialize the first tab as active on load activateTab(0); checkTotalWeights(); // Initial check for weights });