简体   繁体   English

QuickFix市场数据请求错误

[英]QuickFix Market Data Request Error

I am new to fix. 我是新手要修复。 I am using quickfix library in my app. 我在我的应用程序中使用quickfix库。 I'm able to do logon and exchange heart beat. 我可以登录并交换心跳。 But when i send the market data request, i get the below error. 但是,当我发送市场数据请求时,出现以下错误。

8=FIX.4.49=13035=V34=249=PrimoDEMOFIX52=20160622-17:35:14.62256=CfhDemoPrices262=PrimoApp123263=1264=0265=0269=0146=155=GBPUSD267=110=129
8=FIX.4.49=14435=334=249=CfhDemoPrices52=20160622-17:35:18.36756=PrimoDEMOFIX45=258=Incorrect NumInGroup count for repeating group371=267372=V373=1610=043

Below is the code where is generate the message. 下面是生成消息的代码。

Message msg = new Message();
QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup group = new QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup(); 
msg.Header.SetField(new MsgType("V"));
msg.SetField(new MDReqID("PrimoApp123"));
msg.SetField(new SubscriptionRequestType('1'));
msg.SetField(new MarketDepth(0));
msg.SetField(new MDUpdateType(0));
// msg.SetField(new NoMDEntryTypes(2));
group.SetField(new NoMDEntryTypes(1));
msg.SetField(new MDEntryType('0'));
msg.SetField(new NoRelatedSym(1));
group.SetField(new Symbol("GBPUSD"));
//msg.SetField(new Symbol("GBPUSD"));
msg.AddGroup(group);
Session.SendToTarget(msg, FeederApp.mysession);

Trying to help. 试图帮助。 Try the code below. 试试下面的代码。 If it does not work please inform the FIX log file and FIX event file and any error message. 如果不起作用,请通知FIX日志文件和FIX事件文件以及任何错误消息。 Please double check if the types are OK (I used notepad) and if the compiler works. 请仔细检查类型是否正确(我使用了记事本)以及编译器是否工作。

// Create message instance
// If you create a specific FIX Message new QuickFix.FIX44.MarketDataRequest() instead of new Message()
// you don't need set the MessageType and your intelisense is better.
QuickFix.FIX44.MarketDataRequest msg = new QuickFix.FIX44.MarketDataRequest();

// Fill message fields
msg.SetField(new MDReqID("PrimoApp123")); 
msg.SetField(new SubscriptionRequestType('1')); 
msg.SetField(new MarketDepth(0)); 
msg.SetField(new MDUpdateType(0)); 

// Add the MDEntryTypes group
QuickFix.FIX44.MarketDataRequest.NoMDEntryTypes noMDEntryTypes = new QuickFix.FIX44.MarketDataRequest.NoMDEntryTypes();
noMDEntryTypes.SetField(new MDEntryType('0')); 
msg.addGroup(noMDEntryTypes);

// Add the NoRelatedSym group
QuickFix.FIX44.MarketDataRequest.NoRelatedSym noRelatedSym = new QuickFix.FIX44.MarketDataRequest.NoRelatedSym();
noRelatedSym.setSymbol("GBPUSD");
msg.addGroup(noRelatedSym);

// Send message
Session.SendToTarget(msg, FeederApp.mysession);

Your message request is incorrectly assembled and the error message is telling you what. 您的消息请求组装不正确,错误消息告诉您什么。 The field 371 on the reject message 35=3 is showing which tag is incorrect, and in your case is the NoMDEntryType (267) group. 拒绝消息35=3上的字段371显示哪个标签不正确,在您的情况下为NoMDEntryType (267)组。 That is occurring because you have added this group inside the NoRelatedSym group and not on the message. 发生这种情况是因为您已将此组添加到NoRelatedSym组内,而不是在消息上。

See the code bellow for a correct created message: 有关正确创建的消息,请参见下面的代码:

var marketDataRequest = new MarketDataRequest();
marketDataRequest.set(new QuickFix.MDReqID(Utility.GetNewUniqueId()));
marketDataRequest.set(new QuickFix.SubscriptionRequestType('1'));
//if market depth require
marketDataRequest.set(new QuickFix.MarketDepth(1));
marketDataRequest.set(new QuickFix.MDUpdateType(1));
marketDataRequest.set(new QuickFix.AggregatedBook(true));
var noMDEntryTypes = new MarketDataRequest.NoMDEntryTypes();
var mdEntryType_bid = new QuickFix.MDEntryType('0');
noMDEntryTypes.set(mdEntryType_bid);
marketDataRequest.addGroup(noMDEntryTypes);
var mdEntryType_offer = new QuickFix.MDEntryType('1');
noMDEntryTypes.set(mdEntryType_offer);
marketDataRequest.addGroup(noMDEntryTypes);
var relatedSymbol = new MarketDataRequest.NoRelatedSym();
relatedSymbol.set(new QuickFix.Symbol(instrument));
marketDataRequest.addGroup(relatedSymbol);
//Send message
Session.sendToTarget(marketDataRequest, _admin.TradeSessionId);

I've got this code from codeprojet and I haven´t tested it. 我已经从codeprojet获得了此代码,但尚未对其进行测试。

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

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