Tag Archive for: arbitrage

Algorithmic crypto trading: market specifics and strategy development

By Marek Koza, Product Owner of Empirica’s Algo Trading Platform

Among trading professionals, interest in cryptocurrency trading is steadily growing. At Empirica, we see it by an increasing number of requests from trading companies, commonly associated with traditional markets, seeking algorithmic solutions for cryptocurrency trading or developing trading software with us from scratch. However, new crypto markets suffer from old and well-known problems. In this article, I try to indicate the main differences between traditional and crypto markets and take a closer look at a few algorithmic strategies (known as trading bots on crypto markets) that are currently effective in the crypto space. Differences between crypto and traditional markets constitute an exciting and deep subject in itself, which is evolving quickly as
the pace of change in crypto is also quite fast. But here I only want to focus on algorithmic trading perspectives.

LEGISLATION

First, there is a lack of regulations in terms of algorithmic usage. Creating DMA algorithms on traditional markets requires a great deal of additional work to meet reporting and measure standards as well as limitations rules provided by regulators (e.g., EU MiFIDII or US RegAT). In most countries, crypto exchanges have yet to be covered by legal restrictions. Nevertheless, exchanges provide their own internal rules and technical limitations, which, in a significant way, restrict the possibility of algorithmic use, especially in the HFT field. This is crucial for market-making activities, which now require separate deals with trading venues.

DERIVATIVES

As for market-making, we should notice an almost non-existent derivatives market in the crypto world. Even if a few exchanges offer futures and options, they only apply to a few of the most popular cryptocurrencies. Combining it with highly limited margin trading possibilities and none of the index derivatives (contracts that reflect market pricing), we see that many hedging strategies are almost impossible to execute and may only exist as a form of spot arbitrage.

As for market-making, we should notice an almost non-existent derivatives market in the cryptoworld. Even if a few exchanges offer futures and options, they only apply to a few popular cryptocurrencies. Combining it with highly limited margin trading possibilities and none of the index derivatives (contracts that reflect market pricing), we see that many hedging strategies are almost impossible to execute and may only exist as a form of spot arbitrage.

DECENTRALIZATION

The above-mentioned facts are slightly compensated for by the biggest advantage of blockchain currencies – fast and direct transfers around the world without banks intermediation. With cryptoexchange APIs mostly allowing automation of withdrawal requests, it opens up new possibilities for algorithmic asset allocation by much smaller firms than the biggest investment banks. This is important due to two things. Firstly, there is still no one-stop market brokerage solution we know from traditional markets. Secondly, cryptocurrency trading is distributed among many exchanges around the world. It could therefore be tricky for liquidity seekers and heavy volume execution. It implies there is still much to do for execution algorithms, such as smart order routing.

CONNECTIVITY

A smart order routing strategy GUI

Another difference is direct market access for algorithmic trading. While on traditional markets, DMA is costly, cryptocurrency exchange systems provide open APIs for all their customers that may be used without upfront prerequisites. Although adopted protocols are usually easy to implement, they are often too simplistic. They do not usually offer advanced order types. Besides, the order life-cycle status following is cumbersome and trading protocols differ among exchanges since each one requires its own implementation logic. That makes a costly technical difference compared to traditional markets with common standards, including FIX protocol.

MARKET DATA

Fast, precise and up-to-date data are crucial from an algorithmic trading perspective. When a trader develops algorithms for cryptocurrencies, she should be aware of a few differences. APIs provided by crypto exchanges give easy access to time & sales or level II market data for everyone for free. Unfortunately, data protocols used in the crypto space are unreliable, and trading venue systems often introduce glitches and disconnections. Moreover, not every exchange supports automatic updates and an algorithm has to issue a request every time it needs to check on the state of a market, which is difficult to reconcile with algorithmic strategies.

The APIs of most exchanges allow downloading of historical time & sale data, which is important in the algorithmic developing process. However, historical level II data are not offered by exchanges. We should also notice that despite being immature, the systems of crypto trading venues are evolving and becoming more and more professional. This forces trading systems to follow and adapt to these changes, which adds big costs to systems’ maintenance. In the following sections I overview a few trading algorithms that are currently popular among crypto algo traders because of the differences between traditional and crypto markets listed above.

SMART ORDER ROUTING

Liquidity is, and probably will remain, one of the biggest challenges for cryptocurrency trading. Trading on bitcoin and Ethereum, and all other altcoins with smaller market capitalization, is split among over 200 different exchanges. Executing a larger volume of assets often requires seeking liquidity in more than one trading venue. To achieve that, cryptocurrency traders may apply smart order routing strategies. These follow limit order books for the same instrument from different exchanges and aggregate them internally. When an investment decision is made, the strategy splits the order among exchanges that offer the best prices for the instrument. A well-designed strategy will also manage partially filled orders left in the order book in case some volume disappears before the order has arrived at the market. This strategy could be combined with other execution strategies such as TWAP or VWAP.

