Documentation
How-to get started
Pre-requisites
Install the following standard tools to run examples and build your own applications
- JDK 17+ - IdeaFIX makes the most of current JVMs for best performances
- Maven 3.6+ - indispensable to manage dependencies in the JVM world
- Gradle 8.0+ - Widespread and powerful build tool
SDKMAN! is highly recommended. It helps installing SDKs on a profile-only basis.
User Guide
Follow these simple steps to make a FIX application
- Make or re-use a FIX Dictionary
- Implement the IFixMessageInitializer interface
- Implement the IFixIncomingHandler interface
- Define configuration
- Use the client or server factory methods
Please refer to the Javadoc for more details.
1. Define a dictionary
A dictionary is required to run IdeaFIX. It’s a key aspect that makes IdeaFIX ultra-fast. QuickFIX’s conventions are used, so an existing or custom QuickFIX dictionary can be re-used.
Here’s an extract taken from SDK’s file SIMPLE_OM.xml
:
<fix major="4" minor="4">
<header>
<field name="BeginString" required="Y"/>
<field name="BodyLength" required="Y"/>
<field name="MsgType" required="Y"/>
<field name="SenderCompID" required="Y"/>
<field name="TargetCompID" required="Y"/>
<field name="MsgSeqNum" required="Y"/>
<field name="PossDupFlag" required="N"/>
<field name="SendingTime" required="Y"/>
<field name="OrigSendingTime" required="N"/>
</header>
<trailer>
<field name="CheckSum" required="Y"/>
</trailer>
<messages>
<message name="Heartbeat" msgtype="0" msgcat="admin">
<field name="TestReqID" required="N"/>
</message>
<message name="Logon" msgtype="A" msgcat="admin">
<field name="EncryptMethod" required="Y"/>
<field name="HeartBtInt" required="Y"/>
<field name="ResetSeqNumFlag" required="N"/>
<field name="NextExpectedMsgSeqNum" required="N"/>
<field name="Username" required="N"/>
<field name="Password" required="N"/>
</message>
...
</fix>
2. Implement IFixMessageInitializer
Many counterparties depart from the plain FIX 4.2 up to 5.0 standards and expect additional headers or trailers. This is where you can insert custom field. Internally, hook methods are called on the main event loop each time a message is requested from the message pool.
You can perfectly design an application that only requires the bare minimum fields and use the NoopMessageInitializer
implementation. In fact, using a factory method without this argument type will automatically use this class.
3. Implement IFixIncomingHandler
This is the main interface to implement for any IdeaFIX application. In fact, it follows the design of many other FIX engines. Each of the following methods corresponds to a certain stage of the session
-
onLogon(IChannelContext <T> sender)
is called after a logon message is received -
onLogout(IChannelContext <T> sender)
is called after a logout message is received -
onMessage(IChannelContext <T> sender)
is called after a valid business message is received (not an admin message) -
onDisconnection()
is called after a valid end of session (with a logout message) or not. Very useful to manage resources, even in case of unexpected loss of remote connection -
onEndOfBatch(IChannelContext <T> sender)
is an optional hook in case you want to wait the end of an incoming buffer to perform time-consuming task (like flushing i/o, etc.). Useful for performances
And finally, your client code can call the close()
method to gracefully finish a session (with a logout message). It’s useful to implement security such as password checks in the client code.
4. Define configuration
Configuration follows the same conventions as QuickFIX except that IdeaFIX uses YAML. The file is loaded by the loadConfig
methods in the factory classes. Here’s an example
ConnectionType: acceptor
SocketPort: 8080
SocketHost: localhost
StartTime: 00:00:00
EndTime: 00:00:00
HeartBtInt: 30
SenderCompID: testClient
TargetCompID: testServer
CheckLatency: Y
HeartBeatTimeoutMultiplier: 1.5
IncomingPoolSizes:
D: 2048
0: 1024
...
Alternatively, you can directly load a JDK Map and therefore use any kind of format.
5. Run a factory methods
There are 2 kinds of factory methods depending on whether you’re writing a client (Initiator in FIX lingo) or a server (Acceptor) :
- static methods in
FixClientFactory
- static methods in
FixServerFactory
Here’s a snippet
String name = OMIdeaFixClientExample.class.getSimpleName();
IFixClient fixClient = FixClientFactory.makeClient(makeSimpleClientConfig(name),
name,
new OMClientIncomingHandler());
fixClient.run();
Please bear with us as more detailed documentation will be uploaded later ! As always, the best is to head GitHub to view and run the latest examples.