Skip to main content

package description

Project description

getBISy logo

PyPI version Python 3.11+ License: MIT Downloads

A Python package for programmatically fetching and working with Bank for International Settlements (BIS) datasets.

The package currently allows access to the following sets of international financial statistics via the BIS data portal.

  • Central Bank policy rates
  • Bilateral exchange rates
  • Locational banking statistics
  • International debt securities
  • Global liquidity
  • Debt securities
  • OTC derivatives
  • Exchange-Traded derivatives

All major parameters are declared in custom enums to ensure type safety.

Installation

pip install getBISy

Usage

The below covers gathering 4 datasets from the BIS Data Portal using this package: Locational Banking Statistics (LBS); Global Liquidity Indicators (GLI); Over-the-Counter (OTC) Derivatives; and International Debt Securities (IDS).

Locational Banking Statistics

Import the relevant data functions and enums:

# Test LBS

import getBISy.data as data
import getBISy.enums as enums

# Developing Asia and Pacific, Non-banks, Cross-border Credit, USD
s1 = data.get_locational_banking_data('Q',
                                        enums.LbsMeasure.Stocks,
                                        enums.Position.Claims,
                                        enums.Instrument.LoansAndDeposits,
                                        'USD',
                                        enums.CurrencyType.All,
                                        '5J',
                                        enums.Institution.All,
                                        '5A',
                                        enums.Sector.NonBanks,
                                        enums.Region.DevelopingAsiaAndPacific,
                                        enums.PositionType.CrossBorder)

s1['Description'] = 'Developing Asia and Pacific, Non-banks, Cross-border Credit, USD'

# European Developed Countries, Non-banks, Cross-border Credit, USD
s2 = data.get_locational_banking_data('Q',
                                        enums.LbsMeasure.Stocks,
                                        enums.Position.Claims,
                                        enums.Instrument.LoansAndDeposits,
                                        'USD',
                                        enums.CurrencyType.All,
                                        '5J',
                                        enums.Institution.All,
                                        '5A',
                                        enums.Sector.NonBanks,
                                        enums.Region.EuropeanDevelopedCountries,
                                        enums.PositionType.CrossBorder)

Global Liquidity Indicators

As in the LBS example above, import the relevant functions and enums:

import getBISy.data as data
import getBISy.enums as enums

s1 = data.get_global_liquidity_data(freq='Q',
                               currency='TO1',
                               borrowing_country=enums.Region.DevelopingAsiaAndPacific,
                               borrowing_sector=enums.Sector.NonFinancialPrivateSector,
                               lending_sector=enums.Sector.Banks,
                               position_type= enums.PositionType.Local,
                               instrument_type=enums.Instrument.Credit,
                               unit_of_measure=enums.UnitOfMeasure.PercentageOfGDP
                               )

s2 = data.get_global_liquidity_data(freq='Q',
                               currency='TO1',
                               borrowing_country=enums.Region.EuroArea,
                               borrowing_sector=enums.Sector.NonFinancialPrivateSector,
                               lending_sector=enums.Sector.Banks,
                               position_type= enums.PositionType.Local,
                               instrument_type=enums.Instrument.Credit,
                               unit_of_measure=enums.UnitOfMeasure.PercentageOfGDP
                               )

Given the below plot in the context of the above, we infer that local bank credit to non-financial private sector in Developing Asia is replacing cross-border credit.

OTC Derivatives

Fetch OTC derivatives notional amounts by risk category (FX vs Interest Rate):

import getBISy.data as data
import getBISy.enums as enums

# Foreign Exchange derivatives
fx_derivatives = data.get_otc_derivatives_data(
    freq='H',
    derivative_type=enums.OtcDerivativeType.NotionalAmounts,
    instrument=enums.OtcDerivativeInstrument.All,
    risk_category=enums.OtcDerivativeRisk.ForeignExchange,
    counterparty_sector=enums.OtcCounterpartySector.All,
    maturity=enums.OtcMaturity.All,
    basis=enums.OtcBasis.NetNet
)

# Interest Rate derivatives
ir_derivatives = data.get_otc_derivatives_data(
    freq='H',
    derivative_type=enums.OtcDerivativeType.NotionalAmounts,
    instrument=enums.OtcDerivativeInstrument.All,
    risk_category=enums.OtcDerivativeRisk.InterestRate,
    counterparty_sector=enums.OtcCounterpartySector.All,
    maturity=enums.OtcMaturity.All,
    basis=enums.OtcBasis.NetNet
)

International Debt Securities

Fetch international debt securities outstanding by issuer residence:

import getBISy.data as data
import getBISy.enums as enums

# Developed Countries
developed = data.get_international_debt_data(
    freq='Q',
    issuer_res=enums.Region.DevelopedCountries,
    issuer_nat=enums.Region.AllCountries,
    issuer_sector_imm=enums.Sector.All,
    issuer_sector_ult=enums.Sector.All,
    issue_curr_group=enums.CurrencyGroup.All,
    issue_orig_mat=enums.Maturity.Total,
    issue_re_mat=enums.Maturity.Total,
    issue_rate=enums.RateType.All,
    measure=enums.IdsMeasure.Outstanding
)

# Emerging & Developing Economies
emerging = data.get_international_debt_data(
    freq='Q',
    issuer_res=enums.Region.EmergingAndDevelopingEconomies,
    issuer_nat=enums.Region.AllCountries,
    issuer_sector_imm=enums.Sector.All,
    issuer_sector_ult=enums.Sector.All,
    issue_curr_group=enums.CurrencyGroup.All,
    issue_orig_mat=enums.Maturity.Total,
    issue_re_mat=enums.Maturity.Total,
    issue_rate=enums.RateType.All,
    measure=enums.IdsMeasure.Outstanding
)

Examples of usage of this package can be found on my personal website, here using the Debt Securities series to comment on the behaviour of foreign capital flows during the GFC, and here using the Bank Lending series to show how cross-border lending has evolved.

Project Structure

getBISy/
├── src/
│   ├── __init__.py
│   ├── data.py         # Main data-fetching functions
│   ├── enums.py        # Enum definitions for all API parameters
│   └── fetcher.py      # Fetcher classes for making API requests
├── requirements.txt

Data Source

This package retrieves data from the Bank for International Settlements (BIS) Data Portal. The BIS is an international financial institution that serves central banks and fosters international monetary and financial cooperation.

Disclaimer: This package is not affiliated with, endorsed by, or officially connected to the Bank for International Settlements. All data is sourced from publicly available BIS statistics. Users should refer to the BIS terms of use for information about data usage and redistribution.

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

getbisy-0.0.12.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

getbisy-0.0.12-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file getbisy-0.0.12.tar.gz.

File metadata

  • Download URL: getbisy-0.0.12.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for getbisy-0.0.12.tar.gz
Algorithm Hash digest
SHA256 713fb3771933e1b4410871eb386ca7d053caff97ed372ed596dc6ec32d8a4ee3
MD5 cc0f6b13c9125486a58b25b4a4b9d1ff
BLAKE2b-256 92bd81f1b9f5b300f4ddd06104f54cde1052ee9ce22dff1b6347f5dbcd4305cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for getbisy-0.0.12.tar.gz:

Publisher: publish.yml on matthew-potts/getBISy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file getbisy-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: getbisy-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for getbisy-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 be007c2dd329a4c3c7bd73440014c21630ae52f6879f4e09a0b24f878c635d50
MD5 4a0d57c94ee6b888cbc96a1c8cb56294
BLAKE2b-256 e965276fe666dd13a22db189914393bd418224e1cc86cd49d2e5c628831511b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for getbisy-0.0.12-py3-none-any.whl:

Publisher: publish.yml on matthew-potts/getBISy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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