Empirica algorithmic trading platform front-end app (TradePad) for crypto-markets.

ARBITRAGE

The days when simple cross-exchange arbitrage was profitable with manual execution are over. Nowadays, price differences among exchanges for the most actively trading crypto assets are much smaller than a year ago and transactional and transfer costs (especially for fiat) still remain at a high level. Trading professionals are now focused on using more sophisticated arbitrage algorithms such as maker-taker or triangular arbitrage. The former works by quoting a buy order on one exchange, based on VWAP, for a particular amount of volume from another exchange (the same instrument) decreased by expected fees and return. A strategy is actively moving quoted order and if the passive gets executed, it sends a closing order to the other exchange. As the arbitrage is looking for bid-bid and ask-ask difference and maker fees are often lower, this type of arbitrage strategy is more cost-effective.

Triangular arbitrage may be executed on a single exchange because it looks for differences among three currency pairs that are connected to each other. To illustrate, let us use this strategy with BTCUSD, ETHUSD, and ETHBTC pairs. This strategy keeps following order books of these three instruments. The goal is to find the inefficient quoting and execute trades on three instruments simultaneously. To understand this process, we should notice that the ratio between BTCUSD and ETHBTC should reflect the ETHUSD market rate. Contrary to some FX crosses, all cryptocurrency pairs are priced independently. This creates numerous possibilities for using triangular arbitrage in the crypto space.

MARKET MAKING

Market making should be considered more as a type of business than as just a strategy. The main task of a market maker is to provide liquidity to markets by maintaining bid and ask orders to allow other market participants to trade any time they need. Since narrow spreads and adequate prices are among the biggest
factors of the exchange’s attractiveness, market making services are in high demand. On the one hand, crypto exchanges have special offers for liquidity providers, but on the other hand, they require from new coins issuers a market maker before they start listing an altcoin.

These agreements are usually one source of market maker income. Another one is a spread – a difference between a buy and a sell price provided to the other traders. The activity of a market maker is related to some risks. One of them is inventory imbalance – if a market maker buys much more than sells or sells much more than buys, she stays with an open long or short position and takes portfolio risk, especially in volatile crypto markets. This situation may happen in markets with a strong bias or when market maker is quoting wrong or delayed prices, which arbitrageurs will immediately exploit. To avoid such situations, market makers apply algorithmic solutions such as different types of fair price calculations, trade-outs, hedging, trend, and order-flow predictions, etc. Technology and math used in market making algorithms are exciting subjects for future articles.

Read more about how we execute market making strategies for crypto exchanges

SUMMARY

Fast-developing crypto markets are attracting many participants, including more and more trading professionals from traditional markets. However, the crypto space has its own specificity, such as high decentralization, maturing technology, and market structure. Compared to other markets, these differences make some strategies more useful and profitable than others. Arbitrage – even simple cross-exchange is still very popular. Market making services are in high demand. Midsized and large orders involve execution algorithms like smart order routing. To embrace the fast-changing crypto environment, one needs algorithmic trading systems with an open architecture that evolves alongside the market.

Bitcoin and Arbitrage: hand in hand

A brief guide to cryptocurrency exchanges

With a rapidly growing interest among technologist as well as trader towards cryptocurrencies, we have been writing a series of posts about them. In this post we will be covering cryptocurrency exchanges and point out their characteristics, and hopefully at the end of this post you may get an idea on which crypotocurrency exchange to do your trades.

Generally there are many doubts and question marks around how reliable cryptocurrency exchanges are. There has been a lot of rumors and news also around governments getting involved and closing down cryptocurrency exchanges, we heard that in South Korea  the governments is going to raid the cryptocurrency exchanges operating in the country and shut them down. If you are curious about that story, one of the officials from the government called that an “unrealistic move”. nevertheless in recent times we have heard numerous speculations about cryptocurrency world which never came to life.

The purpose of this post is to assess the most known and used cryptocurrency exchanges. We have chosen arguably the top rated exchanges, basing on fees applied, how safe the exchange is, if liquidity in the exchange is high or not, the possible pairs and currencies to trade with  USD, Euros or crypto with crypto and so on. The list we have gathered is narrowed with qualities indicated above.

Coinbase

Coinbase is one the most known and used exchange for Cryptocurrencies with up to 10 million users. Coinbase was founded in 2012 and is California based Crypto exchange for cryptocurrencies like Bitcoin, Ethereum, Litcoin, Ripple and etc. After introducing GDAX, Coinbase also aimed more sophisticated traders with a more powerful tool. Coinbase is also available for mobile users. Fees charged are around 0.25%.

Read here more on our coinbase market making bot and coinbase trading bot.

Bitfinex

