File: repeating_groups.html

package info (click to toggle)
quickfix 1.15.1%2Bdfsg-4
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 42,080 kB
  • sloc: cpp: 631,686; python: 129,549; ruby: 106,716; xml: 43,737; ansic: 7,668; java: 1,826; cs: 816; makefile: 544; sh: 462; sql: 313
file content (89 lines) | stat: -rw-r--r-- 2,842 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>
<head>
  <link href="doxygen.css" rel="stylesheet" type="text/css">

  <title>Repeating Groups</title>
</head>

<body>
  <div class='header'>
    <div class='headertitle'>
      Repeating Groups
    </div>
  </div>

  <div class='contents'>
    QuickFIX has the ability to send messages containing repeating
    groups and even recursive repeating groups. All repeating
    groups begin with a field that indicates how many repeating
    groups are in a set. A group can be created by referencing a
    class named after this field scoped within the parent message
    or group.

    <br/><br/><hr/>
    <h1>Creating Messages With Repeating Groups</h1>

    <p>When a message is created the required field declaring the
    number of repeating groups is set to zero. QuickFIX will
    automatically increment field for you as you add groups.</p>See
    this code in <a href=
    "python/repeating_groups_1.html">PYTHON</a>, <a href=
    "ruby/repeating_groups_1.html">RUBY</a>
    <pre class="fragment">
    // create a market data message
    FIX42::MarketDataSnapshotFullRefresh message(FIX::Symbol("QF"));

    // repeating group in the form of MessageName::NoField
    FIX42::MarketDataSnapshotFullRefresh::NoMDEntries group;
    group.set(FIX::MDEntryType('0'));
    group.set(FIX::MDEntryPx(12.32));
    group.set(FIX::MDEntrySize(100));
    group.set(FIX::OrderID("ORDERID"));
    message.addGroup(group);

    // no need to create a new group class if we are reusing the fields
    group.set(FIX::MDEntryType('1'));
    group.set(FIX::MDEntryPx(12.32));
    group.set(FIX::MDEntrySize(100));
    group.set(FIX::OrderID("ORDERID"));
    message.addGroup(group);
</pre>

    <br/><hr/>
    <h1>Reading Messages With Repeating Groups</h1>

    <p>To pull a group out of a message you need to supply the
    group object you wish to pull out. You should first inspect the
    number of entries field (which the group is named after) to get
    the total number of groups. The message that was created above
    is now parsed in this example.</p>See this code in <a href=
    "python/repeating_groups_2.html">PYTHON</a>, <a href=
    "ruby/repeating_groups_2.html">RUBY</a>
    <pre class="fragment">
    // should be 2
    FIX::NoMDEntries noMDEntries;
    message.get(noMDEntries);

    FIX42::MarketDataSnapshotFullRefresh::NoMDEntries group;
    FIX::MDEntryType MDEntryType;
    FIX::MDEntryPx MDEntryPx;
    FIX::MDEntrySize MDEntrySize;
    FIX::OrderID orderID;

    message.getGroup(1, group);
    group.get(MDEntryType);
    group.get(MDEntryPx);
    group.get(MDEntrySize);
    group.get(orderID);

    message.getGroup(2, group);
    group.get(MDEntryType);
    group.get(MDEntryPx);
    group.get(MDEntrySize);
    group.get(orderID);
</pre>
  </div>
</body>
</html>