Skip to content

BIS-Infrastructure

Academic research infrastructure for BIS Credit-to-GDP gap time series analysis - Fully reproducible Python pipeline

View on GitHub


Information

Property Value
Language Python
Stars 0
Forks 0
Watchers 0
Open Issues 0
License MIT License
Created 2025-12-30
Last Updated 2026-02-19
Last Push 2025-12-31
Contributors 1
Default Branch main
Visibility private

Datasets

This repository includes 4 dataset(s):

Dataset Format Size

| data | | 0.0 KB |

| init.py | .py | 0.24 KB |

| bis_fetcher.py | .py | 16.77 KB |

| crisis_database.py | .py | 14.99 KB |

Reproducibility

No specific reproducibility files found.

Status

  • Issues: Enabled
  • Wiki: Enabled
  • Pages: Disabled

README

BIS Credit-to-GDP Gap Research Infrastructure

Python 3.10+ License: MIT

A comprehensive, fully reproducible Python infrastructure for academic research on the BIS Credit-to-GDP gap as an early warning indicator for banking crises.

Overview

This infrastructure provides:

  • Data Fetching: Automated download from BIS Data Portal
  • Literature Search: OpenAlex integration for systematic literature review
  • Time Series Analysis: Unit root tests, structural breaks, decomposition
  • Panel Regression: Fixed effects, random effects, GMM estimators
  • Crisis Prediction: Signal extraction, logistic regression EWS
  • Visualization: Publication-quality charts for papers
  • Paper Generation: LaTeX document structure and tables

The Credit-to-GDP Gap

The credit-to-GDP gap is the deviation of the credit-to-GDP ratio from its long-term trend, computed using a one-sided HP filter with lambda=400,000. It is the primary guide for countercyclical capital buffer (CCyB) decisions under Basel III.

Key Reference: Drehmann, M., & Tsatsaronis, K. (2014). "The credit-to-GDP gap and countercyclical capital buffers: questions and answers." BIS Quarterly Review.

Installation

# Clone repository
git clone https://github.com/Digital-AI-Finance/BIS-Infrastructure.git
cd BIS-Infrastructure

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install package
pip install -e .

# Install development dependencies
pip install -e ".[dev]"

Quick Start

Run Full Pipeline

# Using CLI
bis-research run --output output

# Using Python
from bis_research.pipeline import run_pipeline
results = run_pipeline(output_dir='output')

Individual Components

# Fetch BIS data
from bis_research.data.bis_fetcher import BISDataFetcher
fetcher = BISDataFetcher()
df = fetcher.fetch_bulk_data()

# Search literature
from bis_research.literature.openalex_client import OpenAlexClient
client = OpenAlexClient()
papers = client.search_all_queries()

# Analyze time series
from bis_research.analysis.time_series import TimeSeriesAnalyzer
analyzer = TimeSeriesAnalyzer()
results = analyzer.analyze_country_series(df, 'US')

# Crisis prediction
from bis_research.analysis.crisis_prediction import CrisisPredictionModel
model = CrisisPredictionModel()
ews_results = model.signal_extraction(df, threshold=10)

Project Structure

BIS-Infrastructure/
├── src/bis_research/
│   ├── data/           # BIS data fetching
│   ├── literature/     # OpenAlex integration
│   ├── analysis/       # Time series & panel models
│   ├── visualization/  # Chart generation
│   ├── paper/          # LaTeX generation
│   └── utils/          # Config & cache
├── tests/
│   ├── unit/           # Unit tests
│   └── regression/     # Regression tests
├── config/             # Configuration files
├── data/               # Downloaded data
├── output/             # Generated outputs
│   ├── figures/
│   ├── tables/
│   └── paper/
└── notebooks/          # Jupyter notebooks

CLI Commands

# Run full pipeline
bis-research run

# Fetch BIS data
bis-research fetch-data

# Search literature
bis-research search-literature

# Analyze specific country
bis-research analyze US

# Generate charts
bis-research generate-charts

# Generate LaTeX paper
bis-research generate-paper

# Show configuration
bis-research info

Configuration

Edit config/settings.yaml to customize:

analysis:
  countries: [US, GB, DE, FR, JP, CN]
  start_year: 1980
  end_year: 2024
  crisis_thresholds:
    bis_threshold: 10
    alternative_thresholds: [2, 4, 6, 8, 10, 12, 14]

Testing

# Run all tests
pytest

# Run unit tests only
pytest tests/unit -v

# Run regression tests
pytest tests/regression -v

# Run with coverage
pytest --cov=bis_research --cov-report=html

Reproducibility

This infrastructure follows reproducibility best practices:

  1. Fixed Random Seed: All random operations use seed=42
  2. Caching: Downloaded data cached to avoid re-fetching
  3. Version Control: All code and configs versioned
  4. Environment: Requirements pinned in pyproject.toml
  5. Documentation: Complete methodology documented

To reproduce results:

# Clone exact version
git clone https://github.com/Digital-AI-Finance/BIS-Infrastructure.git
cd BIS-Infrastructure

# Install exact dependencies
pip install -e .

# Run pipeline
bis-research run --output output

Data Sources

  • BIS Data Portal: https://data.bis.org
  • Dataset: WS_CREDIT_GAP (Credit-to-GDP gaps)
  • Updated quarterly
  • Covers 40+ countries from 1960s onwards

  • OpenAlex: https://openalex.org

  • Academic literature metadata
  • Citation networks
  • Open access papers

Key Outputs

  1. Data Files
  2. output/data/panel_data.parquet - Processed panel data
  3. output/data/panel_data.csv - CSV format

  4. Analysis Results

  5. output/analysis/time_series_summary.csv
  6. output/analysis/signal_extraction.csv
  7. output/analysis/lead_time_analysis.csv

  8. Visualizations

  9. output/figures/credit_gap_*.pdf - Country charts
  10. output/figures/credit_gap_comparison.pdf
  11. output/figures/credit_gap_distribution.pdf

  12. Paper

  13. output/paper/main.tex - LaTeX source
  14. output/paper/references.bib - Bibliography

Academic References

Key papers on credit-to-GDP gap methodology:

  • Borio, C., & Lowe, P. (2002). Asset prices, financial and monetary stability. BIS Working Papers No. 114.
  • Drehmann, M., et al. (2010). Countercyclical capital buffers: exploring options. BIS Working Papers No. 317.
  • Drehmann, M., & Juselius, M. (2014). Evaluating early warning indicators of banking crises. International Journal of Forecasting, 30(3), 759-780.
  • Basel Committee (2010). Guidance for national authorities operating the countercyclical capital buffer.

License

MIT License - see LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

Contact

Digital AI Finance Research - research@digital-ai-finance.org

Project Link: https://github.com/Digital-AI-Finance/BIS-Infrastructure