Bitfinex is a Hong Kong based cryptocurrency exchange, specialized for trading Bitcoin and Altcoins. About fees, Bitfinex does have very low fees of 0.2% and for those who instead place trades in the order book will pay only 0.1%. Bitfinex is also available for traders to trade using mobile app. Bitfinex offers a variety of order types. For automating the trades Bitfinex also has provided an API feature for third-party softwares to integrate.

Coinmama

Coinmama is a well-known, Israeli based Bitcoin exchanges which traders could purchase Bitcoin using creadit/debit cards. The fees in Coinmama are about 6%, relatively high among other exchanges. Though Coinmama does not require traders to provide or upload their know your customer (KYC) documents.

Kraken

Kraken known as one of the largest Bitcoin exchanges. Kraken’s users can trade Bitcoin using Canadian dollars, US dollars, British Pounds and Japanese yen. Kraken is in Euro volume and liquidity. Kraken was founded in 211 by Jesse Powel, Kraken is also known for low transaction fees ranging from 0% to 0.26% depending on the account tier and the type of the transaction(buy/sell).

Gemini

Gemini is a US based exchange mainly focused on Bitcoin, US dollars and Ethereum. Gemini was founded in 2015 by Winklevoss twins (same brothers who claimed Mark Zuckerberg stole the idea of Facebook from them). Gemini’s users can deposit Bitcoin, Ether and make bank and wire transfer free of charge. In regard to trading fee, Gemini set to charge 0.25% for sellers and buyers. Gemini is referred to as the safest cryptocurrency exchange out there.

More on cryptocurrency exchanges:

Exchange Estimated traffic users Fees Tokens traded
Coinbase 109M 10.1M 0.25% Bitcoin, Litecoin, Ethereum, Bitcoin Cash, Ethereum Classic
Bitterex 85M 5.6M 0.25% Bitcon, Ubiq, Litecoin, Blackcoin, Dash, Ethereum, Gambit, Gridcoin
Bitfinex 36.5M 2.9M 0.20% Bitcoin, Ethereum, Ripple, Litecoin, Bitcoin Cash, EOS, NEO, Iota, Ethereum Classic, Monero, Dash, Zcash, OmiseGO and more
Kraken 22.6M 2.9M 0 to 0.26% Bitcoin, Ethereum, Litecoin, Gnosis, EOS, Dogecoin, Tether, Melon, Zcash, Augur tokens, Iconomi, Stellar, Ethereum classic, Ripple, Monero, Dash
Okex 3.5M 350K 0.20% to 0.25% CommerceBlock, Revain, Bitcoin, Chatcoin, Gifto, Zipper, Ethereum, Zencash and more
Gdax 46M 4.5M 0.25% Bitcoin, Bitcoin Cash, Litecoin, Ethereum
CEX 10.8M 1.6m 3.9% Bitcoin, Ethereum, Bitcoin Cash, Litcoin
Gemini 3.4M 111K 0.25% Bitcoin, Ethereum
Coinmama 999K 33.4K 6% Bitcoin, Ethereum

About Empirica

We are trading software company focused on developing the potential that cryptocurrencies bring to financial markets. Empirica is offering solutions such as Algorithmic Trading System used by professional investors, tools for cryptocurrency liquidity, robo advisory software, crypto trading bots and trading software development services for companies from capital and cryptocurrency markets.

HFT – the good, the bad and the ugly

High Frequency Trading, known also as HFT, is a technology of market strategies execution. HFT is defined by technically simple and time costless algorithms that run on appropriate software optimized for data structures, level of memory usage and processor use, as well as suitable hardware, co-location and ultra low-latency data feeds.

 

Although HFT exists on the market for over 20 years, it has became one of the hottest topic during past few years. It is caused by several factors, such as May 6, 2010, “Flash crash”, latest poor situation on the market and Michael Lewis book – “Flash Boys”. Let’s look where all that fuss comes from.

 

The Bad

 

Among other things, the advantage over other market participants and ability to detect market inefficiencies is the reason why so many people critics HFT so much. Most common charges put on the table are:

 

  • Front Running – HFT companies use early access to incoming quotes to buy shares before other investors and then turn around and sell him just bought shares with slightly bigger price.
  • Quote Stuffing – Way of market manipulation by quick sending and withdrawing large number of orders. Because of speed of operations, it creates a false impression of the situation on the market that leads other participants to executing against phantom orders. Then there is nothing else to do, but to exploit favorable prices by HFT investors.
  • Spoofing – Another method for market manipulation by placing orders and then cancelling them for price increase/decrease. It is based on placing big order on the market to bait other investors, and when the market starts to react, quickly cancel it. Then new price allows to gain some profit by HFT investor.

 

But that’s just a tip of the iceberg. It can be often heard that there is lack of proper HFT regulations, exist false belief that there are Dark Pools without any regulations where HFT companies can hide their activity, and there is still active argument if HFT brings liquidity to the market or just useless volume.

 

