I do not receive market data

Created at 18 Feb 2022, 16:13
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!
JO

jordigh81

Joined 02.09.2021

I do not receive market data
18 Feb 2022, 16:13


I am not receiving data with this code in python, can anyone tell me if there is a missing field or if there is an error?

 

def requestQuote(self):
        symbols = ['1','2']


        message = fix50.MarketDataRequest()
        header = message.getHeader()
        header.setField(fix.SenderCompID('QUOTE'))
        header.setField(fix.TargetCompID('cServer'))

        message.setField(fix.MDReqID("1"))
        message.setField(fix.SubscriptionRequestType(fix.SubscriptionRequestType_SNAPSHOT_PLUS_UPDATES))
        message.setField(fix.MarketDepth(0))
        
        message.setField(fix.MDEntryType(fix.MDEntryType_BID))
        
        norelatedsym = fix50.MarketDataRequest().NoRelatedSym()
        
        for symbol in symbols:       
            norelatedsym.setField(fix.Symbol(str(symbol)))
            message.addGroup(norelatedsym)          

        fix.Session.sendToTarget(message,self.sessionID)


@jordigh81
Replies

amusleh
21 Feb 2022, 09:01

Hi,

Did you sent the logon message first and did you received back the response?

If you are logged on then do you receive any error message after sending the market data message?


@amusleh

jordigh81
22 Feb 2022, 11:33

RE:

amusleh said:

Hi,

Did you sent the logon message first and did you received back the response?

If you are logged on then do you receive any error message after sending the market data message?

Hello, thank you for your reply. Yes, I receive the loggon message, and being logged in, I do not receive any response when requesting market data.


@jordigh81

amusleh
23 Feb 2022, 09:18

Hi,

If your message format is invalid or has some missing fields you will receive an error message back from server.

Did you received any error response after sending the request?


@amusleh

jordigh81
23 Feb 2022, 12:35

Hello,


I don't get any error message, but I also don't manage to send the message I want. I just send this:

ToApp: FIX.4.4:demo.ctrader.3449248->cServer

And I get response fromAdmin:

fromAdmin: FIX.4.4:demo.ctrader.3449248->cServer

I will keep trying.


@jordigh81

jordigh81
24 Feb 2022, 11:54

I get this logon message, but I still cannot send the market data request.

toAdmin 8=FIX.4.4☺9=88☺35=A☺34=1☺49=demo.ctrader.3449248☺52=20220224-09:52:20.000☺56=cServer☺98=0☺108=30☺141=Y☺10=085☺
fromAdmin: FIX.4.4:demo.ctrader.3449248->cServer
logged in


@jordigh81

jordigh81
24 Feb 2022, 12:31

Trying it this way, I don't even get an error message.

          message = fix44.Message()
          header = message.getHeader()
          header.setField(fix.BeginString(fix.BeginString_FIX44))
          header.setField(fix.MsgType(fix.MsgType_MarketDataRequest))
          header.setField(fix.TargetCompID("cTrader"))
          header.setField(fix.SenderCompID("demo.ctrader.3449248"))
          header.setField(fix.SenderSubID("QUOTE"))
          
          message.setField(fix.MDReqID(str(self.genReqID())))
          message.setField(fix.SubscriptionRequestType(fix.SubscriptionRequestType_SNAPSHOT_PLUS_UPDATES))
          message.setField(fix.MDUpdateType(fix.MDUpdateType_INCREMENTAL_REFRESH))
          message.setField(fix.MarketDepth(0))
          message.setField(fix.NoRelatedSym(1))
          message.setField(fix.Symbol("EURUSD"))
          message.setField(fix.NoMDEntryTypes(1))
          message.setField(fix.MDEntryType(fix.MDEntryType_BID))
          fix.Session.sendToTarget(message, self.sessionID)

 

ToApp: FIX.4.4:demo.ctrader.3449248->cServer

fromAdmin: FIX.4.4:demo.ctrader.3449248->cServer


@jordigh81

amusleh
25 Feb 2022, 09:31

Hi,

Most probably your message miss some fields, or there is something wrong with your code.

I can't help you as we don't have a Python sample for FIX right now, I tested on our .NET samples and it was working fine.

We will develop a Python sample for our FIX API very soon.


@amusleh

jordigh81
02 Mar 2022, 13:17

RE:

amusleh said:

Hi,

Most probably your message miss some fields, or there is something wrong with your code.

I can't help you as we don't have a Python sample for FIX right now, I tested on our .NET samples and it was working fine.

We will develop a Python sample for our FIX API very soon.

Hello again, the message I generate with my script is:

8=FIX.4.4☺9=129☺35=V☺34=2☺49=demo.ctrader.3449248☺50=QUOTE☺52=20220302-11:13:37.000☺56=CSERVER☺57=QUOTE☺55=2☺146=1☺262=1☺263=1☺264=1☺267=1☺269=0☺10=020☺

And the one that is sent is:

FIX.4.4:demo.ctrader.3449248->CSERVER.

I don't know if this can help to see what the error is, or to find out what part of the message may be missing.

Thanks.


@jordigh81

amusleh
03 Mar 2022, 08:39

Hi,

Can you change the value of field 267 to 2? based on documentation it should be always set to 2.

We are developing now a Python package for our FIX API, it will be released soon.


@amusleh

jordigh81
04 Mar 2022, 11:09

RE:

amusleh said:

Hi,

Can you change the value of field 267 to 2? based on documentation it should be always set to 2.

We are developing now a Python package for our FIX API, it will be released soon.

Sorry for the delay in responding. I have tried what you indicated, but the same error persists.

This is the message that is created;

ToApp: 8=FIX.4.4☺9=129☺35=V☺34=2☺49=demo.ctrader.3449248☺50=QUOTE☺52=20220304-09:07:15.000☺56=CSERVER☺57=QUOTE☺55=2☺146=1☺262=1☺263=1☺264=1☺267=2☺269=0☺10=029☺

And this the one that is sent;

ToApp: FIX.4.4:demo.ctrader.3449248->CSERVER.

The response is;

fromAdmin: FIX.4.4.4:demo.ctrader.3449248->CSERVER


@jordigh81

jordigh81
04 Mar 2022, 12:51

RE: RE:

jordigh81 said:

amusleh said:

Hi,

Can you change the value of field 267 to 2? based on documentation it should be always set to 2.

We are developing now a Python package for our FIX API, it will be released soon.

Sorry for the delay in responding. I have tried what you indicated, but the same error persists.

This is the message that is created;

ToApp: 8=FIX.4.4☺9=129☺35=V☺34=2☺49=demo.ctrader.3449248☺50=QUOTE☺52=20220304-09:07:15.000☺56=CSERVER☺57=QUOTE☺55=2☺146=1☺262=1☺263=1☺264=1☺267=2☺269=0☺10=029☺

And this the one that is sent;

ToApp: FIX.4.4:demo.ctrader.3449248->CSERVER.

The response is;

fromAdmin: FIX.4.4.4:demo.ctrader.3449248->CSERVER

I hadn't noticed, in the previous message I think there may be an error in the 10 CheckSum field. Could it be?


@jordigh81

amusleh
04 Mar 2022, 15:07

Hi,

Most probably you are calculating the checksum incorrectly, that's the only reason that server is not responding at all.

We will release our Python FIX API package very soon and it has all you need, with samples.

Please wait for the release in next 1-2 weeks.


@amusleh