The resource loading... loading...

How to break through the Tick receiving limit of commodity futures

Author: Goodness, Created: 2019-02-19 09:54:06, Updated:

What is Tick?

For example, transaction data can be imagined as a river, and Tick is the data of a section of the river. The finest granularity of domestic futures is twice per second. In other words, domestic futures send up to one Tick at 500 milliseconds.

How do most domestic software get Tick?

Then there is often more than one transaction in 500 milliseconds, and the specific situation in it is completely a black box. Especially in the high-frequency trading strategy of commodity futures, the receiving speed of the Tick market has a decisive influence on the profitability of the strategy.

Most trading frameworks on the market use a callback mode, which means that there is at most one Tick in 500 milliseconds in ideal situation. Under the real situation onBar/onTick, it is good not to miss Tick. why? Because you have to deal with the whole code logic in onBar/onTick function, which costs a lot of time. Whether you want it or not, your strategy logic must be interrupted, you must use the state idle, like this:

More advanced mechanism

FMZ quantitative trading platform does not adopt this backward callback mechanism, but adopts the main function mechanism that does not interrupt the strategy logic, allowing users to control the strategy flow more naturally. Using C++ and Golang as a strategy underlying level, the upper level of strategy uses JavaScript / Python to handle logic problems. Combined with the event trigger mechanism, the strategy can also be used to process the market at the fastest speed in the first time.

Don’t say that the scripting language is slow, unless you use it for neural network training, even if it was, it can be used in any occasion after adding Jit hot compilation. The entry-level strategy is not written here, and talk about the synthesis of futures high-frequency Tick. For example, if we connect to a futures company, we can only receive the market of this futures company. The speed and quality of our receiving are related to our own network, and also related to the load of the futures company’s front-end machine.

So, how can we get more accurate futures Tick data faster? Under the FMZ Quant’s strategy model, you can easily operate the accounts of different futures companies, and combine their prices to process orders at the fastest speed. Under normal circumstances, we can get two Ticks per second from the futures company, but through the technology of combining market, taking the MA801 as an example, we can get a Tick with up to six times per second and no repetition.

Code demo

This code can only be used in real market and cannot be backtested. If you don’t use it on FMZ Quant platform, you can reference the principle only.

When adding the exchange, many futures companies can be added to carry out the concurrent fusion processing of the market. Here add two exchanges to state:

The code is as follows:

Demo effect:

As shown above, at 21:24:44, the data of the first futures company is earlier than the second one. Adding two futures companies can show the effect, if you add more than 5 futures companies to merge together, then you basically have no possibility of missing Tick; if you are developing a high-frequency trading strategy, you’ve solved a very important and decisive step, namely the speed and stability of Tick receiving.

visit this to get complete code: FMZ


More