Skip to content

Generated file. Source: docs/TOS_interest_flow_diagram.md Edit the source document and run npm run docs:sync to refresh this published copy.

TOS Interest Flow Diagrams

This file contains visual diagrams explaining the TOS (3-year fixed annual accumulation) bond strategy algorithm.

Architecture Overview

flowchart LR
    A[calculateTosBondResult] --> B[createTosAnnualAccumulationStrategy]
    B --> C[simulateAnnualAccumulationBond]
    C --> D[Yearly snapshots]
    C --> E[Purchase events]
    C --> F[Redemption events]
    C --> G[Yearly results]

Annual Accumulation Flow

TOS uses the shared annual-accumulation engine with yearly capitalization and no intermediate payouts.

flowchart TD
    A[Start year] --> B[Apply yearly capitalization to active bonds]
    B --> C[Accrue cash account interest if non-capitalizing]
    C --> D{Year is natural maturity?}
    D -- Yes --> E[Redeem bonds at full value]
    D -- No --> F[Continue to next year]
    E --> G[Tax redemption profit]
    G --> H[Add net proceeds to cash]
    H --> I{Reinvest cash >= 100?}
    I -- Yes --> J[Buy new TOS batch]
    I -- No --> K[Add remainder to cash account]
    J --> L[Store purchase event]
    K --> L
    L --> M{final year?}
    M -- Yes --> N[Early redeem remaining bonds]
    M -- No --> O[Build year snapshot]
    N --> O

Interest Accumulation Timeline

xychart-beta
    title "TOS 3-Year Capitalization Timeline"
    x-axis ["Start", "Year 1", "Year 2", "Year 3", "Maturity"]
    y-axis "Value (PLN)" 100 --> 120
    line [100, 104.65, 109.52, 114.63]

Cash Account Behavior

For capitalizing bonds like TOS, the cash account only holds purchase remainders and rollover residues - it does not earn interest to prevent incorrect OKO balance reporting.

stateDiagram-v2
    [*] --> PurchaseRemainder
    [*] --> RolloverResidue
    PurchaseRemainder --> NoInterestAccrual : TOS is capitalizing
    RolloverResidue --> NoInterestAccrual
    NoInterestAccrual --> [*] : Used for next purchase

References