Skip to content

Technical Design

Detailed design documentation for TradAI libraries.

Large Documents

These are comprehensive technical design documents (10k-15k lines each). For quick overviews, see Libraries.

Design Documents

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

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

  • 80% coverage minimum
  • Unit tests in tests/unit/
  • Integration tests in tests/integration/
  • TDD workflow: RED → GREEN → REFACTOR