Data Sources Overview¶
π Implementation Status: β Core Features Implemented (v1.0.0)
This document provides a high-level overview of the multi-source data integration architecture for the trading system.
Overview¶
The trading system supports multiple market data sources to provide:
- Redundancy: Backup sources if one fails
- Data Validation: Cross-validate data between sources
- Rich Data: Different sources provide different data types
- Cost Optimization: Use free sources where possible
- Flexibility: Choose best source for each use case
Supported Data Sources¶
| Source | OHLCV | Fundamentals | Dividends | Splits | Real-time | Cost |
|---|---|---|---|---|---|---|
| Polygon.io | β | β | β | β | β | Paid (Free tier: 5 calls/min) |
| Yahoo Finance | β | β | β | β | β οΈ Delayed | Free (Unlimited) |
| Alpaca | β | β | β | β | β | Free with account |
For detailed integration guides, see: - Polygon.io Integration - Yahoo Finance Integration - Data Source Comparison
Multi-Source Architecture¶
Design Principles¶
- Independent Services: Each data source has its own service module
- Unified Storage: All market data stored in
data_ingestion.market_datawithdata_sourcefield (e.g.yahoo,yahoo_adjusted,polygon,alpaca) - Source Tracking: Track which provider supplied each data point; Yahoo stores both unadjusted (
yahoo) and adjusted (yahoo_adjusted) OHLCV - Separate Loaders: Each source has dedicated loader class
- Consistent Interface: Similar API patterns across sources
Directory Structure¶
src/services/
βββ polygon/
β βββ __init__.py
β βββ client.py # PolygonClient
β βββ exceptions.py # Polygon-specific exceptions
β βββ models.py # Pydantic models
β
βββ yahoo/
β βββ __init__.py
β βββ client.py # YahooClient
β βββ exceptions.py # Yahoo-specific exceptions
β βββ models.py # Pydantic models
β βββ loader.py # YahooDataLoader
β
βββ alpaca/
β βββ __init__.py
β βββ client.py # AlpacaClient
β βββ exceptions.py
β
βββ data_ingestion/
βββ __init__.py
βββ historical_loader.py # HistoricalDataLoader (Polygon)
βββ symbols.py
Data Flow¶
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββββββ
β Polygon.io ββββββΆβ PolygonClientββββββΆβ HistoricalDataLoaderβ
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββββββ
β
β
βββββββββββββββ ββββββββββββββββ βββββββββββΌββββββββββ
βYahoo FinanceββββββΆβ YahooClient ββββββΆβ YahooDataLoader β
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββββ
β
β
βββββββββββββββ ββββββββββββββββ β
β Alpaca ββββββΆβ AlpacaClient β β
βββββββββββββββ ββββββββββββββββ β
β
ββββββββββββΌβββββββββββ
β PostgreSQL DB β
β ββββββββββββββββ β
β β market_data β β
β β fundamentals β β
β β dividends β β
β β splits β β
β ββββββββββββββββ β
βββββββββββββββββββββββ
Related Documentation¶
- Polygon.io Integration: Detailed Polygon.io integration guide
- Yahoo Finance Integration: Comprehensive Yahoo Finance integration guide
- Data Source Comparison: Feature comparison and best practices
- Implementation Plan: Yahoo Finance implementation phases
Last Updated: December 2025
Status: β
Core Features Implemented (v1.0.0)