What are the quantitative trading tools in the digital currency market?

What are the quantitative trading tools in the digital currency market?

Legend has it that the generals Kim has participated in the mining.

Dazzling (partially bright dog eyes) ICO

One after another, the indiscriminate amaranth?

These four figures probably represent the development path of the digital money market (hereinafter referred to as the "coin circle") in the past few years (the method of making a rich overnight), from the coin to the mining to the ICO, the amazing wealth gathering and eyeball attraction After a wave of leek.

In these stages, the currency circle and the quantification can be said to have almost no intersection (or a slight application) until the second half of 2017. Individuals who have accumulated a large amount of wealth in the first few stages, the various investment institutions (VC, self-operated, funds) that have been forced into the market by the profit-making effect, the number of institutional investors has risen rapidly, and the quantitative change has finally caused a qualitative change: the currency circle is quantified. The time has come.

Different from the quantification of traditional financial markets, this group of institutional investors faces three major problems:

a well-established exchange

For a variety of reasons (no regulatory threshold, big fanfare, capital bubble…), there may already be thousands of exchanges (and even more) in the global currency.

The situation with retail brokers in the foreign exchange market seems to be similar, but there is a big difference in nature. The sellers of the secondary market in the traditional financial market are mostly composed of the first layer: liquidity wholesalers (exchanges, large investment banks), and the second layer: liquidity distributors (securities companies, futures companies), which consist of two layers. Many retail brokers in the foreign exchange market are only in the second tier, and their ultimate liquidity is still concentrated in the first floor of large investment banks.

The exchanges in the currency circle play the role of the first and second layers at the same time. Each exchange is directly facing the customer and can only provide customers with the mobility of their own home. There is no interoperability mechanism between the exchanges, and the liquidity of the entire market has been severely fragmented. Some large-scale entrusted investors may need to break up into multiple small entrustments and send them to different exchanges. Otherwise, it will take a long time to use only a single exchange.

The splitting of liquidity leads to the fact that the prices of identical products of various exchanges may be subject to continuous deviation, and the convergence of prices needs to be completed by arbitrage traders in the market. From another point of view, it can also be said that arbitrageurs actually play the role of liquidity wholesalers in the currency circle, so the profit level of the currency arbitrage strategy should be far beyond the traditional financial market.

Another problem with the large number of exchanges is the extreme confusion of trading rules: high-end exchanges support complex commission types such as FAK, FOK, OCO, etc. Some low-end exchanges may not even support market orders; All exchanges claim that their match rule is "price first, time first", but we have seen many times in the market that some head exchanges have appeared in the order book, buying a price greater than selling one.

7×24 trading hours

As can be seen from the above table, the trading hours of the currency circle are as high as 168 hours per week, which is more than 8 times of the domestic A-share trading time! ! !

Even compared to the global foreign exchange market, the currency circle has 30% more time, not to mention the fact that the actual trading volume of the foreign exchange market has obvious time distribution characteristics (partial time trading volume and market fluctuations are negligible).

Therefore, some short-term trading teams (self-employed or private) that have relatively large trading volume in the currency circle have to adopt the “three shifts” working mode that some physical sweatshops have.

Extremely immature technology system

The rapid development of the market has made the exchange not have enough time to upgrade the technology, nor is it willing to suspend the printing press to do technical upgrades. As of the current technical system of the currency exchange, compared with the traditional financial exchanges, it can be said that the difference is far and far. Some of the technical flaws have been mentioned in the previous two sections, and some examples are given:

Some exchanges only have the REST API of the active query function. All user status updates must be checked, checked, and checked (the logic behind the web page is also checked), and the overhead of the HTTP request itself is relatively large, plus the exchange server. Poor performance, further causing the following problems

In order to avoid the user's request too much to cause the server to get stuck, the exchange has almost restricted the user's API calls (this is normal), but some of the exchanges that claim to allow the user to request 100 times in 10 seconds, the actual It is possible that the transaction may only be 10 times in 30 seconds, which is a few times lower than the level (this seriously affects the user's transaction)

When data is transmitted on the Internet, there are always certain security risks (interception, tampering, and loss). Therefore, the transaction API needs to encrypt and verify the data. The API in traditional finance usually encapsulates the data encryption function internally (for the user) It is said that there is no feeling), and the REST API for the currency has to be implemented externally by the user (because the various rules are not clear, the user may not be able to toss for a few weeks)

The above three problems basically constitute the main pain points of the currency circle quantification. Next, we will use this as a target to look at some currency trading tools.

