Data Collection
EBA data collector for financial network analysis.
This module provides the EBACollector class for retrieving data from the
European Banking Authority (EBA) transparency exercises and stress tests.
-
class scr_financial.data.collectors.eba_collector.EBACollector[source]
Bases: object
Collector for European Banking Authority (EBA) data.
This class provides methods for retrieving data from EBA transparency
exercises and stress tests, which include key bank metrics like CET1 ratio,
leverage ratio, and liquidity coverage ratio.
-
__init__()[source]
Initialize the EBA data collector.
- Return type:
None
-
__repr__()[source]
Return a string representation of this collector.
- Returns:
Class name and base URL.
- Return type:
str
-
collect_transparency_data(start_date, end_date, bank_list=None)[source]
Collect data from EBA transparency exercises.
- Parameters:
start_date (str) – Start date for data collection in ‘YYYY-MM-DD’ format.
end_date (str) – End date for data collection in ‘YYYY-MM-DD’ format.
bank_list (List[str] | None) – List of bank identifiers to include.
- Returns:
DataFrame containing bank solvency metrics.
- Return type:
DataFrame
-
collect_aggregated_data(start_date, end_date, bank_list=None)[source]
Collect aggregated data from EBA.
- Parameters:
start_date (str) – Start date for data collection in ‘YYYY-MM-DD’ format.
end_date (str) – End date for data collection in ‘YYYY-MM-DD’ format.
bank_list (List[str] | None) – List of bank identifiers to include.
- Returns:
DataFrame containing bank liquidity metrics.
- Return type:
DataFrame
ECB data collector for financial network analysis.
This module provides the ECBCollector class for retrieving data from the
European Central Bank (ECB) Statistical Data Warehouse and other ECB sources.
-
class scr_financial.data.collectors.ecb_collector.ECBCollector[source]
Bases: object
Collector for European Central Bank (ECB) data.
This class provides methods for retrieving data from ECB sources, including
TARGET2 interbank payment data, CISS systemic stress indicator, and G-SIB data.
-
__init__()[source]
Initialize the ECB data collector.
- Return type:
None
-
__repr__()[source]
Return a string representation of this collector.
- Returns:
Class name and base URL.
- Return type:
str
-
collect_target2_data(start_date, end_date, bank_list=None)[source]
Collect TARGET2 interbank payment data.
- Parameters:
start_date (str) – Start date for data collection in ‘YYYY-MM-DD’ format.
end_date (str) – End date for data collection in ‘YYYY-MM-DD’ format.
bank_list (List[str] | None) – List of bank identifiers to include.
- Returns:
DataFrame containing interbank payment volumes.
- Return type:
DataFrame
-
collect_ciss_data(start_date, end_date)[source]
Collect ECB Composite Indicator of Systemic Stress (CISS) data.
- Parameters:
-
- Returns:
DataFrame containing CISS values.
- Return type:
DataFrame
-
collect_gsib_data(start_date, end_date, bank_list=None)[source]
Collect G-SIB (Global Systemically Important Bank) indicator data.
- Parameters:
start_date (str) – Start date for data collection in ‘YYYY-MM-DD’ format.
end_date (str) – End date for data collection in ‘YYYY-MM-DD’ format.
bank_list (List[str] | None) – List of bank identifiers to include.
- Returns:
DataFrame containing G-SIB indicators.
- Return type:
DataFrame
Market data collector for financial network analysis.
This module provides the MarketDataCollector class for retrieving market data
such as CDS spreads, equity prices, and other market indicators.
-
class scr_financial.data.collectors.market_collector.MarketDataCollector[source]
Bases: object
Collector for market data.
This class provides methods for retrieving market data such as CDS spreads,
equity prices, SRISK, and other market indicators from various sources.
-
__init__()[source]
Initialize the market data collector.
- Return type:
None
-
__repr__()[source]
Return a string representation of this collector.
- Returns:
Class name and FRED base URL.
- Return type:
str
-
collect_cds_data(start_date, end_date, bank_list=None)[source]
Collect CDS spread data.
- Parameters:
start_date (str) – Start date for data collection in ‘YYYY-MM-DD’ format.
end_date (str) – End date for data collection in ‘YYYY-MM-DD’ format.
bank_list (List[str] | None) – List of bank identifiers to include.
- Returns:
DataFrame containing CDS spreads.
- Return type:
DataFrame
-
collect_srisk_data(start_date, end_date, bank_list=None)[source]
Collect SRISK data from NYU V-Lab.
- Parameters:
start_date (str) – Start date for data collection in ‘YYYY-MM-DD’ format.
end_date (str) – End date for data collection in ‘YYYY-MM-DD’ format.
bank_list (List[str] | None) – List of bank identifiers to include.
- Returns:
DataFrame containing SRISK values.
- Return type:
DataFrame
-
collect_equity_data(start_date, end_date, bank_list=None)[source]
Collect equity price data.
- Parameters:
start_date (str) – Start date for data collection in ‘YYYY-MM-DD’ format.
end_date (str) – End date for data collection in ‘YYYY-MM-DD’ format.
bank_list (List[str] | None) – List of bank identifiers to include.
- Returns:
DataFrame containing equity prices.
- Return type:
DataFrame
-
collect_funding_stress_data(start_date, end_date)[source]
Collect funding stress indicators.
- Parameters:
-
- Returns:
DataFrame containing funding stress indicators.
- Return type:
DataFrame
-
collect_bis_data(start_date, end_date, indicator)[source]
Collect data from Bank for International Settlements (BIS).
- Parameters:
start_date (str) – Start date for data collection in ‘YYYY-MM-DD’ format.
end_date (str) – End date for data collection in ‘YYYY-MM-DD’ format.
indicator (str) – Indicator to collect (e.g., ‘credit_to_GDP_gap’).
- Returns:
DataFrame containing BIS data.
- Return type:
DataFrame
Data preprocessor for financial network analysis.
This module provides the DataPreprocessor class for loading, cleaning,
and normalizing financial data from various sources.
-
class scr_financial.data.preprocessor.DataPreprocessor(start_date, end_date, bank_list=None)[source]
Bases: object
Handles loading, cleaning, and normalizing financial data from various sources.
- Parameters:
start_date (str) – Start date for data collection in ‘YYYY-MM-DD’ format.
end_date (str) – End date for data collection in ‘YYYY-MM-DD’ format.
bank_list (List[str] | None) – List of bank identifiers to include in the analysis.
-
node_data
Dictionary containing bank-specific attributes.
-
edge_data
Dictionary containing interbank network data.
-
system_data
Dictionary containing system-wide indicators.
- Raises:
ValueError – If start_date or end_date cannot be parsed as dates, or if
end_date is earlier than start_date.
- Parameters:
-
-
__init__(start_date, end_date, bank_list=None)[source]
Initialize the data preprocessor with date range and optional bank list.
- Parameters:
-
- Return type:
None
-
load_bank_node_data(data_sources)[source]
Load bank-specific attributes from specified sources.
- Parameters:
data_sources (Dict[str, str]) – Dictionary mapping attribute categories to data sources.
- Returns:
Dictionary of loaded bank attributes.
- Return type:
Dict[str, DataFrame]
-
load_interbank_exposures(source='ECB_TARGET2')[source]
Load interbank network data from specified source.
- Parameters:
source (str) – Source for interbank exposure data, by default ‘ECB_TARGET2’.
- Returns:
Dictionary of interbank exposure data.
- Return type:
Dict[str, DataFrame]
-
load_system_indicators()[source]
Load system-wide financial indicators.
- Returns:
Dictionary of system-wide indicators.
- Return type:
Dict[str, DataFrame]
-
normalize_edge_weights(method='degree')[source]
Apply normalization to edge weights.
- Parameters:
method (str) – Normalization method, by default ‘degree’.
- Returns:
Dictionary of normalized edge weights.
- Return type:
Dict[str, DataFrame]
-
filter_network(method='threshold', threshold=0.05)[source]
Apply filtering techniques to reduce noise in the network.
- Parameters:
method (str) – Filtering method, by default ‘threshold’.
threshold (float) – Threshold value for filtering, by default 0.05.
- Returns:
Dictionary of filtered edge data.
- Return type:
Dict[str, DataFrame]
-
align_timescales()[source]
Align data with different frequencies to a common timeline.
- Return type:
None
-
get_data_for_timepoint(time_point)[source]
Get all data for a specific time point.
- Parameters:
time_point (str | datetime) – Time point for which to retrieve data.
- Returns:
Dictionary containing node_data, edge_data, and system_data for the
specified time point.
- Return type:
Dict[str, Dict]