NO.1 PrefaceIn recent years, the digital currency industry based on blockchain technology and cryptography has witnessed explosive growth. As one of the most important links in the digital currency industry chain, the blockchain asset exchange undoubtedly has the priority position. It connects the secondary market of blockchain investment, as well as the project side and ordinary investors.
Background of blockchain asset trading market- Operating time of the exchange: the average operating time of the top big exchanges is less than 3 years
- Exchange team: led by small entrepreneurial team
- Number of global trading users: about 10 million to 20 million global trading users
- Global daily transaction fee income: about $25 million
- Growth of the number of global exchanges: from dozens to hundreds
According to statistics, at present, more than 300 exchanges have been included by non-small platforms, and even thousands of those have not been included. Even so, entrants still enjoy it. Under the background that everyone is involved in the trading, almost every exchange has dozens or even hundreds of trading objects, so in the market with limited stock, small and medium-sized blockchain assets and exchanges will face the situation of lack of flow and a situation of no price and no market.
NO.2Why market maker strategies are just what's neededThe emergence of market maker robots has changed this situation. By participating in market making, we can curb excessive speculation in the market due to the asymmetry of information and resources, and maintain the good operation of the trading platform. It also reduces the phenomenon that the so-called dealer secretly manipulates the price in the traditional trading mode to enhance the market attractiveness, improve liquidity and trading volume, meet the buying and selling needs of ordinary investors, and stabilize market confidence.
Market maker
Buying and selling at asking price
■ Arbitrators
■ Short-term bias
■ Earning spreads
Market taker
Buyer or seller
■ Traders
■ Investors
■ Producer/consumer
■ Earning or hedging from price fluctuations
Today, in order to make the new exchange and new currency better connect with ordinary investors and solve many problems faced by them at the initial stage of listing, both small and medium-sized exchanges and blockchain project parties have to rely on market robots.
NO.3Principle of market maker strategyMarket-making strategy tracks price changes through market making system, and provides two-way quotations for buying and selling constantly. Through a large number of high-frequency buying and selling transactions, accumulate the price difference between each transaction price and the theoretical price gradually, and adjust the price difference dynamically according to the characteristics of the position.
There are two common market maker strategies in general exchanges:
Passive market making: Market makers follow the in-depth data and transaction data of the mainstream exchanges through the strategy of tracking, instead of making a big active choice, but passively follow the market. They pursue the maximum degree of close tracking and complete replication, and try to achieve the same K-line data as the mainstream exchanges.
Free market making: This market making mode does not refer to other trading targets, but makes the market according to its own cost and setting of order. This model is suitable for the environment where the pricing power of relevant currencies is relatively concentrated, such as small blockchain assets or currencies issued by the exchange itself.
NO.4Market maker strategy vulnerabilityWhether it is a passive market making or a free market making, it is necessary to solve not only the price problem of the transaction object, but also the liquidity problem. Therefore, in order to activate the market, it is necessary for the marketers to buy and sell themselves, otherwise it is difficult to form a decent K-line.
The common method is to sell at a random price near the market and immediately buy at the same price. Or buy before selling according to the random price. Generally, due to the short time interval between trading and buying, the corresponding listing can not be found in the depth data, but the transaction record can be left in the historical data. The K-line is drawn by this market making method.
**Please pay attention! This is how the vulnerability appears.**
In order to generate a continuous K-line, the market maker strategy has hidden the vulnerability in the self-buying and self-selling list near the opening of the market. Although the buying order and selling order of the strategy are issued at the same time, the network problem and the matching speed are not ideal, nor can they be ideal, which leads to a certain probability that the order of the marketing strategy will be closed by others.
Imagine that if there is another high-frequency order strategy in the market, it always deals with the selling orders of the market strategy at a lower price, and deals with the purchase orders of the market strategy at a higher price. As long as the price difference obtained by this high-frequency order strategy can cover the handling charges, it will generate profits. This leads to the strategy of selling low and buying high in the market, think carefully!
NO.5Practical demonstrationAfter observation, there is a market making phenomenon in **the ETHUSDT trading pair of a certain exchange**, and the reference object may be the ETHUSDT data of Binance. By observing the data of its market order book, it is found that there is a self-closing order, and the trading direction is random. The chart below shows the K-line generated by the market making strategy on that day.
https://stocksharp.ru/file/150331
Usually, the high-frequency order strategy is not randomly priced at the opening of the market, but randomly changes with reference to the last transaction price of the market strategy. In fact, it is difficult for the transaction price to reach the low and high market prices, and the success rate of obtaining market making strategy orders is limited, so there is almost no profit.
They even have to bear the risk of unilateral positions. This seems to be impeccable, but if we take advantage of the bug that market making orders must be placed in the market, we can easily crack the market strategy of the exchange and make great profits.
NO.6The specific steps are as follows:When expecting a low price deal, add a certain price to the buy one price to pend a selling order. When the buy price is 200, pend a selling order of 200.1, then keep pending a buying order of 200.09, and withdraw immediately. When the transaction is completed, reverse the operation immediately and sell the traded currency at a high price, thus completing a loop.
Although such a success rate is not very high, through a large number of frequent pending order and cancellation transactions, this opportunity will be greatly increased and the profit will still be considerable.
https://stocksharp.ru/file/150330
As shown in the chart above, **a high-frequency order strategy was written through the FMZ Quant Trading Platform (FMZ) and run in the real market with almost no withdraw**. In only one night, the profit of 1,000USDT was transferred to 4,000USDT.
This is a gentle order. If you use multiple accounts, multiple contracts, and multiple threads, you will increase profits. After the high-frequency order strategy takes advantage of this vulnerability, it steals a huge amount of money and leaves behind a dreadful of the K-line, as shown in the following chart:
https://stocksharp.ru/file/150332
NO.7The source code of the order strategy based on the vulnerability of the exchange market
https://stocksharp.ru/file/150333
The above strategy source code is based on the FMZ Quant Trading Platform (www.fmz.cn)
NO.8Prevention methodsFor this market making strategy, it is easy to solve the problem after knowing the principle. For example, when the transaction price of the market making strategy is at a low level, only the buy order is placed first and then the sell order, and vice versa, so that others will not buy it at a low price and sell it at a high price. Or put all transactions and pending orders in the scope that can be hedged in other exchanges.
Words to follow**Although the exchange is at the top of the entire blockchain industry**, it is like a giant outside, revealing more attack areas and exploitable vulnerabilities.
Objectively speaking, the irrationality that can be deduced from the order book may have more hidden bugs. For example, by taking advantage of the obvious vulnerabilities in the strategies of exchange market makers, attackers can skillfully design various covert attack strategies, and they can also do it unknowingly.
**Today, digital currency has become a new target for investment, and exchanges have become an arena for many hackers**. The hackers hiding in the dark are like hungry wolves, waiting for the opportunity to move, staring at the flaws of the exchange, and preparing for a fatal attack. The blockchain centralized exchange can only strengthen its own defense deployment, so that customers can have worry-free transactions.
From:
https://blog.mathquant.c...ity-in-the-exchange.html