Cross-exchange order book matching is a mechanism that MultiTrader employs in order to find arbitrage opportunities. MultiTrader platform constantly records ticker prices and order books from all the exchanges it is connected to. It is searching for the situation when it could buy low on one exchange and sell high on another. Theoretically we could just use ticker prices for that – e.g. compare ticker price from one exchange to ticker price on another. But let’s dig deeper here.

A little bit of theory

Ticker definition after Investopedia:

A stock ticker is a report of the price for certain securities, updated continuously throughout the trading session by the various stock exchanges.

Ticker contains information about “current price” of given asset. However this is tricky – it doesn’t tell what is the amount of this asset that is available with this price. You could easily get into problems if you rely only on this price. Arbitrage opportunities often appear between smaller and bigger exchanges. On bigger exchanges with greater liquidity, the ticker price is pretty close to what you will have to pay, however on the smaller exchanges with less liquidity the ticker price may be very distant from what you will have to pay. The liquidity of the exchange after Wikipedia:

market liquidity is a market’s feature whereby an individual or firm can quickly purchase or sell an asset without causing a drastic change in the asset’s price.

Ticker price represents just the top of the order book.Ticker ask price is the lowest entry in the order book on the ask side of the order book. Ticker bid price is the highest entry in the order book on the bid side. Let’s take a look at the definition of the order book after Wikipedia:

An order book is the list of orders that a trading venue (in particular stock exchanges) uses to record the interest of buyers and sellers in a particular financial instrument

Each exchange maintains separate order book for each currency pair. Order book has two sides – ASK – list of orders with sell offers, it is usually sorted from the highest sell offers on the top to the lowest at the bottom. Ask side of the book stores orders from the exchange users who want to sell given asset – hence the “ask” – this is how much they are asking for it. Second side – BIDS – list of orders with buy offers – again, highest buy offers are on top of it, lowest on the bottom. Bid side represents the list of orders of the exchange users who are willing to buy given asset and the bid is how much they are willing to pay for it. On this picture ASK offers are red, BIDS are green. That is common pattern across many exchanges. As you can notice the order has two parameters – size and price. Size expresses the amount of currency in this order available for this price. What is important, this price doesn’t contain exchange’s trading fee. Exchange trading fee is applied at the moment of actual trade.

When the user places the order on the exchange it is matched against exchange order book.

One more definition that we will need in the example. Market order after Investopedia:

An investor makes a market order through a broker or brokerage service to buy or sell an investment immediately at the best available current price.

Market order has only one parameter – the size – what amount of given currency do we want to buy. Exchange will fill our order with the lowest available ASK offers, starting from the lowest.

Order book matching example

Lets assume that the user chooses to place buy market order. User is reach and wants to buy 5 BTC/USD. The bottom of ASK side of exchange order book looks like that:

The exchange will fill our order with the lowest available ask order 4.3397 BTC for 7425.77 USD each (total 32225,61 USD). After filling your 5 BTC order with 4.3397 BTC, we have 0,6603 BTC remaining to be filled. Exchange will fill it with part of second lowest sell order for 7426.69. For 0.6603 BTC you will pay 4903,84 USD. In total for your 5 BTC you will pay 37129,45 USD which gives 7425,89 USD for each BTC. The lowest ask order in the order book has been filled completely, therefore it will be removed from the order book, second lowest was filled partially, from now on it will be on the bottom of the ask offers in the order book, with the size 1.0024 – 0.6603 = 0.3421 BTC.

What is important in the example above – the price that you’ve paid – that is 7425,89 USD for each BTC is higher than the ticker ask price – 7425,77 USD – that was initially the lowest ask price in the order book. In this example the difference is very small, but very often, especially on exchanges with low liquidity, the ticker prices differ even 5% from the next available entry in the order book.

This example shows that in order to properly perform the arbitrage you need to look deep into the order books of both exchanges on which you want to perform the arbitrage. The size matters! The bigger the size of your order, the deeper you go in the exchange order book, the worse price you are getting.

Cross-exchange order book matching

The screen below represents arbitrage trade opportunity analysis performed by the MultiTrader platform:

This particular arbitrage opportunity shows that you can buy BCN/BTC low on Binance and sell high on Poloniex.

The Ticker data section shows you that the buy price on Binance is 0.00000046 BTC, while the sell price on Poloniex is 0.00000048 BTC. These prices do not contain exchanges’ trading permissions.

The Cross-exchange order book matching analysis section goes deeper – it shows you how the Binance ask orders can be filled with the Poloniex bid orders. In this section, user can already see the commissions applied to the prices. Maximum amount available for arbitrage is calculated based on matching the bid and ask orders on both exchanges with the use of default commissions.
MultiTrader matches bid orders from one exchange with ask orders from another going from the top of the list as long as the outcome of arbitrage is positive.
Total amount available for arbitrage is the sum of the orders that were matched (these orders are highlighted with yellow on the list). The total trade price is calculated assuming that the maximum amount available for arbitrage is traded. If you purchase less, the gain may be bigger as the lower asks are matched against higher bids first.

MultiTrader constantly reads the stream of order books from the exchanges and analyses all possible combinations of exchanges and currency pairs. In case in some combination the ticker prices looks promising, MultiTrader conducts detailed order book matching to find out the real size of the arbitrage opportunity. MultiTrader provides user with live stream of current arbitrage opportunities.

Next articlePlatform Overview