Search code examples
c#.netquickfixfix-protocol

How to get symbol from securitylist using quickfix?


I'm sending a SecurityListRequest and I am receiving confirmation. I am unable to get the symbol from the response. I'm getting response like this.

8=FIXT.1.1|9=795|35=y|34=3|49=TMATCH=YYYYY|52=20160804-09:39:56.534|56=zzzzz|320=0001|322=zzzz->zzzzx|393=19|560=0|893=Y|
  146=2|
    55=xxxxx|48=xxxxx|22=8|167=xxxx|762=PERIOD|15=xxx|423=1|20000=1W|
    55=xxxx|48=xxxxx|22=8|167=xxxx|762=PERIOD|15=xxx|423=1|20000=1M|
10=234

I tried to get like this

QuickFix.FIX50.SecurityList.NoRelatedSymGroup symbolGroup
  = new QuickFix.FIX50.SecurityList.NoRelatedSymGroup();

int noofsymbols = m.Get(new NoRelatedSym()).getValue();

symbolGroup.Get(new Symbol());

and

m.get(new symbol()).getvalue();

and

m.getfield(new stringfield(55));

Every time it is throwing exception saying "Field Not Found" for tag 55.


Solution

  • You created a new empty NoRelatedSymGroup object, but you forgot to populate it from your message.

    I think you are using the C++ QF with the C# wrapper, so this is probably the code you'd want:

    var sym1 = new Symbol();
    var sym2 = new Symbol();
    
    m.getGroup(1, symbolGroup); // first group
    symbolGroup.get(sym1);
    
    m.getGroup(2, symbolGroup); // second group
    symbolGroup.get(sym2);