我试图复制Python中的MarketDataRequest,我在Java中有,但找不到任何代码示例。有人有Python和Quickfix的经验吗
Java代码如下所示:
MarketDataRequest mdr = new MarketDataRequest();
if (subscribed)
{
mdr.set(new SubscriptionRequestType(SubscriptionRequestType.DISABLE_PREVIOUS_SNAPSHOT_PLUS_UPDATE_REQUEST));
Session.sendToTarget(mdr, sessionId);
}
mdr.set(new MDReqID("1"));
mdr.set(new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES));
mdr.set(new MarketDepth(0));
mdr.set(new MDUpdateType(MDUpdateType.INCREMENTAL_REFRESH));
mdr.set(new NoMDEntryTypes(2));
MarketDataRequest.NoMDEntryTypes entries = new MarketDataRequest.NoMDEntryTypes();
entries.set(new MDEntryType(MDEntryType.BID));
mdr.addGroup(entries);
entries.set(new MDEntryType(MDEntryType.OFFER));
mdr.addGroup(entries);
mdr.set(new NoRelatedSym(pairs.size()));
MarketDataRequest.NoRelatedSym symbols = new MarketDataRequest.NoRelatedSym();
for (String pair : pairs)
{
symbols.set(new Instrument(new Symbol(pair)));
mdr.addGroup(symbols);
}
Session.sendToTarget(mdr, sessionId);
到目前为止,在Python中我有这样一个:
mdr = fix.Message()
mdr.getHeader().setField(fix.BeginString(fix.BeginString_FIX44))
mdr.getHeader().setField(fix.MsgType(fix.MsgType_MarketDataRequest))
mdr.setField(fix.MDReqID('1'))
mdr.setField(fix.SubscriptionRequestType(fix.SubscriptionRequestType_SNAPSHOT_PLUS_UPDATES))
mdr.setField(fix.MarketDepth(0))
mdr.setField(fix.NoMDEntryTypes(2))
mdr.setField(fix.MDUpdateType(fix.MDUpdateType_INCREMENTAL_REFRESH))