# Model of accounts

**URL:** https://discourse.julialang.org/t/model-of-accounts/62912
**Category:** Finance and Economics
**Tags:** question, pluto, excel
**Created:** [June 14, 2021, 9:18pm UTC](https://discourse.julialang.org/t/model-of-accounts/62912 "2021-06-14T21:18:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![elgator](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elgator/32/26099_2.png) [@elgator](https://discourse.julialang.org/u/elgator)
#### Post date: [June 14, 2021, 9:18pm UTC](https://discourse.julialang.org/t/model-of-accounts/62912/1 "2021-06-14T21:18:49Z")

</div>

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](https://github.com/elgator/FinancialReportModel/blob/main/FinancialReportModel.jl)

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?

---

<div class="post-metadata">

### Author: ![iblis17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iblis17/32/649_2.png) [@iblis17](https://discourse.julialang.org/u/iblis17)
#### Post date: [June 15, 2021, 7:54am UTC](https://discourse.julialang.org/t/model-of-accounts/62912/2 "2021-06-15T07:54:11Z")

</div>

You can consider this. (disclaimer: I don’t try it out yet, it’s just in my overflowed TODO list. :p)

> **[GitHub - LAMPSPUC/StateSpaceModels.jl: StateSpaceModels.jl is a Julia package...](https://github.com/LAMPSPUC/StateSpaceModels.jl)**
>
> StateSpaceModels.jl is a Julia package for time-series analysis using state-space models. - GitHub - LAMPSPUC/StateSpaceModels.jl: StateSpaceModels.jl is a Julia package for time-series analysis us...
