Tech insights: Programmable Banking Community: Christo’s Crypto Hedge

Programmable Banking Community: Christo’s Crypto Hedge

By Ben Blaine

Every week, we run a meetup for the Investec Programmable Banking Community. Developers demo cool projects they’ve been working on and everyone has the chance to ask questions. If you’ve been wondering where programmable banking is at, here’s your sneak peek!

In this demo, Christo Bezuidenhout shares how he built a tool to hedge his spending against the Rand using crypto. His goal was to see if he could build something to 10X using programmable banking.

The tech he worked with included Next.js, React, GCP (PubSub, Functions), Firestore, Auth0, Ant Design and Puppeteer.

Click here to download Christo’s presentation slide deck.

Transcript of the demo

Christo [00:01]

I thought that our Rand was weakening every day, and I thought how I could hedge myself a bit against the Rand. A lot of economists were saying, save some of your money in US dollars or pounds, and I looked at that and the costs for me to move money across to US dollars and then to invest in some stock or a trust incurred a lot of fees. I started to think what’s another easy way to do it and cryptocurrencies came to mind.

Christo [00:51]

I then thought it would be nice if I could, each month almost as an experiment when I get my salary, put a certain amount of money into Luno, buy Bitcoin, or Ethereum, or Litecoin, or whatever. As I spend money during the week, track that money that gets spent on my card, and then at the end of the week, see the total amount that I’ve spent on my card and I can then sell Ethereum and get my Rands back.

Christo [01:34]

The idea is that I can take my account on Investec into the minus saying minus R5000 every week, and then at the end of the week, I’ll just buy that money back from crypto. Hopefully, the cryptocurrencies would have increased in value. Still, it is a bit of a risk so I’m obviously not doing this with the volatility of cryptocurrencies. Still, I thought it’s a great experiment.

Christo [02:04]

It felt to me like it could be something like Phoenix where you have a card, and you spend cryptocurrencies instead of Rands. I just called it Luno Hedge for lack of a better word – LH against the Rand, like Phoenix.

Christo [02:24]

The extract that I used was Next.js because I wanted to keep stuff server-side and use Next.js also as some API routes, which is quite nice as it all runs server-side. The other benefit of those APIs is that you can pose them as serverless functions.

Christo [02:46]

I’m going to use it for future stuff, where I have functions or API calls that can actually do bank payments and stuff like that as well and then it gets hosted as a serverless function, which allows a lot of people to use it because then it runs on Google servers.

Christo [03:12]

Usually, to do those payments and stuff, you need to use something like Tyco. That could be expensive.

Christo [03:31]

I used React, JS React, TCP PubSub functions and Firestore AuthO for authentication and Design. I wanted to check out Design as it’s a nice React framework, UI framework, and I wanted to check that out, and then DFO payments.

Christo [03:51]

Just to show you guys, I did a demo a while ago so I will just reuse this. I have a Google Cloud Function – if I spend something on my card, it will push that transaction to a cloud function, which is on to PubSub. That allows me to replay transactions and stuff as well. That then essentially gets pushed to cloud Firestore and my function and my application then finally just talks to cloud Firestore to get the balances and the transactions.

Christo [04:39]

I’ll show that in action now. The slides, okay, and I will talk a bit about how it works and looks.

Christo [05:15]

This is how the application looks. One of the challenges for me was designing and laying stuff out a bit better. I’m not good on the UI side, and that’s why I also use this AntDesign stuff because it just makes things a bit better.

Christo [05:31]

The idea is that this just shows my bank account that’s with Luno so I can see where my money will go when I withdraw it, and then eventually ending up. I have this status over here that shows the amount that’s currently outstanding, that’s the amount that I spend at Investec that still needs to be swapped on Luno for Bitcoin or Ethereum, etc.

Christo [06:06]

Then over here, you can see – that’s on Luno and the difference for Bitcoin Ethereum and the Rand balance stuff.

Christo [06:19]

I’m just gonna simulate a transaction on Investec – sign in, and then that should push this outstanding amount up to whatever the amount was that I simulated. If I go here now – let me do a different amount. Maybe let’s make it R50, then simulate this transaction.

