mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-02 10:44:16 +08:00
817ed88e38
Algorithm returns and the risk calculations that depend on them now include cash dividends. This commit does _not_ provide an API for user algorithms to access dividends. PerformanceTracker expects the dividend data to arrive as events, similar to the way that Trades arrive. Dividends are expected to have adjusted payment amounts that are inline with adjusted trades. PerformanceTracker maintains state of all the unpaid dividends in the position objects held in PerformancePeriod. Dividend objects contain all the relevant dates (declared, ex, payment) as well as net and gross amounts. Dividends are removed from the list as they are paid. Cash flow is not incremented until the payment day. This creates the possibility of a dividend being owed but not paid or realized before the end of a test. For example, a dividend with an ex_date of today may have a pay date 2 weeks in the future. Right now the algorithm does not receive any credit for unpaid dividends. Tests cover buying/selling around the ex_date and payment_date, and checking that the performance calculated is as expected.