[QFJ-467] Susbcribe to symbol quote Created: 01/Sep/09  Updated: 20/Mar/11  Resolved: 20/Mar/11

Status: Closed
Project: QuickFIX/J
Component/s: Message Generation
Affects Version/s: None
Fix Version/s: None

Type: Other Priority: Default
Reporter: Ahmed Al Jebouri Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None


 Description   

Hi support,

Just want to know how i could subscribe to symbol using MarketDataRequest, and how i can get the session id ?

Regards,



 Comments   
Comment by Toli Kuznets [ 01/Sep/09 ]

Ahmed,

You can look at the code for Marketcetera Trading Platform. We use QuickFIX/J under the hood, and we have a sample FIX-based market data simulator.

If you look at the code, we tunnel all of our market data subscription requests through the FIXMessageFactory.newMarketDataRequest() call. It's around line 172.

Hope this helps. Not sure what you mean by how you can "get the session ID". Get it from where?

Comment by Ahmed Al Jebouri [ 02/Sep/09 ]

thank you for yor reply, i 've gone through th code, but still i am not able to do a sample quote subscription.

is there any sample code on how to use the same?

i am not able to understand how i can use the same in my application

Comment by Ahmed Al Jebouri [ 02/Sep/09 ]

i tried tocopy and paste the belwo code into my application but i get lot of errors, i.e what is reqID, and in line 180 also it shows error and so on can you help me to create a sample app to subscribe to FX

public Message newMarketDataRequest(String reqID,
173 List<MSymbol> symbols,
174 String inExchange)
175 {
176 Message request = msgFactory.create(beginString, MsgType.MARKET_DATA_REQUEST);
177 request.setField(new MarketDepth(TOP_OF_BOOK_DEPTH));
178 request.setField(new MDReqID(reqID));
179 request.setChar(SubscriptionRequestType.FIELD, SubscriptionRequestType.SNAPSHOT);
180 Group entryTypeGroup = msgFactory.create(beginString, MsgType.MARKET_DATA_REQUEST, NoMDEntryTypes.FIELD);
181 entryTypeGroup.setField(new MDEntryType(MDEntryType.BID));
182 request.addGroup(entryTypeGroup);
183 entryTypeGroup.setField(new MDEntryType(MDEntryType.OFFER));
184 request.addGroup(entryTypeGroup);
185
186 int numSymbols = symbols.size();
187 if (numSymbols == 0)

{ 188 request.setInt(NoRelatedSym.FIELD, numSymbols); 189 }

190 for (MSymbol oneSymbol : symbols) {
191 if(oneSymbol != null) {
192 Group symbolGroup = msgFactory.create(beginString, MsgType.MARKET_DATA_REQUEST, NoRelatedSym.FIELD);
193 symbolGroup.setField(new Symbol(oneSymbol.getFullSymbol()));
194 if(inExchange != null &&
195 !inExchange.isEmpty())

{ 196 symbolGroup.setField(new SecurityExchange(inExchange)); 197 }

198 request.addGroup(symbolGroup);
199 }
200 }
201 return request;
202 }

Comment by Ahmed Al Jebouri [ 02/Sep/09 ]

ok i am using the below code but i am getting and error

8=FIX.4.39=17735=334=2749=demo.client.fxgrid.integral.com52=20090902-15:36:06.15156=quote.SWSPB.dev.SWSPB.com57=SWSPBle45=2758=Tag not defined for this message type371=55372=V373=210=165

can you please help?

public Message newMarketDataRequest(String reqID) throws SessionNotFound
{
//msgFactory.create
//Message request = msgFactory.create(beginString, MsgType.MARKET_DATA_REQUEST);
// request.setField(new MarketDepth (1));
// request.setField(new MDReqID(reqID));
// request.setChar(SubscriptionRequestType.FIELD, SubscriptionRequestType.SNAPSHOT);
//quickfix.fix43.MarketDataRequest sub= new MarketDataRequest();

quickfix.fix43.MarketDataRequest sub = new MarketDataRequest(new MDReqID(reqID),new SubscriptionRequestType('0'), new MarketDepth (1));
sub.setField(new quickfix.field.Symbol("EUR/USD"));
sub.setField(new SenderSubID("SWSPBle"));
sub.setField(new Product(4));
sub.setField(new NoRelatedSym(1));
sub.setField(new MDUpdateType(0));
sub.setField(new NoMDEntryTypes(1));
// sub.setField(new MDEntryType('x'));

// set(new quickfix.field.Symbol("EURUSD"));

// Group entryTypeGroup; new Group() (beginString, MsgType.MARKET_DATA_REQUEST);
//= (Message)msgFactory.create (beginString, MsgType.MARKET_DATA_REQUEST);
// entryTypeGroup.setField(new MDEntryType(MDEntryType.BID));
// request.addGroup(entryTypeGroup);
// entryTypeGroup.setField(new MDEntryType(MDEntryType.OFFER));
// request.addGroup(entryTypeGroup);

//int numSymbols = symbols.size();
// if (numSymbols == 0)

{ // request.setInt(NoRelatedSym.FIELD, numSymbols); // }

// for (MSymbol oneSymbol : symbols) {
//if(oneSymbol != null) {
// Group symbolGroup = new Group(beginString, MsgType.MARKET_DATA_REQUEST);
// symbolGroup.setField(new Symbol("EURUSD"));
// if(inExchange != null &&
// !inExchange.isEmpty())

{ // symbolGroup.setField(new SecurityExchange(inExchange)); // }

// request.addGroup(symbolGroup);
// }
// }

return sub;
}

Generated at Sat Nov 23 07:45:32 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.