FDM.3:4.2.2 - Construct enough state and preserve the different dates
Work back from the next calculation to identify the required state. Simple interest on unpaid principal needs that principal, the rate and the start of the interval still to accrue. Carry any accrued unpaid interest separately. An exercised option may change which events remain possible. Other instruments can require other state.
Initialize the state at the requested starting time from supported history or an adequate opening account. After a repayment, the original principal may give a wrong forecast. After a rate change, today’s rate may give a wrong amount for an earlier interval. Use the intervening event or an adequate opening value. If neither is available, identify the later quantities that remain conditional.
Generate recurring dates from the specified anchor, interval and end condition. Preserve a short final period or end-of-month rule where the agreement requires it. Then determine which dates the business-day convention changes. The date used to calculate interest, the date on which payment is due and the date on which a transfer actually settles can differ. Notice and observation dates can add further relevant boundaries.
When a rate or principal changes, split the accrual interval at the effective boundary and apply each value during its interval. If events coincide, use the order supported by the terms or a qualified interpretation. Calculate each event from the state its rule requires. A spreadsheet row order needs a financial basis before it can determine the result.
If the order remains unknown, carry the permitted orders to the result in question. Two unconditional credits in the same currency leave the same closing balance in either order. Now start with 20, a credit of 50 and an instruction to pay a debt of 60. In this agreement a funded instruction executes at once, the creditor receives the full amount and that receipt settles the debt. An unfunded instruction is declined without retry. There are no other changes. Credit first leaves 10 and a completed payment. Instruction first leaves 70 and the payee still owed 60. The closing balance and discharge depend on the order. A question about a threshold met in both histories can already have an answer.