The Ugly?

 

Bill Laswell once said “People are afraid of things they don’t understand. They don’t know how to relate. It threatens their security, their existence, their career, image.” That phrase perfectly fits to what is happening now on High Frequency Trading topic. When people would like to take a closer look on how exchanges work, probably, they would be less sceptic to High Frequency Trading.

 

Thus, on most, maybe even on all, exchanges exist two mechanism which can efficiently handle problem of quote stuffing and spoofing. First of them is limitation of number of messages per second that can be send from one client. For example on New York Stock Exchange there is a limit of 1000 messages/sec, so it means that if HFT company burst whole 1000 of messages in first half of the period, in second half it cannot send any message, so it’s cut out of the market. Other limitation used by exchanges is a limit of messages per trade. It hits even harder in quote stuffing and spoofing. In most of the cases limit is around 500 messages per trade and if someone exceed it then he should be prepared for fines. On top of it company that frequently break limits could be banned from exchange for some time.

 

If we talk about front running, first thing we have to know is a fact that front running, in the dictionary meaning, is illegal action, and there are big fines for caught market participants who use it. Front running is using informations about new orders before they will go to the order book. Let’s say Broker gets new order with price limit to process, but before putting it to exchange, he will buy all available shares at better price than limit and then he execute client’s new order at limit getting extra profit. That’s highly not allowed and that’s not what HFT companies do.

 

All they do is tracking data feed, analyzing quotes, trades, statistics and basing on that information they try to predict what is going to happen in next seconds. Of course, they have advantage due to latency on data feed and so on, because of co-location, better connection and algorithms, but it’s still fair.

Hft-scalping-for-large-orders.svg

(source: Wikipedia)

 

HFT companies have to play on the same rules as other market participants, so they don’t have any special permits letting them do things not allowed for others. Same with Dark Pools, specially that they are regularly controlled by Finance Regulators.

 

The Good

 

First, we have to know that suppliers of liquidity, i.e. Market Makers and some investors use HFT. They place orders on both sides of the book, and all the time are exposed to sudden market movement against them. The sooner such investors will be able to respond to changes in the market, the more he will be willing to place orders and will accept the narrower spreads. For market makers the greatest threat is the inability to quickly respond to the changing market situation and the fact that someone else could realize their late orders.

 

System performance in this case is a risk management tool. Investments in the infrastructure, both a software and hardware (including co-location), are able to improve their situation in terms of risk profile. The increase in speed is then long-term positive qualitative impact on the entire market, because it leads to narrowing of the spread between bids and offers – that is, reduce the transaction costs for other market participants, and increase of the liquidity of the instruments.

 

HFT AND MARKET QUALITY

 

In April of 2012. IIROC (Investment Industry Regulatory Organization of Canada), the Canadian regulatory body, has changed fee structure based so far only on the volume of transactions, adding the tariffs and fees that also take into account the number of sent messages (new orders, modifications and cancellations). In result, introducing new fees made trading in the high frequencies more difficult. It was very clearly illustrated by data from the Canadian market.

 

Directly in the following months these fees caused a decrease in the number of messages sent by market participants by 30% and hit, as you might guess, precisely the institutions that use high-frequency trading, including market makers. The consequence for the whole market was increase in the average bid-ask spread by 9%.

NO PLACE FOR MISTAKES

 

When people talk about HFT, both enthusiast and critics, it is not rare to hear that HFT is risk free. Well, on the face of it, after analyzing how HFT works you would possibly agree with it, but there is a dangerous side of HFT that can be not so obvious and people often forgot about it. HFT algorithms works great if the code is well written, but what would happen if someone would run wrong, badly tested or incompatible code on a real market?

 

We don’t have to guess it, because it happened once and it failed spectacularly, it was a “Knightmare”. Week before unfortunate 1st of August Knight Capital started to upload new version of its proprietary software to eight of their servers. However Knight’s technicians didn’t copy the new code to one of eight servers. When the market started at 9:30 AM and all 8 server was run, the horror has begun. Old incompatible code messed up with the new one and Knight Capital initiated to lose over $170,000 every second.

(source: nanex.net)

It was going for 45 minutes before someone managed to turn off the system. For this period Knight Capital lost around $460 million and became bankrupt. That was valuable lesson for all market participants that there is no place for mistakes in HFT ecosystem, because even you can gain a lot of money fast, you can lose more even faster.

 

SUMMARY

 

HFT is a natural result of the evolution of financial markets and the development of technology. Companies that invest their own money in technology in order to take advantage of market inefficiencies deserve to profit like any other market participant.

 

HFT is not as black as is painted.

 

Aldridge, Irene (2013), High-Frequency Trading: A Practical Guide to Algorithmic Strategies and Trading Systems, 2nd edition, Wiley,