File: repeating_groups.html

package info (click to toggle)
quickfix 1.13.3%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 152,548 kB
  • ctags: 679,426
  • sloc: cpp: 639,331; xml: 129,200; python: 108,722; ruby: 85,152; sh: 10,492; ansic: 9,025; java: 1,827; cs: 1,145; makefile: 523; sql: 313; perl: 108
file content (78 lines) | stat: -rw-r--r-- 3,031 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<html>
  <head>
    <title>Repeating Groups</title>
    <H1>Repeating Groups</H1>
  </head>
  <body>
    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.

    <H2>Creating Messages With Repeating Groups</H2>

    <p>
    Here is an example of a message that distributes market data. When the message is created
    the required field with the number of repeating groups is set to zero. This is because
    QuickFIX will automatically set this field for you when you add groups. This way there is
    never an inconsistancy between the number of entries in the field and in the message.
    </p>

    See this code in <a href="csharp/repeating_groups_1.html">C#</a>, <a href="vbnet/repeating_groups_1.html">VB.NET</a>, <a href="python/repeating_groups_1.html">PYTHON</a>, <a href="ruby/repeating_groups_1.html">RUBY</a>
    <PRE>
    // create a market data message
    <B>FIX42::MarketDataSnapshotFullRefresh message(FIX::Symbol("QF"));</B>

    // repeating group in the form of MessageName::NoField
    <B>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);</B>

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

    <H2>Reading Messages With Repeating Groups</H2>

    <p>
    To pull a group out of a message you need to supply the group 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 back out below.
    </p>

    See this code in <a href="csharp/repeating_groups_2.html">C#</a>, <a href="vbnet/repeating_groups_2.html">VB.NET</a>, <a href="python/repeating_groups_2.html">PYTHON</a>, <a href="ruby/repeating_groups_2.html">RUBY</a>
    <PRE>
    // should be 2
    <B>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);</B>
    </PRE>

  </body>
</html>