{
  "formatVersion": 1,
  "name": "FIXScope synthetic venue acceptance scenarios",
  "description": "Independent FIX 4.4 conversations for an isolated synthetic venue. Each step lists initiating-client body fields and selected expected reply fields in arrival order. The FIX engine supplies transport fields and live timestamps.",
  "beginString": "FIX.4.4",
  "scenarios": [
    {
      "id": "parties-order",
      "name": "Accept an order with nested Parties",
      "description": "Submit a passive order with an executing firm, an executing trader and two firm sub-identifiers. The venue checks the ordered groups before admitting the order.",
      "preconditions": ["Use the built-in FIX 4.4 dictionary or the example QuickFIX XML, which requires VenueMode (9001) on orders."],
      "steps": [{
        "send": {
          "msgType": "D",
          "fields": {"11":"UAT-PARTIES-01","38":"10","40":"2","44":"98","54":"1","55":"NOVA","9001":"P"},
          "groups": [["453","2"],["448","SYNTH-FIRM"],["447","D"],["452","1"],["802","2"],["523","DESK-A"],["803","1"],["523","DESK-B"],["803","1"],["448","SYNTH-TRADER"],["447","D"],["452","12"]]
        },
        "expect": [{"msgType":"8","fields":{"11":"UAT-PARTIES-01","39":"0","150":"0","151":"10"}}]
      }]
    },
    {
      "id": "session-probe",
      "name": "Logon and heartbeat echo",
      "description": "Establish an authenticated session and send a uniquely named TestRequest. The echoed ID ties the heartbeat to this request.",
      "preconditions": [
        "Connect to the assigned test session using its CompIDs, credentials and negotiated starting sequence numbers.",
        "Set the heartbeat interval to 30 seconds."
      ],
      "steps": [
        {
          "send": {"msgType":"A","fields":{"98":"0","108":"30"}},
          "expect": [
            {"msgType":"A","fields":{"98":"0","108":"30"}}
          ]
        },
        {
          "send": {"msgType":"1","fields":{"112":"UAT-PROBE-01"}},
          "expect": [
            {"msgType":"0","fields":{"112":"UAT-PROBE-01"}}
          ]
        }
      ]
    },
    {
      "id": "limit-match",
      "name": "Fill a crossing limit order",
      "description": "A buy limit of 101 can execute against the resting ask at 100. The report carries the resting execution price and a zero remainder.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "Exactly 10 units are offered at 100 by the simulated counterparty. There is no other executable liquidity."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-MATCH-01","38":"10","40":"2","44":"101","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-MATCH-01","14":"0","39":"0","150":"0","151":"10"}},
            {"msgType":"8","fields":{"11":"UAT-MATCH-01","14":"10","31":"100","32":"10","39":"2","150":"F","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "partial-rest",
      "profile": {"askQty": 4},
      "name": "Partial execution with a working remainder",
      "description": "A day order consumes four units and leaves six on the book. A subsequent cancel proves the six were still working.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "Exactly 4 units are offered at 100 by the simulated counterparty. There is no other executable liquidity."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-PART-01","38":"10","40":"2","44":"100","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-PART-01","14":"0","39":"0","150":"0","151":"10"}},
            {"msgType":"8","fields":{"11":"UAT-PART-01","14":"4","31":"100","32":"4","39":"1","150":"F","151":"6"}}
          ]
        },
        {
          "send": {"msgType":"F","fields":{"11":"UAT-PART-CXL","38":"10","41":"UAT-PART-01","54":"1","55":"NOVA"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-PART-CXL","14":"4","39":"4","41":"UAT-PART-01","150":"4","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "price-band-reject",
      "name": "Reject a limit outside the price band",
      "description": "A buy one tick above the configured maximum receives a business rejection before entering the book.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "Set the inclusive NOVA price band to 90 through 110 with a 0.01 tick."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-BAND-01","38":"10","40":"2","44":"110.01","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-BAND-01","14":"0","39":"8","103":"3","150":"8","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "cancel-resting",
      "name": "Cancel a resting limit order",
      "description": "A passive order receives an acknowledgement. The cancel names the last accepted client order ID and receives a canceled execution report.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "The NOVA book has no sell order at or below 99."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-CXL-01","38":"10","40":"2","44":"99","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-CXL-01","14":"0","39":"0","150":"0","151":"10"}}
          ]
        },
        {
          "send": {"msgType":"F","fields":{"11":"UAT-CXL-02","38":"10","41":"UAT-CXL-01","54":"1","55":"NOVA"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-CXL-02","14":"0","39":"4","41":"UAT-CXL-01","150":"4","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "replace-resting",
      "name": "Replace quantity and price, then cancel by the new ID",
      "description": "An unfilled order is amended to a total quantity of twelve. The next cancel refers to the accepted replacement ID.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "The NOVA book has no sell order at or below 99."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-RPL-01","38":"10","40":"2","44":"98","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-RPL-01","14":"0","39":"0","150":"0","151":"10"}}
          ]
        },
        {
          "send": {"msgType":"G","fields":{"11":"UAT-RPL-02","38":"12","40":"2","41":"UAT-RPL-01","44":"99","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-RPL-02","14":"0","38":"12","39":"0","41":"UAT-RPL-01","44":"99","150":"5","151":"12"}}
          ]
        },
        {
          "send": {"msgType":"F","fields":{"11":"UAT-RPL-03","38":"12","41":"UAT-RPL-02","54":"1","55":"NOVA"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-RPL-03","14":"0","39":"4","41":"UAT-RPL-02","150":"4","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "duplicate-clordid",
      "name": "Reject a duplicate client order ID",
      "description": "A second NewOrderSingle uses an outstanding ID with a new sequence number. After the rejection, the client can still cancel the original order.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "The NOVA book has no sell order at or below 99.",
        "Do not set PossDupFlag on the second request."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-DUP-01","38":"10","40":"2","44":"99","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-DUP-01","14":"0","39":"0","150":"0","151":"10"}}
          ]
        },
        {
          "send": {"msgType":"D","fields":{"11":"UAT-DUP-01","38":"12","40":"2","44":"99","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-DUP-01","103":"6","150":"8"}}
          ]
        },
        {
          "send": {"msgType":"F","fields":{"11":"UAT-DUP-CXL","38":"10","41":"UAT-DUP-01","54":"1","55":"NOVA"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-DUP-CXL","14":"0","39":"4","41":"UAT-DUP-01","150":"4","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "ioc-remainder",
      "profile": {"askQty": 4},
      "name": "Expire an IOC remainder",
      "description": "An immediate-or-cancel order takes four units. The final report closes the remaining six and retains the four executed units.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "Exactly 4 units are offered at 100 by the simulated counterparty. There is no other executable liquidity.",
        "Use Expired as the immediate-order terminal disposition."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-IOC-01","38":"10","40":"2","44":"100","54":"1","55":"NOVA","59":"3"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-IOC-01","14":"0","39":"0","150":"0","151":"10"}},
            {"msgType":"8","fields":{"11":"UAT-IOC-01","14":"4","31":"100","32":"4","39":"1","150":"F","151":"6"}},
            {"msgType":"8","fields":{"11":"UAT-IOC-01","14":"4","39":"C","150":"C","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "fok-insufficient",
      "profile": {"askQty": 4},
      "name": "Expire an unfillable FOK atomically",
      "description": "Only four of the requested ten units are available. The FOK expires with zero cumulative quantity. A follow-up order can still execute all four units.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "Exactly 4 units are offered at 100 by the simulated counterparty. There is no other executable liquidity.",
        "Use Expired as the immediate-order terminal disposition."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-FOK-01","38":"10","40":"2","44":"100","54":"1","55":"NOVA","59":"4"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-FOK-01","14":"0","39":"0","150":"0","151":"10"}},
            {"msgType":"8","fields":{"11":"UAT-FOK-01","14":"0","39":"C","150":"C","151":"0"}}
          ]
        },
        {
          "send": {"msgType":"D","fields":{"11":"UAT-FOK-CHECK","38":"4","40":"2","44":"100","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-FOK-CHECK","14":"0","39":"0","150":"0","151":"4"}},
            {"msgType":"8","fields":{"11":"UAT-FOK-CHECK","14":"4","31":"100","32":"4","39":"2","150":"F","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "fok-full",
      "name": "Fully execute a fill-or-kill order",
      "description": "All ten requested units are available at the limit when the order arrives.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "Exactly 10 units are offered at 100 by the simulated counterparty. There is no other executable liquidity."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-FOK-FULL","38":"10","40":"2","44":"100","54":"1","55":"NOVA","59":"4"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-FOK-FULL","14":"0","39":"0","150":"0","151":"10"}},
            {"msgType":"8","fields":{"11":"UAT-FOK-FULL","14":"10","31":"100","32":"10","39":"2","150":"F","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "unknown-cancel",
      "name": "Reject an unknown cancel reference",
      "description": "A cancel referring to an unseen client order ID receives OrderCancelReject with a reason and response type.",
      "preconditions": [
        "Discretionary rejection is 0%. Use a fresh session and book for this scenario.",
        "The client order ID UAT-UNKNOWN has never existed in this isolated book."
      ],
      "steps": [
        {
          "send": {"msgType":"F","fields":{"11":"UAT-UNKNOWN-CXL","38":"10","41":"UAT-UNKNOWN","54":"1","55":"NOVA"}},
          "expect": [
            {"msgType":"9","fields":{"11":"UAT-UNKNOWN-CXL","41":"UAT-UNKNOWN","102":"1","434":"1"}}
          ]
        }
      ]
    },
    {
      "id": "forced-policy-reject",
      "profile": {"rejectPercent": 100},
      "name": "Force a discretionary rejection",
      "description": "A valid new order exercises the configured rejection path independently of price-band checks.",
      "preconditions": [
        "Set the discretionary rejection rate to 100%.",
        "The synthetic NOVA market is open and 100 lies within its permitted price band."
      ],
      "steps": [
        {
          "send": {"msgType":"D","fields":{"11":"UAT-POLICY-01","38":"10","40":"2","44":"100","54":"1","55":"NOVA","59":"0"}},
          "expect": [
            {"msgType":"8","fields":{"11":"UAT-POLICY-01","14":"0","39":"8","150":"8","151":"0"}}
          ]
        }
      ]
    },
    {
      "id": "session-logout",
      "name": "Log out and close the connection",
      "description": "Complete a client-initiated logout handshake. The client observes the transport close after the peer reply.",
      "preconditions": [
        "Use a logged-on session with no outstanding application requests."
      ],
      "steps": [
        {
          "send": {"msgType":"5","fields":{}},
          "expect": [
            {"msgType":"5","fields":{}}
          ]
        }
      ]
    },
    {
      "id": "book-snapshot",
      "name": "Read the best bid and offer",
      "description": "Request one level on each side and verify the complete ordered snapshot group.",
      "preconditions": [
        "The initial book has 100 bid at 99 and 10 offered at 100."
      ],
      "profile": {},
      "steps": [
        {
          "send": {
            "msgType": "V",
            "fields": {
              "262": "UAT-MD",
              "263": "0",
              "264": "1"
            },
            "groups": [
              [
                "267",
                "2"
              ],
              [
                "269",
                "0"
              ],
              [
                "269",
                "1"
              ],
              [
                "146",
                "1"
              ],
              [
                "55",
                "NOVA"
              ]
            ]
          },
          "expect": [
            {
              "msgType": "W",
              "fields": {
                "262": "UAT-MD",
                "55": "NOVA"
              },
              "groups": [
                [
                  "268",
                  "2"
                ],
                [
                  "269",
                  "0"
                ],
                [
                  "270",
                  "99"
                ],
                [
                  "271",
                  "100"
                ],
                [
                  "269",
                  "1"
                ],
                [
                  "270",
                  "100"
                ],
                [
                  "271",
                  "10"
                ]
              ]
            }
          ]
        }
      ]
    },
    {
      "id": "stop-trigger",
      "name": "Trigger a resting buy stop",
      "description": "Enter a buy stop while the mark is 99. An independent trade at 100 triggers the stop.",
      "preconditions": [
        "Start a new book with at least four offered at 100."
      ],
      "profile": {},
      "steps": [
        {
          "send": {
            "msgType": "D",
            "fields": {
              "11": "UAT-STOP",
              "55": "NOVA",
              "54": "1",
              "38": "2",
              "40": "3",
              "59": "0",
              "99": "100"
            }
          },
          "expect": [
            {
              "msgType": "8",
              "fields": {
                "11": "UAT-STOP",
                "150": "0",
                "39": "0",
                "14": "0",
                "151": "2"
              }
            }
          ]
        },
        {
          "send": {
            "msgType": "D",
            "fields": {
              "11": "UAT-TRIGGER",
              "55": "NOVA",
              "54": "1",
              "38": "2",
              "40": "2",
              "59": "0",
              "44": "100"
            }
          },
          "expect": [
            {
              "msgType": "8",
              "fields": {
                "11": "UAT-TRIGGER",
                "150": "0",
                "39": "0",
                "14": "0",
                "151": "2"
              }
            },
            {
              "msgType": "8",
              "fields": {
                "11": "UAT-TRIGGER",
                "150": "F",
                "39": "2",
                "14": "2",
                "151": "0"
              }
            },
            {
              "msgType": "8",
              "fields": {
                "11": "UAT-STOP",
                "150": "F",
                "39": "2",
                "14": "2",
                "151": "0"
              }
            }
          ]
        }
      ]
    },
    {
      "id": "passive-policy",
      "name": "Hold a crossing order and query status",
      "description": "Disable matching and verify a crossing order stays New when queried.",
      "preconditions": [
        "Match attempt probability is zero."
      ],
      "profile": {
        "matchPercent": 0
      },
      "steps": [
        {
          "send": {
            "msgType": "D",
            "fields": {
              "11": "UAT-HOLD",
              "55": "NOVA",
              "54": "1",
              "38": "10",
              "40": "2",
              "59": "0",
              "44": "101"
            }
          },
          "expect": [
            {
              "msgType": "8",
              "fields": {
                "11": "UAT-HOLD",
                "150": "0",
                "39": "0",
                "14": "0",
                "151": "10"
              }
            }
          ]
        },
        {
          "send": {
            "msgType": "H",
            "fields": {
              "11": "UAT-HOLD",
              "54": "1",
              "55": "NOVA"
            }
          },
          "expect": [
            {
              "msgType": "8",
              "fields": {
                "11": "UAT-HOLD",
                "150": "I",
                "39": "0",
                "14": "0",
                "151": "10"
              }
            }
          ]
        }
      ]
    },
    {
      "id": "custom-dialect",
      "name": "Enforce a counterparty-specific field",
      "description": "Reject an order missing a venue tag. A correctly tagged order receives the venue’s custom acknowledgement.",
      "preconditions": [
        "D requires 9001=P or A. Execution reports carry 9002=UAT."
      ],
      "profile": {
        "requiredFields": {
          "D": {
            "9001": [
              "P",
              "A"
            ]
          }
        },
        "replyTags": {
          "8": {
            "9002": "UAT"
          }
        }
      },
      "steps": [
        {
          "send": {
            "msgType": "D",
            "fields": {
              "11": "UAT-MISSING",
              "55": "NOVA",
              "54": "1",
              "38": "10",
              "40": "2",
              "59": "0",
              "44": "98"
            }
          },
          "expect": [
            {
              "msgType": "3",
              "fields": {
                "371": "9001",
                "372": "D",
                "373": "1"
              }
            }
          ]
        },
        {
          "send": {
            "msgType": "D",
            "fields": {
              "11": "UAT-CUSTOM",
              "55": "NOVA",
              "54": "1",
              "38": "10",
              "40": "2",
              "59": "0",
              "9001": "P",
              "44": "98"
            }
          },
          "expect": [
            {
              "msgType": "8",
              "fields": {
                "11": "UAT-CUSTOM",
                "150": "0",
                "39": "0",
                "14": "0",
                "151": "10",
                "9002": "UAT"
              }
            }
          ]
        }
      ]
    },
    {
      "id": "session-recovery",
      "name": "Recover a partial fill after reconnect",
      "description": "Break the transport after a partial execution, resume the same FIX session and request the original trade report before querying the working remainder.",
      "preconditions": [
        "Use Resume this lab, a fresh initiator store and four units on offer at 100. Disconnect without Logout before the second Logon. Keep both sequence counters."
      ],
      "profile": {
        "resumeSession": true,
        "askQty": 4
      },
      "steps": [
        {
          "send": {
            "msgType": "D",
            "fields": {
              "11": "UAT-RECOVER",
              "38": "10",
              "40": "2",
              "44": "100",
              "54": "1",
              "55": "NOVA",
              "59": "1"
            }
          },
          "expect": [
            {
              "msgType": "8",
              "fields": {
                "11": "UAT-RECOVER",
                "39": "0",
                "150": "0"
              }
            },
            {
              "msgType": "8",
              "fields": {
                "14": "4",
                "17": "E2",
                "150": "F",
                "151": "6"
              }
            }
          ]
        },
        {
          "send": {
            "msgType": "A",
            "fields": {
              "98": "0",
              "108": "30"
            }
          },
          "expect": [
            {
              "msgType": "A",
              "fields": {
                "98": "0",
                "108": "30"
              }
            }
          ]
        },
        {
          "send": {
            "msgType": "2",
            "fields": {
              "7": "3",
              "16": "3"
            }
          },
          "expect": [
            {
              "msgType": "8",
              "fields": {
                "14": "4",
                "17": "E2",
                "43": "Y",
                "122": "*",
                "150": "F",
                "151": "6"
              }
            }
          ]
        },
        {
          "send": {
            "msgType": "H",
            "fields": {
              "11": "UAT-RECOVER",
              "54": "1",
              "55": "NOVA"
            }
          },
          "expect": [
            {
              "msgType": "8",
              "fields": {
                "14": "4",
                "37": "O1",
                "39": "1",
                "150": "I",
                "151": "6"
              }
            }
          ]
        }
      ]
    },
    {
      "id": "venue-message-rules",
      "name": "Answer a counterparty-defined message",
      "description": "Use a venue-defined request and reply body, copy the incoming request ID, and verify the synthetic trading session state.",
      "preconditions": [
        "Enable the supplied g → h rule. The synthetic session is named REGULAR."
      ],
      "profile": {
        "messageRules": {
          "g": [
            {
              "when": {
                "263": "0",
                "335": "*"
              },
              "replies": [
                {
                  "msgType": "h",
                  "fields": {
                    "335": {
                      "copy": "335"
                    },
                    "336": "REGULAR",
                    "340": "2"
                  }
                }
              ]
            }
          ]
        }
      },
      "steps": [
        {
          "send": {
            "msgType": "g",
            "fields": {
              "335": "UAT-STATUS",
              "336": "REGULAR",
              "263": "0"
            }
          },
          "expect": [
            {
              "msgType": "h",
              "fields": {
                "335": "UAT-STATUS",
                "336": "REGULAR",
                "340": "2"
              }
            }
          ]
        }
      ]
    }
  ]
}
