Simulation Trading

Market Data Replay

Market Data Replay allows a trader to replay tick-by-tick data on their own time at their own pace and as many times as needed. AlgoEye replays a recorded stream of quotes and trades recreating the same environment as during a real trading session. It is a great way to learn about trading and trading algorithms without risking your money.

Market data is sourced from zip-compressed plain text files. Each file contains all the quotes and trades for the underlying products (futures, options, etc.) for a given day. Example of a market data file:

TRD     12:08:19:935    K200-11SEP14-F          6       261.35
PRC     12:08:19:935    K200-11SEP14-F          74      261.35  69      261.4
PRC     12:08:19:935    K200-11SEP14-F          74      261.35  110     261.4
PRC     12:08:20:188    K200-11DEC14-265.00-C   3       7.05    13      7.65
PRC     12:08:20:435    K200-11SEP14-255.00-P   19      2.84    12      2.9
PRC     12:08:20:436    K200-11DEC14-F          5       262.7   3       262.8
PRC     12:08:20:436    K200-11SEP14-F          43      261.35  110     261.4
PRC     12:08:20:436    K200-11SEP14-F          43      261.35  130     261.4
TRD     12:08:20:686    K200-11SEP14-F          1       261.35
PRC     12:08:20:938    K200-11SEP14-267.50-C   9       2.65    3       2.74
PRC     12:08:20:938    K200-11SEP14-255.00-P   5       2.85    12      2.9
PRC     12:08:20:938    K200-11SEP14-255.00-P   5       2.85    3       2.91
PRC     12:08:20:939    K200-11DEC14-275.00-P   3       15.55   1       16.1
PRC     12:08:20:940    K200-11DEC14-265.00-C   3       7.05    18      7.65
PRC     12:08:20:940    K200-11SEP14-F          227     261.3   130     261.4
PRC     12:08:20:940    K200-11SEP14-F          227     261.3   7       261.35

Exchange Simulator

The exchange simulator that powers AlgoEye’s simulated trading and backtesting does accurate tick-by-tick matching of orders with replayed quotes and trade ticks. Orders entered into the system are not executed immediately but after a configurable delay thus emulating network delay as if orders are sumbitted to a real exchange. Limit orders are tracked according to price-time priority. A limit order is placed at the back of the order queue at a price level and is moved closer to the head of the queue as trades are reported. E.g. market is:

#    bid     ask    #
267  10.56 - 10.58  983

If a sell limit order is sumbitted for 5@10.58 the simulator will put the order behind the queue of orders totaling 983 lots. So the queue position of our order is 983. When trades arrive (they are replayed from a recorded market feed) the position of the order is moved closer to the top according to the volume traded. If trades reported in the feed were 10@10.58, 50@10.58 and 23@10.58 then the order would be moved to position 900, exactly by 83 lots according to cumulative traded volume. This algorithm is pessimistic as it does not account for cancelled orders ahead of our order. Those cancellations would push the order to the top of the queue faster, leading to faster executions.

In a nutshell the simulator accounts for the issues which usually lead to unreliable, much better backest results than live trading:

  • Not accounting for network/exchange latency gives too much advantage by getting too many favorable trades, picking off other market participans.
  • Ignoring queue priority leads to inaccurate estimates on how long an order would spend in the queue before getting executed.