2

I am working on creating an OrderMassStatusRequest using Python and Quickfix. When building up the message it seems the Instrument class is needed when using MassStatusReqType(3).

From the docs here http://fixwiki.org/fixwiki/OrderMassStatusRequest/FIX.4.4-5.0SP1 it seems that I should be able to simply create an Instrument group as shown in the code below.

Sadly, this does not work. Neither does any of the options I commented out.

Any help to get this method working is greatly appreciated!

Thanks in advance

def mass_status_request(self, product):
    #
    #   product is a class containing attributes code, instrument_type and exchange
    #
    mass_status_request = quickfix44.OrderMassStatusRequest()
    mass_status_request.setField(quickfix.MassStatusReqID("123"))
    mass_status_request.setField(quickfix.TargetSubID(product.instrument_type))
    mass_status_request.setField(quickfix.MassStatusReqType(3))

    # Create instrument group

    #mass_status_instruments = quickfix44.OrderMassStatusRequest().FieldMap()
    mass_status_instruments = quickfix44.Instrument()
    #mass_status_instruments = quickfix44.component().Instrument()
    #mass_status_instruments = quickfix44.Component().Instrument()
    #mass_status_instruments = quickfix44.OrderMassStatusRequest.Instrument()
    #mass_status_instruments = quickfix44.OrderMassStatusRequest().Instrument()
    #mass_status_instruments = quickfix44.Instrmt()
    #mass_status_instruments = quickfix44.Fieldmap().Group()

    # Done creating instrument group

    mass_status_instruments.setField(quickfix.Symbol(product.code))
    mass_status_instruments.setField(quickfix.SecurityExchange(product.exchange))
    mass_status_request.addGroup(mass_status_instruments)

    print "Sending Mass Status Quote Request for {} for Session Id {}".format(str(product), str(self.session_identifier))
    quickfix.Session.sendToTarget(mass_status_request, self.session_identifier)
2
  • What's your error message? Commented Mar 12, 2015 at 14:05
  • Thank you for your answer, for the record the error was: 'AttributeError: 'module' object has no attribute 'Instrument' Commented Mar 12, 2015 at 15:22

1 Answer 1

5

In this case, Instrument is not a group, but a "component".

Components aren't really... things. They're like macros in the FIX DataDictionary. Many messages need the same set of fields, so instead of specifying the same fields in every message, the DD defines an Instrument component that other messages can include.

QuickFIX's programming interface ignores components as a concept. Messages don't include components, they include the fields that are defined in the component. So you can just set those fields directly on your message.

Delete all that instrument stuff in your code, and just set the instrument fields directly on your message:

mass_status_request.setField(quickfix.Symbol(product.code))
mass_status_request.setField(quickfix.SecurityExchange(product.exchange))
Sign up to request clarification or add additional context in comments.

5 Comments

Nice explanation of components.
Thank you for explaining that! I ended up doing exactly that, though still busy testing since there are other errors about tags being in the wrong order. So, to be clear, is it possible to add a group of symbols with their exchanges to a single mass order request?
TIP: body fields need only be in a specified order when within a repeating group. Outside of groups, order doesn't matter inside of the body.
I'm not terribly familiar with the AF message. Looking at the fields that it uses, it doesn't appear that you can (according to the default message definition, anyway). You should check your counterparty's docs for the FIX interface that you're connecting to.
TIP2: Use FIXimate. It's the best FIX reference tool I know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.