1. Java FIX serialisation
When a FIX engine is too little and too much
github.com/YTEQ/fixb
Vlad Yatsenko @ YTEQ
2. Agenda
● Problem
● FIX basics
● Solution: JA(FIX)B
● Provider flexibility: Cheetah is fast, but QuickFIX is free
● QuickFIX/J pitfalls
● Demo
3. Problem
Initial requirements
● Single Dealer Platform (not high-frequency trading)
● Integration with backend systems via FIX protocol.
● Integration contracts as immutable POJOs on Java
side.
● Custom messages are based on FIX5.0.
● For now use QuickFIX/J but later will need to switch to a
commercial product like Cameron.
4. FIX Basics
● Financial Information eXchange protocol.
● FIX is a public-domain specification owned and
maintained by FIX Protocol, Ltd.
● The latest version is 5.0SP2.
● Standard protocol but not a silver bullet - many use
custom messages.
● Somewhat bloated - covers areas already defined in
TCP.
5. FIX Basics
● FIX message - a string of delimited key-value pairs.
● Header, body and trailer.
● Key, FIX tag, is a number.
● Repeating groups - a mechanism for complex nested
structures with collections of key-value sets.
100=2|101=V11|102=V12|101=V21|102=V22
● Dictionary based.
7. Solution
● Java API for FIX bindings.
● Annotation-based.
● Immutable POJOs.
● Built-in support for jodatime types.
● Used as a serialisation adapter at integration endpoint.
● Version-agnostic approach.
8. Solution
Example
@FixMessage(type = "ORD")
public class Order {
@FixBlock
private final OrderParameters parameters;
@FixGroup(tag=100)
private final List<Party> quotes;
@FixField(tag=111)
private final org.jodatime.DateTime timestamp;
public Order(
final OrderParameters parameters,
final List<FxQuote> quotes,
final DateTime timestamp) {
this.parameters = parameters;
this.quotes = quotes;
this.timestamp = timestamp;
}
}
9. Provider flexibility
● Two simple interfaces allow for implementation on top of
different existing FIX libraries.
● Free "Quick"FIX/J in dev, Commercial provider in prod.
● Reference implementation based on QuickFIX/J.
● Own implementation would potentially be the fastest.
● Version-agnostic approach.
10. QuickFIX/J Pitfalls
● Somewhat stiff implementation (Java port of C++-based
QuickFIX).
● Dictionary required to deserialise repeating groups.
● All values are stored as Strings that are converted to
required type when accessed.
● Deserialisation errors are stored as part of a quickfix.
Message object.
● Problems with milliseconds for time values.
11. Demo
Demo* :)
* Hopefully, this is not one of those never working demos. ;)