ately, I have been hearing a lot of people talking about arbitrage and how they are doing it, or planning to do it, or how they have made amazing profits arbitraging cryptocurrencies with bots they have programmed using instructions in YouTube.

I have even seen ICOs that have raised capital for said activity, w/o mention of key aspects of arbitrage, and with teams lacking the right domain expertise.

I have heard this from programmers in Silicon Valley, Hong Kong, and New York as well. Knowing a thing or two about arbitrage, high yield trading, and financial engineering, I decided to write my first Medium article, to illustrate what arbitrage is, its different flavors, and what I see are some of the opportunities in cryptocurrencies out there. My knowledge in the area is both academic (MBA, Finance; Engineer, Programmer) and practical: I used to structure proprietary arbitrage CDO deals for Deutsche Bank in New York and London, with the largest having a total size of about $3bn USD; and had a similar role in Lehman Brothers (check out this video piece that theWall Street Journalwhere I am interviewed in reference of Lehman Brothers bankruptcy in 2008).

Long story short? Yes, there were plenty of opportunities in cryptocurrencydeterministic arbitrageuntil at least late 2017; there are still opportunities instatistical arbitrage, and there a few interesting ones isregulatory arbitrage.The most exciting to me, as a quant and data scientist involved in the crypto assets space is in what I callhashing arbitrage,which touches some aspects of all of the above, but it is unique by itself.

As I mentioned, in the crypto space, there are still some opportunities out there; however, people in the know do not talk about it; do not publish papers, or open source their code, or disclosed part of it in Kaggle kernel competitions. Wall Street and Silicon Valley are opposite side of the spectrum when it comes to sharing knowledge.

Merrian-Webster defines arbitrage as the following:

The nearly simultaneous purchase and sale of securities or foreign exchange in different markets in order to profit from price discrepancies

I wont talk here about what I call hashing arbitrage mentioned above, and about regulatory arbitrage, I will just quote the definition from investopedia, which is pretty good:

Regulatory arbitrage is a practice whereby firms capitalize on loopholes in regulatory systems in order to circumvent unfavorable regulation. Arbitrage opportunities may be accomplished by a variety of tactics, including restructuring transactions, financial engineering and geographic relocation. Regulatory arbitrage is difficult to prevent entirely, but its prevalence can be limited by closing the most obvious loopholes and thus increasing the costs associated of circumventing the regulation.

Before I explain and differentiate between deterministic and statistical arbitrage, and which type of arbitrage most crypto currency traders are talking about, I need to first talk about Market Making.

When participants want to buy or sell a financial product they need to make their way to an exchange where buyers and sellers meet.

The price they can trade at depends on the supply and demand of the product at the moment and this is translated into the bid price to buy, and ask price to sell. If there are limited parties to trade with, then it may not be possible to buy or sell the product and the product is now considered illiquid. This process is illustrated in the chart below:

In order to guarantee liquidity, exchanges need the participation of professionals to continuously provide a bid-ask spread to the market.

In other words, these professionals make markets, hence the origination of the term market makers.

Market makers do not have an opinion on whether the price of the product should go up or down, they make money on the difference between the bid and ask price or the spread.

When a market maker trades on either side of the spread, they take a position in the market which is translated into a risk for them. Market makers will try to find a way to offset that risk by, for example, hedging the position with a different product.

A market maker must therefore not only understand the product they are making markets in, but also the relationship with other similar financial products.

Over time, competition and technology have significantly changed the job of market makers in order to continuously provide competitive quotes on multiple exchanges, and multiple products require computers running trading algorithms along with electronic exchange connectivity.

Investment banking powerhouses such as JPMorgan, Morgan Stanley, and Goldman Sachs dominate this type of financial activity, but to my knowledge, with zero or minimal presence in the cryptocurrency markets, in part due to regulatory constraints. However, there is evidence that Goldman Sachs and JPMorgan have participated in at least some transactions on behalf of private clients, and might move non trivial resources into the market very soon.

Market makers need to continuously invest in both technology and people to remain competitive and contribute to efficient financial markets. These technological advancements and competition have made the job of market makers significantly more complex.

Market makers provide real benefits by reducing transaction costs to buy or sell securities by tightening the bid-ask spread.

Now, with these basic understanding of liquidity and the impact of technology, we can differentiate two main types of arbitrage: a) Deterministic Arbitrage, and b) Statistical Arbitrage.

a) Deterministic arbitrageoccurs when an investorsimultaneouslybuys and sells an asset in an attempt to benefit from an existing price difference on similar or identical securities. The arbitrage technique enables investors to self-regulate the market and aid in smoothing out price differences to ensure that securities continue to trade at a fair market value.

Given the advancement in technology when trading legacy securities, it has become extremely difficult to profit from miss pricing in the market. Many sophisticated financial institutions as the ones mentioned before are market leaders in this sector, by heavily investing in IT infrastructure and computerized trading systems to monitor fluctuations in similar financial instruments. Any inefficient pricing setups are usually acted upon quickly, with the opportunity often eliminated in a matter of seconds. As I mentioned before, I used to be part of a team of quants that structured these transactions for my employer and using proprietary capital. As you can imagine, casual traders dont stand a chance when large amounts of capital and cutting edge technologies are committed to the activity by large institutional players.

From the days of hot railroad stock trading in the early 20th century; technology provided an edge to those who had it. It allowed some visionaries that coupled capital and technology to profit from huge differential in prices between stock exchanges in California and New York. Those who had access to cutting edge technology such as private telephones and telegraphs at that time, could find out the prices in California and New York for certain railroad stocks during times of volatility, and have their brokers execute risk less transactions.

This type of arbitrage in the crypto market is no different than arbitrage in legacy securities. Until late 2017, there was practically no institutional presence in this asset class, and if you knew Python, some basic data analysis, and maybe some basic knowledge of finance; you could have made some money; as probably some of you reading this article did, probably labeling it deterministic arbitrage.

Of course, having experience exploiting arb opportunities for my former employers, I attempted to profit from arb opportunities in the crypto market a while ago; since I had already been mining and getting exposure to BTC and ETH since 2015 for fun. But for arb, I developed my own tech stack and teamed up with a former analyst for the Federal Reserve, also a Ph.D. Quant with pretty good knowledge of C++, Python, and its scientific stack. I also enlisted an amazing Python and C++ coder from India that has helped me on several projects. So three coders with domain expertise in several areas seriously started this project in Palo Alto, when we were developing an A.I. for a company out there that needed quants with knowledge of time-series analysis for a different industry.

To put our cash to work, we first needed to quantify the market and its risks. We did this by collecting real-time data for every crypto currency exchange: tick-by-tick price and volume information in over 100 different currency pairs; as well as hundreds of other factors related to their underlying blockchains and exchanges that traded those coins, and storing everything in a NoSQL db.

The graph on the left shows the GUI of our early (January 2017) version of the arb tracker & execution code we programmed.

I defined an Arb Event as a function of time, and compiled a table with some of the data we collected. Our analysis shows that the largest arbitrage opportunities in both frequency and value last year happened in the BTC-USD/USDT, and BTC-ETH pairs.

For example, the table below show tick by tick data and averaged by minute, for BTC-USD/USDT for different exchanges from 7/22/2107 to 8/23/2017.

For that period, our analysis shows that the average time an arbitrage opportunity was opened was about 11 minutes, with an average arbitrage profit of about 6%. Exchanges Exmo, OKCoin, and LakeBTC accounted for over 2/3 of all the arb opportunities in the period I chose to show in this article.

But having an inquisitive mind, we wanted to find outwhy these opportunities existed. The table below shows that in over 90% of the trades, a Chinese exchange was involved as one of the parties in the arbitrage.

What was creating these arbitrage opportunities? Did they continue or slow down over time?

On September 4th 2017, China announced the banning of ICOs in that country, generating a market correction over the next several days. Later on, the banning was extended to exchanges and some mining operations in China, with some operators given 30 days to cease operations.

These actions resulted in a correction of virtually all crypto currencies; but at the same time, this created an equally dramatic increase in profit opportunities in the crypto currency markets we were tracking.

This decision of the Chinese government was due to the heavy cost of subsidized energy that Chinese miners have been taking advantage of, by having operations in rural China. In the past years, a substantial increase in energy consumption was not correlated with industrial production in China and became decoupled; which forced the Chinese government to take actions at least while they investigated the issue. As many of you know, companies such as Bitmain (which dominates the ASIC market for mining machines), started to explore relocation to some other parts of Asia, as well as North America an Europe. Arbitrage opportunities existed because Chinese miners (where a great deal of cryptocurrency mining existed), were forced to sell its production in local Chinese exchanges at discounted prices, which allowed operators of Chinese exchanges to profit from price discrepancies in exchanges outside China.

So, lets move on to explain statistical arbitrage.

b)Statistical arbitrageis a heavily quantitative and computational approach to trading. It involves data mining and statistical methods, as well as automated trading systems. Here, we have hedge funds shops such asQuantbot Technologies, or $150 billion USD hedge fundBridgewater Associates, or2 Sigma, being among market leaders in this type of activity, by heavily investing in technology, hiring the best quants from Wall Street, and retraining Silicon Valley programmers and computer scientists (with limited or zero exposure to time series analysis or domain expertise in finance in most cases) to think like quants. However, these shops are not involved, at least significantly, in cryptocurrencies.

Historically, statistical arbitrage evolved out of pairs trade strategy, in which stocks are put into pairs by fundamental or market-based similarities. When one stock in a pair outperforms the other, the poorer performing stock is bought long with the expectation that it will climb towards its outperforming partner, and the other stock is sold short. Mathematically speaking, the strategy is to find a pair of assets with highcointegration.

In statistical arbitrage, portfolio construction consists of the scoring phase, where each asset in the market is assigned a numeric score or rank that reflects its desirability; sort of like Googles page rank, but for financial assets. The scoring is very intuitive, since high scores indicate go long and low scores indicate go short.There is a risk reduction phase where the assets are combined into a portfolio in carefully matched proportions so as to eliminate risks. But obviously, once has to be aware of these risks, and thats where the casual crypto traders fail the tests.

This scoring aspect of quant shops and hedge funds is fascinating, and highly proprietary. Obviously, the details of the scoring formula vary and are highly guarded. I have my own, which I have been applying to cryptocurrency trading, and even mining; and that it also works with other assets but in a different time frame.

Broadly speaking,statistical arbitrage is any strategy that uses statistical and econometric techniques in order to provide signals for execution. As one can expect, statistical arbitrage has become a major force at both hedge funds and investment banks, where many proprietary operations center to varying degrees around statistical arbitrage trading.

So, coming back to the crypto currency traders that claim to have monetized some arbitrage opportunities out there; in my opinionthey have not realized arbitrage profits in the strict sense of the word.

The definition of arbitrage statesthat arbitrage occurs when an investorsimultaneouslybuys and sells an asset. Currently, with the verification of transactions in the different blockchains, the speed is not nearly simultaneously. At best, there has been a 1015 minute window of risk, which in the crypto market is a lot riskier than in the stock market, if one adjust for median volatilities.

Although some of the crypto traders I have come across have in some cases realized some profits, there was some risk taking, mainly, holding the currency in the time window between the time they acquired crypto currency A in exchange X, transferring it to exchange Y, and selling it there. Aside from themarket riskexposure, they have also taken thecredit riskof the different exchanges, as well as manyoperational risks. Not being aware of these risks or how to quantify them, this has created the illusion of having realized arb profits. In reality, the ones who claim have realized profits have been lucky, andliquidity riskdid not work against them. Everybody looks smart in a bull market.

To increase the odds to profit from arb opportunities in the crytpo market, I would say you have to aim for at least 2 out of the 3 types of arbitrage I mentioned here, namely, deterministic, statistical, and regulatory.

With custom code, we currently analyze cryptocurrency exchanges order book transactional accounts, which provide many insights into the market; plus many other factors. Our code is able to:

All of these is designed to outperform benchmarks on a risk adjusted basis.

So how well an A.I. managed crypto portfolio performs compared to, lets say BTC buy and hold, or compared to a passive index strategy such asBitwises Cryptocurrency Index fund?. The chart below (you can find the Tableau versionhere), shows the yield of $10,000 invested in each one of the strategies.

Ten thousand USD invested on BTC on January 1st 2017 grows to about ~$69K by April 5th 2018. The same $10K grows to about $97K in Bitwises Top 10 index; and grows to about $170K in an A.I. managed portfolio using a stat arb approach. All of the indices consider slippage and transaction costs.

I have seen VCs fund startups with good (on paper) theoretical models in the fintech space, which I suspect (for what I have seen), will break down in scenarios such as the 2008 Lehman debacle, or around the LTCM crisis. Many of the underlying machine learning models these startups have developed hardly (or not at all) consider stressed macro economic scenarios and hidden operational risks. I imagine that some some newly capitalized hedge funds with fresh capital and venturing into the crypto space are not considering some of these risks as well.

So to profit from cryptocurrency arbitrage the right way, before you commit any capital, start with a quantification of all the risks you can think of; and do a lot of out of sample tests. Also, domain expertise goes a long way, so if you havent had exposure to professional trading; try to team up with people who share your interest but have some financial engineering experience in a real-world setting.

You can follow activity in my private reposhere,twitter postshere, or you can ask Qs below oremail meat SGX Analytics.

If you are curious about my time series analysis and simulations applied to algorithmic music composition, you can listen to my AI generated music inApple MusicSpotifyand SoundCloud(and If you a background in music promotion and/or search engine optimization and you have qs about this post, Ill love to hear from you and have the chance to ask you a few Qs about your job)

Data Scientist/Strategist. Former ABS Banker, Senior Quant for Barclays, Lehman, Deutsche, Spec Ops for AIG, hedge funds.

Welcome to a place where words matter. OnWatch

Follow all the topics you care about, and well deliver the best stories for you to your homepage and inbox.Explore

Get unlimited access to the best stories onUpgrade