A Brief Look At Crypto Arbitrage Trading

in #cryptocurrency8 years ago

Hi again!

I am surprised that my introduction post was so well received. Thank you for having me! Someone asked for more details about the arbitrage trading that I do. So I will talk a little bit about arbitraging in this post - how you could do it, and what kind of risks you need to consider.

I will assume that you are already familiar with the basics of crypto trading - exchanges, order books, volume, and stuff like that.

So what is arbitrage? Wikipedia:

"In economics and finance, arbitrage (...) is the practice of taking advantage of a price difference between two or more markets: striking a combination of matching deals that capitalize upon the imbalance, the profit being the difference between the market prices."

The simplest form of arbitrage would be: when a particular coin is cheaper on exchange A than on exchange B, you buy on A, sell on B, and pocket the difference. Sounds easy enough, right? So why doesn't everybody and their grandma do it? Well, there are quite a number of pitfalls and risks that I would like to touch on in this post.

Counterparty risk

To strike arbitrage deals, you will need to store coins on exchange sites. Sadly, there are many examples of bitcoin exchanges getting hacked, or running away with their customers' money.

Some decentralized exchanges exist, such as Bitshares or the NXT asset exchange. Unfortunately, their volume is still quite low, and the non-realtime nature of decentralized systems may be a downside for arbitrage trading (see "Execution risk").

A good piece of advice to mitigate counterparty risk would be to increase the number of parties. As in, spread your coins on many different exchanges. The likelyhood of all of them getting hacked at the exact same time should be low.

Execution risk

Execution risk stems from the possibility of having executed the trade on one side, but then not being able to fulfill the opposite trade because someone else has already taken it, or the order was pulled from the market.

In other words, it is the risk of someone else being faster than you, or the market quickly moving against your favor.

Most of the time, you can undo the first trade with a minor loss, so it's not a huge concern. Still, it's a good idea to make your bot as fast as possible, through efficient use of the exchange APIs. If you are not located in the US (or whereever the exchanges are based), you might want to run your bot on a remote system so as to get a better ping.

Movement risk

If the arbitrage was so random that on each exchange you would buy as often as you sell, then you can get away with not moving your coins around from one exchange to another.

But more often than not, prices are moving in a particular direction (bull market or bear market). During a bull market, it is common for lower volume exchanges to "lag" behind prices i.e. always being cheaper, and vice versa for a bear market. So during these periods you would only sell on one exchange while only buying on the other exchange. If you want to keep doing that, you will need to transfer your coins from site A to site B.

And this is where another big source of risk comes in. Aside from having your funds unavailable for 10-120 minutes or so as they move along the blockchain, I have encountered many issues since I've started doing this:

  • A deposit stuck for 3 whole days on a halted blockchain. This can happen if mining pools go offline or nodes become unreachable.
  • Exchanges not paying enough transaction fees, causing the transaction to get stuck for days before being mined.
  • Two exchanges that were on different forks of the blockchain, hence not seeing deposits.
  • Deposits not being credited for no discernable reason.
  • Withdrawing the same currency multiple times in quick succession can screw you over. Some exchanges will attempt to combine withdrawals into the same transaction. And apparently they're not very good at adding numbers, as I have received less coins on the other end than I withdrew. Be careful!
  • Deposit systems not compatible with each other. Exchange A wants you to include a message / payment ID / memo, but exchange B doesn't allow you to specify one.
  • A deposit being credited twice. I shit you not, they gave me free money! Being the nice citizen that I am, I told them about it of course. They thanked me and even let me keep a portion as a reward.
  • Wallets going into prolonged or perpetual maintenance as the exchange struggles to get it running. I've heard horror stories of crashing wallets, wallets that refuse to sync past a certain block, etc. I don't envy these guys' job.

To mitigate movement risk, you could stick to trustworthy exchanges that offer customer support. You could stick to coins that have stable wallets, lots of users and are well-tested. But on the other hand, the lower market cap coins are much more volatile in their prices, making for more potential profits. Is this risk worth it? is a question you will be asking yourself all the time.

Price decline risk

In a bear market, your trading funds will decline in value over time. Even if you managed to strike lots of arbitrage deals, the profit generated may not be enough to mitigate your losses.

Recently, for example, we have seen all major alt-coins take a hit when Bitcoin moved up.

There is an interesting way around this risk, though. Some exchanges support margin trading, in which you can trade with funds borrowed from other users. What you can do is borrow someone else's alt-coin, sell it, wait for its price to decline, then rebuy. This is called a short position. It makes you money when the price goes down, and it loses you money when the price goes up. So to make our arbitrage trading funds immune to price trends, we just need to open a short position for the same amount that we own. I like to call this a long-short position.


