|
1 | 1 | # easyfix-dictionary |
2 | 2 |
|
3 | | -A Rust library for parsing and representing FIX (Financial Information Exchange) protocol dictionaries. |
| 3 | +Parses FIX XML specifications into Rust data structures for inspection and code |
| 4 | +generation. |
4 | 5 |
|
5 | | -## Overview |
6 | | - |
7 | | -The `easyfix-dictionary` crate provides functionality to parse XML-based FIX protocol specifications into Rust structures. It supports: |
| 6 | +Part of the [easyfix](https://github.com/ldanko/easyfix) FIX engine. |
8 | 7 |
|
9 | | -- Different FIX protocol versions |
10 | | -- Component and group membership |
11 | | -- Field definitions with data types |
12 | | -- Message specifications and categorization |
| 8 | +## Overview |
13 | 9 |
|
14 | | -## Features |
| 10 | +The dictionary represents the FIX protocol structure: |
15 | 11 |
|
16 | | -- XML parsing of standard FIX dictionary formats |
17 | | -- Rich type representation of FIX protocol components |
18 | | -- Support for field types, message types, and component hierarchies |
| 12 | +- **Fields** — data elements with types and possible enumerated values |
| 13 | +- **Components** — reusable groups of fields |
| 14 | +- **Groups** — repeating sets of fields or components |
| 15 | +- **Messages** — message types composed of fields, components, and groups |
19 | 16 |
|
20 | 17 | ## Usage |
21 | 18 |
|
22 | | -### Basic Usage |
23 | | - |
24 | 19 | ```rust |
25 | | -use easyfix_dictionary::{DictionaryBuilder, Version}; |
26 | | -use std::path::Path; |
| 20 | +use easyfix_dictionary::DictionaryBuilder; |
27 | 21 |
|
28 | | -// Parse a standard FIX dictionary |
29 | 22 | let dictionary = DictionaryBuilder::new() |
30 | 23 | .with_fix_xml("path/to/FIX50SP2.xml") |
31 | 24 | .with_strict_check(true) |
32 | 25 | .build() |
33 | 26 | .expect("Failed to parse dictionary"); |
34 | 27 |
|
35 | | -// Access field definitions |
36 | 28 | if let Some(field) = dictionary.field_by_name("BeginString") { |
37 | | - println!("Field number: {}", field.number); |
| 29 | + println!("Field number: {}", field.number()); |
38 | 30 | } |
39 | 31 |
|
40 | | -// Access message definitions |
41 | 32 | if let Some(message) = dictionary.message_by_name("Heartbeat") { |
42 | 33 | println!("Message type: {}", message.msg_type()); |
43 | 34 |
|
44 | | - // Iterate through message members |
45 | 35 | for member in message.members() { |
46 | | - println!("Member: {}, Required: {}", member.definition().name(), member.required()); |
| 36 | + println!(" {}, required: {}", member.name(), member.required()); |
47 | 37 | } |
48 | 38 | } |
49 | 39 | ``` |
50 | 40 |
|
51 | | -### Working with Modern FIX (FIXT) |
| 41 | +### FIXT (FIX 5.0+) |
| 42 | + |
| 43 | +FIX 5.0+ splits the protocol into transport (FIXT) and application layers. |
| 44 | +Provide both XML files and use `subdictionary()` to access the application |
| 45 | +layer: |
52 | 46 |
|
53 | 47 | ```rust |
54 | 48 | use easyfix_dictionary::{DictionaryBuilder, Version}; |
55 | 49 |
|
56 | | -// Parse FIXT1.1 with application dictionaries |
57 | 50 | let dictionary = DictionaryBuilder::new() |
58 | 51 | .with_fixt_xml("path/to/FIXT11.xml") |
59 | 52 | .with_fix_xml("path/to/FIX50SP2.xml") |
60 | 53 | .build() |
61 | 54 | .expect("Failed to parse dictionary"); |
62 | 55 |
|
63 | | -// Accessing the application-level subdictionary |
64 | | -if let Some(app_dict) = dictionary.subdictionary(Version::FIX50SP2) { |
65 | | - // Use app_dict for application messages |
| 56 | +if let Some(app) = dictionary.subdictionary(Version::FIX50SP2) { |
| 57 | + // application-level messages and fields |
66 | 58 | } |
67 | 59 | ``` |
68 | 60 |
|
69 | | -## Dictionary Structure |
70 | | - |
71 | | -The FIX dictionary consists of: |
72 | | - |
73 | | -- **Fields**: Individual data elements with types and possible enum values |
74 | | -- **Components**: Reusable groups of fields |
75 | | -- **Groups**: Repeating sets of fields or components |
76 | | -- **Messages**: Specific message types composed of fields, components, and groups |
| 61 | +## License |
77 | 62 |
|
78 | | -Each element is linked through references, creating a comprehensive representation of the FIX protocol. |
| 63 | +MIT |
0 commit comments