Can I request multiple symbols in one market data request?

svanharmelen since: 20 Dec 2017;

  20 Dec 2017, 21:59
Can I request multiple symbols in one market data request?

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?

PanagiotisCharalampous's avatar

PanagiotisCharalampous since: 13 Jan 2017;

  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

Head of Community Management at cTrader

svanharmelen since: 20 Dec 2017;

  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 since: 20 Dec 2017;

  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!

#EOL's avatar

#EOL since: 27 Dec 2016;

  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

svanharmelen since: 20 Dec 2017;

  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!

swapd0 since: 07 Oct 2019;

  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|

amusleh's avatar

amusleh since: 01 Mar 2021;

  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.

Spotware | Telegram: @algodeveloper

swapd0 since: 07 Oct 2019;

  25 May 2022, 12:46

Don't know why sometimes I get quotes from several symbols, and sometimes only from the first one in the list.

amusleh's avatar

amusleh since: 01 Mar 2021;

  26 May 2022, 09:27
RE:

swapd0 said:

Don't know why sometimes I get quotes from several symbols, and sometimes only from the first one in the list.

Hi,

Not sure what environment you are using but when I test on our .NET or Python samples I receive all the quotes.

Spotware | Telegram: @algodeveloper