简体   繁体   English

QuickFIX / n:查询组时出现FieldNotFoundException

[英]QuickFIX/n: FieldNotFoundException when querying group

I'm currently using QuickFIX/n to build an acceptor service, and I've built an initiator to test the acceptor. 我目前正在使用QuickFIX / n构建接受器服务,并且已经构建了一个启动器来测试接受器。 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: 在启动程序中,我按如下所示构建并发送一个AllocationInstruction:

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. 分配。NoOrders的值为1,如预期的那样。 However, when GetGroup() is called with an index of 1 (first group), I get 但是,当使用索引1(第一个组)调用GetGroup()时,我得到

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: 这是FIX消息日志:

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 . 上面的C#代码基于QuickFIX / n网站上的示例

Any ideas? 有任何想法吗?

After downloading the source code for quickfix/n and debugging against it I finally found the cause of the problem! 在下载quickfix / n的源代码并对其进行调试之后,我终于找到了问题的原因!

The acceptor did not interpret the message properly because it did not create a group for the NoOrders (73) tag. 接受者没有正确解释消息,因为它没有为NoOrders(73)标记创建组。 The data-dictionary map for looking up group tags was empty, because I used UseDataDictionary=N in my settings. 用于查找组标签的数据字典映射为空,因为我在设置中使用UseDataDictionary = N。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM