Hi, I need a piece of architecture advice.

I am trying to implement a DSL for financial modelling (3 statement financial model, not the asset-valuaion one). Conceptually the model is quite straitforward: given a number of assumptions and a starting balance sheet, one applies accounting rules (reporting, more precisely) and calculates the future state of accounts. There is no need to anyhow *solve* this system, pure simuation. Pluto seems to be a nice UI for this kind of models, so I’ve ventured into this. And easily reached my limits .

So far so good, I’ve made a squeaky prototype and it even calculates *something*. Here

It boils down to:

- Each account is associated with a formula (string) for calculation. This formula can reference other accounts and this account values for the current and the previous periods.
- Some parameters are vectors, i.e. one element for each time period.
- There is a
`calculate!()`

method that cycles over time periods and calculates a new state of accounts.

At this point I’ve got a feeling that I am reinventing the wheel. So my question is, how would you aproach this task? Should I build on top of ModelingToolkit instead? Another library?