--- domain: domain-model last_rule_review_commit: no-commit-yet last_rule_updated_at: 2026-05-24 --- # domain-model ## 목적 / 책임 ALT의 핵심 business vocabulary를 Go 타입으로 표현한다. market, instrument, price, bar, backtest run 같은 개념을 transport나 storage와 분리된 형태로 유지한다. ## 포함 경로 - `packages/domain/` - shared Go domain model module - `packages/domain/market/` - market, venue, currency, instrument, OHLCV bar types - `packages/domain/backtest/` - backtest run spec, run state, result types ## 제외 경로 - `packages/contracts/` - external protobuf schema representation - `services/api/` - socket transport and API boundary - `services/worker/` - execution and scheduled job boundary ## 주요 구성 요소 - `market.Instrument` - tradable instrument identity and provider symbol mapping - `market.Bar` - timeframe OHLCV market data point - `backtest.RunSpec` - strategy, market, timeframe, period inputs for a run - `backtest.Run` - backtest lifecycle state - `backtest.Result` - backtest financial summary ## 유지할 패턴 - Domain type names should stay concise and market-neutral unless a market-specific rule is unavoidable. - Decimal values are represented as strings through `market.Decimal`; avoid float types for prices and quantities. - Keep package dependencies inward: domain packages should not import API, worker, CLI, Flutter, protobuf generated code, database drivers, or proto-socket. ## 다른 도메인과의 경계 - **contracts**: domain-model owns internal Go vocabulary; contracts owns protobuf wire schema and compatibility. - **worker**: domain-model defines the shapes; worker executes imports, normalization, and backtests. - **api**: domain-model may be mapped to responses, but API transport details stay outside this module. ## 금지 사항 - Do not add persistence annotations, socket parser logic, or environment configuration here. - Do not introduce generated protobuf code into this package. - Do not use `float32` or `float64` for money, price, or quantity values.