Reputation: 2120
I'm currently using QuickFIX/n to build an acceptor service, and I've built an initiator to test the acceptor. I suspect the error I get is due to a bug in the acceptor because the same error occurs with a message that someone else is sending to the service.
In the initiator I build and send an AllocationInstruction as follows:
var fix44Message = new QuickFix.FIX44.AllocationInstruction(
new AllocID(request.Info.AllocationID), EnumHelpers.ParseAllocationTransactionType(request.Info.AllocationTransactionType), EnumHelpers.ParseAllocationType(request.Info.AllocationType),
new AllocNoOrdersType(AllocNoOrdersType.EXPLICIT_LIST_PROVIDED), EnumHelpers.ParseSide(request.Info.Side), new Symbol(request.Info.Symbol), new Quantity(request.Info.Quantity),
new AvgPx(request.Info.AveragePrice), new TradeDate(request.Info.TradeDate.ToString("yyyyMMdd")))
{
SecurityID = new SecurityID(request.Info.SecurityID),
SecurityIDSource = new SecurityIDSource(request.Info.SecurityIDSource),
SecurityExchange = new SecurityExchange(request.Info.SecurityExchange),
Issuer = new Issuer(request.Info.Issuer),
Currency = new Currency(request.Info.Currency),
TransactTime = new TransactTime(request.Info.TransactTime),
SettlDate = new SettlDate(request.Info.SettlementDate.ToString("yyyyMMdd")),
GrossTradeAmt = new GrossTradeAmt(request.Info.GrossTradeAmount),
NetMoney = new NetMoney(request.Info.NetMoney)
};
var group = new QuickFix.FIX44.AllocationInstruction.NoOrdersGroup
{
ClOrdID = new ClOrdID(order.ClOrdID),
OrderID = new OrderID(order.OrderID),
OrderQty = new OrderQty(order.Quantity)
};
fix44Message.AddGroup(group);
In this specific case the message is created with exactly one order group.
In the acceptor I try get the order-groups as follows:
public void OnMessage(QuickFix.FIX44.AllocationInstruction allocation, SessionID sessionID)
{
Console.WriteLine("Order count: " + allocation.NoOrders.getValue());
var orderGroup = new QuickFix.FIX44.AllocationInstruction.NoOrdersGroup();
allocation.GetGroup(1, orderGroup);
info.Orders.Add(new AllocationInstructionOrder
{
ClOrdID = orderGroup.ClOrdID.getValue(),
OrderID = orderGroup.OrderID.getValue(),
Quantity = orderGroup.OrderQty.getValue()
});
}
allocation.NoOrders has a value of 1 as expected. However, when GetGroup() is called with an index of 1 (first group), I get
QuickFix.FieldNotFoundException occurred
HResult=-2146232832
Message=field not found for tag: 73
Source=QuickFix
Field=73
StackTrace:
at QuickFix.FieldMap.GetGroup(Int32 num, Int32 field)
at QuickFix.FieldMap.GetGroup(Int32 num, Group group)
at FIX.FixAcceptorService.AcceptorExchange.OnMessage(AllocationInstruction allocation, SessionID sessionID) in c:\Projects\AdHoc\FIX\FIX\FIX\FixAcceptorService\AcceptorExchange.cs:line 82
InnerException:
This is the FIX message log:
20151008-06:03:57.410 : 8=FIX.4.4 9=65 35=A 34=1 49=TEST 52=20151008-06:03:57.388 56=BAOBAB 98=0 108=30 10=225
20151008-06:03:57.444 : 8=FIX.4.4 9=65 35=A 34=1 49=BAOBAB 52=20151008-06:03:57.440 56=TEST 98=0 108=30 10=214
20151008-06:04:04.162 : 8=FIX.4.4 9=258 35=J 34=2 49=TEST 52=20151008-06:04:04.158 56=BAOBAB 6=9.175 15=ZAR 22=4 48=ZAE0007990962 53=506 54=1 55=R 60=20151008-08:04:04.141 64=20151008 70=080404139 71=0 75=20151008 106=ABC 118=4642.56 207=XJSE 381=4642.56 626=2 857=1 73=1 11=18122977 37=118 38=506 10=251
20151008-06:04:10.876 : 8=FIX.4.4 9=110 35=j 34=2 49=BAOBAB 52=20151008-06:04:10.876 56=TEST 45=2 58=Conditionally Required Field Missing 372=J 380=5 10=127
20151008-06:04:34.890 : 8=FIX.4.4 9=53 35=0 34=3 49=TEST 52=20151008-06:04:34.890 56=BAOBAB 10=176
20151008-06:04:40.894 : 8=FIX.4.4 9=53 35=0 34=3 49=BAOBAB 52=20151008-06:04:40.894 56=TEST 10=177
20151008-06:05:04.909 : 8=FIX.4.4 9=53 35=0 34=4 49=TEST 52=20151008-06:05:04.908 56=BAOBAB 10=175
20151008-06:05:10.910 : 8=FIX.4.4 9=53 35=0 34=4 49=BAOBAB 52=20151008-06:05:10.910 56=TEST 10=165
20151008-06:05:34.921 : 8=FIX.4.4 9=53 35=0 34=5 49=TEST 52=20151008-06:05:34.920 56=BAOBAB 10=173
20151008-06:05:40.924 : 8=FIX.4.4 9=53 35=0 34=5 49=BAOBAB 52=20151008-06:05:40.924 56=TEST 10=174
And finally, the acceptor settings:
[DEFAULT]
SenderCompID=BAOBAB
UseDataDictionary=N
StartTime=00:00:00
EndTime=00:00:00
FileStorePath=C:\Users\bernhard.haussermann\AppData\Local\Temp\FIX_BAOBAB
FileLogPath=C:\Users\bernhard.haussermann\AppData\Local\Temp\FIX_BAOBAB_log
ConnectionType=acceptor
SocketAcceptPort=8030
ResetOnLogon=N
ResetOnLogout=N
ResetOnDisconnect=N
[SESSION]
BeginString=FIX.4.4
TargetCompID=TEST
[SESSION]
BeginString=FIXT.1.1
DefaultApplVerID=FIX.5.0
TargetCompID=TEST
The C# code above is based on the example on the QuickFIX/n site.
Any ideas?
Upvotes: 1
Views: 2195
Reputation: 2120
After downloading the source code for quickfix/n and debugging against it I finally found the cause of the problem!
The acceptor did not interpret the message properly because it did not create a group for the NoOrders (73) tag. The data-dictionary map for looking up group tags was empty, because I used UseDataDictionary=N in my settings. Changing the acceptor to use a data dictionary solved the problem.
Here is my updated settings string:
[DEFAULT]
SenderCompID=BAOBAB
UseDataDictionary=Y
DataDictionary=C:\Users\bernhard.haussermann\AppData\Local\Temp\FIX44.xml
StartTime=00:00:00
EndTime=00:00:00
FileStorePath=C:\Users\bernhard.haussermann\AppData\Local\Temp\FIX_BAOBAB
FileLogPath=C:\Users\bernhard.haussermann\AppData\Local\Temp\FIX_BAOBAB_log
ConnectionType=acceptor
SocketAcceptPort=8030
ResetOnLogon=N
ResetOnLogout=N
ResetOnDisconnect=N
[SESSION]
BeginString=FIX.4.4
TargetCompID=TEST
Upvotes: 6