Poloniex supports margin trading for 11 different alt-coins.

There are a few downsides to this technique though. Some of your bitcoins will be unavailable for trading, as you need collateral for the borrowed coins. You need to pay daily interest to the lender. When entering or exiting a long-short position you pay trading fees, and you might incur losses from the market spread. To avoid your short positions from being forcefully closed (margin called), you will need to monitor them closely and transfer additional bitcoins to your margin account when necessary.

So, is arbitraging worth it?

Depends on your expectations. I can speak for myself that my operation has been rather profitable, but it has also been a lot more work than I anticipated. Coding the "exchange API wrapper" that wraps all the exchanges I use (12 at the moment) under one common programming interface was quite the challenge, as most of these APIs are badly documented and have some unexpected quirks. The kind that will make you pull your hair out. Anyway, now that I have finished my trading bot (hm, not nearly finished, let's just say it's good enough for now), I see no reason to not just keep it running, as it provides for a small stream of profit with little action required on my part:


Relative growth of my trading fund (in BTC, amounts undisclosed). That large spike was the day of the DAO hack, though funny enough most of my profit that day was made through a trade completely unrelated to the DAO.

There are lots and lots of unknown variables in this that you'll have to figure out for yourself - How much starting capital should you put in? Which coins do you arbitrage? Which exchange sites are trustworthy and which frequently have the highest arbitrage? Do you keep a balance for each coin on each site, or do you just buy and transfer on demand (increasing delays and execution risks)? What percentage of arbitrage do you aim for? If you strike too early at, say, 0.1% profit, you will barely gain anything, but if you wait for prices to diverge more, someone else might take it first. Finding the best answers to these questions will ultimately determine your success or failure. Unfortunately, the answers will often change as the market changes, so the trading bot would not be 100% maintenance-free in any case.

The amount of arbitrage you can get overall also depends on market conditions; as you can imagine, rapid price changes make for the most arbitrage, events like the DAO hack for example. But there is no guaranteed profit by any means.

The good news is that as with all trading techniques, you can start small, see if it works out, and go from there.

If I had to start over from scratch, I think I would do a market making bot instead. Not having to worry about moving funds around makes things a lot easier. liquidtech.info runs a crypto trading fund that makes its profits through a market making bot. As you can see, he has made some impressive profits in the last months as well.

Crypto markets are so inefficient and volatile right now that it's not very hard to make a profitable bot. Perhaps this will change in the future as the markets gain traction towards the mainstream.

Thanks for reading, and have fun trading!

Sort:  

there is software developed right now for this....

Do you mean software available to others?

These guys seems to be fraudulent. Many shill posts out there - balanced against adamant claims of loss. But the big red flag is lack of any trade results and knowing who the developers are.

Someone asked for more details about the arbitrage trading that I do.

That would be me!

Thanks for this very detailed article on profiting on arbitrage in the cryptocurrency markets. I see that you have done quite a bit of work to set up your system, and I'm glad it has paid off for you.

What language is your exchange API wrapper coded in? I have experience in js and VB/C# but most of the code I see discussed on here is in Python or Go.

Thanks for the lead at the end, about another way forward via market making. I'll look into that too.

I wish you much continued success!

I use Python myself. I don't think the language matters that much, each has its pros and cons. Python is nice because it's fast to write and the standard library has helpful things like encryption and a thread pool built in. Some might prefer a more strongly typed language (e.g. C++) as the compiler can catch bugs for you before you run your program. C++ might also be best from a performance perspective, then again your main concern is network latency, so I don't think the language matters there.

Bottom line, pick whatever you like.

I wrote an article that explains a simple way to arbitrage across cryptocurrency exchanges, and the math involved. Important to know what you are getting into so that you will not be trading at a loss. https://steemit.com/arbitrage/@kesor/the-math-behind-cross-exchange-arbitrage-trading

Thanks for the detailed post. What's exchange API wrapper ?

There's only one you need to know about: https://github.com/ccxt/ccxt

Do you have any information about make the Market Maker, I'm just starting studying computer science and I have a degree in account I would really be interested in this project

I developed my own arbitrage system....http://arbiswap.com feel free to check it out, it has many filters to avoid false arbitrage reports and it monitors 800+ coins on the most popular exchanges...

screenshot-arbiswap.com-2018.02.19-14-10-16red.png

There is already a calculator which calculates the best arbitrage rate for you. For example ( https://admycoin.com/arbitrage/ )

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63900.40
ETH 3140.82
USDT 1.00
SBD 3.98