cTraderFixPy icon indicating copy to clipboard operation
cTraderFixPy copied to clipboard

Multiple MDEntryType

Open ganymedenet opened this issue 1 year ago • 1 comments

Good day,

How can I set multiple MDEntryType (269=) for MarketDataRequest? I need to subscribe for Bid and Ask order updates.

Regards,

ganymedenet avatar Jul 13 '24 20:07 ganymedenet

Hello! Actually, you don't need to set multiple MDEntryType. If you check documentation (https://help.ctrader.com/fix/specification/?h=269#market-data-request-msgtype35v), you have such a param as NoMDEntryTypes - Always set to 2 (both bid and ask will be sent). I don't remember why, but i have NoMDEntryTypes = 1. Try both - values 1 or 2. So your code will be looking like that:

from ctrader_fix.messages import MarketDataRequest
def create_request(symbol) -> None:
        quote_conf = handler.quote.config
        req = MarketDataRequest(quote_conf)
        req.MDReqID = time.time()
        req.SubscriptionRequestType = 1
        req.MDUpdateType = 1
        req.MarketDepth = 1
        req.NoMDEntryTypes = 1
        req.MDEntryType = 0
        req.NoRelatedSym = 1
        req.Symbol = symbol
        handler.quote.fix_client.send(req)

Hope it will solve your problem, since i haven't answered on your question. But in my code i have both of market data - bid and ask.

Simongolovinskiy avatar Jul 21 '24 15:07 Simongolovinskiy