Skip to content

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:

  1. Exchange Rate Processing:

    • Historical exchange rate data
    • Inflation rate relationships
    • Growth rate correlations
    • Rate prediction model estimation
  2. Market Data Organization:

    • Buyer-seller relationships
    • Trade flow patterns
    • Price level initialization
    • Market clearing conditions
  3. Parameter Processing:

    • Exchange rate model parameters
    • Price adjustment factors
    • Trade flow coefficients
    • Growth-inflation relationships

Key Attributes

  • country_name: Country identifier for data collection
  • exchange_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:

  1. Collecting historical exchange rates
  2. Matching with inflation and growth data
  3. Cleaning and aligning time series
  4. Estimating exchange rate model parameters

The method takes:

  • country_name: Country to process data for
  • year: Base year for preprocessing
  • quarter: Base quarter for preprocessing
  • readers: Data source access
  • exogenous_data: External economic data
  • max_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:

  1. Exchange Rate Processing:
  2. Historical exchange rate data
  3. Inflation rate relationships
  4. Growth rate correlations
  5. Rate prediction model estimation

  6. Market Data Organization:

  7. Buyer-seller relationships
  8. Trade flow patterns
  9. Price level initialization
  10. Market clearing conditions

  11. Parameter Processing:

  12. Exchange rate model parameters
  13. Price adjustment factors
  14. Trade flow coefficients
  15. 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

  1. Market Structure:
  2. Buyer identification
  3. Seller categorization
  4. Trade relationship mapping
  5. Initial price levels

  6. Trade Flow Data:

  7. Historical patterns
  8. Volume relationships
  9. Price dependencies
  10. 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