ChrisCScott / forecaster

A personal finances forecasting tool for Canadian retirement planning
Other
1 stars 2 forks source link

Improve Forecast transaction timing information #49

Closed ChrisCScott closed 5 years ago

ChrisCScott commented 6 years ago

To accurately model flows to/from savings over the year, it's necessary to know when those transactions occur. In particular, we need to know:

In some of these cases, we want money to flow to/from an account multiple times in a year. Think about how to accommodate transaction schedules, especially for debts and income.

Should classes like DebtPaymentStrategy return a dict[Debt, dict[Decimal, transaction] ] mapping instead (where Decimal is the timing)? If so, how can we be sure that debt minimum payments are not being shifted in time - record them first in Forecast, via a separate call to DebtPaymentStrategy? (This is probably the way to do it.)

ChrisCScott commented 6 years ago

Rather than pass around dicts of {timing: amount} pairs (or lists of [timing] vals), I've generalized the existing nper logic in the Account class by moving it to utility and using it in Person and Debt to add a payment_frequency property.

This makes it easy to specify the number of payments each year, which we'll assume are evenly spaced. For single-transaction items (asset sale, tax refund), add a payment_timing property that uses the when logic (previously moved over to utility).

We will likely need to make changes to the ContributionStrategy class, perhaps to return a dict (and ingest more information, e.g. a Person ref instead of simply their net income as a Money object?)