Explanation of quick Fix in IB Fix development, ibquickfix
Quickfix is an open-source FIX engine that supports JAVA, C #, and other languages.
Address: http://quickfixn.org/tutorial/creating-an-application.html
Before reading the following text, we assume that you have read the official Quickfix website and have an understanding of the basic content of the fix protocol.
The following describes the key points of Quickfix (C:
(1) What is Quickfix?
Quickfix can be understood as a set of tools for implementing the fix protocol. By using this tool, users can send fix messages to their opponents and receive and respond to the messages sent by them in a timely manner.
You can also extend this tool (which will be briefly introduced in the IB condition list)
(2) Where is the Quickfix source code?
Https://github.com/connamara/quickfixn
(3) how to use Quickfix?
You can download the source code directly. After compilation, You can reference the generated QuickFix dynamic library or download the latest version of QuickFix dynamic library from the official website.
(4) Key Interfaces of Quickfix ----- IApplication
This interface is the core of Quickfix. After you reference the dynamic library of QuickFix, the most important task is to implement the methods in this interface according to your own needs.
For the convenience of the description, assume that Company A and IB are competitors. Company A, as the initiator of the Fix reply, actively connects to IB, that is, Company A is initator and IB is acceptor.
In addition, ib fix messages can be divided into two types: application msg messages and administrative msg messages.
Company A's programmers need to implement the following methods of the IApplication interface:
Public void FromApp (Message msg, SessionID sessionID)
Method Description: This method is called when Company A's application program receives an application message sent from IB. Company A's programmer needs to process different application messages in this method.
Public void OnCreate (SessionID sessionID)
Method Description: This method is called when the Quickfix creates a session based on the configuration file. This method does not do anything special.
Public void OnLogon (SessionID sessionID)
Method Description: This method is called when the application of Company A and the IB Fix service are successfully connected.
Public void OnLogout (SessionID sessionID)
Method Description: This method is called when the application of Company A is disconnected from the IB Fix service. You need to implement the reconnection mechanism in this method.
Public void FromAdmin (Message msg, SessionID sessionID)
Method Description: This method is called when Company A's application receives A Management message from IB,
Public void ToAdmin (Message msg, SessionID sessionID)
Method Description: This method is called before Company A sends A Management message to IB (you can modify msg before sending the message)
Public void ToApp (Message msg, SessionID sessionID)
Method Description: This method is called before Company A sends an application message to IB (you can modify msg before sending the message)
For detailed examples on the official website, refer
(5) Manage the FIX Message Sequence Number
A fix session is composed of different messages. Each message contains an incremental field MsgSeqNum (tag #34)
That is, MsgSeqNum = 1 when the user sends the first msg, MsgSeqNum = 2 when the second msg is sent, and so on.
Assume that MsgSeqNum is 1 when the user receives the first msg, MsgSeqNum is 2 when the second msg is received, and the messages received later are similar.
That is, when you call Quickfix, you must maintain two serial number queues. One is the serial number queue of the message sent by the user, and the other is the serial number queue of the message received by the user.
Assume that the serial number of the previous message received by the user is 30, and the serial number of the next received message is 31. Assume that the serial number of the next message is 40, this means that the user has missed some messages. In this case, the user needs to tell IB to resend the lost messages.
The user can maintain the serial number of the sent message in the ToAdmin and ToApp functions. The user can maintain the serial number of the received message in the FromAdmin and FromApp functions.
(6) configuration of Quickfix
Users need to do some configuration before using Quickfix, these configurations are very simple, refer to the official website (http://quickfixn.org/tutorial/configuration.html)