Does cTrader FIX API support subscribing to changes in positions?
Does cTrader FIX API support subscribing to changes in positions?
17 Jan 2020, 07:39
I would like to subscribe to updates from positions.
http://fixwiki.org/fixwiki/RequestForPositions/FIX.4.4
As per the FIX4.4 specification I have used the RequestForPositions message and set the SubscriptionRequestType field in the message to be SNAPSHOT and UPDATES (http://fixwiki.org/fixwiki/SubscriptionRequestType/1_SnapshotAndUpdates).
8=FIX.4.49=13535=AN34=349=PEPPERSTONE.332708850=TRADE52=20200117-05:36:52.17156=CSERVER57=TRADE263=1710=32a43f28-5bb3-427f-b6f8-34765f1eb67010=148
I receive a message from the cTrader server stating that the "Tag not defined for this message type, field" (SubscriptionRequestType)
8=FIX.4.49=16535=334=349=CSERVER50=TRADE52=20200117-05:36:52.20256=PEPPERSTONE.332708857=TRADE45=358=Tag not defined for this message type, field=263371=263372=AN373=210=117
How can I subscribe to position updates?
I found the https://www.spotware.com/pdf/cTraderFixApi_v2.16.pdf that indicates that Spotware does not support including the SubscriptionRequestType field in the RequestForPositions message. Is this API document implemented by all cTrader brokers? Or can individual brokers choose to implement other variations?
I am still unable to get a position report regardless when simply requesting this. Please can you explain what I am doing wrong? I have tried with and without the PosMaintRpId.
8=FIX.4.49=15335=AN34=349=PEPPERSTONE.332708850=TRADE52=20200117-06:40:32.74856=CSERVER57=TRADE710=1322c384-246c-4448-9538-97ef3a526465_1579279232721=3672216510=143
I do not get any response from the cTrader server - just an Admin sequence reset?
8=FIX.4.49=12935=434=243=Y49=CSERVER50=TRADE52=20200117-06:40:32.95656=PEPPERSTONE.332708857=TRADE122=20200117-06:40:32.95636=4123=Y10=078
Many Thanks
Replies
ac@arconomy.digital
17 Jan 2020, 11:49
RE:
PanagiotisCharalampous said:
Hi ac,
cTrader FIX API does not support subscription to position updates. Regarding the position report issue, make sure that you are sending the correct message sequence number. You can also check our FIX API example on how to request for positions.
Best Regards,
Panagiotis
Thanks for getting back to me Panagiotis.
The sequence number appears correct to me - here are the sequence of messages;
Place Market Order message Sent (msgSeqNum 34=8):
8=FIX.4.49=16435=D34=849=PEPPERSTONE.332708850=TRADE52=20200117-08:59:17.83456=CSERVER57=TRADE11=ORD_1_TEST_STRATEGY38=140=154=255=1001159=160=20200117-18:59:17.83210=197
fromApp response (msgSeqNum 34=8):
8=FIX.4.49=21135=834=849=CSERVER50=TRADE52=20200117-08:59:18.14356=PEPPERSTONE.332708857=TRADE11=ORD_1_TEST_STRATEGY14=037=6613446438=139=040=154=255=1001159=360=20200117-08:59:18.006150=0151=1721=3672374310=035
Position Request message Sent (msgSeqNum 34=9):
8=FIX.4.49=15335=AN34=949=PEPPERSTONE.332708850=TRADE52=20200117-08:59:25.43656=CSERVER57=TRADE710=a5ee13e4-60a0-471d-a695-42565fb51060_1579287563721=3672374310=072
Admin Response (reset to msgSeqNum 34=8):
8=FIX.4.49=13035=434=843=Y49=CSERVER50=TRADE52=20200117-08:59:25.55356=PEPPERSTONE.332708857=TRADE122=20200117-08:59:25.55336=10123=Y10=135
Can you see anything wrong with the message structure of the position Request?
Many Thanks
ac
@ac@arconomy.digital
PanagiotisCharalampous
17 Jan 2020, 12:03
Hi ac,
The message asks you to set the sequence number to 10 (36=10). Any change you are sending another message in between?
Best Regards,
Panagiotis
@PanagiotisCharalampous
ac@arconomy.digital
17 Jan 2020, 13:30
RE:
PanagiotisCharalampous said:
Hi ac,
The message asks you to set the sequence number to 10 (36=10). Any change you are sending another message in between?
Best Regards,
Panagiotis
I found the issue. I am using QuickFixJ and there was an error saving the parsed response from the initial market order that seemed to cause a retry to send the message in the background.
Thanks again for your help pointing me in the right direction with the MsgSeqNum.
@ac@arconomy.digital
PanagiotisCharalampous
17 Jan 2020, 09:32
Hi ac,
cTrader FIX API does not support subscription to position updates. Regarding the position report issue, make sure that you are sending the correct message sequence number. You can also check our FIX API example on how to request for positions.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous