2

I need to create TradeCaptureReport FIX messages. It was clear how to do this until I tried to create Parties:

...
<RptSide Ccy="USD" ... >
    <Pty Src="D" ID="1111" R="11">
        <Sub ID="AA" Typ="4010"/>
        <Sub ID="AA" Typ="4013"/>
    </Pty>
    <Pty Src="D" ID="1360" R="1"/>
</RptSide>

RptSide/Pty          - 453
RptSide/Pty/@ID      - 448
RptSide/Pty/@Src     - 447
RptSide/Pty/@R       - 452

RptSide/Pty/Sub      - 802
RptSide/Pty/Sub/@ID  - 523
RptSide/Pty/Sub/@Typ - 803

final TradeCaptureReport tradeCaptureReport = new TradeCaptureReport();
...
final Instrument instrument = new Instrument();
tradeCaptureReport.set(instrument);
...
 // (552) RptSide/*
TradeCaptureReport.NoSides rptSide = new TradeCaptureReport.NoSides();
tradeCaptureReport.addGroup(rptSide);

// (15) RptSide/@Ccy (Currency)
rptSide.set(new Currency("USD"));
...

// (453) RptSide/Pty/*:
Parties parties = new Parties();
rptSide.setGroups(parties);


// (802) RptSide/Pty/Sub/* (NoPartySubIDs)
NoPartySubIDs sub = new NoPartySubIDs();

// (523) RptSide/Pty/Sub/@ID (PartySubID)
PartySubID subID1 = new PartySubID("AA");
PartySubID subID2 = new PartySubID("AA");

// (803) RptSide/Pty/Sub/@Typ (PartySubIDType)
PartySubIDType subIdTyp1 = new PartySubIDType(4010);
PartySubIDType subIdTyp2 = new PartySubIDType(4013);

Can somebody give the Java code sample how to create and link them to RptSide (803)?

TT.
  • 15,774
  • 6
  • 47
  • 88
Sergey
  • 191
  • 1
  • 2
  • 12
  • Read [the doc page about repeating groups](http://quickfixj.org/quickfixj/usermanual/1.5.3/usage/repeating_groups.html). If you've already read it, read it again, because your code doesn't look like the example at all. If you're still stuck, reply in a comment and I'll come back to help. – Grant Birchmeier Feb 01 '16 at 15:14
  • Is in the "repeating groups" doc enough information to solve task described in this post? (I've read this doc many times) At least I didn't find there info about components you described in [link](http://stackoverflow.com/questions/29772481/difference-between-group-and-component-in-quickfix-j) – Sergey Feb 01 '16 at 16:08

1 Answers1

4

To create Parties:

...
<RptSide Ccy="USD" ... >
    <Pty Src="D" ID="1111" R="11">
        <Sub ID="AA" Typ="4010"/>
        <Sub ID="AA" Typ="4013"/>
    </Pty>
    <Pty Src="D" ID="1360" R="1"/>
</RptSide>

it it's possible to code in Java:

final TradeCaptureReport tradeCaptureReport = new TradeCaptureReport();
...
final Instrument instrument = new Instrument();
tradeCaptureReport.set(instrument);
...
 // (552) RptSide/*
TradeCaptureReport.NoSides rptSide = new TradeCaptureReport.NoSides();

// (15) RptSide/@Ccy (Currency)
rptSide.set(new Currency("USD"));
...

// (453) RptSide/Pty/*:
// 1-st Pty:
Parties.NoPartyIDs ptyGrp = new Parties.NoPartyIDs();

ptyGrp.set(new PartyID("1111"));
ptyGrp.set(new PartyIDSource('D'));
ptyGrp.set(new PartyRole(11));

Parties.NoPartyIDs.NoPartySubIDs subGrp = new Parties.NoPartyIDs.NoPartySubIDs();

subGrp.set(new PartySubID("AA"));
subGrp.set(new PartySubIDType(4010));

ptyGrp.addGroup(subGrp);                          // add <Sub ID="AA" Typ="4010"/>

subGrp = new Parties.NoPartyIDs.NoPartySubIDs();

subGrp.set(new PartySubID("AA"));
subGrp.set(new PartySubIDType(4013));

ptyGrp.addGroup(subGrp);                          //add <Sub ID="AA" Typ="4013"/>

rptSide.addGroup(ptyGrp);                         // add <Pty Src="D" ID="1111" R="11">... with 2 Sub-s (above)

// 2-nd Pty:
ptyGrp = new Parties.NoPartyIDs();

ptyGrp.set(new PartyID("1360"));
ptyGrp.set(new PartyIDSource('D'));
ptyGrp.set(new PartyRole(1));

rptSide.addGroup(ptyGrp);                        // add <Pty Src="D" ID="1360" R="1"/>

tradeCaptureReport.addGroup(rptSide);            // add <RptSide Ccy="USD" ... > with nested Pty-s

I'm not confident that it's according to the rules, but at least it creates expected fix message. So the suggestion: "If you've already read it [doc], read it again" was helpful (many thanks to Grant Birchmeier).

Sergey
  • 191
  • 1
  • 2
  • 12