Models#
The etfs app has two models: the concrete asset type Etf and
its dividend records.
Etf#
Concrete subclass of Item via Django
multi-table inheritance. Adds an indexes many-to-many to
Index so an ETF can be tagged with the
indexes it tracks.
Holdings (the ETF’s underlying basket) live as JSON on
ItemData under the holdings key and
are accessed exclusively through the two helpers below – never via
ItemData directly.
The update_cache override invalidates the ETF-specific
transaction-performance / profit-performance cache keys and re-warms
them by re-running Performance.
Dividend#
A dividend record for an Etf. Inherits all fields from
BaseDividend and adds only the etf
foreign key. Records are downloaded by
get_dividends() (which wraps the
rug library); ETFs with no dividends produce an empty list.
Field semantics:
ex_date– the first date on which the ETF is traded without the right to receive the next dividend payment (equals therecord_datesince 2024).record_date– the day the fund finalizes which shareholders receive the dividend.payment_date– the date the dividend is paid out.yield_value– dividend in %.amount_value– dividend as a value in currency.
- class richy.etfs.models.Dividend(id, ex_date, payment_date, record_date, yield_value, amount_value, etf)[source]#
Bases:
BaseDividend