Skip to content

Technical Design

Detailed design documentation for TradAI libraries and services.

Large Documents

Library design docs are comprehensive (~750-800 lines each). For quick overviews, see Libraries or Services.

Library Design Documents

Library Lines Description
tradai-common ~756 Base classes, SOLID principles, AWS utilities
tradai-data ~809 Clean architecture, repository pattern, ArcticDB
tradai-strategy ~660 Strategy framework, validation, MLflow integration

Service Design Documents

Service Description
Backend API gateway, backtest orchestration, SQS/local executors
Data Collection Market data fetching, ArcticDB storage, streaming
Strategy Service Backtest execution, hyperopt, model promotion
MLflow Experiment tracking wrapper (non-standard architecture)

Design Principles

All libraries follow these principles:

SOLID

  • Single Responsibility - Each class has one reason to change
  • Open/Closed - Open for extension, closed for modification
  • Liskov Substitution - Subtypes are substitutable for base types
  • Interface Segregation - Many specific interfaces over one general
  • Dependency Inversion - Depend on abstractions, not concretions

Patterns

  • Repository Pattern - Abstract data access behind interfaces
  • Dependency Injection - Constructor injection with FastAPI Depends()
  • Protocol-based Abstractions - Python Protocol instead of ABC
  • Immutable Entities - Pydantic models with frozen=True

Testing

  • 60% coverage enforced (80% roadmap target)
  • Unit tests in tests/unit/
  • Integration tests in tests/integration/
  • TDD workflow: RED → GREEN → REFACTOR

See Also