Coverage for src/copytrading_engine/execution/domain/values.py: 100%
12 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-11-16 16:55 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-11-16 16:55 +0000
1from decimal import Decimal
2from typing import Annotated, Literal, NewType
4from pydantic import BaseModel, ConfigDict, Field
6Money = Annotated[Decimal, Field(allow_inf_nan=False)]
7Positive = Annotated[Money, Field(gt=0)]
8Quantity = Annotated[Money, Field(ge=0)]
9Identifier = Annotated[str, Field(min_length=1)]
10# The broker's own number for an account, which a ledger records to stay bound to one broker
11# account. The app names accounts separately (the account's folder, such as "primary"); the two
12# are different values and must never be compared with each other.
13BrokerAccountNumber = NewType("BrokerAccountNumber", str)
14BrokerAccountId = Annotated[BrokerAccountNumber, Field(min_length=1)]
15Side = Literal["buy", "sell"]
18class Value(BaseModel):
19 model_config = ConfigDict(frozen=True, extra="forbid", strict=True, hide_input_in_errors=True)