tradai-data¶
Market data collection and storage for the TradAI platform.
Status: ✅ Production Ready | Tests: 67/67 passing | Coverage: 93%
Features¶
- SOLID Design: Repository pattern, dependency inversion, single responsibility
- DRY Value Objects: DateRange, SymbolList, Timeframe eliminate duplication
- Clean Architecture: 3-layer pattern (Core → Infrastructure)
- Type-Safe: 100% type hints with Pydantic validation
- Test-Driven: 93% test coverage with strict TDD methodology
- Zero Dead Code: Every line driven by tests
Architecture¶
See the Design Document for complete architecture documentation (3-layer pattern, entities, repositories, adapters).
Installation¶
Usage¶
from tradai.common import ExchangeConfig, TradingMode
from tradai.data.core.services import DataQueryService
from tradai.data.infrastructure.repositories import CCXTRepository
from tradai.data.infrastructure.adapters.arctic_adapter import ArcticAdapter
# Setup with dependency injection
config = ExchangeConfig(name="binance", trading_mode=TradingMode.FUTURES)
repository = CCXTRepository(config)
adapter = ArcticAdapter(bucket="my-bucket", library_name="ohlcv")
service = DataQueryService(repository=repository, adapter=adapter)
# Query data with value objects
data = service.query(
symbols=["BTC/USDT:USDT", "ETH/USDT:USDT"],
start_date="2024-01-01",
end_date="2024-01-31",
timeframe="1h"
)
Testing¶
# Run tests with coverage
uv run pytest
# Run only unit tests (exclude integration tests)
uv run pytest -m "not integration"
# Run with coverage report
uv run pytest --cov=tradai.data --cov-report=html
Documentation¶
- Design Document — Complete architecture and design patterns
- pyproject.toml - Package configuration and dependencies