我是新手修理。我在我的应用中使用quickfix
库。我能够登录并交换心跳。但是当我发送市场数据请求时,我得到以下错误。
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
以下是生成消息的代码。
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);
答案 0 :(得分:2)
尝试提供帮助。请尝试下面的代码。如果它不起作用,请通知FIX日志文件和FIX事件文件以及任何错误消息。请仔细检查类型是否正常(我使用记事本)以及编译器是否正常工作。
// 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);
答案 1 :(得分:0)
您的邮件请求未正确汇编,错误消息告诉您什么。拒绝邮件371
上的字段35=3
显示哪个标记不正确,在您的情况下是NoMDEntryType (267)
组。
之所以发生这种情况,是因为您已在NoRelatedSym
组中添加了此组,而不是在邮件中添加。
请参阅下面的代码,了解正确创建的消息:
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);
我从codeprojet获得了此代码,但我没有测试过它。