Configuring QuantReplay - Quod-Financial/quantreplay GitHub Wiki
To run QuantReplay, it requires several configuration files.
When starting Docker Compose for the first time, the Docker container automatically creates the necessary files in the cfg directory:
-
market_simulator.xml — main configuration file for QuantReplay;
-
configSim.txt — QuickFIX configuration file QuickFIX documentation;
-
the directory with QuickFIX AppDataDictionary and TransportDataDictionary files of FIX 5.0 SP2 version.
If files are already present, they are not changed.
The path to the QuantReply XML file configuration is passed to the binary as the -f command line option.
| Section | Node | Required | Description |
|---|---|---|---|
|
|
Y |
Defines a |
|
Y |
Specifies a full path to the QuickFIX engine |
|
|
|
Y |
Sets a database name that QuantReplay connects to. |
|
Y |
Sets a database user name. |
|
|
Y |
Sets a database user password. |
|
|
Y |
Sets a database server IP address/hostname. |
|
|
Y |
Sets a database server port number. |
|
|
|
Y |
Specifies a log level for the instance. Possible values:
|
|
Y |
Specifies a maximal size (in MB) of a single log file. |
|
|
Y |
Specifies a maximal number of log files before starting a log rotation. |
|
|
|
N |
Specifies how the QuantReplay instance must resolve a hostname to redirect HTTP requests to other instances. This setting is crucial for running QuantReplay instances on different hosts, i.e., in different Docker containers. Possible values:
For instance, the request should be redirected to the venue with ID Note: If Ensure that the market simulator containers are running as services in Docker Compose and are connected to the same network. Additionally, their service names must match the venue ID. |
|
N |
Turn on or off the check for the equality of the incoming REST API requests' optional
If they are not equal, the simulator will respond with status code 412, "Precondition Failed". If the header is not present, the simulator will not check the version. Possible values:
|
An example of the XML configuration file:
<mktsimulator>
<!-- A path to a QuickFIX configuration file -->
<config>/market-simulator/quod/data/cfg/configSim.txt</config>
<!-- VenueID of the venue that is simulated by a MktSimulator instance -->
<venue>XETRA</venue>
<!-- Database connection configuration -->
<database>
<name>simdb</name>
<user>sim</user>
<password>sim</password>
<host>market-simulator-database</host>
<port>5432</port>
</database>
<!-- Rotating logger configuration -->
<logger>
<!-- Available levels: [DEBUG, INFO, WARN, ERROR] -->
<level>INFO</level>
<!-- Maximal size (MB) of a single log file -->
<maxSize>5</maxSize>
<!-- Maximal number of log files -->
<maxFiles>10</maxFiles>
</logger>
<HTTP>
<!-- Specifies how the market simulator instance must resolve
a hostname to redirect HTTP requests to other instances.
Possible values:
* localhost (default) - use localhost hostname
* venue - use VenueID as hostname -->
<peerHostResolution>venue</peerHostResolution>
<!-- Turn on or off the check the equality of
the incoming REST API requests' optional X-API-Version HTTP header value and
the major version of the simulator.
If they are not equal, the simulator will respond with status code 412, "Precondition Failed".
If the header is not present, the simulator will not check the version.
Possible values:
* true - turn on the check - the default value.
* false - turn off the check. -->
<checkApiVersion>true</checkApiVersion>
</http>
</mktsimulator>You need to define common settings and then define each FIX session separately.
Common settings are inherited by each FIX session. Here you need to define:
-
ConnectionType=acceptor— QuantReplay is always setting up a FIX acceptor, you can not configure it to set up an initiator; -
SocketAcceptPort={your-port-number}— specifies which port has to be used for listening for incoming FIX connections; -
AppDataDictionary={full-path-to-dict-file}— specifies a full path to the FIX application spec file (it can be found incfg/default/FIX50SP2_marketsimulator.xml); -
TransportDataDictionary={full-path-to-dict-file}— specifies a full path to the FIX application spec file (it can be found incfg/default/FIXT11_marketsimulator.xml);
The optional settings that are nice to have:
-
MillisecondsInTimeStamp={boolean}— Only available for FIX.4.2 and greater.TimestampPrecisionoverrides the setting. The default value isY.-
If set to
Y, the timestamp precision is 3 — milliseconds are included in the timestamp. -
If set to
N, the timestamp precision is 0 — seconds. There is a bug in QuickFIX library version 1.15.1 — if set toN, the timestamp precision is3: https://github.com/quickfix/quickfix/issues/615. It was fixed, but the new version of QuickFIX was not released.
-
-
TimestampPrecision={integer}— sets the fractional part of all outgoing timestamp FIX fields. Allowable values are0to9.-
If
TimestampPrecisionis not defined andMillisecondsInTimeStampis not defined or equalsY, the precision is set to3for all timestamps. -
If
TimestampPrecisionis not defined andMillisecondsInTimeStampequalsN, the precision is set to0for all timestamps. -
If
TimestampPrecisionis set, it overridesMillisecondsInTimeStamp.
-
There is an example of common settings:
[DEFAULT] ConnectionType=acceptor SocketAcceptPort=9051 SocketReuseAddress=Y SocketNodelay=Y AppDataDictionary=/market-simulator/quod/data/cfg/default/FIX50SP2_marketsimulator.xml TransportDataDictionary=/market-simulator/quod/data/cfg/default/FIXT11_marketsimulator.xml StartTime=00:00:00 EndTime=00:00:00 HeartBtInt=30
|
Note
|
Single SocketAcceptPort value
You can see that the port for the FIX acceptor is defined in the general configuration. It means that all FIX sessions will be established on that port. You also may want to specify a port per session. This approach is valid, but is not recommended, as the number of ports required by the QuantReplay will increase when you define additional FIX sessions. |
To define a session, the following settings are needed:
-
specify
SenderCompIDandTargetCompID; -
set a file path where the QuickFIX engine will keep FIX messages and sequence numbers;
-
define a strategy to keep/reset messages and sequence numbers.
The example:
[SESSION] BeginString=FIXT.1.1 SenderCompID=SIM_XETRA TargetCompID=CLIENT_XETRA_ORDER DefaultApplVerID=9 FileStorePath=/market-simulator/quod/data/files_store_path_common PersistMessages=Y RefreshOnLogon=Y ResetOnLogon=N
|
Warning
|
Resetting/Refreshing on session events
Pay attention that a FIX session is configured to refresh its state in the example. Such a configuration is critical for order-flow sessions as it enables QuickFIX to keep track of sequence numbers and missed messages even after logouts/disconnects. You don’t want to lose your order or execution report messages! Always specify:
|
The market data sessions configuration is similar to the order sessions configuration. The single difference is that for the Market Data session, you shall prevent refreshing the sequence numbers from the previous session and disable message persistence (to prevent storage consumption).
Here is an example of MarketData-flow FIX session setup:
[SESSION] BeginString=FIXT.1.1 SenderCompID=SIM_XETRA TargetCompID=CLIENT_XETRA_MARKET_DATA DefaultApplVerID=9 FileStorePath=/market-simulator/quod/data/files_store_path_common PersistMessages=N RefreshOnLogon=N ResetOnLogon=Y