Order Cancel/Replace doesn't trigger expected response
Order Cancel/Replace doesn't trigger expected response
11 May 2024, 08:28
Hello,
I use the examples in this documentation while implementing a bot:
https://help.ctrader.com/fix/specification/#order-cancelreplace-request-msgtype35g
In the example for message type 35=G I see OrigClOrdID and the ClOrdID fields being echoed by CSERVER (see 11=Is03AvsknNYK
and 41=n9Tm8x1AavO5
) :
Request:
8=FIX.4.4|9=123|35=G|34=3|49=live.theBroker.12345|50=Trade|52=20170721-13:42:17.680|56=CSERVER|57=TRADE|11=Is03AvsknNYK|38=5000|41=n9Tm8x1AavO5|44=1.1|10=010|
Response:
8=FIX.4.4|9=192|35=8|34=3|49=CSERVER|50=TRADE|52=20170721-13:42:18.784|56=live.theBroker.12345|57=Trade|11=Is03AvsknNYK|14=0|37=629|38=5000|39=0|40=2|44=1.1|54=1|55=1|59=1|60=20170721-13:42:18.760|150=5|151=5000|721=624|10=150|
But in reality, when I try this, I don't get back an OrigClOrdID field at all, I get that value back in the ClOrdID field:
Request (see 11=4
and 41=order_1
):
8=FIX.4.4|9=115|35=G|34=5|49=demo.icmarkets.9045572|56=cServer|57=TRADE|52=20240511-08:20:34.591|41=order_1|11=4|38=1000|44=1.0831|10=163|
Response (see 11=order_1
, field 41 missing ):
8=FIX.4.4|9=218|35=8|34=8|49=cServer|50=TRADE|52=20240511-08:20:34.710|56=demo.icmarkets.9045572|11=order_1|14=0|37=703133798|38=1000|39=0|40=2|44=1.0831|54=2|55=1|59=1|60=20240511-08:20:34.704|150=5|151=1000|494=Friday|721=425893557|10=170|
The order is successfully modified, but it gets complicated to identify these execution reports, as field 11 seems to have different meanings in different scenarios. I expected that field 11 would help me identify the specific response to my request, but that doesn't work, no matter what I put into field 11.
The documentation says that field 11 here is “A unique ID of the amend request allocated by the client.”
Replies
PanagiotisCharalampous
13 May 2024, 05:56
Hi there,
In order to identify to which request the response is related to, you need to use tag 11. Tag 41 is about identifying the order to be amended.
I see OrigClOrdID and the ClOrdID fields being echoed by CSERVER
I don't see where is OrigClOrdID sent back to you and it should not. I only see ClOrdID. OrigClOrdID should have been sent to you when the order was executed.
Best regards,
Panagiotis
@PanagiotisCharalampous
gbuella
13 May 2024, 07:22
RE: Order Cancel/Replace doesn't trigger expected response
PanagiotisCharalampous said:
In order to identify to which request the response is related to, you need to use tag 11. Tag 41 is about identifying the order to be amended.
I'm sorry, my bad, I mixed things up, there is no tag 41 in the reply. Thank you for replying anyways.
Here is a better description:
In your example, highlighting fields with tags 11 and 41
Request: 8=FIX.4.4|9=123|35=G|34=3|49=live.theBroker.12345|50=Trade|52=20170721-13:42:17.680|56=CSERVER|57=TRADE|11=Is03AvsknNYK|38=5000|41=n9Tm8x1AavO5|44=1.1|10=010|
Response: 8=FIX.4.4|9=192|35=8|34=3|49=CSERVER|50=TRADE|52=20170721-13:42:18.784|56=live.theBroker.12345|57=Trade|11=Is03AvsknNYK|14=0|37=629|38=5000|39=0|40=2|44=1.1|54=1|55=1|59=1|60=20170721-13:42:18.760|150=5|151=5000|721=624|10=150|
I just tried this again right now, here is what I get:
Request: 8=FIX.4.4|9=216|35=G|34=5|49=demo.icmarkets.9045572|56=cServer|57=TRADE|52=20240513-07:09:42.458|41=tandeta_order_ba2a0805ffa2158980f40120e86d5ae2|11=tandeta_order_ba2a0805ffa2158980f40120e86d5ae2_modify|37=703284983|38=1000|44=1.1|10=024|
Response: 8=FIX.4.4|9=257|35=8|34=5|49=cServer|50=TRADE|52=20240513-07:09:42.576|56=demo.icmarkets.9045572|11=tandeta_order_ba2a0805ffa2158980f40120e86d5ae2|14=0|37=703284983|38=1000|39=0|40=2|44=1.1|54=2|55=1|59=1|60=20240513-07:09:42.565|150=5|151=1000|494=bot_order|721=425980855|10=031|
Notice, that in your example, the response echoes back the value of the field with tag 11.
While in reality, what I get with tag 11, is what I sent with tag 41 (see the _modify suffix above). Whatever string I send with tag 11 is not sent back to me, the response instead contains a tag 11 with the value of tag 41 from the request, as you can see here, and in my original post as well, clearly not as described in the example in the docs.
I am trying to use tag 11 to identify the response as you suggest, but I can't.
I hope it is easier to see it now.
@gbuella
gbuella
13 May 2024, 07:31
RE: Order Cancel/Replace doesn't trigger expected response
PanagiotisCharalampous said:
Hi there,
In order to identify to which request the response is related to, you need to use tag 11. Tag 41 is about identifying the order to be amended.
I see OrigClOrdID and the ClOrdID fields being echoed by CSERVER
I don't see where is OrigClOrdID sent back to you and it should not. I only see ClOrdID. OrigClOrdID should have been sent to you when the order was executed.
Best regards,
Panagiotis
Another log of what actually happens, I just tweaked my code to use specific strings as ids:
-> 8=FIX.4.4|9=184|35=D|34=5|49=demo.icmarkets.9045572|56=cServer|57=TRADE|52=20240513-07:25:05.854|11=this_is_the_original_order_id|55=1|54=2|60=20240513-07:25:05.854|38=1000|40=2|44=1.09|494=bot_order|10=177|
<- 8=FIX.4.4|9=241|35=8|34=5|49=cServer|50=TRADE|52=20240513-07:25:05.931|56=demo.icmarkets.9045572|11=this_is_the_original_order_id|14=0|37=703287877|38=1000|39=0|40=2|44=1.09|54=2|55=1|59=1|60=20240513-07:25:05.928|150=0|151=1000|494=bot_order|721=425982100|10=234|
-> 8=FIX.4.4|9=168|35=G|34=5|49=demo.icmarkets.9045572|56=cServer|57=TRADE|52=20240513-07:26:11.712|41=this_is_the_original_order_id|11=this_is_the_request_id|37=703287877|38=1000|44=1.2|10=204|
<- 8=FIX.4.4|9=240|35=8|34=5|49=cServer|50=TRADE|52=20240513-07:26:11.802|56=demo.icmarkets.9045572|11=this_is_the_original_order_id|14=0|37=703287877|38=1000|39=0|40=2|44=1.2|54=2|55=1|59=1|60=20240513-07:26:11.792|150=5|151=1000|494=bot_order|721=425982100|10=175|
You can see I place an order, modify it, but the string this_is_the_request_id
is only present in my modify request, the response doesn't contain that string.
Maybe/Probably I still misunderstand something, I would be happy if you let me know what is this about, thank you very much!
@gbuella
PanagiotisCharalampous
13 May 2024, 12:44
RE: RE: Order Cancel/Replace doesn't trigger expected response
gbuella said:
PanagiotisCharalampous said:
Hi there,
In order to identify to which request the response is related to, you need to use tag 11. Tag 41 is about identifying the order to be amended.
I see OrigClOrdID and the ClOrdID fields being echoed by CSERVER
I don't see where is OrigClOrdID sent back to you and it should not. I only see ClOrdID. OrigClOrdID should have been sent to you when the order was executed.
Best regards,
Panagiotis
Another log of what actually happens, I just tweaked my code to use specific strings as ids:
-> 8=FIX.4.4|9=184|35=D|34=5|49=demo.icmarkets.9045572|56=cServer|57=TRADE|52=20240513-07:25:05.854|11=this_is_the_original_order_id|55=1|54=2|60=20240513-07:25:05.854|38=1000|40=2|44=1.09|494=bot_order|10=177|<- 8=FIX.4.4|9=241|35=8|34=5|49=cServer|50=TRADE|52=20240513-07:25:05.931|56=demo.icmarkets.9045572|11=this_is_the_original_order_id|14=0|37=703287877|38=1000|39=0|40=2|44=1.09|54=2|55=1|59=1|60=20240513-07:25:05.928|150=0|151=1000|494=bot_order|721=425982100|10=234|-> 8=FIX.4.4|9=168|35=G|34=5|49=demo.icmarkets.9045572|56=cServer|57=TRADE|52=20240513-07:26:11.712|41=this_is_the_original_order_id|11=this_is_the_request_id|37=703287877|38=1000|44=1.2|10=204|<- 8=FIX.4.4|9=240|35=8|34=5|49=cServer|50=TRADE|52=20240513-07:26:11.802|56=demo.icmarkets.9045572|11=this_is_the_original_order_id|14=0|37=703287877|38=1000|39=0|40=2|44=1.2|54=2|55=1|59=1|60=20240513-07:26:11.792|150=5|151=1000|494=bot_order|721=425982100|10=175|
You can see I place an order, modify it, but the string
this_is_the_request_id
is only present in my modify request, the response doesn't contain that string.Maybe/Probably I still misunderstand something, I would be happy if you let me know what is this about, thank you very much!
Hi again,
It looks like a bug, we will check
Best regards,
Panagiotis
@PanagiotisCharalampous
gbuella
11 May 2024, 10:57
Note:
I checked out what happens if the request is rejected, e.g. If request the same price and size a limit the order already has, thus no change, and it works as I expected it to work, I get back the
request_id_3a025f
string I use for identifying the string:Response:
In this case I get back the request id (field 11) in the
BusinessRejectRefID
field (field 379). So this works ok, although in the example in the documentation field 379 is some string not present in the request.So the rejected case works, why doesn't the success response (35=8) work as expected? Do I misunderstand something here?
@gbuella