📜 ⬆️ ⬇️

How trading on a stock exchange actually works: A simple algorithm (part 2)



We continue the series of articles on how high-frequency trading works in a simple and understandable language. In the past material, the former quantum Mark Stucchio talked about the mechanics of the process as a whole. This time we will talk about the concepts of "price disclosure" and liquidity.

How HFT-traders make money


The last time it was about the fact that in high-frequency trading, they "rule" market-making strategies. The author explained the "kitchen" HFT on the example of several fictional characters - market participants. Let's do another thought experiment. We have two market makers (Leela and Bender) and two speculators (Frey and Zoidberg). Suppose Fry bought MomCorp shares a year ago for $ 5 apiece and now wants to cash them. Zoidberg believes that MomCorp is a good investment and wants to enter the market to get it.
')
12:00:00.000 - MomCorp issues an earnings release 

The HFT trader at this point realizes that the risks have decreased dramatically, and you can easily take stocks at $ 10 and trade for $ 10.05. The game has begun. All traders who practice high frequency trading will now try to enter it as soon as possible.

 12:00:00.032 BUY(Leela, $10.00, 100 shares) <- Leela trades first 12:00:00.042 SELL(Leela, $10.05, 100 shares) 12:00:00.045 BUY(Bender, $10.00, 100 shares) 

In our example, Lila managed to beat Bender and earn $ 0.05 per share. Just because she placed her order earlier. If they were both late for 100 ms, none of them would have any influence on the situation.

Now Fry is confident that he will be able to double his initial investment and is ready for sale.

 12:01:00.000 SELL(Fry, $10.00, 100 shares) 

The matching engine and processing system draws a deal between Fry and Leela with indicators of 100 shares for $ 10 each. It is worth noting that for Fry the competition between two buyers does not matter. All Fry knows is that he sells his 100 shares to an anonymous counterparty. Leela got her 100 shares and is waiting for a new player in the market. In this situation, there are two options:


In practice, the second option is less common. But his probability always exists. Therefore, the seller, such as Fry, is always ready to donate $ 0.5 per share as a risk payment. He does not want to worry about the price movement, shifting this risk to someone like Leela.

Price disclosure


As a starting point, we take the fact that the main goal of the market is the dissemination or disclosure of price information. As soon as fresh data on the future value of MomCorp appears, a properly functioning market will adjust it to the current price value. The next prerequisite: this process has a social meaning.

Traders do not participate in the price disclosure process directly. None of the players has an opinion or information about the value of a company. What, then, do they produce? In theory, the stock price is the result of a general agreement or consensus. In the real world there is always an error factor, the value of which is proportional to the transaction costs. If they, for example, are $ 1 per deal, then a price adjustment of 0.5 or 0.99 will not give you the opportunity to earn. That is, the market price will differ from the “true price” by about 1 dollar. In this case, if we take into account the risks, then the estimated mark-up per share should be higher. If you realize that you can not sell shares, it makes no sense to start with the purchase.

For the sake of simplicity, let's leave aside the broker's fee. We focus exclusively on the transaction costs caused by the distribution of bid and askov.

All that traders do is regular or HFT - they are trying to reduce these costs for themselves and improve liquidity. By liquidity, the author understands the ability to trade whenever there is a desire. Liquidity usually describes two concepts: the amount of assets available for purchase and sale right now at a given price and the limited distribution of bid / ask.

Take a look at the order register:

 SELL($10.10, 100 shares) ----------- A --------- BUY($10.00, 100 shares) 

This register has less liquidity than the following:

 SELL($10.08, 100 shares) ----------- B -------- BUY($10.03, 100 shares) 

Just because register B, unlike A, has a more compact distribution, already ($ 0.5 instead of $ 0.10).

 SELL($10.10, 100 shares) SELL($10.10, 100 shares) ----------- C --------- BUY($10.00, 100 shares) BUY($10.00, 250 shares) 

In Register C, liquidity is higher than in Register A, since more shares are available in it at a price of $ 10 and $ 10.10. When comparing B and C, the answer will already be subjective and not so unambiguous. According to the author of the article, in the case of liquidity, this is a partial execution of orders, and not a full one. Some people prefer to measure liquidity quantitatively. To do this, there are lots of ways.

Why is liquidity so important for players?


Suppose Fry is convinced that during the year some events will occur that have a positive impact on the value of the company MomCorp. In this embodiment, he wants to hold a long position and close it in a year.

Let's say the current price of MomCorp shares is $ 9 / 9.05. That is, a purchase right now will cost him $ 9.05, and he can sell right now for $ 9. If Fry is confident that MomCorp will grow to $ 10 in a year, he should do the following:


Profit will be 95 dollars.

Fry made it pretty easy to convey information, his conviction to the market, because he wanted to speculate on a market with high liquidity. At a $ 1 price move, he earned 0.95 per share, paying $ 0.05 as transaction cost.

What would happen if MomCorp were less liquid? If no one wanted to sell 100 shares to Fry, he would be stuck at the first step. The market would not receive new information. But even if the seller was found, he might have doubts whether he would be able to find a buyer in a year.

Inability to trade when you want it is called liquidity risk. If Fry accepts this risk, he probably expects a large difference between the current price and the price in a year.
Now suppose that company shares are available, but the distribution of bid / ask is wider - $ 8.50 / 9.50. In this scenario, a trading strategy might look like this:


Profit will be $ 0. All possible profit from the price movement went to pay for the distribution.

Fry is not a stupid man. Perhaps he could have predicted that this would happen. Therefore, he did not enter the game and did not transmit his information to the market. It would have been meaningless work for him.

Market prices will accurately reflect the participants' general opinion about the value of the assets represented, where the error value is proportional to the distribution of bid / ask. By adjusting for a price less than this value, players lose money. They do not share their information with the market.

It should be understood that in high-frequency trading strategies, liquidity may be fleeting. Here you offer liquidity for a few seconds at a value of $ 10 / 10.05, place an order (raising the distribution to 9.99 / 10.05) for a few seconds in response to a certain event in the market, return it for a few seconds, and so on. For Fry, none of this matters. He does not know at all who will respond to his order at the time of placement. For him, most likely, the distribution of bid / ask will quickly fluctuate between 9.98 / 10.07 and 10 / 10.05, then it will slow down and fix at a value of 9.90 / 10.10.

HFT as a network market infrastructure


If transaction costs are at least $ X, messages with a value of <$ X will not be sent. The author sends thousands of letters annually, the price of each email here is equal to a mouse click. Twice a year, he has to send exactly two regular paper letters. Both relate to fines for an overdue income declaration. Both are quite expensive: going to the post office and communicating with not very friendly postal employees.

Gmail developers have drastically reduced the cost of sending a single message. The cost of communications is much lower, fewer problems, more letters. By and large, players on the exchange (especially HFT traders) perform the same functions in the financial markets. When someone decides to trade, he transfers his information to the market. “Market makers” reduce transaction costs for speculators, allowing the latter to make more accurate price adjustments.

The author is convinced that automated market makers are simply faster and smarter than their human prototypes. In this, in fact, there is an apology or a word in defense of high-frequency trading.

There are two reasons why robots do their job better. They are more accurate, faster produce accurate calculations. Successful distribution can be $ 10 / 10,10. But the person is ready to choose 9.98 / 10.12 to avoid possible arithmetic errors. The machine is ready to offer a narrower distribution, without fear of overshooting.

Automatons are cheaper. There are not so many people in the world who can always stick to a winning strategy in the market. Probably, such an employee will “cost” a financial company at least 50-200 thousand dollars a year. But no matter how brilliant a person is, he can be managed at the same time with a limited number of assets. A man-driven strategy ideally can yield 200-300 thousand dollars of income per year. A machine can manage hundreds of assets. If a server in a good data center costs, say, 50-200 thousand per year (the figure is taken to bind the machine to a person), it is enough to receive income of 2-3 thousand dollars from each of the 100 assets in order to block the capabilities of the person.

All of these findings have been empirically tested. The machine does not do anything fundamentally different from what any trader does. But it does it faster and more accurately, offering tighter distributions and large amounts of liquidity. Several programmers and a pair of servers can successfully replace tens of thousands of ordinary traders and free up a huge amount of human capital to solve many other useful tasks.

Speed ​​reaction


An astute reader may ask: is it imperative that market operations fit into 4 milliseconds? The answer is no. Take another look at the example from the article. Fry doesn't care what time Leela placed her order. From his position, he trades with an anonymous counterparty. For the speculator, it makes virtually no difference what interval the HFT transaction will take: 12, 24 ms, or even 24 seconds. For him, only the fact that someone is willing to sell or buy shares in the narrow distribution of bid / ask has value.

For Leela, speed matters, because it allows her to trade in front of Bender. Turn out to be slower, the advantage goes to the second player. For Fry it is important that they enter into competition for the price. That is, for the end user, the moment of speed is not critical. However, all HFT traders are forced to play this game. Otherwise, a faster trader will push them out of the market.

This is the social costs of high-frequency trading: a bunch of smart people are trying by all means to reduce the waiting period for the response of the trading system. This has both its advantages and disadvantages. On the one hand, we are dealing with competition between intelligent people who are determined all the time to improve their intellectual level. On the other hand, they could find another useful application.

Other materials on the topic from ITinvest :


Source: https://habr.com/ru/post/307408/


All Articles