Models ====== The ``shares`` app has two models: the concrete asset type ``Share`` and its dividend records. Share ----- Concrete subclass of :class:`~richy.core.models.Item` -- ``Share`` joins the ``core_item`` table via Django multi-table inheritance, so the ``symbol`` / ``type`` / ``is_discontinued`` fields come from :class:`~richy.core.models.BaseItem` and the four boolean ``is_share`` / ``is_index`` / ``is_etf`` / ``is_coin`` methods implement the polymorphic dispatch used across the app. The ``update_cache`` override invalidates the share-specific transaction-performance / profit-performance cache keys and **re-warms them** by re-running ``Performance`` so the next request doesn't have to pay the cache-miss cost. .. autoclass:: richy.shares.models.Share :show-inheritance: .. automethod:: richy.shares.models.Share.update_cache Dividend -------- A dividend record for a :class:`Share`. Inherits all fields from :class:`~richy.core.models.BaseDividend` and adds only the ``share`` foreign key. Records are downloaded by :meth:`~richy.core.scraper.Manager.get_dividends` (which wraps the ``rug`` library); shares with no dividends produce an empty list. Field semantics: - ``ex_date`` -- the first date on which a stock is traded without the right to receive the next dividend payment (equals the ``record_date`` since 2024). - ``record_date`` -- the day a company 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. .. autoclass:: richy.shares.models.Dividend :show-inheritance: