Search code examples
c#quickfixquickfixn

How to use quickfix for two symbols in char field


I have noticed that in Fix version 4.4 they use two symbols for a char field

Example below:

FIX 4.4 : MiscFeeType <139> field
Type: char

So lets see what values are defined for these field

https://www.onixs.biz/fix-dictionary/4.4/tagnum_139.html

10 = Per transaction
11 = Conversion
12 = Agent

But char is by definition only one character

https://www.onixs.biz/fix-dictionary/4.4/index.html#char

So when I feed fix44.xml dictionary file and generate C# code I end up with errors like

error CS1012: Too many characters in character literal

public const Char PER_TRANSACTION = '10';

Solution

  • Easy: Change 139's type to String in your DD.

    In QuickFIX/n, 139 has been generated as a StringField since 2011. See source.