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§

dictionary_item
Common dictionary configuration parameters.

Structs§

Application
Application callback wrapper.
DataDictionary
Represents a data dictionary for a version of FIX.
Dictionary
For storage and retrieval of key/value pairs.
FileMessageStoreFactory
File based implementation of MessageStore.
Group
Base class for all FIX repeating groups.
Header
Header part of a FIX message.
LogFactory
Logging factory.
MemoryMessageStoreFactory
In memory implementation of MessageStore.
Message
Base class for all FIX messages.
NullLogger
Drop every log message.
NullMessageStoreFactory
Null implementation of MessageStore.
RustLogger
Log message using log crate.
Session
FIX Session.
SessionId
Unique session id consists of BeginString, SenderCompID and TargetCompID.
SessionSettings
Container for setting dictionaries mapped to sessions.
SocketAcceptor
Socket implementation of incoming connections handler.
SocketInitiator
Socket implementation of establishing connections handler.
Trailer
Trailer part of a FIX message.

Enums§

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

Traits§

ApplicationCallback
These methods notify your application about events that happen on active FIX sessions.
ConnectionHandler
Permit control of an underlying socket connection.
FfiMessageStoreFactory
Object can be converted as a foreign object representing a MessageStore.
FieldMap
Stores and organizes a collection of Fields.
ForeignPropertyGetter
Allow reading value (aka property) from a foreign (C++) object.
ForeignPropertySetter
Allow writing value (aka property) into a foreign (C++) object.
IntoFixValue
Convert object to FIX value.
LogCallback
Log event that can occurs in quickfix library.
SessionContainer
Define a container of session

Functions§

send_to_target
Send message to target design in session ID.