|
From: Toli K. <to...@ma...> - 2007-06-28 19:32:51
|
That's very strange.
I shoved this unit test into the MessageTest class in the source code,
and stepped through with a debugger.
Seems to work for me. Maybe there's something wrong with your incoming message?
/**
* 448=SSNY 447=D 452=1 448=SMARCASSOLI:4784543 447=D 452=11
448=TEST, TEST & CO. 447=D 452=13 10=192
*/
public void testStacyAnn() throws Exception {
Message msg = new Message();
quickfix.fix44.ExecutionReport.NoPartyIDs group =
new quickfix.fix44.ExecutionReport.NoPartyIDs();
group.setString(448, "SSNY");
group.setString(447, "D");
group.setString(452, "1");
msg.addGroup(group);
group.setString(448, "SMARCASSOLI:4784543");
group.setString(447, "D");
group.setString(452, "11");
msg.addGroup(group);
group.setString(448, "TEST, TEST & CO.");
group.setString(447, "D");
group.setString(452, "13");
msg.addGroup(group);
// try to read out
quickfix.field.NoPartyIDs noPartyIDs = new quickfix.field.NoPartyIDs();
msg.getField(noPartyIDs);
int i=1;
boolean traderFound = false;
PartyID partyId = new PartyID();
PartyRole partyRole = new PartyRole();
while (i <= noPartyIDs.getValue() && !traderFound) {
msg.getGroup(i, group);
group.get(partyId);
group.get(partyRole);
if (partyRole.getValue() == 1) {
traderFound = true;
}
}
assertTrue(traderFound);
}
On 6/28/07, stacyann_1 <sta...@gs...> wrote:
> QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
> QuickFIX/J Support: http://www.quickfixj.org/support/
>
> Thanks Toli -
> I'm now getting an exception, so maybe I still don't completely grasp this.
> Here is a snippet:
>
> NoPartyIDs noPartyIDs = new NoPartyIDs();
> quickFixMessage_.getField(noPartyIDs);
>
> quickfix.fix44.ExecutionReport.NoPartyIDs group =
> new quickfix.fix44.ExecutionReport.NoPartyIDs();
>
> int i=1;
> boolean traderFound = false;
> PartyID partyId = new PartyID();
> PartyRole partyRole = new PartyRole();
> while (i <= noPartyIDs.getValue() && !traderFound) {
> quickFixMessage_.getGroup(i, group);
> group.get(partyId);
> group.get(partyRole);
>
> if (partyRole.getValue() == 1) {
> traderFound = true;
> }
> }
>
>
> The exception is
> quickfix.FieldNotFound: 453, index=1
> at quickfix.FieldMap.getGroup(FieldMap.java:621)
>
> at the getGroup line.. I must still not be doing something right.
>
> Thanks,Stacy
>
> toli wrote:
> >
> > QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
> > QuickFIX/J Support: http://www.quickfixj.org/support/
> > Stacy,
> >
> > I think you are seeing problems because you are using a general
> > quickfix.Message instead of a specific fix-versioned message such as
> > quickfix.fix44.ExecutionReport
> >
> > The reason you are not seeing message.get() functions is that they
> > don't exist in a general quickfix.Message but do exist (with only
> > specific parameter types) in a more concrete
> > quickfix.fix4x.<MessageType> classes.
> >
> >> How come noMDEntries is defined as NoMDEntries but group is defined as
> >> quickfix.fix42.MarketDataSnapshotFullRefresh.NoMDEntries? Does it need to
> >> be
> >> this way?
> > The first is NoMDEntries field that tells you the # of groups. the 2nd
> > one is a concrete fix-versioned type for the group itself.
> > So to answer your question - yes, you need to be more specific with
> > your types if you want to just use get() methods.
> >
> > We solved that problem by creating a general -purpose fix-extractor
> > methods (that work both on groups and regular messages) and just rely
> > on the incoming type to get the right value out.
> > Marketcetera Trading Platform is open-sourced and GPL'd, so depending
> > on what you are doing with your code you may just be able to use the
> > marketcetera-core jar file to reuse our code "for free":
> > http://trac.marketcetera.org/trac.fcgi/browser/platform/trunk/core/src/main/java/org/marketcetera/quickfix/FIXValueExtractor.java
> >
> >> I was hoping I could somehow avoid iteration to see which PartId I care
> >> about, but it doesn't seem like that is possible.
> >
> > I'm afraid not - you have to loop through them, i don't think there's
> > a defined pattern to how the groups are arranged.
> >
> > --
> > Toli Kuznets
> > http://www.marketcetera.com: Open-Source Trading Platform
> > download.run.trade.
> >>
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Quickfixj-users mailing list
> > Qui...@li...
> > https://lists.sourceforge.net/lists/listinfo/quickfixj-users
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Multiple-PartyId%27s-tf3990055.html#a11344136
> Sent from the QuickFIX/J mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Quickfixj-users mailing list
> Qui...@li...
> https://lists.sourceforge.net/lists/listinfo/quickfixj-users
>
--
Toli Kuznets
http://www.marketcetera.com: Open-Source Trading Platform
download.run.trade.
|