FixAlchemy.SpecParser (FIXAlchemy v0.2.0)
View SourceParses FIX protocol specification XML files into structured data.
Extracts field definitions, message type mappings, and component/group
definitions from FIX spec XML files (e.g., FIX44.xml).
FixAlchemy.Generator consumes this data to generate and cache compiled
parser modules.
Supported XML Structure
The parser expects XML files with this structure:
<fix major="4" minor="4">
<messages>
<message name="Logon" msgtype="A" msgcat="admin">
<field name="..." required="Y/N" />
<group name="NoPartyIDs" required="N">
<field name="PartyID" required="N" />
</group>
</message>
</messages>
<fields>
<field number="1" name="Account" type="STRING" />
<field number="35" name="MsgType" type="STRING" />
</fields>
<components>
<component name="Instrument">
<field name="Symbol" required="Y" />
</component>
</components>
</fix>Examples
iex> {:ok, spec_data} = SpecParser.parse_spec_file("FIX44.xml")
Summary
Functions
Merge a transport dictionary with an application dictionary into one spec.
Parse a FIX spec XML file, given an absolute or relative path, into structured data.
Types
@type spec_data() :: %{ version: %{major: binary(), minor: binary()}, fields: %{ required(binary()) => %{name: binary(), type: binary(), enums: list()} }, message_types: %{ required(binary()) => %{ name: binary(), category: binary(), structure: list() } }, components: %{required(binary()) => list()}, groups: %{required(binary()) => list()}, header: list(), trailer: list() }
Functions
Merge a transport dictionary with an application dictionary into one spec.
The transport dictionary (FIXT1.1.xml) defines the session layer and the
application dictionary (FIX50SP2.xml and its siblings) the business layer,
so every field, message type, component and group the transport dictionary
declares is kept as declared, and the application dictionary supplies every
key the transport dictionary leaves undefined.
A field both dictionaries declare keeps the transport dictionary's name and type, and carries the values of both dictionaries, the transport's first, deduplicated by value. The merged version is the transport dictionary's, which is the version carried in BeginString.
Parse a FIX spec XML file, given an absolute or relative path, into structured data.