The resource loading... loading...

Industry giant reveals algorithmic trading: inventors quantify platforms as market strategy

Author: Goodness, Created: 2019-07-04 10:57:55, Updated: 2023-10-25 19:59:13

img

The digital currency algorithm trading guide

img

In this article, we will explore the design and implementation of algorithms for trading in cryptocurrencies. In particular, we focus on the execution of algorithms, market maker algorithms, and several market microstructure considerations. We also explore where the theory deviates from practice, especially in dealing with the characteristics of the cryptocurrency market.

Execution algorithms

The goal of the execution algorithm is to convert the portfolio state to a different state while minimizing the cost of doing so. For example, if you want to increase the exposure of BTCUSD by 1000, you may not want to immediately enter market orders into the BitMEX trading channel in a rush, resulting in a large number of slippages. Instead, you can consider gradually gaining your desired position by combining market and limit orders from several different exchanges.

There are usually three layers of execution algorithms: macrotrader, microtrader and smart router.

The macrotrader layer breaks down large initial orders or parent orders into smaller orders that span time. This is actually a displacement part of the entire algorithm. VWAP, TWAP, and POV are common simple examples of macrotrader algorithms. Usually, there are many different market influence models that can be used to design complex macrotrader layers. Market influence models are designed to look at the market's response to execution.

img

Read more: Market influence begins to decline after trading algorithms are executedhttps://arxiv.org/pdf/1412.2152.pdf

The microtrader layer determines whether each sub-order is executed as a market order or a limit order, and what price should be specified if it is executed as a limit order. There is little literature on the microtrader design, which is because the size of the sub-order is usually a small part of the entire market, so it does not matter how it is executed. However, the digital currency market is different, as liquidity is very scarce, and slippage is very obvious even for sub-orders of ordinary size in practice.

The smart router layer decides how to route orders to different exchanges. For example, if Kraken has 60% liquidity and GDAX (Coinbase ProPrime) has 40% liquidity at certain price levels, then microtrader should import orders to Kraken and GDAX at a ratio of 60 and 40 percent respectively.

Now you can say that the arbitrageurs and market makers in the market transfer liquidity from one exchange to another, so if you execute half of the orders in Kraken and wait a few seconds, then some liquidity will be added from arbers and stat arbers to GDAX versus Kraken liquidity, and you can do the rest at a similar price. However, even in this case, the arbers will charge you extra for their own profit and pass on their margin to Kraken's market maker.

Finally, it is best to have your own local smart router. This local smart router also has the advantage of delaying third-party smart router services. In the former case, you can route directly to the exchange, while in the latter case, you first need to send a message to the third-party router service, and then they will send your order to the exchange.

The marketplace algorithm

Market makers provide immediate liquidity and compensation to other market participants. You take inventory risk in exchange for positive expected value. Ultimately, market makers are compensated for two reasons. First, market recipients have a high time preference and need to be immediate. Second, market makers' PnL profits are left-leaning and most traders usually have right-leaning preferences.

img

Read more about: Biashttps://en.wikipedia.org/wiki/Skewness

From a high-level perspective, a limit order is a free option in other markets. The rest of the market has the right but no obligation to buy or sell assets at the limit price of the limit order. In a market where the information is fully known, no one will sell a free option. This is because the market is not a fully known market in general and selling a free option will never make sense. On the other hand, if the market information is completely unknown, risk-neutral market makers are willing to sell these free limit options at a very small price difference, because all transactions are noise.

There are three perspectives that can be considered when designing a market maker algorithm: market makers, market participants and other market makers.

Do your own thinking with their inventory. If you already have too much asset risk, then you may lower your bid, and vice versa. You do this for two different reasons. First, as a company, you have a certain degree of risk avoidance (maybe less than an individual, but your monetary utility curve is still skewed).

There are many shapes of this utility function (e.g. CARA, CRRA, more HARA, etc.). Secondly, as a passive liquidity provider in the market, you will face the risk of reverse selection. The active liquidity recipient may know something you don't, or just be smarter than you. This is basically a matter of selling free options to the market.

Furthermore, even at the level of mechanical operation, market orders that are ordered at the market price will lower the price in the market price way, while market orders that raise the price will be priced at the market price. At the exact moment of any transaction, you are always on the wrong side. In addition, bidding as a market maker has a passive market effect. In other words, the act of sending orders to the unfilled order book will at least drive the market away from you.

img

Read more: Risk aversion functionhttps://en.wikipedia.org/wiki/Risk_aversion

The view of market participants is expressed by the order flow. The volume-weighted frequency at which orders arrive as a depth function should have some key properties.

The function should be:

  • 1) decrease,

  • 2) convex (hard to explain intuitively, but clear from experience)

  • 3) As the depth becomes infinitely close to zero, some formulas require this intensity function to be differentiable twice in a row to be easily handled, which is a fine reasonable assumption but ultimately unnecessary. In addition, there are different formulas for calculating the depth or distance of the pump from the top of the order book to the pump. You can usually use some kind of reasonable middle price pump or the best bid of each corresponding party to the transaction.

In addition to this, there is an unknown factor, which is how much the fair mid-price margin should be. When sending and withdrawing deep orders, the mid-price between the best buy and best sell price is easily affected by the noise price.

In addition, given two cases with the same order book shape, the best bid of the latter will indicate a fair price lower than the best bid of the previous order book. There is also a question of whether the history of the order book is important, and if so, should we pay close attention to the price time or the volume time?

This is actually a convex optimization problem with a single global maximum value. Another consideration is the time-lapse of order traffic arrivals, which looks a bit like a slope-slope process.https://zh.wikipedia.org/wiki/泊松过程Some say it is closer to the Hawkeye process.http://jheusser.github.io/2013/09/08/hawkes.htmlIn addition, the buy/sell rebound that the market maker is trying to capture is the shortest version of the average return. Since this ultra-short average return is scaled by local fluctuations, it makes sense for the market maker to expand the bid when prices are high and tighten the bid when the volume is low.

img

