示例#1
0
def main(specification: str = 'FIX42.xml',
         to_dir: str = './src',
         base_module: str = 'pelicanfix.protocol.fix42',
         protocol: str = 'FIX42'):
    source = files('pelicanfix.dictionary').joinpath(specification)
    with as_file(source) as dict_file:
        parser = FIXDictionaryParser(dict_file)
        fix_dict = parser.parse()
        code_generator = ProtocolCodeGenerator(fix_dict, Path(to_dir),
                                               base_module, protocol)
        code_generator.generate()
示例#2
0
def test_parse_fix50sp1():
    source = files('pelicanfix.dictionary').joinpath('FIX50SP1.xml')
    with as_file(source) as dict_file:
        parser = FIXDictionaryParser(dict_file)
        fix_dict = parser.parse()
        assert fix_dict.major == 5
        assert fix_dict.minor == 0
        assert fix_dict.service_pack == 1

        msg = fix_dict.get_message('NewOrderSingle')
        assert msg.get_msg_type() == 'D'
        assert msg.get_msg_category() == 'app'
        assert len(msg.get_elements()) == 92