Crate quickfix

source
Expand description

This project is an unofficial binding between quickfix library and Rust projects.

CI workflow MSRV codecov dependency status

§Features

  • Provide basic and safe API wrapper above quickfix library.
  • Run on any hardware and operating system supported by Rust Tier 1 (Windows 7+, MacOS 10.12+ & Linux).
  • Only include and compile what you need since project is split into minimal crates.
  • Message decoding / encoding including run-time validation.
  • Supports FIX versions 4x (version 5x can be build locally from XML spec file).
  • Spec driven run-time message validation.
  • Spec driven code generation of type-safe FIX messages, fields, and repeating groups.
  • Session state storage options: SQL, File, In Memory.
  • Logging options: stdout, stderr, log or any other crate if you implement your own trait.

§Project status

Project is working and most of the source library features are available.

It is ready for production and real application use cases.

API MAY CHANGE IN FUTURE VERSION
Crate is still in the reviewing process. Feel free to participate and share your point of view on this github issue.

§Build requirements

Following package must be install to build the library:

  • cmake
  • a C++ compiler (with C++17 support)
  • rustup / rustc / cargo (obviously 😉)
  • rustfmt for auto generated messages from spec.

§Example usage

Here some minimal code sample to getting started:

// Configure FIX engine.
let mut settings = SessionSettings::new();

settings.set(
    None,
    Dictionary::try_from_items(&[
        &ConnectionType::Acceptor,
    ])?
)?;

settings.set(
    Some(&SessionId::try_new("FIX.4.4", "ME", "THEIR", "")?),
    Dictionary::try_from_items(&[
        &StartTime("12:30:00"),
        &EndTime("23:30:00"),
        &SocketAcceptPort(4000),
        &DataDictionary("../quickfix-ffi/libquickfix/spec/FIX41.xml"),
    ])?
)?;

// Configure FIX callbacks.
pub struct MyApplication;

impl ApplicationCallback for MyApplication {
    // Implement whatever callback you need

    fn on_create(&self, _session: &SessionId) {
        // Do whatever you want here 😁
    }
}

// Create FIX objects.
let store_factory = MemoryMessageStoreFactory::new();
let log_factory = LogFactory::try_new(&StdLogger::Stdout)?;
let app = Application::try_new(&MyApplication)?;

let mut acceptor = SocketAcceptor::try_new(&settings, &app, &store_factory, &log_factory)?;

// Start session.
acceptor.start()?;

loop {
    // Do whatever you want here ...
}

// End application
acceptor.stop()?;

Modules§

Structs§

Enums§

  • Represent any day of the week.
  • Error result that can occurs from a on_msg_from_admin callback.
  • Error result that can occurs from a on_msg_from_app callback.
  • Error result that can occurs from a on_msg_to_app callback.
  • Represent all possible error that can occurs with quickfix.
  • Log message to std file descriptors.

Traits§

Functions§