Christo [07:13]

The nice thing about this, Next.js as well as the [inaudible] library, the single SWR, which you can query functions and do HTTP REST calls, but it does it every now and then and then it caches stuff as well. You can see it automatically requested.

Christo [07:37]

What happened now is that the transaction went all the way through Google PopSub up through the Cloud Functions into Firestore. And you can ask for the status of overdue, then I can say, okay, I want to withdraw or exchange some Ethereum to get my money back so basically, now at the end of the week, I’ll say I want to exchange some Ethereum.

Christo [08:04]

Then it generates a quote on Luno. Of course, the Luno API can get a quote, and you can all see it will cost me 008 for an Ethereum. We can check this balance – it is 24644. and if I execute this on there, it’s sorted. It might take a few seconds to come through, but I can also just hit F5 and refresh it.

Christo [08:38]

You can see now it deducted my Ethereum, and my Rand balance on the side has increased again. Yeah, so that’s it’s just a simple way to hedge myself against the Rand – crypto is this thing who knows.

Christo [09:00]

Then, some challenges that I ran into was that I had to learn some new tech. It’s just I’ve never worked with Next.js before or AntDesign. Both are really cool. Next.js is really cool, especially the fact that you can add API calls in as part of it because everything is server-side. It also makes it a bit better than having to pull stuff out of your client from []. All my calls to Luno and the banks are done on the server-side.

Christo [09:41]

Then the UI layout because I am not that used to it.

Christo [09:49]

Then the other problems – I do the stuff of Luno with quotes, so I generate a quote and then execute the quote, but there are fees coupled to a quote. I think there’s a 1% fee, which obviously can amount to a lot of money if you do it a lot of times every week, but if you do it once a month it’s maybe alright.

Christo [10:12]

One of the goals is to move away from quotes and instead place orders, but then you’re not guaranteed that your thing will get executed on the exchange immediately. The other problem is withdrawals – if I want to withdraw my money from Luno into my Investec bank account, again, that also incurs a cost of R8.50, I think, the last time I checked. So obviously, I also don’t want to withdraw often. I’ll only withdraw maybe once a week, or once at the end of the month or something like that.

Christo [10:48]

I don’t know if somebody is here from Luno, or anybody knows anyone that could make some nice exceptions for us – that will be awesome.

Christo [10:56]

Those are some challenges that I encountered.

Christo [11:03]

The next step is, as I said, is not to generate any quotes but place orders. And then the quote also currently only lasts for a certain amount of time so if I continue to use quotes, just to show when the quote expires.

Christo [11:20]

Then currently, I have to go log into Investec and deposit money into the Luno account, where I want to from the UI, be able to say, deposit money into Luno and call an API, and that actually deposits the money for me.

Christo [11:46]

I started with that as well, and I used Puppeteer to create an API that I can call. It starts up in the Chrome browser, it then navigates all the way to the once off payment screens. Then it will populate all your bank account numbers, your references, your email notifications and all of that. It will do the payment automatically for you. So just a faster way of doing it. So while I was doing that, I then started writing a small instance, EFT solution, but I’ve since redesigned that UI, so I still have the API, I just have no UI to show you at the moment.

Christo [12:38]

I will incorporate it on the screen as well so that I can deposit money a bit easier. Yeah, and then my next demos, I’ll show the instant EFT stuff or hope to get some more banks in as well. I think that’s it. Let me just check something I missed.

Christo [13:14]

Yeah, you can contact me on the Slack channels. You can find me on the programmable banking community – just find me there. That’s my email address as well if you want to chat.

Christo [13:25]

And yeah, any questions?

Ben [13:31]

That’s really cool. I’m trying to think of questions. Have you thought of using stablecoins? I guess you can’t buy stable coins on Luno.

Christo [13:46]

So currently, it is limited, I think there is Litecoin as well, but there are no stablecoins. I also didn’t check if there are any other services out there that have an API that I can use in my findings. I’m sure they’ll also have something to do with one of them as well. Yeah.

Audience member [14:13]

Out of curiosity, have you done an analysis to see whether this has actually saved you any money yet or not?

Christo [14:20]

