I’m trying to automate a bunch of business logic in my database using backend functions. The simplest of which is just calculating daily and/or weekly simple interest between columns. At some point, I’ll need to start using live stock market and cryptocurrency data. But for now I just want to calculate simple interest.
E.g. Investor invests $100 on day 1 at 10% interest annually. So they should be paid a portion of interest each day based on the length of their investment and the rate of return.
I have columns setup for “Length” being days since the investment started. And “Rate” being the interest rate. Then “Interest” being Principal * Rate / 365 * Length.
I can do all of this in the front end as part of a page or view if I just want to display the data to a user as a View. But I can’t run these functions such that the Length and Interest columns automatically update daily or weekly or monthly. So the math just has to run on the front end which doesn’t seem to make sense. These figures should be saved to the database - right?
Here is my deposit button when someone adds a new asset:
And here is my Backend workflow where I’m trying to have the records update themselves daily with the new info: