A sophisticated game theory model simulating international trade relationships, incorporating real-world foreign exchange data, reserve currency dynamics, and volatile leadership behavior.
This simulation models trade interactions between 8 major economies using:
- Game Theory: Iterated prisoner's dilemma with multiple strategies
- Real FX Data: Actual currency volatilities and correlations from Interactive Brokers
- Reserve Currency Effects: Modeling the advantages of reserve currency status
- Leadership Dynamics: Including volatile/unpredictable leadership patterns
- Monthly Timeline: 40-month simulations capturing medium-term dynamics
- Does reserve currency status provide meaningful protection in trade conflicts?
- How does leadership volatility affect global trade cooperation?
- Which strategies optimize outcomes in uncertain environments?
- Do managed currency regimes provide trade advantages?
- Interactive Brokers (IBKR):
- 2 years of daily FX rates for 6 major currency pairs
- Calculated volatilities and correlation matrices
- Current exchange rates
- Trade Volumes: Bilateral trade weights based on major trading relationships
- Reserve Currency Shares: Based on IMF COFER reports
- Economic Parameters: Cooperation tendencies and strategic profiles
GameTheoryModel/
├── analysis/
│ ├── convergence_test.py # Statistical convergence analysis
│ ├── results_compiler.py # Systematic experiment runner
│ └── visualization_suite.py # Publication-ready figures
├── config/
│ ├── countries_data.py # Country configurations
│ └── parameters.py # Load researched data
├── core/
│ └── country.py # Country class with strategies
├── data/
│ └── historical/ # IBKR FX data and parameters
├── dynamics/
│ ├── leadership.py # US leadership dynamics
│ └── payoffs.py # Payoff calculations
├── simulation/
│ ├── engine.py # Core simulation engine
│ ├── monte_carlo.py # Monte Carlo wrapper
│ └── scenarios.py # Special scenario testing
└── results/ # Experiment outputs
pip install pandas numpy matplotlib seaborn scipy
pip install ib_insync # For IBKR data collectionfrom config.countries_data import create_countries
from simulation.engine import TradeSimulation
# Create countries with real data
countries = create_countries()
# Run simulation
sim = TradeSimulation(countries, rounds=40, us_leadership_profile='moderate')
results = sim.run()
# View results
for country, payoff in results['average_payoffs'].items():
print(f"{country}: {payoff:.2f}")from analysis.results_compiler import ResultsCompiler
# Run all experiments (takes ~20-30 minutes)
compiler = ResultsCompiler(base_iterations=200)
compiler.run_all_experiments()
# Results saved to /results/paper_results_[timestamp]/- Tit-for-Tat: Reciprocate opponent's last action
- Aggressive: Always impose tariffs
- Cooperative: Always cooperate
- Generous Tit-for-Tat: Forgive defections occasionally
- Reactive Volatile: Unpredictable responses with grudges
- Moderate: Balanced approach
- Internationalist: Pro-free trade
- Protectionist: Tariff-friendly
- Volatile Populist: Reactive with grudges and surprise negotiations
- Floating: Market-determined rates (US, EU, Japan, UK, Canada, Mexico)
- Managed: Controlled fluctuation (China, Singapore)
- Reserve Status: Advantages in funding costs and transaction fees
- Grudges: 1-6 month retaliation periods
- Negotiations: Random "beautiful deals"
- Mood Swings: Overall cooperation changes
- Reactive: Responds to payoff losses
Compares moderate vs volatile US leadership impacts on global trade.
Tests effects of changing reserve currency status (US decline, China rise).
Evaluates which US strategies perform best.
Models currency crisis impacts (peso crisis, pound crisis).
Finds optimal cooperation levels under volatile leadership.
- Volatile Leadership: Creates persistent conflicts (especially with Japan) but can improve US outcomes
- Reserve Currency: Provides advantages but not decisive in trade conflicts
- Japan Success: Balanced tit-for-tat strategy consistently wins
- China Strategy: Aggressive approach pays off despite low cooperation
- Convergence: Model stabilizes quickly (25-50 iterations sufficient)
- Convergence Test: Shows stable results after 25 iterations
- Coefficient of Variation: < 0.5% for all major metrics
- Bootstrap Analysis: Confidence intervals included
- Monte Carlo: 200+ iterations for publication quality
The project generates 6 publication-ready figures:
- Leadership comparison (payoffs & cooperation)
- Reserve currency impact analysis
- Strategy tournament results
- Cooperation sensitivity curves
- Trade network visualization
- Volatile leadership timeline
Edit config/countries_data.py:
Country(
name="US",
currency="USD",
strategy="tit_for_tat",
cooperation_tendency=0.6,
currency_regime="floating",
reserve_status=0.59, # From IMF data
usd_exposure=0.0
)Edit config/parameters.py to adjust:
- Game theory payoff matrix
- Simulation rounds
- Currency regime settings
If using this model in academic work, please cite:
[Your Name]. (2024). Multi-Country Trade Simulation with Currency Dynamics
and Volatile Leadership. [University/Institution].
- Introduction: Reserve currency advantage in trade wars
- Model: Game theory + FX dynamics + leadership
- Data: IBKR real FX data + economic parameters
- Results: 5 experiments with statistical validation
- Discussion: Policy implications
This is an academic project. For questions or collaboration:
- Raise an issue for bugs
- Submit PRs for enhancements
- Contact for research collaboration
This project is for academic research. Please contact before commercial use.
- Interactive Brokers for FX data access
- Game theory framework inspired by Axelrod's tournaments
- Currency dynamics based on international finance literature
Note: This model uses real FX data but simplified trade relationships. Results should be interpreted as theoretical insights rather than specific predictions.