No. I’ve played around with it a little bit, but I’ll see if I can in the coming weeks. I’ll start using it more and see if it saves me money. One of the things I also wanted to do is to show some indicators on here that show the amount that I deposited and then after a week, when I withdraw it, an indicator that shows whether I’ve lost some money or gained some money just based on the growth of the currency.

Christo [14:59]

From that, I can also make a decision to say, if I withdraw now, I will lose R50 but if I withdrew yesterday, I would have gained R100, or I can see that I would gain R1000 if I withdraw now, so do it.

Christo [15:17]

One other thing – it sums the outstanding amount here, but you can’t change it so you might have one massive expense – buy a car on your credit card and then you don’t want to withdraw that. I might just make that editable as well.

Audience member [15:38]

It might actually be in the long term to look at, not just including that little graph, but also include a graph of your relative profits and losses by tracking the actual trades that you made because then you’d be able to see the year or six months or whatever, whether, at the end of the day, you managed to hedge your money or not.

Christo [15:59]

Yeah, that’s actually quite cool. That’s a good idea – I will make a note of it.

Ben [16:08]

How would you decide whether or not to convert Rand into dollars? What’s your strategy here?

Ben [16:18]

I mean, into coins into crypto.

Christo [16:24]

Are you saying how I would make the decision to?

Ben [16:28]

Yeah, are you just gonna do it on a percentage of your salary putting it into crypto?

Christo [16:34]

I see what you mean. What I thought about doing is to leave all my recurring money, like stuff that has to go off for me to make a living, I’ll leave in my Investec account, such as my health insurance, maybe all these kinds of monthly recurring stuff. Then I usually have a budget for spending money and stuff like that so I might start off, putting that spending money into Luno, and then using my Investec account, and then at the end of the week, just withdraw that spending money again, and then I should be able to tell from that, over time, if I’m making money or losing money.

Ben [17:27]

Cool. I was thinking about that idea sometimes like I just bought fast food now, which is probably not a great idea because I keep on buying fast food and it’s actually a little bit expensive, but I want to stop.

Ben [17:51]

If there was a thing that popped up every time I bought something that was fast food that said do you want to rather just fast and put some money into Bitcoin instead or something like that and then see if that could curb my habit of having fast food for lunch?

Christo [18:08]

Yeah, maybe. Who wrote that other solution that Tamagotchi thing?

Ben [18:22]

Yeah, that was Jacques.

Christo [18:28]

Yeah, I use that thing, and every time it will frown at me and say…

Ben [18:32]

What I was thinking was every time I buy fast food it can actually block the transaction and then say, do you want to rather put this money aside or invest it in Bitcoin or something? I can say yes, and then do that and if I say no, then it can keep a tally of what I spent on fast food and what it would be worth now if I had invested it in crypto, or what I’ve actually gained from not having fast food curbing my habit of fast food and just spending it on the real thing.

Audience member [19:14]

You can implement something like that very easily by just having the first time that a fast food transaction tries to go off and call it half an hour it blocks it. If you try the same transaction a second time, then it doesn’t. Then having some extra logic that if a transaction didn’t go off, you mark that amount of funds as earmarked for savings or investment or whatever, and then a month later that tells you to listen, this is how much you spent on fast food. Time to invest it instead.

Programmable-Banking-Community--Christo-s-Crypto-Hedge_Inner-Article-Image

Christo is currently working as a Senior Software Engineer at Sporting Solutions. Having worked in multiple industries, he’s gained a lot of experience with systems integrations, process and quality improvement, business system process design and development and ERP implementations. In his spare time, he enjoys researching and implementing new technologies.


Get involved in the Programmable Banking Community

If you’re not part of our community yet, sign up and join the fun. You can also see more of the demos from our meetups on our YouTube channel here.

For those of you in the community, check out our GitLab to see more of the awesome projects members of our community are working on. You can also sign up for challenges, where you can help find solutions for real life problems.

For more information, get in touch!

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

Subscribe to our blog

Don’t miss out on cool content. Every week we add new content to our blog, subscribe now.

By subscribing you consent to receive OfferZen’s newsletter and agree to our Privacy Policy and use of cookies.