Claude 754b4a62c0 Phase 4: Economic Calendar API Integration
Implemented comprehensive economic calendar system for trading event alerts:

Backend (economic_calendar.py):
- GET /api/economic-calendar/events: Fetch events by days, countries, impact level
- GET /api/economic-calendar/today: Get today's scheduled events
- GET /api/economic-calendar/upcoming: Events within X hours (1-168)
- GET /api/economic-calendar/high-impact: Only critical events (next 30 days)
- GET /api/economic-calendar/by-country/{country}: Country-specific events
- GET /api/economic-calendar/impact-analysis: Gold trading impact analysis
- GET /api/economic-calendar/calendar-view: Calendar view with events by day
- POST /api/economic-calendar/events/{event_id}/notify: Set reminder notifications
- GET /api/economic-calendar/stats: Event statistics and busiest days

Features:
- Sample economic events: NFP, CPI, Unemployment, Fed Rate Decision, ECB Rate
- Impact levels: High/Medium/Low with color coding
- Forecast, previous, and actual values tracking
- Event filtering by country, impact, and days ahead
- Multiple sort options: date, importance, impact
- Notifications 15-120 minutes before events
- Gold trading correlation analysis
- Statistics for 7-day and 30-day windows

Frontend (EconomicCalendar.tsx):
- Calendar overview with event statistics
- Upcoming and high-impact event tabs
- Country-based filtering
- Impact-based color coding (red/yellow/blue)
- Event details: forecast, previous, actual values
- Trading tips for different event types
- Event time display with timezone consideration
- Correlation guidance (USD inverse, rates inverse)
- Visual indicators for pending/actual events

Integration:
- Registered economic_calendar router in main.py
- Added EconomicCalendar tab to App.tsx
- Integrated with navigation system
- Full TypeScript support

Note: Currently uses mock data. In production, integrate with:
- Trading Economics API
- Forexfactory Calendar
- Economic Calendar Pro
- OANDA Calendar
2025-11-16 05:58:35 +00:00

🏆 Gold Trading Simulator

An AI-powered gold trading scenario simulator with professional-grade charting, analytics, and risk management tools.

FastAPI React TypeScript TailwindCSS


📖 Documentation

All comprehensive documentation has been consolidated in the docs/ directory.


Key Features

  • Real-time candlestick charts with WebSocket streaming
  • AI-powered trade analysis using Claude/GPT-4
  • 9+ technical indicators (SMA, EMA, RSI, MACD, Bollinger Bands, etc.)
  • Advanced analytics (Win rate, Sharpe ratio, drawdown analysis)
  • Risk management tools with position sizing
  • Live financial news with AI summarization
  • Customizable dashboard with 5+ presets
  • 22+ professional UI components

🚀 Quick Start

Prerequisites

Setup (5 minutes)

# 1. Clone and navigate
git clone <repository-url>
cd gold-trading-simulator

# 2. Start database
docker-compose up -d

# 3. Backend setup (Terminal 1)
cd backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
# Create backend/.env and add your API keys
python -m app.main

# 4. Frontend setup (Terminal 2)
cd frontend
npm install
npm run dev

Open browser: http://localhost:3000

👉 See QUICKSTART.md for detailed instructions


🏗️ Project Structure

gold-trading-simulator/
├── backend/              # FastAPI Python backend
│   ├── app/
│   │   ├── api/         # REST API endpoints
│   │   ├── services/    # Business logic
│   │   ├── streaming/   # WebSocket handlers
│   │   └── models/      # Database models
│   └── requirements.txt
├── frontend/            # React + TypeScript frontend
│   ├── src/
│   │   ├── components/  # 22+ UI components
│   │   ├── services/    # API clients
│   │   └── utils/       # Indicators & helpers
│   └── package.json
├── database/            # DB initialization
├── docs/                # 📚 Complete documentation
└── docker-compose.yml   # PostgreSQL setup

🛠️ Technology Stack

Backend: FastAPI • PostgreSQL • SQLAlchemy • WebSockets • Pandas
Frontend: React 18 • TypeScript • Vite • TailwindCSS • Lightweight Charts
APIs: Alpha Vantage • OpenRouter AI


📡 API Endpoints

Market Data

  • GET /api/market/gold/current - Current price
  • GET /api/market/gold/historical - Historical data
  • GET /api/ohlcv/klines - Live OHLCV data

Trading

  • POST /api/trading/buy - Execute buy
  • POST /api/trading/sell - Execute sell
  • GET /api/trading/portfolio - Portfolio status

AI Analysis

  • POST /api/ai/analyze - AI trade recommendation
  • POST /api/ai/summarize-news - News summary

News & Alerts

  • GET /api/news/headlines - Latest news
  • POST /api/alerts/create - Create alert

Live Streaming

  • WS /api/stream/price - Real-time price updates

🎯 Use Cases

  • Trading Education - Learn technical analysis and trading strategies
  • Strategy Testing - Backtest and validate trading ideas
  • Portfolio Management - Practice risk management and position sizing
  • AI Integration - Explore AI-powered trading recommendations
  • Full-Stack Demo - Showcase modern web development skills

📚 Full Documentation

For complete setup instructions, feature guides, customization options, and more:

👉 Visit the docs/ directory

Documentation Index


⚠️ Disclaimer

This is a simulation and educational tool. Not financial advice. Do not use for actual trading decisions. No real money involved.


📄 License

This is a demonstration project. Feel free to fork and modify for educational purposes.


Built with ❤️ using FastAPI, React, and modern web technologies

S
Description
No description provided
Readme
7 MiB
Languages
TypeScript 54.9%
Python 44.6%
CSS 0.2%
JavaScript 0.2%