da4089 / simplefix

Simple FIX protocol implementation for Python
MIT License
233 stars 64 forks source link

security definition #18

Closed JerryKahn closed 5 years ago

JerryKahn commented 5 years ago

Hi David! Thank you so much for all of this! I'm trying to use this to parse "ICE (intercontinental exchange) Private order feed" FIX messages for my company. I'm able to use your modules to parse the ICE orders, but not the "security definitions" from ICE which are these huge messages that Ice sends us to describe the ICE commodity products. I attached a sample of one of these. Was hoping you could have a look when u have time. Thank you Thank you Thank you! - Jerry

definition.txt

da4089 commented 5 years ago

Hi Jerry -- I'll take a look today, and get you an update. Thanks for reporting this.

da4089 commented 5 years ago

I guess the problem you're seeing is that get_message() is returning None ? That's what I see when processing the file you attached.

The reason that's happening is that there's no 10=xxx field at the end of the message, and that's how the parser (currently) decides that it has parsed the complete message, and can return it.

I'm not sure how or why the message doesn't have the checksum (10=) field though -- it seems a little odd. Has it been removed perhaps?

Otherwise, perhaps the end of the message is being indicated some other way? If that's the case, then you're really waiting for issue #13 to be fixed. In the meantime, there's a work-around that's a little ugly, but will let you keep going: assuming you get the whole message as a byte buffer somehow, add an extra call like my_parser.append_buffer(b'\x0110=000\x01'). This will add a bogus-but-good-enough checksum to the end of the message, which the parser will then find, and thus return the complete message.


f = open('definition.txt')
t = f.read()
f.close()

p = simplefix.FixParser()
p.append_buffer(t)

# FIXME: mark end of FIX message (see simplefix issue#13)
p.append_buffer(b'\x0110=000\x01')

m = p.get_message()

print(m)

If this isn't your issue, could you explain what's happening in a bit more detail?

JerryKahn commented 5 years ago

That totally WAS the issue.. thank you so much for looking into it David!! I'll try your fix. After I sent it to you I was looking at the ends of these messages and they started to look a little dubious quite frankly.. so I'm not sure what's happening .. maybe they're getting cut off.. will check into that.. but in any case I really really appreciate it David!!

JerryKahn commented 5 years ago

Bingo! How cool !! Thank you David!!!

da4089 commented 5 years ago

Great! You're very welcome, and hope the rest of the project goes smoothly.