SyntheticGoodsMarket¶
The SyntheticGoodsMarket class is a container for preprocessed goods market data that organizes market relationships, trade patterns, and exchange rates for model initialization.
Core Functionality¶
The class handles:
-
Exchange Rate Processing:
- Historical exchange rate data
- Inflation rate relationships
- Growth rate correlations
- Rate prediction model estimation
-
Market Data Organization:
- Buyer-seller relationships
- Trade flow patterns
- Price level initialization
- Market clearing conditions
-
Parameter Processing:
- Exchange rate model parameters
- Price adjustment factors
- Trade flow coefficients
- Growth-inflation relationships
Key Attributes¶
country_name: Country identifier for data collectionexchange_rates_model: Preprocessed exchange rate model for initializing price dynamics, relating exchange rates to inflation and growth patterns
Factory Methods¶
The class provides a factory method from_readers that creates a SyntheticGoodsMarket instance by:
- Collecting historical exchange rates
- Matching with inflation and growth data
- Cleaning and aligning time series
- Estimating exchange rate model parameters
The method takes:
country_name: Country to process data foryear: Base year for preprocessingquarter: Base quarter for preprocessingreaders: Data source accessexogenous_data: External economic datamax_timeframe: Maximum historical periods (default: 40)
Implementation¶
Module for preprocessing synthetic goods market data.
This module provides a framework for preprocessing and organizing goods market data that will be used to initialize behavioral models. Key preprocessing includes:
- Exchange Rate Processing:
- Historical exchange rate data
- Inflation rate relationships
- Growth rate correlations
-
Rate prediction model estimation
-
Market Data Organization:
- Buyer-seller relationships
- Trade flow patterns
- Price level initialization
-
Market clearing conditions
-
Parameter Processing:
- Exchange rate model parameters
- Price adjustment factors
- Trade flow coefficients
- Growth-inflation relationships
Note
This module is NOT used for simulating goods market behavior. It only handles the preprocessing and organization of goods market data that will later be used to initialize behavioral models in the simulation package. The actual market matching, price setting, and trade flow dynamics are implemented in the simulation package.
SyntheticGoodsMarket
¶
Container for preprocessed goods market data.
This class organizes goods market data for initializing behavioral models. It processes and structures data about market relationships, trade patterns, and exchange rates. It does NOT implement any market behavior - it only handles data preprocessing.
The preprocessing workflow includes: 1. Exchange Rate Model: - Historical rate collection - Inflation data integration - Growth rate correlation - Model parameter estimation
- Market Structure:
- Buyer identification
- Seller categorization
- Trade relationship mapping
-
Initial price levels
-
Trade Flow Data:
- Historical patterns
- Volume relationships
- Price dependencies
- Growth correlations
Note
This is a data container class. The actual goods market behavior (matching, price setting, trade flows, etc.) is implemented in the simulation package, which uses this preprocessed data for initialization.
Attributes:
| Name | Type | Description |
|---|---|---|
country_name |
str | Country
|
Country identifier for data collection |
exchange_rates_model |
Optional[LinearRegression]
|
Preprocessed exchange rate model for initializing price dynamics. The model relates exchange rates to inflation and growth patterns. |
country_name = country_name
instance-attribute
¶
exchange_rates_model = exchange_rates_model
instance-attribute
¶
__init__(country_name: str | Country, exchange_rates_model: Optional[LinearRegression])
¶
Represents a synthetic goods market.
Attributes:
| Name | Type | Description |
|---|---|---|
country_name |
str
|
The name of the country. |
exchange_rates_model |
Optional[LinearRegression]
|
The model for exchange rates (optional). |
from_readers(country_name: Country | str | Region, year: int, quarter: int, readers: DataReaders, exogenous_data: ExogenousCountryData, max_timeframe: float = 40) -> SyntheticGoodsMarket
classmethod
¶
Create a preprocessed goods market data container from data sources.
This method processes goods market data from various sources to prepare: 1. Exchange rate relationships with inflation and growth 2. Historical trade patterns and price levels 3. Market structure initialization data
The preprocessing steps: 1. Collect historical exchange rates 2. Match with inflation and growth data 3. Clean and align time series 4. Estimate exchange rate model parameters
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
country_name
|
Country | str
|
Country to process data for |
required |
year
|
int
|
Base year for preprocessing |
required |
quarter
|
int
|
Base quarter for preprocessing |
required |
readers
|
DataReaders
|
Data source access |
required |
exogenous_data
|
ExogenousCountryData
|
External economic data |
required |
max_timeframe
|
float
|
Maximum historical periods. Defaults to 40. |
40
|
Returns:
| Name | Type | Description |
|---|---|---|
SyntheticGoodsMarket |
SyntheticGoodsMarket
|
Container with preprocessed market data |