Skip to main content

Python package for fetching data from BDDK

Project description

pybrsa: A Python Package for Turkish Banking Sector Data

PyPI version Documentation

A Python package for programmatic access to Turkish banking sector data from the Turkish Banking Regulation and Supervision Agency (BRSA, known as BDDK in Turkish). The package provides Python users with a clean interface to fetch monthly and quarterly banking statistics, financial reports, and sectoral indicators directly from BRSA's official APIs. Specifically, the package retrieves tables from two distinct publication portals maintained by the BRSA:

Key Features

  • Direct API access to BRSA monthly bulletins (17 financial tables)
  • Quarterly FinTurk data with city-level granularity (7 tables, 82 cities including 'HEPSI' for all cities)
  • Consistent parameter interface for both data sources
  • Built-in metadata for tables, banking groups, and provinces
  • Multiple export formats: CSV, Excel via save_data()
  • Returns pandas DataFrames ready for analysis

Design Philosophy

Lightweight and Authentic: Other packages providing access to BDDK data also fetch data programmatically, but they add a heavy translation layer - maintaining manual configuration files to map Turkish column names and categorical values to English. This provides user convenience at a high maintenance cost.

pybrsa takes a different path. It interacts directly with the API and uses the data it returns with minimal alteration:

  • For the Monthly Bulletin, it uses the official English column names and labels provided by the API when lang = "en" is set.
  • For the FinTurk dataset, where the API provides data only in Turkish, it returns the authentic Turkish names.

This is a deliberate choice. By avoiding a separate translation file, pybrsa eliminates a major maintenance burden, aiming to adapt instantly to any API changes. This way, the data you see is exactly what the official source provides.

Related Packages

  • bddk{.uri} (Python): Uses manual configuration for translations and column mappings and provides access only to the Monthly Bulletin.
  • bddkdata{.uri} (Python): Provides similar functionality for Python/pandas users with the same constraints as bddk.
  • rbrsa{.uri} R companion to this package with consistent API.
  • bddkR{.uri} (R): Uses manual configuration for translations and column mappings and provides access only to the Monthly Bulletin. It is based on 'bddkdata'

Installation

Install from PyPI:

pip install pybrsa

The development version can be installed from GitHub:

pip install git+https://github.com/obakis/pybrsa.git

Getting started

A vignette demonstrating how to use main functions, download and save data from both BDDK and FinTurk interface can be found at: https://obakis.github.io/pybrsa/articles/introduction.html

The pybrsa package retrieves tables from two distinct publication portalsmaintained by the Turkish Banking Regulation and Supervision Agency (BDDK). Both portals are official sources, but they organize the data differently:

  • The Monthly Bulletin Portal provides high-level, summary reports designed for general consumption and quick overviews of monthly trends without any geographic coverage.
  • The FinTurk Data System provides granular, detailed data, including statistics broken down by province, whereas the standard Monthly Bulletin offers national-level aggregates.
## R users: to use list_tables() as in R you can do
# from pybrsa import list_tables, fetch_bddk
## or importing everything
# from pybrsa import * 

import pybrsa

# Explore available tables
pybrsa.list_tables("bddk")  # For English names
pybrsa.list_tables("bddk", "tr")  # For Turkish names
pybrsa.list_tables("finturk")

# Explore banking groups
pybrsa.list_groups("bddk")
pybrsa.list_groups("bddk", "tr")
pybrsa.list_groups("finturk")

# Fetch monthly data (Table 15: Ratios)
data = pybrsa.fetch_bddk(
    start_year=2024, start_month=1,
    end_year=2024, end_month=3,
    table_no=15, grup_kod=10001
)

# Fetch quarterly FinTurk data
q_data = pybrsa.fetch_finturk(
    start_year=2024, start_quarter=3,
    end_year=2024, end_quarter=9,
    table_no=1, grup_kod=10007
)

# Save results to CSV
# q_data.to_csv("my_file.csv", index=False)
temp_path = pybrsa.tempfile_base()
pybrsa.save_data(q_data, "temp_path", format="csv")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybrsa-0.1.6.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybrsa-0.1.6-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file pybrsa-0.1.6.tar.gz.

File metadata

  • Download URL: pybrsa-0.1.6.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for pybrsa-0.1.6.tar.gz
Algorithm Hash digest
SHA256 fbeec3d3429adb12cb3c660cc8014139ab1fa53857dd1ef0c3960b7240071c81
MD5 72b43eb50b843a171567ea7e74630cf5
BLAKE2b-256 38d1fb65ab40c268a2266e88e3c0d6039861b4ffc9514c8870c849f0e0b7131f

See more details on using hashes here.

File details

Details for the file pybrsa-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pybrsa-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for pybrsa-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f184eb274f5fbe53c7fa0b75b6de0e0a97c6efdd74ff0b2329c4b5ecca2c21c9
MD5 0d13f549edaac1262942369af1db829c
BLAKE2b-256 4493bef48955dc35cdd3f3084e1f32027725f726c8f2498de305709276e4514b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page