|
From: Vamsi P. <vam...@we...> - 2018-06-27 09:58:01
|
I am using following code
public static void sendMarketDataRequest(SessionID sessionId)
throws SessionNotFound {
System.out.println("sending request........");
// We generate a new request ID
MDReqID reqId = new MDReqID("MDRQ-" +
String.valueOf(System.currentTimeMillis()));
// We want EUR/XBT data
String currencyPair = "USD/VND";
// We want to get a snapshot and also subscribe to the market depth updates
SubscriptionRequestType subscriptionType = new
SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT);
// We want the full book here, not just the top
MarketDepth depthType = new MarketDepth(1);
// We'll want only incremental refreshes when new data is available
MDUpdateType updateType = new MDUpdateType(MDUpdateType.FULL_REFRESH);
MarketDataRequest mdr = new MarketDataRequest(reqId, subscriptionType,
depthType);
mdr.setField(updateType);
MarketDataRequest.NoRelatedSym instruments = new
MarketDataRequest.NoRelatedSym();
instruments.set(new Symbol(currencyPair));
mdr.addGroup(instruments);
// Specify that we'll want the bids and asks
mdr.setField(new NoMDEntryTypes(2));
MarketDataRequest.NoMDEntryTypes group = new
MarketDataRequest.NoMDEntryTypes();
group.set(new MDEntryType(MDEntryType.BID));
group.set(new MDEntryType(MDEntryType.OFFER));
mdr.addGroup(group);
boolean fromMarket = Session.sendToTarget(mdr, sessionId);
System.out.println("market request status--->"+fromMarket);
}
/////
the request is success. after that which cal back method i need to check
and how to parse that Code for getting Symbol prize.
|