Challenges of Executing Arbitrage Opportunities in Bitcoin Futures & Options Trading – 3 Way w/ Fees

hi and welcome to this next edition in our series on arbitrage and bitcoin trading bots and all that fun stuff my name is jared i’m from chief i’m rather i am the chief liquidity officer of coin next labs uh in coindex labs who are we and how can you try our five day free trial on our market maker where you can view this youtube video down here to see that in action and while the market maker is actually on pause right now or at least the free trial is that’s because we’ve been redesigning the bot to be more uh beneficial for our users and uh less risk-averse um so if you take a look at our live chart here on chart.condexlabs.com you can see the bot uh is live with a balance um and you can see that it’s actually done fairly well in this dump so the blue line here is the bitcoin the us dollar price uh and it dumped significantly and we gained a whole bunch of bitcoin value and a whole bunch of us dollar value on our returns and we’re currently at about 12 bitcoin over the last couple days and uh four percent on the us dollar so once this is all back up and ready and ready to deliver we’ll uh reinitiate our five-day trial and you can have a look at our other video to see how that works so today what we’re looking at is the challenges of executing arbitrage opportunities in algorithmic trading and for instance uh we’re going to take a look specifically at three-way arbitrage uh crypto trading opportunities on binance on their spot markets so what does that look like what is three-way arbitrage what is three-way arbitrage well let’s say i have an asset let’s say i have an asset on finance let’s take a look at finance to take a look at what this looks like we’ll take a look at the markets let’s take a look at the us tether us dollar tether markets um so let’s say i had something use dollar tether i wanted to sell that us dollar title for bnb uh and then i wanted to use that bnb to buy bitcoin cash and then i wanted to sell that bitcoin cash back for tether let’s say i could do that and find a profitable uh opportunity among all of these markets and there’s hundreds of markets on this exchange so we have an asset trade it for a second asset trade it for a third asset and then back to original asset and that’s why we call it three-way arbitrage because we have two trades and then we have three trades then we have back to the original asset um so if this fees evolved let’s take a look at what the binance fees are for their bottom tier because they have tiered fees as you get more volume hold more of their exchange token you get less fees um but for the bottom fee it’s uh 0.075 percent or seven yeah and then if you hold the bnb token and pay the fee in the b b token instead of paying in whatever token or coin you’re trading it’s 0.6 from the maker or the taker and we’re only concerned with taker fees because we’re looking at initiating the trades in each of these cases against whatever is on the books so we can act on the opportunities that exist so 0.06 then we have one trade at 0.06 we have two trades at 0.06 percent again i’m gonna do three trades at 0.06 and then we have back to the original asset at 0.06 percent what this looks like is 4 times 0.06 percent what is that that’s uh 12 24 0.00 which is actually a huge amount of fees and we can take a look what this looks like with a freeware bot that i found on the internet and this guy has a donation link if you want to take a look at reimbursing them for the information that really provided us but if we do site github.com binance triangular arbitrage we can find this uh this spot so here he is here and you can actually use this spot to automatically trade these opportunities let’s say you negotiated lower fees or you you managed to trade a lot of volume and highlights and bnb and got lower fees this might actually be advantageous to you uh but i’ve set this up already on one of my virtual machines and let’s take a look at what that looks like so here we are let’s open up that config file here’s our market maker but what i want to do is look for finance triangular arbitrage and config file open up the config file let’s change our taker fee to zero percent let’s see what kind of opportunities we can find at zero percent so actually i already had it running let’s run it again uh what coin are we looking at here so hold we’re holding us dollar tethered to begin with we’re going to trade us dollar tether for other uh financial instruments and other financial instruments again so again the point of this video was the uh the challenges of executing arbitrage opportunities in algorithmic trading so another problem that we might face is how long does it take to do all of these trades because let’s say we bought uh our first asset let’s say the opportunity exists at 0.1 percent for all of these items if it takes me 100 milliseconds and i notice i can’t have these in here let’s say it takes me 100 milliseconds per trade let’s say i trade for the first asset 100 milliseconds trade for second asset i should say second third 200 milliseconds total let’s say that after i commit complete these trades then the trade for the third asset back to the original asset is no longer at the arbitrage opportunity that we found so let’s say that we get less of our original asset back than we had originally planned um then because it takes us 300 milliseconds to do all of this the opportunity might disappear so i mean let’s say if i well i mean let’s say we have a dollar of our asset we’re going to trade for the second asset and get a dollar in a cent trade for a third asset and get half of that back and trade for our first asset back and get a little bit less than that back let’s say this was the opportunity that we had so what we might find is that any of these legs of the trade might actually disappear in the time it takes to complete all of these legs of the trade and we just call that the execution challenge the execution time challenge and we can actually take a look what that looks like here in our freeware finance triangular arbitrage trading bot that we found so again we have zero percent fees here we’re actually finding that there are no profitable trades available for zero percent fees on the us tether whole uh base asset but you can see here the ab age that’s the the for the the first uh trade the second trade and the third trade um are changing all the time which means that these these these things exist for less than a second usually before they disappear and you can see that changing in real time but if i was to change these fees again and make them 0.06 percent which is what most people will pay if they just start this off with the traditional fees we’ll run that again what did i just break it’s this one that i want we’ll see that our negative 0.1 percent arbitrage opportunities that we found are no longer that attractive when we run with 0.06 percent taker fees which is our second challenge in executing these arbitrage opportunities is what happens if i have to pay more fees than what is ideal and we will find that out shortly so again if the arbitrage opportunity exists uh and then you execute one or two of these trades um and actually i have a freeware uh github repository that failed recently because of this exact reason um basically it would find an arbitrage opportunity and then because it was on chain or rather it was using the ethereum blockchain to execute these arbitrage opportunities we’d find that after one block or two blocks to to execute on those opportunities um that we are no longer able to find a profitable trade and then we’re actually left helding or we’re actually left holding rather um it would be left holding one of these intermediary assets as the opportunity didn’t last long enough all right let’s go back to our finance trader that we found on github and now you see that these these opportunities that this funding are much less profitable um they’re actually less profitable by as you’d imagine a magnitude of zero point zero six percent times four which is zero point zero two four percent um because we’re now paying fees on each of those legs um and that’s basically what most arbitrage opportunities face as issues when we’re trying to execute on them is is this this age limit here and then also the fees that we have to pay alrighty thank you