Market data and trade, 1 connection or 2?
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.
Replies
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
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
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.
@mattshome