Quant. la/Article/Vie…

NO1. The words written in the front

This strategy is the main strategy, since I do virtual currency behind after constantly improve and modify, complicated a lot, but did not change the main idea, share this version is the original version has no obvious bugs, the most simple and clear, no position management, each transaction is full, without the card dead after the restart, etc., but also enough. The strategy ran from August 2014 until the exchange charged fees earlier this year. During the operation is still very good, the loss of time is very few. The money went from 200 yuan to 80 bitcoins. The specific process can see xiaocaohu’s sina blog virtual currency automated trading road series of articles.

NO2. Firm offer yield curve

Below is my detailed statistical OKcoin platform of the yield curve, the initial capital of 1000 yuan, you can see the initial money stable increase, stopped in the middle of the straight line is my strategy, late due to the whole strategy to earn currency strategy, denominated in renminbi earnings volatility, the specific strategy in the process of trade for two years in the summary of the article is described.

The following figure shows the total asset conversion curve:

NO3. Policy principle

The principle of this strategy is very simple, can be understood as a quasi-high-frequency market strategy, you may want to hit people after reading, this can make money, almost anyone can write at that time. I did not expect it to be so effective at first, so I have the idea to put it into practice quickly, said that there is not necessarily a surprise. In 2014, when bitcoin bots first took off, it was all too easy to write strategies for making money.

As with all high-frequency strategies, this strategy is based on OrderBook, as shown below in the order distribution of a typical Bitcoin exchange:

You can see on the left side is the purchase order, showing the number of orders for different prices, and on the right side is the sell order. Can imagine if a man want to buy COINS, if don’t want to wait are cancelled, can only choose to eat alone, if his list is more, will make substantial sale deity, the impact on prices, but the shock generally will not continue, and people want to sell, the price is likely to recover in a very short time, which in turn understand someone to sell currency is similar.

Taking the listing in the figure as an example, if someone wants to directly buy 5 coins, the price will reach 10,377. At this moment, if someone wants to directly sell 5 coins, the price will reach 10,348. This space is the profit space. The strategy would order at a price slightly below 10377, such as 10376.99, and buy at a price slightly above 10348, such as 10348.01, which would obviously make the difference if that had happened. It won’t always be perfect, but the odds of making money are actually surprisingly high.

With the current policy parameters to explain the specific operation, this parameter of course can not be used, just for an explanation. It will look up for the price at which the cumulative number of selling orders is 8 coins, which is 10377, so the selling price will be this price minus 0.01 (which can be random). Similarly, it will look down for the cumulative number of buying orders is 8 coins, which is 10348, so the selling price will be 10348.01. At this time, the price difference of the buying and selling price is 10376.99-10348.01=28.98, greater than the strategic preset price difference 1.5, with these two prices waiting for the transaction, if the price difference is less than 1.5, will also find a price for the listing, such as the opening price plus or minus 10, waiting for the leakage (more appropriate should be to continue to look for more depth).

NO4. Further clarification

1: What if I have no money or coins? This situation in my less money is very common, most of the time only hanging side of the list, but not a big problem. In fact, the logic of currency balance can be added, but losses will inevitably occur in the process of balance. After all, every transaction is the favor of probability, so I choose to keep unilateral waiting for the transaction, of course, it also wastes the transaction opportunity on the other side.

2. How is the space managed? At the beginning are full buy sell, later according to different parameters divided into different groups, not a complete deal.

3. No stop loss? Strategy has the logic of a complete trading order, I think there is no need to stop loss (can be discussed), there is the probability of favor, clinch a deal is the opportunity, stop loss unfortunately.

4. How to adjust the strategy for earning money? At this time, the parameters are symmetric, that is, the cumulative selling order of 8 coins up and the cumulative buying order of 8 coins down, which is slightly unbalanced. For example, the cumulative selling order of 15 coins up makes the selling opportunity more rare, and there is a greater chance that it will be taken back at a lower price. In this way, coins will be earned and money will be made in turn. In fact, the upfront strategy is so effective that both coins and coins are increasing.

NO5. Code explanation

Complete code directly in the public inside the reply “high frequency” direct access, here only to explain the core logic function. In the case of no changes, the simulation disk in BotVS works perfectly. This is a strategy more than 3 years ago, and the platform still supports it. It is so touching. The first is to get the bid and offer function GetPrice(), which needs to get the order depth information. Note that the length of the order depth information varies from platform to platform, and even after traversing all the orders, there is still no required quantity (in the later stage, many grid orders of 0.01 will cause this situation). The call is GetPrice(‘Buy’) to get the purchase price.

The main function onTick() of each cycle, the cycle time set here is 3.5s, each cycle will cancel the original order, re-order, the simpler the more bugs will not be encountered.

NO6. About this strategy

The entire program, with just over 40 lines, seemed simple enough, but it took me over a week, and that was on BOTVS.

The biggest advantage is to start earlier, in 2014, the market is given priority to with move brick, grid and rob not the dish of the high frequency, makes the strategy like a duck to water, then inevitably more and more fierce competition, my money is also more and more, the challenge for many, every once in a while to make big changes to deal with, but overall went well.

In the case that the trading platform does not charge fees, it is the paradise of programmed trading. Retail investors, because they do not charge fees and tend to operate, provide space for high frequency and arbitrage. All these basically come to an end with the two-way fee of 0.1-0.2% at every turn. But there is still plenty of room for quantitative strategies that do not require high frequencies.

NO7. Why share this strategy

1. When exchanges charge fees, they kill almost all high-frequency strategies, and mine is no exception. But a change of strategy might work, and you might want to look at it.

I haven’t shared anything for a long time. I want to write this article for a long time.

3. Communicate and learn with everyone.

NO8. Special tips

The only constant in the market is that it is always changing and the future is unpredictable. Past firm performance is not indicative of the future.

Read more: Quant. la/Article/Vie…