Less noise, more data. Get the biggest data report on software developer careers in South Africa.

Dev Report mobile

Programmable Banking Community: How To Save On Interest When Paying Off Debt

7 February 2022, by Nick Benson

Members of the Investec Programmable Banking community reported back on the recent Q4 2021 hackathon focusing on the Investec Transfer API. Here Frikkie Snyman walks us through his submission, the Investec Interest Maximiser, which automatically ensures that your savings account earns the most interest possible while decreasing interest paid on your loans.

Transcript of the demo

Frikkie Snyman 0:02

I just want to confirm everyone can see some code on the left-hand side and a terminal on the right-hand side, right?

Nick Benson 0:09

Yeah.

Frikkie 0:09

All right. Great. The idea behind this project; I call it the Interest Maximiser.

The Problem To Be Solved

And it's all about interest that's compounded daily. As we all know Investec has these products; for example, the Prime Saver, which is kind of pretty standard, which accrues your interest on a daily basis. And then this also is the same for a home loan, or property loan, or whatever. We can take advantage of this by keeping as much money in these accounts as possible on a daily basis.

Because that then kind of means that the money that's in your transactional account, you know, the one that you use to swipe with, is actually helping to reduce interest that you're building up or having to pay down or pay off.

How The Solution Works

So, what I'm going do is, I'm just quickly going take you through the code; I'm not going to dive into details, just to get the gist of the logic, and then I will show you how it works, or what it looks like when it runs and how it's running in Heroku.

Looking at the code, basically, we just put our API details in a process; this is running on Node, by the way. Then we have to specify our transactional account ID as well as our savings or loan account ID. There is a script for that as well, that you can get those IDs from the Investec API, along with the facility that you have set up, and a minimum balance that you want to keep.

Basically, we want to avoid jumping into our facility. Your minimum balance could be zero. But if you have some big deposits or whatever going off, then it's nice to have a bit of padding of a minimum balance as well.

So as a first step, you just sign into the API with Investec. This is a nice sort of client that I wrote a while ago, which you can use. You get a list of your accounts. And then we just find which is your transactional, which is a savings account.

From there, we get the balance for your transactional account. Then we try and see, okay, do you actually have more money in your transactional account than the target, or do you have less? The idea being that if there's more, we want to take all of that and put it into our savings account. If there's less, it means that you're busy swiping or busy shopping, you're eating at a restaurant or whatever you just paid. We want to avoid getting into a facility. So, we take money back from the savings account and put it into our transactional account. This is the part here.

And once we've made that decision, we just simply call the Transfer API with the From account to the To account. And that's it.

Screenshot-2022-02-07-at-08.46.45

What this looks like then, if I run it; it's just simply running a "maximise interest" script. A bit of logging through the steps as it goes out. I now in this case, transferred R500 before this demo from my private bank account to my saver account, or rather, from my savings account to my bank account. It now sees there's an imbalance. It corrects the balance. If I run it again, it should say that everything is balanced, so it doesn't do anything. So, this is pretty useful. It runs with Heroku.

This is really a great platform for if you're a hobbyist, and you just want to run something in the cloud; they've got this nice thing called the Heroku scheduler, which is basically just a resource on your app or whatever that you have on Heroku. From here, you can just add a job. It's linked into the code base that you have. And it does auto deploys, and so on.

Every time you push, you know, it gets the latest code. I found that every 10 minutes is a bit too often. You know, if you go out on a shopping spree, then you're doing a bunch of transactions. So, every 10 minutes, becomes a bit aggressive. I run it on an hourly basis. And yeah, that's it and it keeps my accounts quite balanced.

Thank you so much for the time to present this to you all.

Nick 4:44

Cool. Thanks for that. Any questions? Huggs? Any feedback? Questions?

Community Questions

Hagashen Naidu 4:53

No, it was a really nice implementation. We all love the fact that you use the, or added the, Investec API npm repo, which was a really cool, nice way to, to [give] back. It's got a lot of potential; I think we just felt it was a little bit sort of complex for like anybody to just pick up and use. But you could build something on top of this quite easily later on. All in all, a really solid implementation and a nice piece of work.

Hennie Spies 5:40

Were the pending transactions a big issue in the beginning? Because I see that there's some interesting code to work out what the pending transactions and the actuals are, etc.

Frikkie 5:54

Yeah. With the pending transactions, it's a bit tough, because it doesn't actually get returned with the transaction call, because we don't want to tap into our facility, these pending transactions [...] You have to figure out what the difference in the actual balance is, because you could also just, I think, if you're just looking at the balance, then you might dip into your facility if you don't take those into account. So, it was a bit implicit. I think Russell posted a message about it. I was like, oh, okay, that actually is a good idea. So, thanks for that.

Hennie 6:42

We'll put it on the backlog.

[Laughter]

Nick 6:46

Yeah, I'll follow up with that. [Laughter] Any other questions ? Does anyone else have anything to add or questions? Good. Frikkie, is there anything that you'd like to ask the community, the guys, anything you wish Investec could do that would make life easier for you?

Frikkie 7:10

Maybe ... I don't know if this is the correct timing but setting up the API library. I realised there were some inconsistencies in the responses from the Investec API. You know, sometimes things are capital case and sometimes it's camel case. I think maybe just that but nothing major, otherwise.

Nick 7:34

Brilliant. Thank you very much. That's great feedback. Thanks man.

OfferZen_Investec_PB_How-to-save-money-on-interest-when-paying-off-debt_blog-inner-article


Get involved in the Programmable Banking Community.

If you have questions or just want to say hi to the Programmable Banking Community core team, you can pop us a mail and we will get back to you.

If you want to see more from what the community has been up to, you can:

offerzen_investec_Developer_Finance_Guide_Banner_for_Blog_posts-2

Recent posts

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.