valuation_store
ValuationStore: time-series store for position valuations.
Classes:
-
ValuationStore–Stores valuation records keyed by (position_id, date, valuation_type).
ValuationStore
ValuationStore()
Stores valuation records keyed by (position_id, date, valuation_type).
Methods:
-
get–Return the stored value or None if absent.
-
get_previous–Return the most recent value strictly before date, or None if absent.
-
record–Store a valuation value. Overwrites if already present.
-
series–Return (date, value) pairs sorted by date, optionally bounded by start/end.
-
snapshot–Return {position_id: value} for all positions with a record on date.
get
get(
position_id: str,
date: date,
valuation_type: ValuationType,
) -> Decimal | None
Return the stored value or None if absent.
get_previous
get_previous(
position_id: str,
date: date,
valuation_type: ValuationType,
) -> Decimal | None
Return the most recent value strictly before date, or None if absent.
record
record(
position_id: str,
date: date,
valuation_type: ValuationType,
value: Decimal,
) -> None
Store a valuation value. Overwrites if already present.
series
series(
position_id: str,
valuation_type: ValuationType,
start: date | None = None,
end: date | None = None,
) -> list[tuple[date, Decimal]]
Return (date, value) pairs sorted by date, optionally bounded by start/end.
snapshot
snapshot(
date: date, valuation_type: ValuationType
) -> dict[str, Decimal]
Return {position_id: value} for all positions with a record on date.