š
Binance Triangular Arbitrage Finder v2.0 | 20x Faster | 2x Easier | Socket API | Live Updates - YouTube
Channel: unknown
[0]
I finally decided to upgrade the triangular
arbitrage finder tool that I shared last year.
[5]
Iāve been getting a lot of comments on the
previous video asking if the tool was working
[10]
or how to make it run because you have to
install some chrome extensions to make it
[15]
run.
[16]
So the process was very clunky and itās
not very user friendly.
[19]
So Iāve decided to upgrade the tool and
release a new version which is a lot more
[24]
easier to user and a lot more faster.
[27]
Before we talk about it, if you want to understand
how triangular arbitrage trading works, I
[32]
suggest you to watch the excellent video done
on this topic by Bennett.
[37]
I'll leave a link for this as well in the
description box.
[39]
So , to understand arbitrage trading, you
can watch that video.
[43]
Now let's talk about some key enhancements
that were done in version 2.
[48]
So the old one, it's not very optimized.
[50]
It has to run through 6 million loop to calculate
all the opportunities.
[54]
So it was very very slow.
[56]
The new one, it only has to run through 5
thousand loop and it's significantly faster
[62]
than the previous one.
[63]
Iāll talk about this optimization in a minute,
after I summarize all the other aspects of
[68]
the new version.
[69]
Second, we used a REST api to get the binance
data and do the calculations in the previous
[76]
one.
[77]
So that is very slow.
[78]
Because REST protocol is supposed to be used
only when you want to get the data for once.
[83]
But in our case, we have to calculate it again
and again.
[87]
So we need a steady stream of information
from the server every second.
[92]
So in that case, it is optimal to use a Socket
api, instead of a REST api.
[97]
So Iāve used socket api in the tool and
its significantly faster and the good thing
[102]
it, REST apis have a restriction on the number
of calls you can make every minute, but that
[107]
is not the case with socket api.
[109]
You can call any number of sockets, there
is no restriction, so itās faster and no
[114]
restrictions.
[115]
Next, the old one required a chrome extension
to be installed to use.
[119]
So itās clunky and itās not very trustworthy
to install chrome extensions.
[124]
This one, you donāt have to un=install any
extensions.
[126]
You can run some commands and start using
it righ t away.
[130]
Old one was calculated every 5 mins, it's
not very ideal to calculate arbitrage every
[135]
5 min, because trading happens so fast, these
opportunities, they hardly last a few seconds,
[141]
so this timeframe is not applicable to trading
arbitrage opportunities.
[146]
So this one, it runs on socket api, so its
real time, so it's significantly fast, you
[152]
get real updates every second.
[155]
Next the old interface was very clunky, there
were a lot of options and a lot of them were
[159]
not used.
[161]
So i took out all those options and simplified
the interface even further.
[165]
Now letās talk about how the performance
was optimized and how am able to achieve 20x
[170]
performance gain with the new version.
[173]
So to understand that, you have to understand
some basic components of this calculation.
[178]
So, whenever we take any, so this is called
a trading pair.
[183]
So whenever you refer to symbols on binance,
you always refer to trading pair.
[187]
A pair is composed of two assets.
[190]
BTC is an asset, USDT is an asset.We have
several other assets like ETH, NEO, or you
[196]
know, every crypto currency is an asset, and
they are coupled with a market to form a trading
[201]
pair.
[202]
On binance, you have 184 assets as of today.
[205]
We have 184 assets and 565 tradable pairs,
so theses result in 5262 arbitrage-able paths.
[214]
Now with v1, in order to identify all these
arbitragable paths, I had to loop through
[220]
theses 184 assets 3 times, 3 times because
it's triangular arbitrage.
[225]
So itās 184*184*184, that roughly comes
around 6 million.
[230]
So 1 million loop takes roughly around 3.5
sec to process.
[234]
So that means 6 million records take roughly
20 secs to calculate.
[240]
So this is why v1 took 20 sec to perform all
the calculations.
[244]
Now with v2, this 6 million loop, in order
to identify all these arbitragable paths,
[249]
is only run once, and after that these paths
are stored and every subsequent loop, every
[255]
iteration that we run is only executed on
these 5000 paths.
[259]
So thatās how were able to reduce the processing
time to 1 millisecond.
[263]
That being said, the socket sends the data
every sec, so it's safe to assume 1 sec as
[269]
the combined processing time for v2.
[271]
So thatās how weāre able to reduce the
run time from 20 sec to 1 sec.
[276]
And we have to bring down the calculation
time to less than 1 sec because , remember,
[282]
socket sends the data every sec.
[283]
So we have to calculate all the calculations
in less than a sec, otherwise it causes a
[290]
bottleneck.
[291]
Now letās see how to install and use the
tool.
[293]
You need to have Nodejs installed on the system.
[295]
Itās a straight forward installation, Iāll
leave a link for this, you can just go to
[299]
the site and download the current version,
click next=>next and install it.
[302]
Itās very easy.
[304]
After that, this is the link to download the
tool and you have to click on clone or download
[310]
to download the zip file.
[312]
Once you download and extract the zip file,
you will see these files in the folder.
[316]
You have to go to this directory on cmd prompt
and then run ānode index.jsā.
[324]
Thatās it!
[327]
Then hit Enter.
[330]
So you get the message that āArbitrage Bot
has just started on port 3000.
[334]
Please wait...ā.
[335]
So this is when the bot is doing the 6 million
calculations, and after it does the 6 million
[343]
calculations, it gives you a url to access
the tool.
[355]
Okay, the set up is done.
[366]
It takes roughly a minute or 2 to finish this
whole process, and once the process is done,
[371]
you can see the performance cpu usage comes
down to around 1% and the memory is also 50
[377]
Mb, so itās quite, you know, you can just
leave it in the background and let it run.
[381]
Itās not going to eat away your performance
or system resources, and once this setup is
[389]
finished, you get this url to access the tool.
[392]
So you can just copy this and go to your browser
, open the link and you can see that itās
[401]
working.
[402]
These are refreshed every sec, you can see
the data getting changed, you can see 1.127
[407]
and it gets refreshed every sec, and if you
want to trade a particular coin, you can use
[412]
this toggle button.
[413]
So if I click āToggleā, it's off now.
[415]
Itās not updated.
[416]
And if you want to resume updating, just click
on āToggleā, and you can leave you can
[421]
let this run in the background.
[422]
So this is doing all the heavy lifting and
this is just to show you the results.
[428]
You can see that the interface is almost similar
to the previous one because people have gotten
[433]
used to it, right , so I didnāt want to
change it because this is already what you
[437]
are used to.
[438]
Thatās it for this video.
[439]
I hope you find this useful.
[441]
Leave your thoughts and suggestions in the
comments section.
[443]
Talk to you in the next one.
You can go back to the homepage right here: Homepage





