Market data and trade, 1 connection or 2?

Created at 06 Apr 2017, 21:07
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!
MA

mattshome

Joined 06.04.2017

Market data and trade, 1 connection or 2?
06 Apr 2017, 21:07


I've tried both ways.  The following creates a duplicate session error:

# icMarkets demo trade
# [SESSION]
BeginString=FIX.4.4
SenderCompID=icmarkets.xxxx
SenderSubID=xxxx
TargetCompID=cServer
PosMaintRptID=N
SocketConnectHost=h43.p.ctrader.com
Password=7104
SocketConnectPort=5202
TargetSubID=TRADE

# icMarkets demo data
[SESSION]
BeginString=FIX.4.4
SenderCompID=icmarkets.xxxx
SenderSubID=xxxx
TargetCompID=cServer
PosMaintRptID=N
SocketConnectHost=h43.p.ctrader.com
Password=7104
SocketConnectPort=5201
TargetSubID=QUOTE

 

Changing the targetSubID from QUOTE to TRADE like so in python, creates this error.

trade.setField(fix.TargetSubID('TRADE'))

58 Tag specified out of required order Text Tag specified out of required order 371 57 RefTagID 57

 

I've tried changing the order of these tags, but it seems quickfix creates it's own order.  

 


@mattshome
Replies

mattshome
06 Apr 2017, 22:29

I think the cleaner solution would be to have 1 connection and use different ports for trade and quote, however what is working for me as of now is changing the SenderSubID.  This is enough to create unique sessions and avoid the duplicate sessions error.  

I will then have to track which data sessions go w/ each trade session.

# icMarkets demo trade
# [SESSION]
BeginString=FIX.4.4
SenderCompID=icmarkets.xxxx
SenderSubID=trade
TargetCompID=TRADE
PosMaintRptID=N
SocketConnectHost=h43.p.ctrader.com
Password=xxxx
SocketConnectPort=5202
TargetSubID=TRADE

# icMarkets demo data
[SESSION]
BeginString=FIX.4.4
SenderCompID=icmarkets.xxxx
SenderSubID=quote
TargetCompID=cServer
PosMaintRptID=N
SocketConnectHost=h43.p.ctrader.com
Password=xxxx
SocketConnectPort=5201
TargetSubID=QUOTE

@mattshome

mattshome
06 Apr 2017, 23:25

RE:

I really wish I could update past posts.  My solution doesn't work as I mistakenly changed the TargetCompID = TRADE which makes it unique, and worthless.


@mattshome

#EOL
07 Apr 2017, 10:39

It should be two different config files and two different instances of quickfix.Application interface


@#EOL

mattshome
08 Apr 2017, 13:54

Are there additional benefits to starting two quickfix instances?  Seems threading would be more difficult, but it would be easier to shut down the data connection.

I did find that adding SessionQualifier makes the sessions unique.

 

[SESSION]
BeginString=FIX.4.4
SenderCompID=fxpig.xxx
SenderSubID=xxxx
TargetCompID=cServer
PosMaintRptID=N
SocketConnectHost=h23.p.ctrader.com
Password=xxxx
SocketConnectPort=5201
TargetSubID=QUOTE
SessionQualifier=fxpigQuote

@mattshome