Replaying Log Files
Using Logs to Replay Market Data
In normal flow, Handler logs all important aspects of its execution onto the file system. Log files include also original market data processed by the Handler. This information is usually saved for analysis of non-standard situations which may occur during use of the Handler. However, it also can be used to reproduce normal Handler's behavior for a certain period of time.
Note
Onixs.CmeMdHandler logger level should be set at least at Info to log incoming packets for log replay.
Afterward, an instance of ReplayOptions class must be constructed and initialized with the path to log to replay.
When configuring the options is accomplished, replay can be started.
Note
Handler fires appropriate events as soon as market data is received from the network and processed. However, since the CME environment spreads market data with a different frequency which depends on live market activity, there're delays of different duration between fired events. When the log file is replayed, Handler does not do any pauses and fires corresponding events as soon as data is retrieved from the log file.
When replay is accomplished Handler will call ReplayFinished event will be raised.
Note
When market data is being replayed, ReceivingTime parameter of different callbacks will contain the time of corresponding log file entry. That's the value returned represents the original time when market data message was obtained from the network.
Currently, log replay must be run with the same set of Handler's settings which were originally used.
Example
Following example demonstrates how to replay log file 'Log.txt':
string fileName = "Log.txt";
Handler handler = new Handler("310");
handler.ReplayFinished += (h) => Console.WriteLine("Replay finished");
handler.ReplayError += (h, description) => Console.WriteLine("Replay error: " + description);
handler.Start(new ReplayOptions(fileName) { DelayBetweenMessages = 0 });