Search code examples
pythonquickfixfix-protocol

Incorrect data format for value - OrdType


I am using FIX 4.2 with QuickFix and python. I am connecting to CTS, a data provider who does everything in an odd way. I have been modifying my data dictionary for about 4 months (it's hell).

I have encountered a problem that I cannot fix by modifying the data dictionary, yet it appears to be a DD problem. I am very confused.

I send a SecurityDefinitionRequest, 35=c, and get a SecurityDefinition, 35=d, in return. Tag 40 has been heavily altered from the FIX protocol by CTS. http://www.ctsfutures.com/wiki/T4%20API%20FIX.Security%20Definition.ashx

I am trying to just define tag 40 as a string, and get on with it. But no matter what I do, my QF engine rejects the message with Incorrect data format for value:40

Here is an example:

(8=FIX.4.2☺9=591☺35=d☺34=15☺49=CTS☺56=XXX☺50=T4FIX☺52=20141111-15:56:11.62 7☺320=1415721370.22☺322=sd-11/11/2014 9:56:11 AM☺323=4☺911=12☺55=YM☺107=SIM:E-mi ni Dow BF:+Dec14-2Mar15+Jun15☺48=XCME_E YM (Z14)-2(H15)(M15)☺
40=2083
(<-- tag 40 is here)

☺207=CME_E☺200=201412☺205=19☺167=FUT☺762=4☺562=1☺15=USD☺1146=5☺5770=1/1☺555=3☺600=YM☺623=1☺624=1☺609=FUT☺602=XCME_E YM (Z14)☺556=USD☺610=201412☺616=CME_E☺620=SIM:E-mini Dow Dec14☺600=YM☺623=-2☺624=2☺609=FUT☺602=XCME_E YM (H15)☺556=USD☺610=201503☺616=CME_E☺620=SIM:E-mini Dow Mar15☺600=YM☺623=1☺624=1☺609=FUT☺602=XCME_E YM (M15)☺556=USD☺610=201506☺616=CME_E☺620=SIM:E-mini Dow Jun15☺10=235☺)

Incorrect data format for value: 2083 <20141111-15:56:11.087, FIX.4.2:XXX->CTS, event> (Message 15 Rejected: Incorrect data format for value:40)

<20141111-15:56:11.095, FIX.4.2:XXX->CTS, outgoing> (8=FIX.4.2☺9=114☺35=3☺34=23☺49=XXX☺52=20141111-15:56:11.095☺56=CTS☺45=15☺5 8=Incorrect data format for value☺371=40☺372=d☺373=6☺10=114☺)

Here is the entry in my data dictionary:

<field number="40" name="OrdType" type="STRING"/>

Note that I have tried all kinds of combinations, like:

<field number="40" name="OrdType" type="STRING" allowOtherValues="true"/> 

As well as explicitly specifying the problematic value

<field number="40" name="OrdType" type="STRING" >
    <value enum="2083" description="STUPID" />
</field>

Nothing ever works. I always get the same result. Incorrect data format for value:40

What's going on?!?


Solution

  • In QuickFIX, the OrdType class takes a quickfix.CharField:

    class OrdType(quickfix.CharField):
        def __init__(self, data = None):
            if data == None:
                quickfix.CharField.__init__(self, 40)
            else:
                quickfix.CharField.__init__(self, 40, data)
    

    The definition for OrdType in the default FIX42.xml doc corroborates this:

    <field number="40" name="OrdType" type="CHAR">

    Thus, a string value for OrdType in an inbound FIX message will cause QuickFIX to reject the message for containing invalid data. You will need to modify QuickFIX to allow string values for OrdType to be able to accommodate inbound and outbound messages with the CTS custom values.