2.6 KiB
2.6 KiB
| domain | last_rule_review_commit | last_rule_updated_at |
|---|---|---|
| domain-model | 1f1527d7c6 |
2026-06-01 |
domain-model
목적 / 책임
ALT의 핵심 business vocabulary를 Go 타입으로 표현한다. market, instrument, price, bar, backtest run, strategy, portfolio state, and analysis result concepts stay transport- and storage-free here.
포함 경로
packages/domain/- shared Go domain model modulepackages/domain/market/- market, venue, currency, instrument, OHLCV bar typespackages/domain/backtest/- backtest run spec, run state, result types
제외 경로
packages/contracts/- external protobuf schema representationservices/api/- socket transport and API boundaryservices/worker/- execution and scheduled job boundary
주요 구성 요소
market.Instrument- tradable instrument identity and provider symbol mappingmarket.UniverseSelector- provider import universe vocabularymarket.Bar- timeframe OHLCV market data pointbacktest.RunSpec- strategy, market, timeframe, period inputs for a runbacktest.Run- backtest lifecycle statebacktest.Result- backtest financial summary, trades, positions, summary metrics, and equity curvebacktest.Strategy,backtest.StrategyInput,backtest.OrderIntent- strategy execution vocabularybacktest.PortfolioState,backtest.Fill,backtest.Position- portfolio accounting state and fill applicationbacktest.TotalReturn- decimal return calculation helper backed by rational arithmetic
유지할 패턴
- 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. - Portfolio and return calculations use exact decimal/rational conversion, not floating point arithmetic.
- 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, backtests, persistence, and socket mapping.
- 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
float32orfloat64for money, price, or quantity values.