QuickFIX doesn't validate the repeating group

2019-08-06 09:47发布

问题:

I'm implementing a client-server set based on QuickFIX. When I try to send a message that contains a Parties repeating group, I get the Reject with the following description: "58=Tag not defined for this message type|371=447|"

The message type thet I try to send is OrderCancelReplaceRequest.

The code sample is:

FIX44::OrderCancelReplaceRequest order(FIX::MsgType("G"));

FIX44::OrderCancelReplaceRequest::NoPartyIDs party;
// 448-PartyID
party.set(FIX::PartyID("PartyId"));
// 447-PartyIDSource
party.set(FIX::PartyIDSource('B'));    
// 452-PartyRole
party.set(FIX::PartyRole(1));    
// 802-NoPartySubIDs
party.set(FIX::NoPartySubIDs(0));

order.addGroup(party);

...

If the message contains no Parties group, it's validated successfully by the server.

Moreover, it's validated successfully even if it contains the FIX44::OrderCancelReplaceRequest::NoAllocs group:

 FIX44::OrderCancelReplaceRequest::NoAllocs alloc;
 // 79-AllocAccount
 alloc.set(FIX::AllocAccount("Alloc Account"));
 // 80-AllocQty
 alloc.set(FIX::AllocQty(4.2));
 order.addGroup(alloc);

So, I see this problem only when I try to use the Parties group.

The config file for the server is:

[DEFAULT]
ConnectionType=acceptor
SocketAcceptPort=28663
SocketReuseAddress=Y
StartTime=00:00:00
EndTime=00:00:00
UseDataDictionary=Y
DataDictionary=<some path here>/FIX44.xml
FileLogPath=QuickFixServerLog
ValidateUserDefinedFields=N

[SESSION]
BeginString=FIX.4.4
SenderCompID=EXECUTOR
TargetCompID=CLIENT1
FileStorePath=store

The config file of the client is:

[DEFAULT]
ConnectionType=initiator
ReconnectInterval=1
FileStorePath=store
StartTime=00:00:00
EndTime=00:00:00
UseDataDictionary=Y
DataDictionary=<some path here>/FIX44.xml
HttpAcceptPort=9911
ValidateUserDefinedFields=N
ResetOnLogout=Y
ResetOnLogon=Y

[SESSION]
BeginString=FIX.4.4
SenderCompID=CLIENT1
TargetCompID=EXECUTOR
SocketConnectHost=127.0.0.1
SocketConnectPort=28663
HeartBtInt=15

Upd.

The example of the request reseived by server (it's from the server logs) is:

8=FIX.4.4|9=234|35=G|34=2|49=CLIENT1|52=20150417-10:49:07.715|56=EXECUTOR|1=Account|11=Id123|38=11.11|40=1|41=OrigId321|44=4.2|54=2|55=Symbol|60=20150417-10:49:07|78=2|79=AllocAccount1|79=AllocAccount2|80=10|80=20|447=B|448=PartyId|452=1|453=1|802=0|10=185|

The response for that request is:

8=FIX.4.4|9=124|35=3|34=2|49=EXECUTOR|52=20150417-10:49:07.719|56=CLIENT1|45=2|58=Tag not defined for this message type|371=447|372=G|373=2|10=060|

回答1:

As you noted after our conversation in the comments section, the order of the fields in the <Parties> component block group was incorrect. The field order in a repeating group (or component block as in case of <Parties>) should be preserved. You can find here a blog post on the subject explaining the importance of field order in repeating groups.

In your case, a client-side modification of the message screwed up the field order of the <Parties> group which resulted in a Reject message from the server.



回答2:

@TT My 10 cents. Fiximate is your friend.

In my FIX4.4 data dictionary I can see that for message type OrderCancelReplaceRequest the tag 447 PartyIDSource is not defined. I enclose my data dictionary message.

If you need to define PartyIDSource then add it to your data dictionary.

<message name="OrderCancelReplaceRequest" msgtype="G" msgcat="app">
    <field name="OrderID" required="N" />
    <component name="Parties" required="N" />
    <field name="TradeOriginationDate" required="N" />
    <field name="TradeDate" required="N" />
    <field name="OrigClOrdID" required="Y" />
    <field name="ClOrdID" required="Y" />
    <field name="SecondaryClOrdID" required="N" />
    <field name="ClOrdLinkID" required="N" />
    <field name="ListID" required="N" />
    <field name="OrigOrdModTime" required="N" />
    <field name="Account" required="N" />
    <field name="AcctIDSource" required="N" />
    <field name="AccountType" required="N" />
    <field name="DayBookingInst" required="N" />
    <field name="BookingUnit" required="N" />
    <field name="PreallocMethod" required="N" />
    <field name="AllocID" required="N" />
    <group name="NoAllocs" required="N">
      <field name="AllocAccount" required="N" />
      <field name="AllocAcctIDSource" required="N" />
      <field name="AllocSettlCurrency" required="N" />
      <field name="IndividualAllocID" required="N" />
      <component name="NestedParties" required="N" />
      <field name="AllocQty" required="N" />
    </group>
    <field name="SettlType" required="N" />
    <field name="SettlDate" required="N" />
    <field name="CashMargin" required="N" />
    <field name="ClearingFeeIndicator" required="N" />
    <field name="HandlInst" required="N" />
    <field name="ExecInst" required="N" />
    <field name="MinQty" required="N" />
    <field name="MaxFloor" required="N" />
    <field name="ExDestination" required="N" />
    <group name="NoTradingSessions" required="N">
      <field name="TradingSessionID" required="N" />
      <field name="TradingSessionSubID" required="N" />
    </group>
    <component name="Instrument" required="Y" />
    <component name="FinancingDetails" required="N" />
    <group name="NoUnderlyings" required="N">
      <component name="UnderlyingInstrument" required="N" />
    </group>
    <field name="Side" required="Y" />
    <field name="TransactTime" required="Y" />
    <field name="QtyType" required="N" />
    <component name="OrderQtyData" required="Y" />
    <field name="OrdType" required="Y" />
    <field name="PriceType" required="N" />
    <field name="Price" required="N" />
    <field name="StopPx" required="N" />
    <component name="SpreadOrBenchmarkCurveData" required="N" />
    <component name="YieldData" required="N" />
    <component name="PegInstructions" required="N" />
    <component name="DiscretionInstructions" required="N" />
    <field name="TargetStrategy" required="N" />
    <field name="TargetStrategyParameters" required="N" />
    <field name="ParticipationRate" required="N" />
    <field name="ComplianceID" required="N" />
    <field name="SolicitedFlag" required="N" />
    <field name="Currency" required="N" />
    <field name="TimeInForce" required="N" />
    <field name="EffectiveTime" required="N" />
    <field name="ExpireDate" required="N" />
    <field name="ExpireTime" required="N" />
    <field name="GTBookingInst" required="N" />
    <component name="CommissionData" required="N" />
    <field name="OrderCapacity" required="N" />
    <field name="OrderRestrictions" required="N" />
    <field name="CustOrderCapacity" required="N" />
    <field name="ForexReq" required="N" />
    <field name="SettlCurrency" required="N" />
    <field name="BookingType" required="N" />
    <field name="Text" required="N" />
    <field name="EncodedTextLen" required="N" />
    <field name="EncodedText" required="N" />
    <field name="SettlDate2" required="N" />
    <field name="OrderQty2" required="N" />
    <field name="Price2" required="N" />
    <field name="PositionEffect" required="N" />
    <field name="CoveredOrUncovered" required="N" />
    <field name="MaxShow" required="N" />
    <field name="LocateReqd" required="N" />
    <field name="CancellationRights" required="N" />
    <field name="MoneyLaunderingStatus" required="N" />
    <field name="RegistID" required="N" />
    <field name="Designation" required="N" />
  </message>


标签: c++ quickfix