Skip to content

Leotaby/Agora

Repository files navigation

Python 3.11+ FastAPI Vue 3 C++17 OpenGL License: AGPL-3.0 CI Live Demo

AGORA - Agent-Based Banking Stability Simulator

Agent-based simulation of systemic risk and contagion in European interbank networks.

Screenshots

Pre-shock network: all banks healthy (2011 calibration) AGORA Overview

Contagion cascade: UniCredit shock spreading through the network Contagion in progress

ECB intervention: 224bn EUR Emergency Liquidity Assistance deployed ECB Intervention

Scientific question

How do solvency and liquidity shocks propagate through interbank networks? When does central bank intervention prevent systemic collapse, and by how much? These are the questions that reduced-form panel econometrics cannot answer, because they require a structural model with explicit network topology, heterogeneous bank balance sheets, and endogenous feedback loops between asset prices, funding markets, and capital adequacy.

Motivation

My MSc thesis at Federico II di Napoli estimated macro-financial feedback effects across the EA-20 from 2000 to 2022 using two-way fixed effects and System-GMM on a panel of 20 eurozone economies. One core finding was that a 1 percentage point rise in unemployment causes a 1.25pp increase in non-performing loan ratios, with a multiplier that varies significantly across core and periphery countries. AGORA asks the follow-up question: what happens when those NPL losses concentrate in a single nationally important bank and cascade through the interbank network? The thesis gave the elasticity. This simulator gives the propagation mechanism.

Counterfactual result: ECB lender of last resort (2011 Italian sovereign crisis)

Scenario: 8% loan writedown, 15% BTP haircut, 40% corporate deposit run, and 50% wholesale funding freeze on UniCredit, with JPMorgan restricting dollar repo to all European counterparties and UBS marking down European sovereign holdings.

With ECB Without ECB Delta
Total system losses 531 bn EUR 815 bn EUR +283.3 bn EUR
Contagion rounds 11 20 +9
Banks at CET1 ~ 0% 1 (UCG) 4 (DBK, BNP, UCG, CBK) +3
ECB ELA deployed 224 bn EUR 0 -224 bn EUR

The ECB's lender-of-last-resort function prevented three additional banks from reaching effective insolvency (CET1 approaching zero) and 283.3 bn EUR in system losses by breaking the confidence-fire sale feedback loop.

Working Paper

Endogenous Contagion and Central Bank Intervention in European Interbank Networks: An Agent-Based Approach

Hatef Tabbakhian (2025), Working paper, University of Naples Federico II

Abstract: We study the propagation of banking shocks through an explicit interbank network calibrated using publicly available 2011 balance-sheet and supervisory data for seven major European and cross-border banks. Using an agent-based simulation framework, we trace contagion through five transmission channels: counterparty losses, liquidity withdrawal, sovereign bond fire sales, CDS spread contagion, and a dollar funding freeze. Our central result is a counterfactual experiment: removing the ECB lender-of-last-resort facility from the Italian sovereign crisis scenario generates approximately 283.3bn EUR in additional system losses, extends the contagion cascade from 11 to 20 rounds, and pushes three additional banks to effective insolvency (CET1 approaching zero). More broadly, the paper shows how an explicit network model captures institution-level propagation mechanisms that reduced-form panel approaches do not represent directly. The paper contributes a calibrated structural complement to existing panel evidence on the macroeconomic determinants of bank stability and quantifies the systemic value of central bank intervention under explicit network topology.

Key finding from sensitivity analysis: The ECB contribution is invariant to initial shock magnitude but highly sensitive to network density. Doubling interbank exposures increases the ECB contribution by 64%. The value of lender-of-last-resort intervention comes from breaking the propagation cascade, not from absorbing the first-round impact.

Contagion channels

  1. Counterparty losses. Banks that lent to stressed or failed banks take direct write-downs on interbank exposure, proportional to the borrower's probability of default.
  2. Liquidity withdrawal. Wholesale funding markets freeze for banks connected to stressed counterparties, as guilt-by-association causes repo and commercial paper investors to pull back.
  3. Fire sales. Stressed banks dump sovereign bonds to rebuild LCR buffers, and the forced selling depresses prices, causing mark-to-market losses across all banks holding the same asset class.
  4. Confidence contagion. CDS spreads from stressed banks infect connected neighbours through the interbank graph, widening credit spreads and worsening market confidence across connected institutions.
  5. Dollar funding freeze. JPMorgan restricts secured dollar repo lines to all European borrowers when sovereign risk spikes, draining reserves from banks that depend on cross-border dollar funding.

Data calibration (2011)

The five eurozone banks are calibrated to real published data from Q4 2011, not synthetic parameters. Sources:

  • Deutsche Bank Financial Report 2011
  • BNP Paribas Annual Report 2011
  • UniCredit Annual Report 2011
  • Commerzbank Annual Report 2011
  • BayernLB Annual Report 2011
  • EBA Capital Exercise December 2011
  • BIS Consolidated Banking Statistics Q4 2011

UBS is calibrated using the UBS Annual Report 2011. JPMorgan is calibrated using the JPMorgan Chase 2011 Annual Report with EUR values converted at the end-2011 USD/EUR exchange rate of 1.295. Dollar repo exposure to European counterparties is calibrated to the order of magnitude implied by BIS Q4 2011 cross-border claims data.

Bank network

Bank Country Assets (bn EUR) CET1 (2011) LCR (2011) Italian sov. (bn EUR) Post-shock outcome
JPMorgan Chase US 3,550 15.3% 187.9% 0.0 Survived unaided
UBS CH 1,550 14.9% 100.3% 0.0 Survived unaided
BNP Paribas FR 1,465 6.3% 63.3% 21.3 Critical, ECB ELA required
Deutsche Bank DE 1,164 5.3% 55.0% 8.1 Critical, ECB ELA required
UniCredit IT 926 6.4% 128.5% 47.0 CET1 wiped to 0%
Commerzbank DE 538 7.5% 77.3% 10.2 Critical, ECB ELA required
BayernLB DE 302 6.2% 50.9% 2.5 Stressed, ECB ELA required

Architecture

backend/          Python contagion engine, bank models, FastAPI server
  app/models/     Bank balance sheets, interbank network graph, calibration data
  app/services/   Five-channel contagion propagation with ECB intervention logic
  app/api/        REST endpoints for per-round simulation snapshots
  scripts/        Standalone simulation runner with counterfactual experiment
frontend/         Vue 3 + D3 interactive dashboard for network visualization
visualizer/       C++17/OpenGL native 3D renderer for the contagion cascade
docs/             GitHub Pages site with Three.js 3D demo

Quick start

cd backend && uv sync
python scripts/run_banking_sim.py
uv run python run.py

Research agenda

# Working title Target journal
1 Endogenous contagion and central bank intervention in European interbank networks Journal of Financial Stability
2 Calibrating agent-based banking models to supervisory data Journal of Banking and Finance
3 Counterfactual OMT: what if Draghi had not acted Journal of International Money and Finance

Connection to MSc thesis

The macro-financial elasticities estimated in the MSc thesis provide the exogenous shock calibration for this simulator. The thesis repo is at https://github.com/Leotaby/macro-bank-stability-panel .

Author

Hatef Tabbakhian (Leo) MSc Economics and Finance, Universita Federico II di Napoli

License

AGPL-3.0

About

Agent-based simulation of systemic risk and contagion in European interbank networks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors