Search code examples
c#quickfixfix-protocol

QuickFix Market Data Request Error


I am new to fix. I am using quickfix library in my app. 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);

Solution

  • 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. 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);