Order arrival intensity with respect to depth (https://arxiv.org/pdf/1204.0148.pdf

img

In addition, the government has been trying to prevent the spread of the virus.http://jheusser.github.io/2013/09/08/hawkes.html

The view of other market makers is represented by this order book. The order book reveals some information about other market makers. The purchase price near the top of the order book is more than the sale price, indicating that other market makers are more willing to sell rather than buy. These market makers may already have a large unbalanced stockpile, or they just think that the price is more likely to go down rather than up in the short term.

In addition, you will often see this kind of one-penny price jump when competing with each other if the price jump is small. Market makers compete with each other by competing for prices until a yield point is reached and only one winner gets priority. After determining the winner, the runner-up usually jumps back to the previous one before the next best bid or bid. If you lose bid priority, you may get a second bid priority.

img

I'm not sure what to say.http://parasec.net/transmission/order-book-visualisation/

Finally, long-term oriented signals can be covered by market algorithms, in which the goal of the market algorithm is no longer to keep inventories flat or unchanged, but to consider some long-term goals and the corresponding deviations that make them a reality.

The speed

Speed is important for two main reasons. First, you can trade orders in the order book before they are canceled. Second, you can cancel orders in the order book before the order is traded. In other words, you want to have a momentary initiative in ordering and withdrawing orders.

Usually, in principle, the strategies that benefit most from speed are those that judge logic by its simplicity. Any complex logic will inevitably slow the round-trip time. These complex types of algorithmic strategies are the Formula One racing cars of the trading world. Data verification, security checks, hardware settings, sorting methods, etc. may be stripped away in favor of speed.

Another type of speed-sensitive class strategy, the relative statistical leverage strategy, where servers are actually located between multiple exchanges rather than coexisting with a single exchange. Although they will not be the fastest data from any single exchange, they will get the price before any other strategy and can act on the relevant and synchronized data.

img

Read more: Best location for intermediate trading nodes on the world's largest stock exchangehttps://www.alexwg.org/publications/PhysRevE_82-056104.pdf

In the game of speed, the winner is the eater. In the simplest example, if there is a leverage opportunity, then whoever can get the leverage opportunity first wins. The second gets a loaf of bread and the third gets nothing.https://zh.wikipedia.org/wiki/冪定律

The speed game is also a competition. Once everyone is upgraded from fiber optic to microwave or laser networks, everyone will return to a level playing field, where any initial advantage will be commodified.

The size of the price jump, grab priority and queue position

Most order matching engines follow price first, then time first (proportional matching is a less common alternative, but we don't consider these now); a better price is executed before a lower-priced limit order is executed. For a limit order of the same price, an order sent earlier will be executed before an order sent later.

Binance breaks orders down to a maximum of 8 decimal places. If the price of the transaction is.000001, the price of.00000001 is 1% of the transaction. If the price of the transaction is.0001, the price of.00000001 is 1 bps (i.e. a jump). This is a huge difference. In the former case, skipping a large order costs a whole point, so time priority is more important, while in the latter case it is 100 times cheaper, so price priority is more important.

In other words, if you have to pay 1% of the total amount to get trade priority, then it may not be worth it because you pay a relatively large amount while increasing the likelihood of being traded in a relatively small number of transactions, and it may be a better option to wait in line, but if you only need to pay 1 bps to get trade priority, you can do so because you reduce the relatively small marginal cost while increasing the probability of a relatively large number of transactions.

This naturally leads to the next question: What is the value of your queue position?https://moallemi.com/ciamac/papers/queue-value-2016.pdf

img

Order book Delta

There are only two ways to reduce the number of orders in the order book: either by being cancelled or by being cancelled. If the decrease is caused by the transaction process, then all other prices other than this price will also be decreased by the process of the transaction. We can sort these transaction records by sorting them and mark each decrease as either cancelled or cancelled.

Intuitively, a trade means that both parties agree to trade at a certain price, while a cancellation means that one party decides that it is no longer willing to buy or sell at a certain price. So, on the surface, we might say that cancellation at the best bid is a very strong signal that the market price will move down in the short term, followed by the trade price.

On the other hand, prices in the order book start to rise, and there is only one possibility: increase the number of remaining limit orders.

The increase and decrease in the order book reflect the private will of market participants, thus providing a signal of short-term price movements.

Better price index and best trading fees

Currently, most price indices are based on taking trade data from multiple exchanges and aggregating them to obtain a transaction-weighted average price. In particular, the TradeBlock index also increases the penalty mechanism of the exchange's weight, because the weight of the exchange is closely related to the inactivity and price deviation of all trades.

On the GDAX, the maker fee is 0 basis points and the taker fee is 30 basis points, for example, the display transaction price is $4000/BTC, which is actually the seller selling at $4000/BTC and the buyer buying at $4012/BTC. The reasonable price of the transaction should be closer to $4006/BTC rather than the actual display price. On the other hand, since the 25bps fee on Bittrex applies to both maker and taker, the actual price is the display price.

Therefore, from the point of view of price discovery, the prices of the transaction records are not directly comparable between exchanges and should be standardized after constructing the price index taking into account the above. Of course, there are some complications with different commissions resulting from the volume of transactions, such as some exchanges formulating and charging taker and maker fees according to the size of the transaction. This also suggests two interesting inferences.

First, the price discovery is limited, in some respects, while strengthening the asymmetry between the exchanges regarding maker and taker fees. Assuming that most GDAX accounts are 0/30 basis points of maker and taker fees and that GDAX usually has a spread of 1 penny on its BTCUSD order book, then the price displayed in the bidding is about a penny fair value spread, 15 points lower than the spot and per trade, with the display price in between being about a penny fair price spread. Therefore, during the quiet period, the penny fair price fluctuates rapidly between the two points, and the price between them is not found to be further refined.

img

GDAX order book

Second, as with the tax relationship between producers and consumers, there is a certain equality in the rate of occurrence of costs between maker and taker. If you charge a relatively high fee to maker, they will expand the order book and pass some of the fees to taker. If you charge a relatively high fee to taker, the maker will tighten the order book and absorb some of the fees from taker.

An extreme case here is that you like maker so much that the order book is squeezed into a price jump at the point difference (as we often see on GDAX) and the order book becomes too tight. Based on this, any additional costs will now become a loss of revenue and fall on the exchange itself.

Except for this extreme example, we can see where the fees charged are not important, but the sum of the taker and maker fees are important. Ultimately, as with the Laffer Curvein tax policy, exchanges face revenue optimization problems in the fee policy. We can see that profit income is the same as the tax policy. If exchanges do not charge any fees, they have no income.

img

The name means "rafter curve"https://en.wikipedia.org/wiki/Laffer_curve

Unfinished business


Related

More

homilyThat's good.