Dividends#
The DividendTransactions class consumes raw dividend
records (richy.shares.models.Dividend /
richy.etfs.models.Dividend) and the user’s transaction
history, and creates one
ShareDividendTransaction (or
EtfDividendTransaction) row
per (user, dividend) pair, recording how many shares the
user held on the dividend’s payment date and the total cash
payout.
The class is instantiated for a single asset – pass exactly
one of share= or etf= to the constructor. Calling
calculate() walks every user with
at least one transaction. Dividends with a future payment date
are skipped; positions closed before the payment date receive
no dividend record; any previously-created records for users
who no longer hold the asset are deleted on the next
calculate() pass.
DividendTransactions#
- class richy.transactions.dividends.DividendTransactions(*, share=None, etf=None)[source]#
Bases:
objectThis class handles
ShareDividendTransactionorEtfDividendTransactionmodel creation/update. It calculates based onTransaction(currently owned stocks) andshares.Dividend(dividend data) transactions that are income for share holder.