Quote data

Tool Name: CoinAPI.io

Tool Type: Commercial Software (Online Service)

For the pain point: too much exchange

Take a look at this bunch of numbers: access to 96 exchanges, 3156 data updates per second, 3,080 currencies, and up to 38TB of historical data. http://CoinAPI.io is probably the most professional data in the current currency. Service provider.

The services provided include:

REST API: used to retrieve historical data (Tick, K-line, currency information, exchange information, etc.)

WebSocket API: used to get real-time data (transaction, market)

FIX API: for large financial institutions to access internal systems for real-time data

The most practical one is to obtain historical data through the REST API. As long as a set of interfaces can easily obtain almost all the currency data of each exchange in the market, and after data cleaning and frequency conversion, no longer need to suffer. Write a bunch of exchange interfaces, and then get a cloud server to collect data every day.

The WebSocket API is slightly sloppy. After all, from the exchange server to the CoinAPI server to the user, the extra time of forwarding will significantly affect the real-time data.

Transaction interface

Tool name: ccxt

Tool type: open source software

Targeting pain points: too many exchanges + extremely immature technology system

From a positioning perspective, ccxt is a standard package interface for the Exchange REST API:

Currently supports 128 exchanges (OMG!!!)

The main authors are two Russians (not a fighting nation)

Provided Javascript/Python/PHP three languages ​​(Bet Five Hair Support PHP is not for trading, guessing some website users that may be targeted?)

As mentioned above, the REST APIs of the exchanges in the currency circle are similar, but only a little bit of this is enough to kill developers, such as the JSON string sorting problem of signature encryption, and the information returned by the query delegation information. May not be all the same. Ccxt is a simple and refreshing API design, hiding the details of these pits inside, not too cool for the user (to know how cool you can try the handwritten fire coin API, and then use ccxt Docking fire coins ~).

But ccxt also has a few regrets:

Most of the Exchange API's functional compatibility is 60-80%, mainly because it is located in the underlying trading interface, without the support of the transaction management engine (cannot implement complex data cache calculation logic)

Synchronous style API design requires a user to implement asynchronous algorithms for complex quantitative trading strategies. Although Python 3 version can implement asynchronous logic through asyncio, there are conflicts with multi-thread working mode.

Backtesting framework

Tool Name: Catalyst

Tool type: open source software

For pain points: 7×24 trading hours

An enhanced version of the currency based on the Zipline framework, developed in Python. Compared with the domestic A-shares, which is more than 8 times the weekly cumulative trading time, the currency circle is undoubtedly a more ideal quantitative trading battlefield, or a market where the machine is more advantageous than the human advantage. 3×24 do not sleep try ~).

In addition to Zipline itself is a good strategy example, the use of regular resources such as tutorials, Catalyst as a subordinate application of Enigma (a public chain project), community operations are also done more fully. Catalyst also has a decentralized data service application (paying with tokens), but personally feel that the gimmick is bigger.

The last big difference with Zipline, Catalyst can be used directly for real trading, currently supports Bitfinex, Bittrex, Poloniex and Binance. I don't support the firm. I personally think that Zipline is the most regrettable place. Catalyst can do it from the side to withdraw the openness of the currency circle.

Trading System

Tool Name: Gekko

Tool type: open source software

For pain points: 7×24 trading hours

Speaking of Gekko, in fact, the feeling of a little sour inside: When I first counted the open source quantitative trading project on Github almost two years ago, this guy is still a younger brother (probably only a few hundred Stars, vn.py probably already fast) 2000), at 19:03 on August 5, 2018, Gekko's Star is about to break through 7000 (6994), and vn.py is only 6184 (still the result of recent positive updates), so… unhappy .

@杨丰恺 mentioned in the answer "obsessed with automation and illusion, mostly black box for forward looking".

The first half of the sentence I fully agree with: Gekko is fully compliant with a system that meets the requirements of automated real-time trading: data maintenance solutions, backtesting tools, simulation trading, real-world operation and maintenance, technical indicator libraries, and more.

The latter part of the sentence disagrees: although the main focus is on the single-standard CTA type strategy, but combined with a sound strategy development system (data model analysis, sample internal and external verification, over-fitting inspection, etc.), experienced CTA traders You can also run beautiful trading results on Gekko.

Multi-standard and multi-factor type strategies, although higher in knowledge requirements and development difficulty than CTA strategy, but in the case of extremely lacking or unstable currency factor data, CTA may be more grounded. (Know almost)