Can I request multiple symbols in one market data request?
Can I request multiple symbols in one market data request?
20 Dec 2017, 21:59
It looks like I only get 1 the first symbol I added, when adding multiple symbols to the request. So is there a way to get multiple symbols with one request?
And if not, then what is the adviced way to get the data from all symbols?
Replies
svanharmelen
21 Dec 2017, 10:39
Check, then at least I know I'm not doing anything wrong ;)
Already tried to sending multiple requests and that indeed seems to work fine...
Thanks,
Sander
@svanharmelen
svanharmelen
22 Dec 2017, 22:29
Hmm... I thought I should be alright, but I just noticed that the MDReqID is not send back in the W or X messages :(
So now I'm a little bit in trouble as it cannot tell which messages comes from which request. So if I do multiple requests at the same time for multiple symbols (all with their own MDReqID value), I cannot process the responses in parallel (one thread per MDReqID).
Is it possible that MDReqID is always returned? Or is there any other way for me to do this?
Thanks!
@svanharmelen
#EOL
27 Dec 2017, 12:41
You can assume that within a single X-message you will receive quotes related to the only one symbol and sort them out by tag 55 (Symbol)
And I agree with you, it's kind of odd to require MDReqID to be specified and never return it back.
You can send a dozen of Maket Data Requests with a unique MDReqID each but for the same symbol, and and you will receive the same amount of quotes as you would get sending the only one Maket Data Request
@#EOL
svanharmelen
27 Dec 2017, 15:07
That is indeed how I do it now, but I was hoping it could be done a little cleaner.
And your last remark is also interesting. Again thanks for all your feedback!
@svanharmelen
swapd0
20 May 2022, 20:35
( Updated at: 20 May 2022, 20:52 )
After reading this post I've changed my multi-register routine to send several subscribe messages, each one for each symbol but I only get quotes from the first one.
By the way, I'm using different values for MDReqID on each request (reqId1, reqId5, reqId7...), not sure if this is right.
What I'm doing wrong?
Edited: Using the same value for MDReqID I get quotes from two symbols, although I've subscribed for 24...
Here are my request messages
OUT: 8=FIX.4.4|9=144|35=V|34=5|49=live.icmarkets.****|50=******|52=20220520-19:21:27.018|57=QUOTE|56=cServer|262=reqId1|263=1|264=1|267=2|269=0|269=1|146=1|55=1|10=149|
OUT: 8=FIX.4.4|9=410|35=V|34=7|49=live.icmarkets.*****50=******|52=20220520-19:21:53.622|57=QUOTE|56=cServer|262=reqId5|263=1|264=1|267=2|269=0|269=1|146=1|55=14|10=203|
OUT: 8=FIX.4.4|9=152|35=V|34=9|49=live.icmarkets.*****50=******|52=20220520-19:21:53.788|57=QUOTE|56=cServer|262=reqId7|263=1|264=1|267=2|269=0|269=1|146=1|55=17|10=226|
And here are the quotes, I only got from EURUSD(1)
IN:8=FIX.4.4|9=141|35=W|34=301|49=cServer|50=QUOTE|52=20220520-17:24:51.269|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05502|269=1|270=1.05502|10=064|
IN:8=FIX.4.4|9=141|35=W|34=302|49=cServer|50=QUOTE|52=20220520-17:24:51.804|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05503|269=1|270=1.05503|10=062|
IN:8=FIX.4.4|9=141|35=W|34=303|49=cServer|50=QUOTE|52=20220520-17:24:52.774|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05502|269=1|270=1.05502|10=068|
IN:8=FIX.4.4|9=137|35=W|34=304|49=cServer|50=QUOTE|52=20220520-17:24:52.974|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.055|269=1|270=1.055|10=136|
IN:8=FIX.4.4|9=141|35=W|34=305|49=cServer|50=QUOTE|52=20220520-17:24:53.182|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05499|269=1|270=1.05499|10=094|
IN:8=FIX.4.4|9=141|35=W|34=306|49=cServer|50=QUOTE|52=20220520-17:24:53.410|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05498|269=1|270=1.05498|10=087|
IN:8=FIX.4.4|9=141|35=W|34=307|49=cServer|50=QUOTE|52=20220520-17:24:54.457|56=live.icmarkets.****|57=*****|55=1|268=2|269=0|270=1.05497|269=1|270=1.05497|10=098|
@swapd0
amusleh
23 May 2022, 08:49
RE:
swapd0 said:
After reading this post I've changed my multi-register routine to send several subscribe messages, each one for each symbol but I only get quotes from the first one.
By the way, I'm using different values for MDReqID on each request (reqId1, reqId5, reqId7...), not sure if this is right.
What I'm doing wrong?
Edited: Using the same value for MDReqID I get quotes from two symbols, although I've subscribed for 24...
Here are my request messages
OUT: 8=FIX.4.4|9=144|35=V|34=5|49=live.icmarkets.****|50=******|52=20220520-19:21:27.018|57=QUOTE|56=cServer|262=reqId1|263=1|264=1|267=2|269=0|269=1|146=1|55=1|10=149|
OUT: 8=FIX.4.4|9=410|35=V|34=7|49=live.icmarkets.*****50=******|52=20220520-19:21:53.622|57=QUOTE|56=cServer|262=reqId5|263=1|264=1|267=2|269=0|269=1|146=1|55=14|10=203|
OUT: 8=FIX.4.4|9=152|35=V|34=9|49=live.icmarkets.*****50=******|52=20220520-19:21:53.788|57=QUOTE|56=cServer|262=reqId7|263=1|264=1|267=2|269=0|269=1|146=1|55=17|10=226|
And here are the quotes, I only got from EURUSD(1)
IN:8=FIX.4.4|9=141|35=W|34=301|49=cServer|50=QUOTE|52=20220520-17:24:51.269|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05502|269=1|270=1.05502|10=064|
IN:8=FIX.4.4|9=141|35=W|34=302|49=cServer|50=QUOTE|52=20220520-17:24:51.804|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05503|269=1|270=1.05503|10=062|
IN:8=FIX.4.4|9=141|35=W|34=303|49=cServer|50=QUOTE|52=20220520-17:24:52.774|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05502|269=1|270=1.05502|10=068|
IN:8=FIX.4.4|9=137|35=W|34=304|49=cServer|50=QUOTE|52=20220520-17:24:52.974|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.055|269=1|270=1.055|10=136|
IN:8=FIX.4.4|9=141|35=W|34=305|49=cServer|50=QUOTE|52=20220520-17:24:53.182|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05499|269=1|270=1.05499|10=094|
IN:8=FIX.4.4|9=141|35=W|34=306|49=cServer|50=QUOTE|52=20220520-17:24:53.410|56=live.icmarkets.****|57=****|55=1|268=2|269=0|270=1.05498|269=1|270=1.05498|10=087|
IN:8=FIX.4.4|9=141|35=W|34=307|49=cServer|50=QUOTE|52=20220520-17:24:54.457|56=live.icmarkets.****|57=*****|55=1|268=2|269=0|270=1.05497|269=1|270=1.05497|10=098|
Hi,
I just tested by subscribing to multiple symbols and I received quotes from all of them.
I used our QuickFIX console sample: spotware/quickfixnsamples.net: .NET Samples for QuickFIXn library and Spotware FIX API (github.com)
Change the SendMarketDataRequest method on console sample program.cs to:
private static void SendMarketDataRequest(string[] fields, bool subscribe)
{
foreach (var symbolId in Enumerable.Range(0, 10))
{
MDReqID mdReqID = new("MARKETDATAID");
SubscriptionRequestType subType = new(subscribe ? '1' : '2');
MarketDepth marketDepth = new(fields[1].ToLowerInvariant().Equals("y", StringComparison.OrdinalIgnoreCase) ? 0 : 1);
QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup bidMarketDataEntryGroup = new() { MDEntryType = new MDEntryType('0') };
QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup offerMarketDataEntryGroup = new() { MDEntryType = new MDEntryType('1') };
//QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new() { Symbol = new Symbol(fields[0]), };
QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new() { Symbol = new Symbol(symbolId.ToString()), };
QuickFix.FIX44.MarketDataRequest message = new(mdReqID, subType, marketDepth);
message.AddGroup(bidMarketDataEntryGroup);
message.AddGroup(offerMarketDataEntryGroup);
message.AddGroup(symbolGroup);
_application.SendMessage(message);
}
}
Now instead of sending a single request it sends 10 request for 10 symbols.
@amusleh
swapd0
26 May 2022, 10:13
OS-X, I've coded my own (small) FIX library.
I've seen what it's happening. Sometimes the messages that I send look like they don't reach the server, I send the login or the security list message and I don't get a message back, with that messages I can resend it without any problem until I get a response.
I've done a test, if I subscribe to a symbol but I don't get the quotes in about 5 seconds, I send the subscribe message again. After some seconds I get quotes from all symbols, but also I can get a lot of "SYMBOL ALREADY SUBSCRIBED" messages.
The problem is that for any message that I send, I don't get any confirmation message, and looks like some messages are lost or the server discards them without any error message.
@swapd0
amusleh
26 May 2022, 11:03
RE:
swapd0 said:
OS-X, I've coded my own (small) FIX library.
I've seen what it's happening. Sometimes the messages that I send look like they don't reach the server, I send the login or the security list message and I don't get a message back, with that messages I can resend it without any problem until I get a response.
I've done a test, if I subscribe to a symbol but I don't get the quotes in about 5 seconds, I send the subscribe message again. After some seconds I get quotes from all symbols, but also I can get a lot of "SYMBOL ALREADY SUBSCRIBED" messages.
The problem is that for any message that I send, I don't get any confirmation message, and looks like some messages are lost or the server discards them without any error message.
Hi,
Most probably something is wrong with your own app, either message checksums are not valid or something else is not correct with the messages you sent.
If you send a message with invalid checksum server will not return back anything.
Can you please try on our sample QuickFIXN .NET sample: spotware/quickfixnsamples.net: .NET Samples for QuickFIXn library and Spotware FIX API (github.com)
Use the console sample and send multiple subscription requests, to do that change the SendMarketDataRequest method on console sample program.cs to:
private static void SendMarketDataRequest(string[] fields, bool subscribe)
{
foreach (var symbolId in Enumerable.Range(0, 10))
{
MDReqID mdReqID = new("MARKETDATAID");
SubscriptionRequestType subType = new(subscribe ? '1' : '2');
MarketDepth marketDepth = new(fields[1].ToLowerInvariant().Equals("y", StringComparison.OrdinalIgnoreCase) ? 0 : 1);
QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup bidMarketDataEntryGroup = new() { MDEntryType = new MDEntryType('0') };
QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup offerMarketDataEntryGroup = new() { MDEntryType = new MDEntryType('1') };
//QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new() { Symbol = new Symbol(fields[0]), };
QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new() { Symbol = new Symbol(symbolId.ToString()), };
QuickFix.FIX44.MarketDataRequest message = new(mdReqID, subType, marketDepth);
message.AddGroup(bidMarketDataEntryGroup);
message.AddGroup(offerMarketDataEntryGroup);
message.AddGroup(symbolGroup);
_application.SendMessage(message);
}
}
If it worked then you will know something is wrong on your own app.
@amusleh
swapd0
27 May 2022, 19:33
RE: RE:
amusleh said:
Hi,
Most probably something is wrong with your own app, either message checksums are not valid or something else is not correct with the messages you sent.
Thanks for the tip, If you look into my messages you can see that sometimes the message length field(9) is wrong.
Same message, but with very different sizes, I was storing the message into a vector but then I was looking for a null-terminated string to calculate the length. What a stupid mistake, now it registers to any symbol with a single message.
OUT: 8=FIX.4.4|9=144|35=V|34=5|49=live.icmarkets.****|50=******|52=20220520-19:21:27.018|57=QUOTE|56=cServer|262=reqId1|263=1|264=1|267=2|269=0|269=1|146=1|55=1|10=149|
OUT: 8=FIX.4.4|9=410|35=V|34=7|49=live.icmarkets.*****50=******|52=20220520-19:21:53.622|57=QUOTE|56=cServer|262=reqId5|263=1|264=1|267=2|269=0|269=1|146=1|55=14|10=203|
@swapd0
PanagiotisCharalampous
21 Dec 2017, 10:25
Hi svanharmelen,
Requesting multiple symbols in one market request is not available in our current FIX API implementation. Yow need to send a request for each symbol separately.
Best Regards,
Panagiotis
@PanagiotisCharalampous