What I've Learned from Years of Arbitrage and Market Making
https://jare.cloud Accelerating as a Service, Dropout Turned #Entrepreneur, Mental Health Advocate!
My GitHub https://github.com/dunncreativess is rife with examples of crypto trading automation, specifically in making markets and arbitrage. From humble roots doing things like internet traffic buying and selling arbitrage, right through sports betting arbitrage and eventually - upon discovering platforms like the since-extinct Qryptos - figuring out that fee rebates are the real way to make 'risk-free' money, a whole bunch of different custom-built or re-appropriated apps from other FOSS sources to capitalize on that notion.
Opportunities Last Microseconds
Competition is fierce and whenever you find an arbitrage opportunity you can rest assured someone else is already there ahead of you, sometimes with millions $ in budget to create their own bots. They have faster, lesser lag infrastructure supporting their bots, and so opportunities for arbitrage last a very, very small amount of time. Any additional delay in processing or latency talking to the exchange can be critical.
One of my first experiences creating a crypto arbitrage bot was for someone on UpWork who wanted a Cryptopia (I think I remember correctly) but that would operate a triangular arbitrage on given combinations of pairs.
It would cycle through all the pairs, and find out, say, when it could make money doing BTC -> DOGE then DOGE -> ETH then ETH -> BTC. In theory, if the prices don't agree due to some movement then you can turn a profit doing this - even after you factor in fees.
The issue became the fact that - when there was even enough volume to warrant the exchanges - the opportunities for profit would honestly last a shorter amount of time than it would take to complete each leg.
Decentralized Inter-Exchange Arb is Even More Difficult
Classically, there's more opportunitiy for arbitrage when you consider price ineffeciencies among different exchanges. The issue, again, is time - if it takes 30 ETH confirmations to get your money from one exchange to another (and assuming you don't have wallets for all your assets and underlyings on all exchanges, which one would call 'pure arbitrage' - is ideal - but a huge oppressive level of investment!) then the price discrepency will likely disappear too fast.
Enter EtherDelta, IDEX, and etc, where a deposit on the ETH blockchain takes only 1 confirmation. With a faster reaction time than centralized exchanges, you could imagine making more money more quickly, no?
When your transactions execute against smart contracts, if the order doesn't exist on the books anymore (because someone beat you to it with a better script or higher Gas... or what-have-you) then your transaction will actually consume the most gas you're allowed when you go to fail that transaction. Whoops!
I actually wasted a whole Ether or two @ $800 apiece building a crypto arb bot for decentralized exchanges as a part of an interview for a job (no worries, their funds!) - I did get the job, but the bot ended up being defeated. D'oh!
Enter Market Making Fee Rebates
On futures exchanges, usually, like BitMex or Deribit, if you create an order that someone else then acts again - adding to (or making) the books rather than taking from the books - you receive a percent fraction of the fees they charge the market taker.
What's beautiful here is that while 'the house always wins,' now you can be part of that winning side of the formula!
So, I started building scripts that would be on both sides of the order books and have orders executed against them.
On testnet, on Deribit, one of my more profound bots did literally billions in notional trades and turned 10 BTC seed into 600+ BTC - a triumph! I did, however, find out that there were fake taker volume bots on the Deribit testnet - on livenet, there weren't enough volumes to make enough maker rebate before the market would move in an opposite direciton of open positions and lose out on a huge margin. D'oh!
This bot still has a lot of promise when there's more volumes on Deribit, BitMex. This sounds like a tall order - but think of how much the IBM, Microsoft, Apple equities and deriviatives dwarf the markets of Mex or Der!
I then thought about a different approach: one could automate both sides of the spread and if the spread itself was of a bigger percent vs. itself, then you'd soak up more profits as people buy and sell against you. For instance, if you buy BTC and then sell it on the other side of the spread you're making 0.00002% on the price movement - whereas if you buy and sell a lesser-volume coin (think Binance) - then you might make as much as 5, 10, 15% on that spread!
This bot actually does have a lot of promise - it was ported to a number of exchanges - but never fully tested on livenets.
What's the Plan for These Bots?
These bots are still fantastic creations, and believe-you-me they won't go to waste! I am Chief Liquidity Officer at Coindex Labs, and part of my duties there are to re-appropriate FOSS bots for use within their platform. The above bots I wrote are in various stages of production with them.
What does this mean? The bots had many - dozens upon dozens - of input paramaters. When me and my Telegram group were testing the bots, we were using a smattering - guessing, really - the settings we would test, and optimize the code as we went. Sometimes, crazy ideas returned the best results - like using higher-volume coins in the second bot. Seems counter-intuitive, but the higher volumes meant more trades and - even at smaller volumes - more revenues!
So, when I feed these bots into the Coindex Artificial Intelligence, it takes the input variables and creates competing genomes that evolve over generations to see what combinations of input variables yield more favorable results - whether that be profits, notional volume traded, or whatever the goal may be! We can then employ the different genomes on livenets and have them do actual trades.
Check the non-NDA teaser that I include as a bonus on my email subscriber list for some details about how the bot's been performing :D
!! Do you appreciate my code?
Drop me a $1/month or $5/month subscription to feed me a coffee every now and then on my newly launched
Be notified about new articles? Welcome to the Jarett Dunn email subscriber list! Each new signup will receive a link to download the Coindex Labs non-NDA teaser, which includes information about the value proposition for my organization — where we’re setting our sights first on a money-printing machine, then returning later as conquering heroes in order to then defeat the world’s greater humanitarian issues.
(Disclaimer: The Author is the Chief Liquidity Officer at Coindex Labs)
Subscribe to get your daily round-up of top tech stories!