ChrisCScott / forecaster

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

Adding timing-aware methods and classes #63

Closed ChrisCScott closed 5 years ago

ChrisCScott commented 5 years ago

This PR adds the Timing class, replaces when and frequency attributes of Account and Person with a attributes that expect a Timing-like object, and adds various timing-aware methods to Account, Person, and Strategy (along with corresponding changes to SubForecast subclasses). This closes #62.

Most code which called Account.max_inflow (which took a scalar when attribute) now calls the timing-aware Account.max_inflows (which takes a Timing-like time series input). Account.max_inflow_limit and similar properties are added to generalize the concept of providing upper and lower bounds on inflows and outflows.

A major compatibility-breaking change is that AccountTransactionsStrategy.__call__ now returns a mapping from Accounts to dictionaries of transactions (rather than scalar Money values). This required changes to some SubForecast subclasses, including changing the expected typing of the account_transactions properties. This relates to #51 but does not close it since AccountTransactionStrategy.__call__ still ingests a scalar arg instead of a Timing-like object and DebtPaymentStrategy is entirely unchanged.