Expand description
This project is an unofficial binding between quickfix library and Rust projects.
§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.
- Data
Dictionary - Represents a data dictionary for a version of FIX.
- Dictionary
- For storage and retrieval of key/value pairs.
- File
Message Store Factory - File based implementation of
MessageStore
. - Group
- Base class for all FIX repeating groups.
- Header
- Header part of a FIX message.
- LogFactory
- Logging factory.
- Memory
Message Store Factory - In memory implementation of
MessageStore
. - Message
- Base class for all FIX messages.
- Null
Logger - Drop every log message.
- Null
Message Store Factory - Null implementation of MessageStore.
- Rust
Logger - Log message using
log
crate. - Session
- FIX Session.
- Session
Id - Unique session id consists of BeginString, SenderCompID and TargetCompID.
- Session
Settings - Container for setting dictionaries mapped to sessions.
- Socket
Acceptor - Socket implementation of incoming connections handler.
- Socket
Initiator - Socket implementation of establishing connections handler.
- Trailer
- Trailer part of a FIX message.
Enums§
- DayOf
Week - Represent any day of the week.
- MsgFrom
Admin Error - Error result that can occurs from a
on_msg_from_admin
callback. - MsgFrom
AppError - Error result that can occurs from a
on_msg_from_app
callback. - MsgTo
AppError - Error result that can occurs from a
on_msg_to_app
callback. - Quick
FixError - Represent all possible error that can occurs with quickfix.
- StdLogger
- Log message to std file descriptors.
Traits§
- Application
Callback - These methods notify your application about events that happen on active FIX sessions.
- Connection
Handler - Permit control of an underlying socket connection.
- FfiMessage
Store Factory - Object can be converted as a foreign object representing a
MessageStore
. - Field
Map - Stores and organizes a collection of Fields.
- Foreign
Property Getter - Allow reading value (aka property) from a foreign (C++) object.
- Foreign
Property Setter - Allow writing value (aka property) into a foreign (C++) object.
- Into
FixValue - Convert object to FIX value.
- LogCallback
- Log event that can occurs in quickfix library.
- Session
Container - Define a container of session
Functions§
- send_
to_ target - Send message to target design in session ID.