Search code examples
c#.netquickfixfix-protocolquickfixn

Making a security definition request to FIX adapter


I am trying to make a request (Security Definition Request) to FIX Adapter using the following method. This is an application level call and I manually invoke this method whenever there is a successful connection to FIX Adapter.

WHen i run this method i get a "Field not found for tag:49" exception message. However SecurityDefinitionRequest class doesnt allow me to set Tag 49 (SenderCompId) to it.

First of all is this the right way to make a SecurityDefinitionRequest? I tried looking at QuickFix/N docs but they dont explain how to make such request.

http://quickfixn.org/tutorial/sending-messages.html

Infact i havent seen any articles so far in the internet. Any suggestions?

public void ToApp(Message message, SessionID sessionId)
{        
    var request =
        new SecurityDefinitionRequest()
        {
            SecurityReqID = new SecurityReqID("1"),
            SecurityID = new SecurityID("5"),
            SecurityRequestType = new SecurityRequestType(3),
            SecurityType = new SecurityType("FUT")
        };

    request.SetField(new SenderCompID("217"));
    Session.SendToTarget(request);  
 }

The constructed message looks like this

    8=FIX.4.29=3735=c48=549=217167=FUT320=1321=310=003

Solution

  • I'm going to suggest:

    SessionId currentSessionId = new QuickFix.SessionID("FIX4.2", "217","CBOE");
    securityDefinitionRequest.SetSessionID(currentSessionId );