Search code examples
javaquickfixfix-protocol

Fix Protocol Error : Field [5232] was not found in message


I am using Quickfix and stunnel to connect to server with RSA private key.

When I am sending Market Data Request(MsgType=V), I am getting the following error

8=FIX.4.49=14735=Y34=55349=ABCD52=20130513-03:23:23.24356=ABCDEFGHI58=Field [5232] was not found in message.262=85ee75f8-ab5d-4aff-b87d-108b74d3281=010=53

i searched and found from this link that 5232 is Currency field

So I passed Currency value to 5232 as below

Message message = new Message();
................
message.setField(5232, new quickfix.field.Currency("EUR"));
................
Session.sendToTarget(message, sessId);

But when i checked the code of outgoing message, i found that the field 5232 is automatically converted to '15=EUR', and its again giving error 'Field [5232] was not found in message'

Can anyone point out what I am missing here ?


Solution

  • Thanks to all who replied this thread. I will explain the steps I followed to solve the issue

    initiator.cfg

    UseDataDictionary=Y
    ValidateUserDefinedFields=N
    ValidateFieldsOutOfOrder=N
    ValidateFieldsHaveValues=N
    DataDictionary=/var/www/FIX44_edited.xml
    

    /var/www/FIX44_edited.xml

    <message name="MarketDataRequest" msgtype="V" msgcat="app">
        <field name="MDReqID" required="Y"/>
        <field name="SubscriptionRequestType" required="Y"/>
        <field name="MarketDepth" required="Y"/>
        <field name="MDUpdateType" required="N"/>
        <field name="AggregatedBook" required="N"/>
        <field name="OpenCloseSettlFlag" required="N"/>
        <field name="Scope" required="N"/>
        <field name="MDImplicitDelete" required="N"/>
        <group name="NoMDEntryTypes" required="Y">
          <field name="MDEntryType" required="Y"/>
        </group>
        <group name="NoRelatedSym" required="Y">
          <component name="Instrument" required="Y"/>
          <group name="NoUnderlyings" required="N">
            <component name="UnderlyingInstrument" required="N"/>
          </group>
          <group name="NoLegs" required="N">
            <component name="InstrumentLeg" required="N"/>
          </group>
        </group>
        <group name="NoTradingSessions" required="N">
          <field name="TradingSessionID" required="N"/>
          <field name="TradingSessionSubID" required="N"/>
        </group>
        <field name="ApplQueueAction" required="N"/>
        <field name="ApplQueueMax" required="N"/>
        <field name="CurrencyNew" required="Y"/>
      </message>
    

    and

    <field number="5232" name="CurrencyNew" type="STRING"/>
    

    define the field 5232 with a unique name (i gave "CurrencyNew"), and use the field inside the message in which you need to use the custom variable 5232.

    Initiator.java

    Message message = new Message();
    quickfix.fix44.MarketDataRequest.NoRelatedSym group = new quickfix.fix44.MarketDataRequest.NoRelatedSym();
    StringField currency= new StringField(5232, "EUR");
    group.setField(currency);
    message.addGroup(group);
    

    Hope this helps anyone who is stuck in generating data dictionary :)