Discover more from Savage Corner
Order Books & Market Makers
Understand Market Structure: Make Better Trading Decisions!
A couple of weeks ago, I posted about trade types. I’m going to build on that and talk about order books today. We will also compare order book markets with liquidity pools. Understanding market structure for the assets you’re trading will help you make more informed trading decisions.
Please subscribe for more finance education. Knowledge creates opportunities!
If you take all of the limit orders that have previously been submitted, there will be a bunch of ask orders (an ask is an order to sell) above the current price. Then there will be the current price, and a bunch of bid orders (offers to buy) below the current price.
The price of Bitcoin shown here is ~46650. There are ask orders where people are lined up to sell Bitcoin. Some at 46650, and someone else at 46655, and so on, with more bitcoin available the more you are willing to pay. Then below that people have placed bids to buy at 46649.99 on down.
How much is available on the order book right now is called Market Depth. So Market Depth is basically, “how much can I buy or sell without moving the market?”
In an orderly market, there will normally be similar market depth to both long and short. When it becomes unbalanced, there is some likelihood that the price is about to move quickly to a more balanced equilibrium.
Checking Market Depth
When you evaluate trading opportunities, it can be helpful to check the market depth first to determine whether it’s good for the size of trade you want to make, or to appropriately size your trades for risk management.
I can look up any trading pair on Coingecko; let’s say that I look up BTC/USD. It will show me the depth on each exchange; how much I can buy or sell without moving the market more than two percent. Two percent is a lot for Bitcoin, but for a lot of the smaller tokens, it moves two percent in 30 minutes or an hour. The reason why is because there actually is not very much market depth.
What if the market depth is only $1000 at the two percent mark, and I want a $2000 position? I can either go with $1000 and wait for it to go back down (because I push the market up and other people say “no” and push it back down) or I could just go in the whole $2000 and hope that my order goes through without getting front run by bots that push up the price ahead of my order getting filled.
Heavy Transaction Load
The first decentralized exchanges that were developed used order books. Building an order book exchange on a blockchain is kind of a hard problem. It’s transaction heavy. There’s a whole blockchain that is built for this called BitShares, and it’s very transaction heavy. You have to put in a limit order, and that order sits there on the order book waiting for a match. Eventually it will either expire or you need to cancel it. If you want to be a market maker, you have some bot that’s interfacing with the exchange and doing a lot of trades.
If I’m running a market-maker bot on Coinbase Pro, some months I might have 100,000 trades. If I’m doing 100,000 orders on a blockchain, that is a really high transaction throughput. The reason why being a market maker on an order book is so transaction heavy is because every time one of my limit orders fills, I now have this token that I want to trade the other side of. So I buy Bitcoin at 44,000 and I put an order to buy to sell it at 46,000. When that sells I put in an order to buy it at 44,000 and I flip back and forth as the market bounces up and down. And then I might have orders 10 or 20 deep on either side of the market. It could move plus or minus 10% and my bot will automatically adjust and do orders above and orders below. But that means that every time one of the orders fills it triggers my bot to do a new order on the other side.
And I’m not the only trader, right? There are lots of traders that are market makers that are doing a million trades a month. On a blockchain it very quickly becomes very transaction heavy, and is not necessarily the best solution.
No Market Maker?
Another problem with order books is that to have good market depth you have to have active market makers. Market makers are not necessarily interested in making a market for every single token. Every project that releases a token won’t necessarily have the capability to run a market maker bot and make a market and maintain liquidity for their project. If I want to buy into this token that’s 1000 on the market rankings on CoinGecko, there might not be any liquidity for that token at all.
I look at the order book, and it says well you know you can buy one at one cent. And you can sell one at $1. So is the price one cent or is the price $1? I don’t even know. I don’t, and neither does anybody else. If the spread is one cent to $1, there’s no way to know where are the “actual” prices. I put in an order at two cents, and itt was above the actual price — my order order is going to fill right away. I bought in at two cents and no one ever wants to buy it from me for more than a cent. I’ve already overpaid 100% for the token.
Or I put an order in at two cents, and it will sit there. I check back every couple of days and see if any of it filled. I actually want to get into this, so every couple of days I raised the price a cent. But if it’s a really thin market, no one is actively trading it. I’m raising the price, increasing my bid every couple of days to get into the position. I might shoot way past the actual price or the fair market price before somebody notices that I’m raising my bids every day, and comes in and sell some of it to me. Or they might notice and say “oh this guy is raising his bids every day I wonder how high he will go”. I get all the way to 99 cents and then they fill it at 99 cents. It drops back to a cent, because there’s no bids below mine, and then I can never sell it. I’ve overpaid 9800%.
This is obviously not ideal, especially for the long tail of thinly traded assets, where you can only get a couple of thousands dollars worth without moving the price plus or minus two percent. Or in this case, plus or minus thousands of percent. Or I might never be able to get into the position that I want because I’m not willing to raise the price more than 20 cents and there’s no liquidity. So this is a very far from ideal situation.
Automated Market Makers (Liquidity Pools)
As the cryptocurrency ecosystem matured, people started thinking there are other ways to do decentralized exchange without order books. Eventually Uniswap developed their ‘constant product’ ( x * y = k ) market maker mechanism. I won’t go too deep into the math here. Both tokens are put in a pool, and it maintains the price to be whatever value will hold both sides of the pool to be equal. When someone trades, the quantity of tokens in either side changes, so the price changes. There’s always at least as much liquidity as people put in the pool.
It worked, and projects could submit their own liquidity pools. If you provide liquidity, you earn market maker fees, and sometimes projects will incentives liquidity with additional rewards (yield farming). So that proved to be a much more elegant solution for liquidity provision for this long tail of thinly traded crypto assets, and it became the standard for decentralized exchange on Ethereum and most every blockchain that can support the required token standards and smart contracts.
Some Trading Implications
In my post two weeks ago, I mentioned that all of the liquidity providers in a liquidity pool are makers, and every trade against the liquidity pool is a taker. The liquidity pool replaced this order book design, and the liquidity providers (LPs) are effectively making a market at any particular price on both sides of the market price. Their liquidity provision is essentially spread out at every potential price, so how much liquidity you can get will still depend on how much you’re willing to push the price — on how much market depth there is.
If you understand the difference between order books versus liquidity pools, then you can look at specific markets and have a better understanding of how price might behave, based on whether the market depth is primarily liquidity pools or order books.
If the only liquidity for a token is an order book, then the market depth might be irregular. Let’s say that there’s 1000 HIVE available at 40 cents. There’s only 10 HIVE available at 41 cents, and then there’s 100,000 HIVE available at 42 cents. That’s a very irregular orderbook. I could buy 1000 and barely move the price. Then buying anywhere between 1010 and 100,000 will push the price the exact same amount!
If the token is traded in liquidity pools, then the market depth is very regular, almost the same for either buying or selling. Buying a higher quantity will go deeper into the market depth (more slippage) but in a predictable way.
A Quick Warning — Front Running Bots
In both cases, when you’re trading on a decentralized exchange, other market participants will be able to see your orders before they are recognized by the exchange. There are bots that evaluate your orders and may potentially manipulate the markets you’re trading in to extract excess profits from your activity.
Depending on what the fees are on the blockchain that you’re using, you may want to break a large order up into smaller pieces. If your order would push the price by 5%, then as soon as you submit that order you’re going to be front run by a bot. They’re going to push the price up 5% first, your order is going to fill and push the price up another 5%, and then they’re going to sell the crypto that they just bought and push the price back down. You’re immediately going to get an above market price, 5% above what you intended for it to be.
The easiest way to avoid that is to make sure that you set your order to limit the slippage. Your order is not allowed to execute if the price goes above a certain point. Set that slippage level, and break up your order into smaller pieces. I never, ever, ever do orders that push the price more than 1% because I know that if I do an order that pushes it more than 1% it’s going to get front run. I will usually trade even smaller than that.
The liquidity ‘behaves’ differently in order book markets and liquidity pool markets. Order book liquidity is mostly provided by active market maker bots, while liquidity in pools is provided by passive LP participants. There are always bots hiding in the shadows that may take action if you don’t structure your orders carefully, but if you trade carefully you can minimize your risks to an acceptable level.
My hope is that a better understanding of market structure can help you to better evaluate how new markets are likely to behave. Knowledge creates opportunities!
If this has been informative to you, please share with a friend! If it was all review, but you know somebody that really needs to understand these concepts, pass it on gently.
Not financial or tax advice. This newsletter is strictly educational and is not investment advice or a solicitation to buy or sell any assets or to make any financial decisions. This newsletter is not tax advice. Talk to your accountant. Do your own research.
Disclosure. From time-to-time I may add links in this newsletter to products I use. I may receive commission if you make a purchase through one of these links. Additionally, the Savage Corner writers hold crypto assets and actively trade in certain markets.