basic Market Data Request

Created at 12 Jul 2023, 08:47
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
LU

lukepoga

Joined 15.10.2015

basic Market Data Request
12 Jul 2023, 08:47


Hi,

Just working through the cTraderFixPy Python fix sample. I get an error when requesting market data. Incorrect NumInGroup count for repeating group, field=267

 

CODE:

      mr = MarketDataRequest(config)

        mr.MDReqID = "1"

        mr.SubscriptionRequestType="1"

        mr.MarketDepth=1

        mr.MDUpdateType=1

        mr.NoMDEntryTypes=2

        mr.MDEntryType=0

        mr.NoRelatedSym=1

        mr.Symbol=7

REQUEST:

Sent:  8=FIX.4.4|9=134|35=V|49=xxxxx.icmarkets.xxxxxxx|56=cServer|57=QUOTE|50=QUOTE|34=2|52=20230712-05:38:40|262=1|263=1|264=1|265=1|267=2|269=0|146=1|55=7|10=065|

 

RESPONSE:

Received:  8=FIX.4.4|9=178|35=3|34=2|49=cServer|50=QUOTE|52=20230712-05:38:44.470|56=live2.icmarkets.2233754|57=QUOTE|45=2|58=Incorrect NumInGroup count for repeating group, field=267|371=267|372=V|373=16|10=245|
 

For Field 265 and 267 I am using the same values in the SPOT example published in your specification here: 

8=FIX.4.4|9=131|35=V|49=live.theBroker.12345|56=CSERVER|34=3|52=20170117-10:26:54|50=QUOTE|262=876316403|263=1|264=1|265=1|146=1|55=1|267=2|269=0|269=1|10=094|

Could you please advise?


@lukepoga
Replies

lukepoga
12 Jul 2023, 09:35 ( Updated at: 12 Jul 2023, 09:55 )

RE:

i tried to hack in two 269 fields:

        mr = MarketDataRequest(config)
        mr.MDReqID = "1"
        mr.SubscriptionRequestType="1"
        mr.MarketDepth=1
        mr.MDUpdateType=1
        mr.NoMDEntryTypes=2
        mr.MDEntryType="0|269=1"
        mr.NoRelatedSym=1
        mr.Symbol=7

but still same error!?

Sent:  8=FIX.4.4|9=140|35=V|49=xxxxx.icmarkets.xxxxxxx|56=cServer|57=QUOTE|50=QUOTE|34=2|52=20230712-06:22:33|262=1|263=1|264=1|265=1|267=2|269=0|269=1|146=1|55=7|10=197|

Received:  8=FIX.4.4|9=178|35=3|34=2|49=cServer|50=QUOTE|52=20230712-06:22:37.167|56=xxxxx.icmarkets.xxxxxxx|57=QUOTE|45=2|58=Incorrect NumInGroup count for repeating group, field=267|371=267|372=V|373=16|10=244|
 


@lukepoga

lukepoga
12 Jul 2023, 09:39

RE: RE:

its mentioned here:

 

 

its supposed to work with two 269 records, which i have tried and it still fails.


@lukepoga

lukepoga
12 Jul 2023, 10:03 ( Updated at: 12 Jul 2023, 10:05 )

RE: RE: RE:

if any one finds it in the future, the MarketDataRequest is broken, the field orders are defined wrong (ROFL). I just replaced it with my own class:

 

class BidAskMarketDataRequest(RequestMessage):
    def __init__(self, config):
        super().__init__("V", config)

    def _getBody(self):
        fields = []
        fields.append(f"262={self.MDReqID}")
        fields.append(f"263=1")
        fields.append(f"264=1")
        fields.append(f"265=1")
        fields.append(f"146=1")
        fields.append(f"55={self.Symbol}")
        fields.append(f"267=2")
        fields.append(f"269=0")
        fields.append(f"269=1")

        return f"{self.delimiter.join(fields)}"

and it works fine now.

 

Sent:  8=FIX.4.4|9=144|35=V|49=xxxxx.icmarkets.xxxxxxx|56=cServer|57=QUOTE|50=QUOTE|34=2|52=20230712-06:59:11|262=12345|263=1|264=1|265=1|146=1|55=1|267=2|269=0|269=1|10=028|

Received:  8=FIX.4.4|9=138|35=W|34=2|49=cServer|50=QUOTE|52=20230712-06:59:15.541|56=xxxxx.icmarkets.xxxxxxx|57=QUOTE|55=1|268=2|269=0|270=1.10213|269=1|270=1.10217|10=073|
 

Hope it helps people in the future.


@lukepoga