auradefi 0.1.1
PyPI GitHub

HoldingsReport

auradefi.portfolio.models · source

All holdings of one (address × chain) with an exact USD total.

as_of_ms is an integer ms-epoch timestamp (SPEC §4.4: ms epoch, everywhere, always). unpriced lists the CAIP-19 ids of holdings that carry no value, in input order, so a consumer knows exactly what the total omits (SPEC §4.4 data_quality spirit: incompleteness is first-class, never silent).

Fields

addressstr
chain_idstr
holdingstuple[Holding, ...]
total_valueMoney
unpricedtuple[str, ...]
as_of_msint

assemble

assemble(cls, address: str, chain_id: str, holdings: Iterable[Holding], as_of_ms: int) -> HoldingsReport

Assemble a report from holdings; pinned algorithm.

  • total_value = Money of the EXACT Decimal sum of h.value.amount over priced holdings, currency "USD", NO rounding, NO floats (SPEC rule #1), exact past any Decimal context precision. Decimal("0") when nothing is priced.
  • Raises CurrencyMismatchError if any holding's value.currency != "USD".
  • unpriced = tuple of caip19 for holdings whose value is None, input order preserved.
  • holdings stored as a tuple in input order.

Parameters

addressrequired, str

none

chain_idrequired, str

none

holdingsrequired, Iterable[Holding]

none

as_of_msrequired, int

none

Raises

CurrencyMismatchError

__init__

__init__(self, address: str, chain_id: str, holdings: tuple[Holding, ...], total_value: Money, unpriced: tuple[str, ...], as_of_ms: int) -> None

Parameters

addressrequired, str

none

chain_idrequired, str

none

holdingsrequired, tuple[Holding, ...]

none

total_valuerequired, Money

none

unpricedrequired, tuple[str, ...]

none

as_of_msrequired, int

none