I am trying to read my FIX logs and to parse them with the cracker that I wrote in python. However, this does not work because in my cracker I have calls like message.getHeader()
which are QuickFix methods. They unsurprisingly return an error:
AttributeError: 'str' object has no attribute 'getHeader'
The logs are all strings, but the cracker is embedded within QuickFix and so uses QF methods. Is there any way to take the string and transform it into a QF message so I can just call crack(message)
on it, or do I have to rewrite my cracker for this special case?
The following code should work.
import quickfix as qfix
import quickfix44 as q44
message = q44.ExecutionReport()
message.setString(input_string, True, qfix.DataDictionary('CustomDictionary.xml'))
'message' object will be updated in place and you should be able to use it as a quickfix Message object
The way that I do it in C# is to read tag 35 to see what message type I need to create. Then, I create that message type, and use the setString method to populate it. Something like this:
if (line.Contains("35=8"))
{
message = new QuickFix44.ExecutionReport();
}
else if(line.Contains("35=AS"))
{
message = new QuickFix44.AllocationReport();
}
. . . . and so on
message.setString(line, true, dictionary);
application.fromApp(message, sessionId); //The cracker takes care of it from here
where dictionary is my data dictionary. Is a similar method available in the Python bindings?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With