Setting up a new venue - Quod-Financial/quantreplay GitHub Wiki

This page outlines the steps to set up a new venue and run its simulation.

Let the new venue be "LSE" and the listing be "AAPL".

Adding venue and listing to the database

  1. To create a new venue in the database, send a POST request /api/venues. Define all parameters. Set the id to "LSE", and a free REST port in restPort.

  2. To create a new venue in the database, send a POST /api/listings. The venueId must be equal to the venue’s id created on the previous step. In our case, "LSE".

    1. A listing has to match these criteria to be resolved in order messages sent by a gateway (Order session):

      1. Depending on the FIX SecurityIDSource tag (22) value, the FIX SecurityID tag (48) has to match the:

        1. cusipId when SecurityIDSource is CUSIP (1),

        2. sedolId when SecurityIDSource is SEDOL (2),

        3. isinId when SecurityIDSource is ISIN number (4),

        4. ricId when SecurityIDSource is RIC code (5),

        5. exchangeSymbolId when SecurityIDSource is Exchange Symbol (8),

        6. bloombergSymbolId when SecurityIDSource is Bloomberg Symbol (A);

      2. FIX Symbol tag (55) has to match the symbol value (i.e. "AAPL");

      3. FIX SecurityType (167) has to match the securityType value;

      4. FIX SecurityExchange (207) has to match the securityExchange value;

    2. In case SecurityIDSource and SecurityID tags are not sent in the order message, only the FIX Symbol (tag 55) has to match the symbol value.

    3. For market data sessions, the FIX Symbol (tag 55) has to match the symbol value.

  3. If a random order generation is required for a listing, add the price seeds to the database by POST /api/priceseeds.

Configuring the QuantReplay instance

  1. Make a copy of the existing QuantReplay and QuickFIX configuration files. Store them in the same cfg directory. For instance, lse_simulator.xml and configLSE.txt.

  2. In the QuantReplay configuration file:

    1. change the value of <mktsimulator><venue> to the new venue id. I.e. "LSE".

    2. change the value of <mktsimulator><config> to the path of new QuickFIX configuration file. I.e. a full path to configLSE.txt.

  3. In the QuickFIX configuration file, define a session or edit the existing one. The following parameters must be set:

    1. SocketAcceptPort

    2. SenderCompID

    3. TargetCompID

Running the QuantReplay instance

Warning
One instance processes only one venue. Hence, to simulate several venues, the same number of QuantReplay instances must be started.
  • Let the restPort of the venue "LSE" be 9052

  • There are two QuickFIX sessions with different SocketAcceptPort, i.e. 9053 and 9054.

To add a new QuantReplay instance to the Docker Compose, define it as a service like:

  LSE:
    image: ghcr.io/quod-financial/deploy_marketsim:latest
    container_name: LSE
    networks:
      - market-simulator-net
    ports:
      - "9052:9052" # Port to send REST API requests
      - "9053:9053" # Port to send FIX messages in the first session
      - "9054:9054" # Port to send FIX messages in the second session
    volumes:
      - ./:/market-simulator/quod/data/
      - ./cfg/lse_simulator.xml:/market-simulator/quod/data/cfg/market_simulator.xml
    environment:
      - INSTANCE_ID=LSE
      - PREFIX=QUOD
    depends_on:
      liquibase:
        condition: service_completed_successfully

And then restart Docker Compose.

To check the status of running simulators, send the REST API request to the restPort of the already running instance:

curl -X GET "http://localhost:9050/api/venuestatus"
Invoke-RestMethod -Uri "http://localhost:9050/api/venues" -Method GET | ConvertTo-Json -Depth 100
⚠️ **GitHub.com Fallback** ⚠️