QuickFIX/n Documentation

repository·master·Indexed 19 days ago

https://github.com/connamara/quickfixn

A .NET implementation of the FIX (Financial Information eXchange) protocol for building financial messaging applications. Includes documentation on using DDTool for Data Dictionary analysis and code generation, implementing acceptors and clients, managing SSL certificates via GenerateKeys, and integrating Serilog for logging. Provides guidance on building and testing with the dotnet CLI and installing version-specific message definitions (FIX 4.0 through 4.4) via NuGet.

Tokens
5.1K
Snippets
23
Records
32
Agent score
66%

What's inside QuickFIX/n

  1. Implement a simple acceptor with SimpleAcceptor

    master

    To create a basic acceptor, you need two main components:

    1. Setup Logic (Program.cs): Use the Session settings file to initialize and start a new acceptor object.
    2. Application Logic (SimpleAcceptorApp.cs): Implement the Application interface. This is where you define how your application responds to FIX events.

    Configuration is handled via a .cfg file (e.g., simpleacc.cfg) which defines the FIX Sessions the acceptor will manage.

  2. Process and respond to messages using MessageCracker in Executor

    master

    The Executor example demonstrates how to build an acceptor that actively processes business logic by 'cracking' messages.

    Key Patterns:

    • Inheritance: The application class should inherit from MessageCracker and implement the Application interface.
    • Message Cracking: Use the cracking mechanism to trigger specific OnMessage callbacks based on the incoming message type.
    • Version-Specific Responses: When responding to a message (e.g., responding to a NewOrderSingle with an ExecutionReport), you must create the response message using the same FIX version namespace as the initiator. If the versions do not match, the counterparty will reject the message.
  3. Use DDTool to generate code from Data Dictionaries

    master

    To parse Data Dictionaries and generate code, use the following command structure. You must specify the repository root using --reporoot and the destination directory for the generated files using --outputdir, followed by the paths to the Data Dictionary files you wish to process.

    Arguments:

    • --reporoot <qfRepoDir>: The directory of the QuickFIX/n repository.
    • --outputdir <destDir>: The directory where generated files should be placed.
    • <ddFile> <ddFile>...: One or more paths to Data Dictionary files.
    > dotnet run --project DDTool --reporoot <qfRepoDir> --outputdir <destDir> <ddFile> <ddFile>...
  4. Install QuickFIX/n FIXT 1.1 message definitions

    master

    To use FIXT 1.1 message definitions in your .NET project, you must install this NuGet package.

    Dependency Requirement: If you are using a QuickFIXn.FIX5* package, you must include this package in addition to the QuickFIXn.Core package to ensure all FIXT 1.1 message definitions are available.

    <!-- Note: The package name changed in v1.14. Ensure you use the correct name for your version. -->
    <!-- For v1.14 and later: QuickFIXn.FIXT1.1 (or similar based on NuGet registry) -->
    <!-- For versions prior to v1.14: QuickFIXn.FIXT1.1 (with the extra period) -->
  5. Run QuickFIX/n example applications

    master

    The repository includes several example applications to demonstrate different FIX roles. You can run these by navigating to their respective directories and using the dotnet run command followed by the path to a configuration file.

    Available Examples:

    • SimpleAcceptor: A barebones acceptor that logs all admin and application-level messages to the screen without processing them.
    • Executor: An acceptor that uses MessageCracker to parse incoming orders and sends back ExecutionReport responses.
    • TradeClient: A command-line client for sending various FIX messages (NewOrderSingle, CancelRequest, etc.). Warning: Do not use this with commercial FIX interfaces.
    • FIX/Json Examples: Demonstrates converting between FIX and JSON formats.
    # Run SimpleAcceptor
    cd Examples/SimpleAcceptor && dotnet run simpleacc.cfg
    
    # Run Executor
    cd Examples/Executor && dotnet run executor.cfg
    
    # Run TradeClient
    cd Examples/TradeClient && dotnet run tradeclient.cfg
  6. Use DDTool to analyze Data Dictionaries

    master

    DDTool is a Data Dictionary (DD) analyzer and code generator for QuickFIX/n. To use DDTool to parse and analyze Data Dictionaries without generating any code, run the tool using dotnet run and provide one or more <ddFile> paths as arguments.

    > dotnet run --project DDTool <ddFile> <ddFile>...
  7. Generate message and field source code using DDTool

    master

    QuickFIX/n uses DDTool, a C#-based tool that analyzes DataDictionary files to regenerate source code for message and field classes.

    You can trigger the code generation process by running the provided PowerShell script from the repository root:

    pwsh scripts\Generate-Message-Sources.ps1
  8. Install QuickFIX/n FIX 4.2 message definitions via NuGet

    master

    To use FIX 4.2 message definitions in your .NET project, install the QuickFIX/n message definitions package.

    Important: Starting with version 1.14, the package name has changed. Ensure you use the correct name based on your version requirements.

    Dependency Requirement: You must also have the QuickFIXn.Core package installed in your project for these definitions to function.

    # For v1.14 and later:
    # Use the updated package name (no period before 4.2)
    # (Package name depends on specific NuGet implementation, but note the naming convention change)
    
    # For versions prior to v1.14:
    # The package name included an extra period: "FIX4.2"
  9. Install QuickFIX/n FIX 4.0 message definitions

    master

    To use FIX 4.0 message definitions in your .NET project, you must install the QuickFIX/n FIX 4.0 NuGet package.

    Important: Starting with version 1.14, the package name changed. Ensure you are using the correct name based on your version requirements:

    • For v1.14 and newer: Use the package name without the extra period (e.g., QuickFIXn.FIX40 or similar, depending on the specific NuGet ID provided by the registry).
    • For versions prior to v1.14: The package name included an extra period (e.g., QuickFIXn.FIX4.0).

    Requirement: This package is a set of message definitions and requires the QuickFIXn.Core package to be installed in your project to function.

    <!-- Note: The exact NuGet command depends on your package manager, but ensure you include QuickFIXn.Core -->
    # Example requirement
    # QuickFIXn.Core
  10. Install QuickFIX/n FIX 4.1 message definitions

    master

    To use FIX 4.1 message definitions in your .NET project, you must install the QuickFIX/n FIX 4.1 NuGet package.

    Important Requirements:

    • You must also install the QuickFIXn.Core package for these definitions to function.
    • Package Naming Note: Starting with version v1.14, the package name was changed. If you are looking for the current version, use the name without the extra period. If you are working on a legacy project using a version prior to v1.14, the package name includes a period (e.g., FIX4.1).
    # For v1.14 and later:
    # Install the FIX 4.1 definitions and the required Core package
    dotnet add package QuickFIXn.FIX41
    dotnet add package QuickFIXn.Core
    
    # For versions prior to v1.14 (Legacy):
    # The package name included an extra period
    dotnet add package QuickFIXn.FIX4.1
    dotnet add package QuickFIXn.Core
  11. Build and test QuickFIX/n using dotnet CLI

    master

    QuickFIX/n uses the dotnet CLI for building and testing.

    Building

    To build the project, run:

    dotnet build

    Testing

    To run all unit and acceptance tests (using NUnit):

    dotnet test

    To run specific test suites:

    • Unit Tests only: dotnet test UnitTests
    • Acceptance Tests only: dotnet test AcceptanceTests

    Advanced Testing Options

    • Detailed Output: To see more detail in the Acceptance Test output, use the verbosity flag:
      dotnet test -l "console;verbosity=detailed" AcceptanceTest
    * **Filtering**: Use the `--filter` flag to run a specific test case or suite (e.g., `Fix44Test`):
      ```bash
    dotnet test --filter Fix44Test AcceptanceTest

    Note: Acceptance Test logs are stored in bin/Debug/net<NN>/log.

    dotnet build
    dotnet test