FMZ inventors quantify platform feedback

Author: The grass, Created: 2019-07-06 12:15:50, Updated: 2023-10-25 20:00:15

img

Most strategies require retesting to be validated before they are put into practice, and FMZ supports some varieties of digital currency spot, futures, and perpetual contracts, as well as all varieties of commodity futures. However, the inventor's quantified platform's retesting mechanism differs from the common onbar retesting, causing confusion for many newcomers. This article will detail and answer some common retesting questions.

How does the feedback system work?

img

As shown above, the time from the start to the end of the retest can be treated as a timeline, when the retesting time point along the axis of the retesting time point moves from left to right to start the retesting, at this time point, only the historical data before this point can be obtained, and the strategy is based on these data to buy and sell, ultimately forming a profit and loss. Of course, given the density of retesting time points and the length of time required, actual retesting systems need to trade between accuracy and efficiency.

Traditional onBar feedback mechanism

The onbar retracement mechanism is based on the K-line, where each K-line generates a retracement time point at which information such as the current K-line's high and low bid/ask prices, trading volume, and historical K-line information prior to this time point can be obtained. The disadvantage of this mechanism is obvious: on a K-line, only one buy and sell can be generated, and the price is usually based on the closing price of the K-line. And a K-line can only get up to four prices, as for how the price changes in a K-line, no information can be obtained, such as the highest price first, or the lowest price first. For example, with a K-line of 1 hour, it is certain to get a transaction information every few seconds in real time, and the trading instructions will be sent in the disc instead of waiting for the end of the K-line.

FMZ inventor of the onTick feedback mechanism

img

The diagram above shows the FMZ retest settings interface. The retest mode is divided into two types of analogue-level retest and real-disk-level retest, which are described below:

What's a tick?

Unlike K-line data, ticks are prices at a specific point in time. Based on K-line data, we actually only know when the opening and closing prices occurred, and it is not clear what time the price reached its highest in the K-line cycle. In fact, K-line data is also generated based on ticks.

Simulated retesting

The analogue-level retest selects the K-line cycle and the underlying K-line cycle used for retesting. For example, if the strategy uses hour-line retesting, and the underlying K-line selects 5 minutes, then the interval between the retesting time points will be based on the tick generated by the 5-minute K-line analogue, which is expressed as the closing price of the latest 1-hour K-line constantly changing.https://www.fmz.com/bbs-topic/662

img
We demonstrate this mechanism using a simple strategy, the strategy code:

function main() {
  while(true){
      var records = exchange.GetRecords() //GetRecords可以填参数,获取不同周期K线。
      var ticker = exchange.GetTicker()
      Log('K线收盘价: ', records[records.length-1].Close, 'ticker买一卖一价: ', ticker.Buy, ticker.Sell)
      //js回测不用Sleep,会自动跳到下一个tick。Python需要一个小的休眠时间
  }
}

The results of the tests:imgOnly the tick of the opening and closing of each K-line is fixed, and the middle plus 12 ticks of the simulation, so a K-line will form 14 check-in time points. If the check-in day, the bottom K-line cycle for 5 minutes, a total of 24 × 12 × 14 = 4032 time points, whereas the traditional onBar check-in is only 24, the accuracy is greatly improved.

Repeat at the real disk level

The real-time tick is used, with a minimum interval of 1s between each time point, and the accuracy of the tick varies every second, but due to the large amount of data, the speed of the tick is slow, and the timing of the tick cannot be very long.img

Gap between retest and real disk

Even if the real-disc retrospection and the real-disc retrospection have obviously insufficient data, such as the inability to access transaction history trades, the inability to access actual depth changes, real network latency, etc. Even so, FMZ's current retrospection system is relatively complete, with many small features, such as network error simulations, which can be used to test the error tolerance of the strategy, network latency simulations, and charting of trends, etc.

Frequently asked questions

Why is it that only a few trading pairs and exchanges can be retested?

Currently, there are only a few common trades for data, and the relationship between strategy and variety is not very large, which is enough to verify the strategy.

Can BitMEX be simulated to charge a fee?

You can open the event log by selecting BitMEX Retest.img

Did the retesting take place there?

The JavaScript policy is retested in the browser, and Python can choose FMZ's server or its own host.

Can you download the logs?

Yes, there's a download button in the top right corner of the log.

Can you retest locally?

FMZ is an open-source Python backtest engine.https://www.fmz.com/bbs-topic/1687


Related

More

The bride too.The one-minute-level strategy, preferably with real disk data, but now real disk-level re-test, only let the re-test two hours, not very reasonable, at least a day.