QuickFIX/J – Best way to consume market data

  Kiến thức lập trình

I am using QuickFIX library to connect to my broker’s FIX server and send orders. My Application (QuickFIX Initiator) receive orders message from different algorithms by consuming a RabbitMQ queue and route it to my broker using FIX protocol, as outlined by the diagram bellow:

enter image description here

I had to implement a custom order execution that must check the bid and ask of a specific security before deciding if the order to be send is a LIMIT or a STOP LIMIT.Before having access to market data through FIX, I used to make a request to an internal API build uppon the Bloomberg API

instrumentData = bbgApi.getInstrumentData(this.params.getSymbol());

String side = this.params.getSide();

if (side.equals(Side.BUY)) {
    Double ask = instrumentData.getAsk();
    // ...
    Session.sendToTarget(this.getOrder(), sessionID);

 else if (side.equals(Side.SELL)) {
    Double bid = instrumentData.getBid();
    Session.sendToTarget(this.getOrder(), sessionID);


I just have to check the bid and ask of the specific moment that I am sending the order.

Now that I have access to market data through FIX, I would like to consume the bid and ask using it because the price are closer to the real price of the securities at each moment. But because of the way that FIX works, I don’t know how can I make a call like

instrumentData = fixApi.getInstrumentData(this.params.getSymbol());

because when I send a FIX message, it does not returns me a “promise” that I can wait to be complete before continuing my code execution. I am used to the way that JavaScript and REST APIs works, so I am a little bit stuck. I am wondering what is the best way that I can consume and produces market data that is received through FIX.

My ideas

  1. Create a Market Data FIX application (Initiator) that will subscribe to securities data. The data of each securitity will be put to an RabbitMQ queue. For each order received from my FIX Order Application, the Order Execution Object will consume from the specific security queue and react to the first market data message received and send an order.
  2. Also create a Market Data FIX Application (Initiator) that will subscribe to securities data. The data of each security will be put to a table of MySQL. Then I would create an API like the bbgApi that I mentioned above that will consult the MySQL and get the most recent data of the required security.
  3. Create an Market Data Application that is composed of an Initiator and Acceptor. The Initiator will connect to my broker’s market data app and the acceptor will be used to accept new connections from internal applications. My Order Execution Object will require market data through the acceptor and wait for a message containing the required data.

In my opinion, the solution 3 seems ideal, but would require multiple connections to my acceptor, which can slow down (and delay) the order execution. It would be ideal if I only have one object connected to the FIX market data app that would send the request and this request returns a promise that, when completed, returns the required data.

I appreciate your opinion about which way is better to consume market data. If you have a different opinion or suggestion, please let me know. Thank you very much for your help.


RabbitMQ won’t be a good option because maybe I would like to have multiple consumers for the same message. Maybe kafka would be ideal.