I recently read babyquant's "Brief Analysis of Arbitrage Strategies in the Big Pie Circle" and wrote about various arbitrage strategies. I will also talk about my own digital currency arbitrage strategy that has been running for about 2 years.
All of this is made public, firstly, because I no longer run these strategies, and I will summarize them myself after writing them; secondly, the logic of arbitrage strategies is not mysterious in the first place. What this industry competes for is execution, that is, the ability to write code, especially in high-frequency trading. The frequency of trading may not be very high, but you must react quickly and enter the market immediately when fluctuations occur. Of course, there is also the ability to specialize in research, because the competition for arbitrage is still relatively fierce, and the competition in the later period is even more fierce. You also need to have a certain ability to raise funds. After all, the profitability of arbitrage is limited. Only with sufficient funds can you make considerable profits. At least it must exceed your part-time income before it is worth doing it full-time. Of course, joining an institutional team is also a way.
Disclosure here does not mean that these strategies are completely ineffective now. They may still be effective, but the efficiency may not be too high. This means that there may not be much money to be made with high risks, and as mentioned earlier, the competition is fierce, more and more people are playing, and they play in teams.
More importantly, compared to other strategies, pure arbitrage is less attractive, although it may be relatively stable. In the end, you still have to have a risk exposure strategy to make more money. Of course, the risk is greater, and the profits and losses come from the same source. In the past, when the market came, although I also made money, compared to other people's position strategies, others were eating meat, and I could only get a sip of soup. Of course, when the position strategy direction was reversed, I didn't get beaten up, so I could only comfort myself like this.
Let me first talk about one of my most stable and profitable arbitrage strategies, which is commonly known as "moving bricks".
Arbitrage by moving bricks is the most suitable strategy for the currency circle. Because these coins are digital and all on the chain, this pie and that pie are completely homogeneous (if they are not homogeneous, they will become NFTs). In this way, the two big pies traded between different exchanges are exactly the same, which is naturally suitable for moving bricks. Unlike other physical varieties, such as agricultural products, although they may have the same name, such as wheat, transportation is troublesome and warehousing costs have to be factored in. Wheat in different countries, regions, and cycles may have different protein and other contents. Likewise, the pricing is definitely different, and it’s easy to be cheated.
The more uncontrollable factors, the greater the risk.
The so-called "moving bricks" means that there are many exchanges in the currency circle, so the price of each exchange's pie and pie is actually a game between the accounts of this exchange, so there must be differences between different exchanges. Ordinary users feel that the prices of each exchange are almost synchronized. This is the contribution of arbitrage strategies. Of course, the strategies of market makers also contribute.
In short, the trappers are the biggest contributors to smoothing the price difference on the exchange.
specific strategies
The strategy logic is very simple.
It's so simple that when I didn't know that the English word for buying and selling in trading was bid ask, I could make money just by writing the code. When I searched everywhere for buy sell in the API documentation, I found that I couldn't find it. I still remember it, only bid ask long short and the like. So every other line is like a mountain. One of the barriers to isolation is the “slang” that comes with every industry.
The general logic of the strategy is that if the selling price of one exchange is lower than the buying price of another exchange, then the conditions are met. It means that some people are selling at a low price, and others are buying at a high price. You buy the agreed quantity of the two pending orders at the first place, and then sell it at the other place, it's that simple! To be more aggressive, you can eat them all and then slowly ship the rest.
If both sides are takers and only do soft transfers (that is, both exchanges have funds or coins, and they do not actually buy the coins and then transfer them to another exchange to sell them, this is too slow, and the day lily will be useless if you follow this operation. ) There are almost no positions, and the transaction is completed at the same time, and the profit is obtained immediately. There is no simpler or more stable strategy than this.
But the reality is definitely not that easy. There is often a huge gap between knowing and actually doing it. Accidents always happen in practice.
Below I will talk about the problems I encountered back then and how I dealt with them, which may be of some inspiration to those who come after me.
Problem one, there is no price difference.
The solution to this problem is simple, just wait. Don't move easily.
Later, I added a little maker logic and took the initiative to go to the orderbook and wait. This way, it is similar to a market maker, but the logic is a little more complicated.
Anyway, you have to wait. If you don’t want to wait, then you have to change your strategy as mentioned above. There were a lot of opportunities before the pie circle, and there were enough fluctuations. There were several small opportunities almost every day, and several big opportunities every week. To be a taker is to wait for the opportunity to arise.
What you really need to worry about is whether you have enough buckets to collect water and whether they are big enough when it rains. But you won’t understand this until you actually see it.
Problem two, I can’t get it.
This is the biggest problem.
Your code monitors that the price difference between selling and buying is profitable, but it is fleeting. In this case, either someone else has canceled the order, or someone has jumped in first. It's okay if you don't issue orders, you are just a spectator. Or an order has been issued, but no transaction has been completed, and the orderbook is listed, which is fine, but the worst case scenario is that the order will be cancelled. (At the beginning, there were no algorithmic orders like IOC and FOK. The orders were automatically canceled immediately if the transaction was not completed. They would not risk being eaten. Instead, there were only ordinary limit and market orders, especially for small firms.) The trouble is that the single-leg transaction was completed. , we will talk about this later.
The response to not being able to grab the order.
Because it is arbitrage between two (or even multiple) exchanges, the response speed of a single exchange is not that important. At that time, there were no facilities like colo, let alone big killers like FPGA. In fact, everyone was relatively fair, and the arbitrage algorithm It is also extremely simple and has no calculation speed requirements. So the key is the comprehensive speed between the two institutes.
At that time, the mainstream exchange servers were mainly distributed in Tokyo (B'an), Hong Kong (ok), as well as Dublin, Frankfurt, Switzerland, etc. in Europe.
So you can’t run your actual code on a North American server.
The picture below is a simple submarine optical cable diagram. You can look for the general position where you can reach them faster based on the exchanges you arbitrage. Especially for those cross-continental arbitrage, a single trip of the signal on the optical cable takes hundreds of ms.
The trick here is that you can first consider exchanges with less liquidity, that is, small exchanges. It is best to have code in the same cloud server provider and in the same area as it. In this way, you can get the pending orders from small exchanges first, and then go to exchanges with good liquidity to ship.
Lead-lag, start on the lag side. The so-called take slow mover strategy. Eat a pending order that has not yet realized that the price is changing drastically.
One of the key points of arbitrage is that it is best to join a large firm and a small firm, so that it is easier to make profits. The competition between the two large firms has long been eliminated.
Then another trick is, forget about 3721, place your own codes on both sides, and then maybe place them in the middle area, so as to increase the probability of grabbing. In the end, it is very likely that you will find that you are actually competing with your own trading robot, which is best.
Back then, as long as your code was asynchronous and you used websocket to get market information, it was fast enough to get on the poker table and compete.
Question three, grab one leg.
The fear is that if one leg is traded and the other leg is still hanging there, you will be exposed, and most of the time you will be adversely selected. That is to say, the price is rising, you sold, but you did not buy a hedge on the other side; the price is plummeting, congratulations, you successfully received the goods, but the sell order was not completed.
This time it depends on your strategy. If it is currency-to-crypto arbitrage, that is, the quote base is all pie, such as the ETH/BTC trading pair, then the problem is not big, because it is all pie anyway, and the increase or decrease is generally not large.
But if it is USDT, then the price fluctuations may be large. At this time, you can wait and see, you can accept the loss and ship, or you can see if it is in the danger zone outside the hourly Bollinger Band and the lower track. It is best to stop the loss as early as possible.
I used to have a 6-second position limit. Generally, if a single leg exceeds 6 seconds, I would close the position and leave. Fortunately, the winning rate is generally relatively high, and such situations are limited.
In short, it depends on your risk appetite. Arbitrage will sometimes lead to losses, although if done well it can be avoided most of the time.
Question 4: Single positions are full.
In a general market situation, if you sell all the stocks on the side that falls slowly into USDT, and on the side that falls sharply and the price is lower, you should receive the corresponding coins. This is not really a full position, because the amount of pie and money in your hand has not actually changed, but the exchange where they are located has changed, and then the amount has increased a little.
If the market continues and the price difference continues, basically all you have to do is transfer currencies to each other, which is the real "moving bricks". Of course, you can also wait for a rebound. Sometimes once the price rebounds, the spread will invert, allowing you to trade again. Over and over again, if you have a lot of currencies, you may be able to earn 1 point or even more on a full position on the same day, because the market switching between currencies will increase the utilization rate of funds. Of course, your strategy must be designed appropriately. This is also one of the challenges. For example, by using cross-exchange triangular arbitrage, you can soft-transfer coins without losing money, and then continue the arbitrage.
In the later stages of my arbitrage, there were more people taking arbitrage, and only in very big market conditions would I have such an opportunity to fill my position. With more people and more funds, liquidity has increased. Especially after institutions like Afro sbf entered the market, they seized the main opportunities, and many traps have switched to other strategies.
Nowadays, there are more and more market makers, more and more arbitrageurs, institutions are entering the market, and options trading is increasing. It is really difficult to reproduce an epic market like 312. It was really a carnival that day, I can still remember it vividly.
Other tips
I remember that the largest single order at that time was about 1.5 million (calculated in RMB).
I have designed two modes, namely supervised mode and unsupervised mode.
It's very simple. When there is no supervision, such as going to bed at night, just keep a low profile, make smaller orders, limit your orders, and eat your orders slowly. Both legs of the previous transaction must be completed before executing the next transaction. Control your positions. If the opportunity is missed, it is missed. Moreover, all trading pairs must control the total position and control the risk of the entire account.
When someone is supervising, you can turn on the cannon mode, take the orders on the low-flow side in one go, or even take the big orders directly, and then slowly ship the goods to several large exchanges with good liquidity. If there is a sudden turn, please quickly intervene manually. Use the handling methods mentioned before.
I remember that when the American TV series "Silicon Valley" was released, I also used the music used by the Canadian programmer in it as a reminder of a big deal. I was very excited every time I heard it and rushed to check the situation to make sure there were no mistakes.
There’s also a tip for dealing with competition. It is best to monopolize some trading pairs on a small exchange. The spot handling fee is generally around one thousand one, so one in and one out is one thousand two (there is also a fee for currency transfer, if the funds are small, then it must be included), so there must be at least two thousandths of the price difference to make a profit. .
If you are the only one trading on this small exchange's trading pair, such as EOS/ETH, you can let its price difference reach 1,000 yuan before taking action, or even a little higher. Of course, it's not good to be too high, as it will attract competitors. Everyone in the market is scanning and monitoring the price differences on various exchanges all the time. When people see how the price difference of this trading pair is so high, they will come over and be eager to try it. But if you see that the price difference is not big and disappears quickly, your peers will know that there is already an owner here, and if you want to come over to do something, you will have to put in more effort, and you will probably have to confront the person head-on, so you may not come.
If a tough colleague comes to cause trouble, then you have to challenge him.
It doesn’t matter if the maker comes, because this strategy only works as a taker, which is complementary to the maker strategy. If he is a novice and the code response speed is slow, you can just eat him.
How to answer the challenge? It is to take orders when the market has just started. It was three thousand before. Then the opponent may come in and take action at 2.5 out of 1,000. If you miss a few orders in a row, you will know that someone is coming in and doing the same thing. At this time, you have to sacrifice profits, maybe take action at Qian 2, and rush away. In fact, everyone still makes a profit at 1,000, because those with large transaction volume have discounts on handling fees, so everyone will keep testing until around 1,000. At this time, you have to cut off your strength, don't want profits, or even make a small profit. For example, start at around 50,000.
This is where the psychology comes into play. Because the opponent has just come here, his mentality is actually to give it a try. He will make a shot if there is no date, and he will quickly withdraw when he sees that he is not making money. As I said before, if you want to do this kind of arbitrage well, you have to deploy servers in multiple places, and you have to recharge coins and occupy funds. Someone needs to monitor it. In a word, there is a cost. Once they stop making money, the newcomers will withdraw. Usually it takes 1 week. The other party may report to his boss that this trading pair is not profitable, and then they may move elsewhere. If you encounter a tough situation, use half a month's profit to spend it with him. The newcomers will basically not be able to bear it.
I've been done this to other places myself. Others will not hesitate to fight you in order to defend their territory. So everyone knows the truth.
Finally, if your competitors leave, then you will continue to increase prices, and Qiansan will take action. This is actually the same strategy as those of vendors in offline wet markets. After all, they are all transactions, no one is superior.
Therefore, this industry is actually quite tiring, and everyone is constantly on guard against each other. Sometimes there are trading robots that specialize in harvesting arbitrage strategies to induce you to trade. This is complicated and will not be explained here. In short, there are many things to guard against, and you must always be vigilant. Keeping an eye on the market is a common thing. If you don’t keep an eye on the market for a few days, check the changes in market prices, modify configuration parameters, or even source code, profits will decline.
All in all, it’s hard-earned money.
potential risks
Arbitrage strategies are not entirely risk-free. The strategy itself is not very risky. Just put it on one leg and exit in time. The worst is to make less money.
Risk is the structural risk of the currency circle. One is that the exchange runs away, goes bankrupt, and cannot withdraw the currency. For example, if cz is law-enforced by a long-armed agency such as the FBI/CIA, your currency may not be available; the other is that USDT or other currencies themselves suddenly become violent.
At that time, the head effect among exchanges was not very significant, and there were still people from small exchanges trading. Unlike now, after several exchanges ran away and ftx misappropriated funds, everyone only went to the top exchanges to trade.
So, plain arbitrage is not necessarily a good strategy. If you know other transactions, such as CTA, it is better than arbitrage and has a higher capital utilization rate. In the past, those who had strong skills in dog trapping basically turned to high-frequency market making and trend trading.
at last
It was a really good time in the past, with too many opportunities. Sometimes when the market moves, you can actually make arbitrage by placing orders with your hands. Under really big market conditions, you can still continue to transfer coins between exchanges because the price difference is always there. I heard that there are still people who move to South Korea to set up scams, but I didn't catch up with the market during that period.
My first version of the code was written in JavaScript. The test code is mainly just a few dozen lines. I thought I would invest a few days of time and energy, and have a few dozen dollars to give it a try, and then continue to make money, or else quickly move on to something else. Unexpectedly, I started making money on the first day of testing. At that time, I adjusted the initial code in a few days, thinking that I would continue as long as I made money on chicken drumsticks on the first day, because after all, I only had a few dozen dollars in principal. As a result, I made lunch and coffee at the beginning, and then I got out of hand. Modify the code, modify the model, fight monsters and upgrade along the way.
Unfortunately, because arbitrage by myself is so smooth, I have no motivation to upgrade to other more profitable strategies. The main reason is that other strategies have retracement, and I am used to arbitrage. I really can't stand the situation of having to lose the money I earned. I can't accept it mentally, so I have never been successful. Plus, other money-making strategies are actually more difficult. On the other hand, those who did not make money through early arbitrage quickly switched to strategies such as high frequency or CTA. Many of them successfully transformed, caught up with the previous bull market, and successfully exploded.
In short, the logic of arbitrage is very simple. It does not require great cleverness. It only requires gathering a lot of small cleverness and creativity, and doing it more carefully than others. The emphasis is on execution. But to do real trading well, that is, to have exposures and positions, you must understand the essence of trading. Strategy design, backtesting, and actual execution must not miss a single link.
Let me share these first this time.