CTraderFixApi v2.16.1
CTraderFixApi v2.16.1
Engagement
Spotware Systems Ltd
2. Disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1. Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4. Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5. Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
6. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.1. Logon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.2. Logout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.12.2 2017-04-06 • Types of RelativeTP and RelativeSL were changed from 'Integer' to
'Price' for Execution Report
2.13.0 2017-07-20 • TimeInForce is optional and deprecated for New Order Single
2.13.1 2017-07-21 • Wrong Checksum and Length values were fixed in Examples
2.14.0 2017-09-20 • Business Message Reject replaced with Market Data Request Reject
in case unsuccessful Market Data Request
Application messages
• Market Data Request (Client → cTrader)
All messages sent to cTrader should have a standard header with following fields:
Heartbeat messages are sent by both cTrader and client application to confirm a live connection.
The provider’s client application transmits a recurring heartbeat at the interval (defined by
'HeartBtInt (#108)' field in Logon message) or as a response to a Test Request message.
Standard Y
Header
112 TestReqID N — String If heartbeat is result of a Test
Request message, TestReqID is
required.
Standard Y
Trailer
Forces heartbeat from receiver of request. A response is sent from the receiving system as a
Heartbeat message containing the 'TestReqID'.
Standard Trailer Y
The logon message is sent from the client side application to begin a cTrader FIX session, and a
response is sent by cTrader to the client side application. Once logon is complete, quote and trade
flows can proceed for the lifecycle of the session.
If an invalid logon messages received by cTrader (invalid fields), cTrader sends a logout message in
response.
Standard Y
Header
98 EncryptMeth Y 0 int Defines a message encryption
od scheme. Currently, only transport-
level security is supported. Valid
value is
"0" (zero)= NONE_OTHER
(encryption is not used).
553 Username N — String The numeric User ID. User is linked
to SenderCompID (#49) value (the
user’s organization).
Standard Y
Trailer
Please note, that field Username (553) must contain numeric trader login value, whilst
SenderCompID (49) must contain both BrokerUID and trader login delimited by dot, e.g.
"theBroker.12345".
Logout message is sent from the client application to request session end with cTrader and sent as a
response by cTrader. A session logout occurs in response to a Market Participant sending a Logout
message to cTrader. Before terminating the session, cTrader will cancel all prices that are still
actively streaming out to the requesting party.
If an invalid logon message is received by cTrader (invalid fields), cTrader sends a logout message
in response with error details in the field 'Text (#58)'.
Standard Y
Header
58 Text N — String Logon rejection details. Used only
for cTrader-to-client messages as an
invalid Logon message response.
Standard Y
Trailer
Inbound/Outbound message used to request resending a message (or messages), typically when a
gap is detected in the sequence numbering.
Standard Y
Header
7 BeginSeqNo Y Integer Message sequence number of first
record in range to be resent.
Standard Y
Trailer
Sent when a received message cannot be processed due to a session-level rule violation. Refused
messages must be recorded and an increment must be applied to the incoming sequence number.
371 RefTagID N — Int Tag number of the FIX field that
initiated the message refusal.
Standard Y
Trailer
Inbound/Outbound message, should not be used on application level. The Sequence Reset can only
increase the sequence number.
Standard Y
Header
123 GapFillFlag N Y or N String Indicates that the Sequence Reset
message is replacing administrative
or application messages which will
not be resent.
Standard Y
Trailer
Standard Y
Header
262 MDReqID Y String Unique quote request id. New ID for
a new subscription, same one as
previously used for subscription
removal.
Standard Y
Trailer
Standard Y
Header
262 MDReqID N String ID of the market data request
previously sent.
Standard Y
Trailer
Standard Y
Header
262 MDReqID N String ID of the market data request
previously sent.
Standard Y
Trailer
Standard Trailer Y
The Order Status Request <H> message is used by the institution to generate an order status
message back from the trader. For correct interaction it is very important to have unique client
order identifiers (ClOrdID) for all orders.
Standard Y
Trailer
The Order Mass Status Request <H> message requests the status for orders matching criteria
specified within the request. Answer will be returned as a number of Execution Report(8) messages
(one for each order) or Business Message Reject(j) message if no orders found.
Standard Y
Trailer
The execution report message for an accepted order has the following format:
Standard Trailer Y
This type of message is sent when the system was unable to process subscription request or an
order cannot be executed.
Standard Y
Header
45 RefSeqNum N Integer MsgSeqNum<34> of rejected
message.
Standard Y
Trailer
Standard Y
Header
710 PosReqID Y String Unique request ID (set by client).
Standard Y
Trailer
Standard Header Y
710 PosReqID Y String Id of RequestForPositions.
Standard Trailer Y
Standard Header Y
41 OrigClOrdID Y String Unique identifier for the order, which
is going to be canceled, allocated by
the client.
Standard Trailer Y
Standard Header Y
37 OrderID Y String cTrader order id. Unique identifier
for the order, which system couldn’t
cancel.
Standard Header Y
41 OrigClOrdID Y String Unique identifier for the order, which
is going to be amended, allocated by
the client.
Standard Trailer Y
Standard Header Y
262 MDReqID Y String Must refer to the MDReqID <262> of
the request.
Standard Trailer Y
Standard Trailer Y
Standard Trailer Y
Request
8=FIX.4.4|9=126|35=A|49=theBroker.12345|56=CSERVER|34=1|52=20170117-
08:03:04|57=TRADE|50=any_string|98=0|108=30|141=Y|553=12345|554=passw0rd!|10=131|
Response (Success)
8=FIX.4.4|9=106|35=A|34=1|49=CSERVER|50=TRADE|52=20170117-
08:03:04.509|56=theBroker.12345|57=any_string|98=0|108=30|141=Y|10=066|
Response (Failed)
8=FIX.4.4|9=109|35=5|34=1|49=CSERVER|50=TRADE|52=20170117-
08:03:04.509|56=theBroker.12345|58=InternalError: RET_INVALID_DATA|10=033|
6.2. Logout
Request
8=FIX.4.4|9=86|35=5|49=theBroker.12345|56=CSERVER|34=161|52=20170117-
09:22:33|57=TRADE|50=any_string|10=102|
Response
8=FIX.4.4|9=90|35=5|34=160|49=CSERVER|50=TRADE|52=20170117-
09:22:33.077|56=theBroker.12345|57=any_string|10=044|
Request
8=FIX.4.4|9=131|35=V|49=theBroker.12345|56=CSERVER|34=3|52=20170117-
10:26:54|50=QUOTE|262=876316403|263=1|264=1|265=1|146=1|55=1|267=2|269=0|269=1|10=094|
Response
8=FIX.4.4|9=134|35=W|34=2|49=CSERVER|50=QUOTE|52=20170117-
10:26:54.630|56=theBroker.12345|57=any_string|55=1|268=2|269=0|270=1.06625|269=1|270=1
.0663|10=118|
For depths
Request
8=FIX.4.4|9=131|35=V|49=theBroker.12345|56=CSERVER|34=2|52=20170117-
11:13:44|50=QUOTE|262=876316411|263=1|264=0|265=1|146=1|55=1|267=2|269=0|269=1|10=087|
Responses
8=FIX.4.4|9=310|35=W|34=2|49=CSERVER|50=QUOTE|52=20180925-
12:05:28.284|56=local.1000|57=Quote|55=1|268=6|269=1|270=1.11132|271=3000000|278=16|26
9=1|270=1.11134|271=5000000|278=17|269=1|270=1.11133|271=3000000|278=15|269=0|270=1.11
12|271=2000000|278=12|269=0|270=1.11121|271=1000000|278=13|269=0|270=1.11122|271=30000
00|278=14|10=247|
8=FIX.4.4|9=693|35=X|34=2|49=CSERVER|50=QUOTE|52=20170117-
11:13:44.461|56=theBroker.12345|57=any_string|268=12|279=0|269=1|278=7475|55=1|270=1.0
691|271=2000000|279=0|269=1|278=7476|55=1|270=1.06911|271=3000000|279=0|269=1|278=7484
|55=1|270=1.06931|271=34579000|279=0|269=1|278=7485|55=1|270=1.06908|271=1000000|279=0
|269=1|278=7483|55=1|270=1.06906|271=500000|279=0|269=1|278=7482|55=1|270=1.06907|271=
500000|279=0|269=1|278=7488|55=1|270=1.06909|271=3000000|279=0|269=0|278=7468|55=1|270
=1.06898|271=500000|279=0|269=0|278=7467|55=1|270=1.06874|271=32371000|279=0|269=0|278
=7457|55=1|270=1.06899|271=1000000|279=0|269=0|278=7478|55=1|270=1.06896|271=7000000|2
79=0|269=0|278=7477|55=1|270=1.06897|271=1500000|10=111|
8=FIX.4.4|9=376|35=X|34=3|49=CSERVER|50=QUOTE|52=20170117-
11:13:44.555|56=theBroker.12345|57=any_string|268=8|279=0|269=0|278=7491|55=1|270=1.06
897|271=1000000|279=0|269=0|278=7490|55=1|270=1.06898|271=1000000|279=0|269=0|278=7489
|55=1|270=1.06874|271=32373000|279=0|269=1|278=7496|55=1|270=1.06931|271=34580000|279=
2|278=7477|55=1|279=2|278=7468|55=1|279=2|278=7467|55=1|279=2|278=7484|55=1|10=192|
Request
8=FIX.4.4|9=143|35=D|49=theBroker.12345|56=CSERVER|34=77|52=20170117-
10:02:14|50=any_string|57=TRADE|11=876316397|55=1|54=1|60=20170117-
10:02:14|40=1|38=10000|10=010|
Responses
8=FIX.4.4|9=197|35=8|34=77|49=CSERVER|50=TRADE|52=20170117-
10:02:14.720|56=theBroker.12345|57=any_string|11=876316397|14=0|37=101|38=10000|39=0|4
0=1|54=1|55=1|59=3|60=20170117-10:02:14.591|150=0|151=10000|721=101|10=149|
8=FIX.4.4|9=206|35=8|34=78|49=CSERVER|50=TRADE|52=20170117-
10:02:15.045|56=theBroker.12345|57=any_string|6=1.0674|11=876316397|14=10000|37=101|38
=10000|39=2|40=1|54=1|55=1|59=3|60=20170117-10:02:14.963|150=F|151=0|721=101|10=077|
Request
8=FIX.4.4|9=151|35=D|49=theBroker.12345|56=CSERVER|34=80|52=20170117-
10:02:55|50=any_string|57=TRADE|11=876316398|55=1|54=1|60=20170117-
10:02:55|40=1|38=10000|721=101|10=120|
Responses
8=FIX.4.4|9=197|35=8|34=80|49=CSERVER|50=TRADE|52=20170117-
10:02:56.003|56=theBroker.12345|57=any_string|11=876316398|14=0|37=102|38=10000|39=0|4
0=1|54=1|55=1|59=3|60=20170117-10:02:55.984|150=0|151=10000|721=101|10=156|
8=FIX.4.4|9=207|35=8|34=81|49=CSERVER|50=TRADE|52=20170117-
10:02:56.239|56=theBroker.12345|57=any_string|6=1.06735|11=876316398|14=10000|37=102|3
8=10000|39=2|40=1|54=1|55=1|59=3|60=20170117-10:02:56.210|150=F|151=0|721=101|10=127|
Request
8=FIX.4.4|9=162|35=D|49=theBroker.12345|56=CSERVER|34=89|52=20170117-
10:06:22|50=any_string|57=TRADE|11=876316400|55=1|54=2|60=20170117-
10:06:22|40=2|44=1.07162|38=50000|721=101|10=122|
Response
8=FIX.4.4|9=208|35=8|34=90|49=CSERVER|50=TRADE|52=20170117-
10:06:22.466|56=theBroker.12345|57=any_string|11=876316400|14=0|37=104|38=50000|39=0|4
0=2|44=1.07162|54=2|55=1|59=1|60=20170117-10:06:22.436|150=0|151=50000|721=101|10=149|
Response
8=FIX.4.4|9=207|35=8|34=8|49=CSERVER|50=TRADE|52=20170117-
12:10:48.400|56=theBroker.12345|57=any_string|11=876316418|14=0|37=205|38=50000|39=0|4
0=3|54=1|55=1|59=1|60=20170117-12:10:48.362|99=1.07148|150=0|151=50000|721=202|10=122|
Request
8=FIX.4.4|9=98|35=H|49=theBroker.12345|56=CSERVER|34=95|52=20170117-
10:08:31|50=any_string|57=TRADE|11=876316400|10=191|
Response
8=FIX.4.4|9=208|35=8|34=95|49=CSERVER|50=TRADE|52=20170117-
10:08:31.819|56=theBroker.12345|57=any_string|11=876316400|14=0|37=104|38=50000|39=0|4
0=2|44=1.07162|54=2|55=1|59=1|60=20170117-10:06:22.436|150=0|151=50000|721=101|10=158|
Request
8=FIX.4.4|9=117|35=AF|34=3|49=theBroker.12345|52=20170404-
07:20:55.325|56=CSERVER|57=TRADE|225=20170404-07:20:44.582|584=mZzEY|585=7|10=065|
Response
8=FIX.4.4|9=199|35=8|34=13|49=CSERVER|50=TRADE|52=20170404-
07:20:55.333|56=theBroker.12345|14=0|37=635|38=100000|39=0|40=2|44=1.35265|54=2|55=1|5
9=1|60=20170404-07:20:44.582|150=I|151=100000|584=mZzEY|721=617|911=1|10=152|
8=FIX.4.4|9=149|35=j|34=2|49=CSERVER|52=20170105-
06:36:00.912|56=theBroker.12345|57=any_string|58=Message to explain reason for
rejection|379=u4Jr7Rr5t2VS7HSP|380=0|10=123|
Request
8=FIX.4.4|9=100|35=AN|49=theBroker.12345|56=CSERVER|34=99|52=20170117-
10:09:54|50=any_string|57=TRADE|710=876316401|10=103|
Response
8=FIX.4.4|9=163|35=AP|34=98|49=CSERVER|50=TRADE|52=20170117-
10:09:54.076|56=theBroker.12345|57=any_string|55=1|710=876316401|721=101|727=1|728=0|7
30=1.06671|702=1|704=0|705=30000|10=182|
Request
8=FIX.4.4|9=115|35=F|34=2|49=theBroker.12345|50=Trade|52=20170721-
13:41:21.694|56=CSERVER|57=TRADE|11=jR8dBPcZEQa9|41=n9Tm8x1AavO5|10=182|
Response (Success)
8=FIX.4.4|9=221|35=8|34=3|49=CSERVER|50=TRADE|52=20170721-
13:41:21.784|56=theBroker.12345|57=Trade|11=jR8dBPcZEQa9|14=0|37=641|38=100000|39=4|40
=2|41=n9Tm8x1AavO5|44=1.499|54=1|55=1|59=1|60=20170721-
13:41:21.760|150=4|151=100000|721=624|10=180|
Response (Failed)
8=FIX.4.4|9=174|35=j|34=3|49=CSERVER|50=TRADE|52=20170721-
13:41:21.856|56=theBroker.12345|57=Trade|58=ORDER_NOT_FOUND:Order with
clientOrderId=n9Tm8x1AavO5 not found.|379=jR8dBPcZEQa9|380=0|10=075|
Response
8=FIX.4.4|9=156|35=9|34=3|49=CSERVER|50=TRADE|52=20181024-
12:35:02.896|56=local.1000|57=Trade|11=gBljx7YOg5jY|37=629|39=0|41=FdXLfS0tTyUL|58=Ord
er is under execution|434=1|10=109|
Request
8=FIX.4.4|9=123|35=G|34=3|49=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 (Success)
8=FIX.4.4|9=192|35=8|34=3|49=CSERVER|50=TRADE|52=20170721-
13:42:18.784|56=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|
Response (Failed)
8=FIX.4.4|9=171|35=j|34=3|49=CSERVER|50=TRADE|52=20170721-
13:42:18.784|56=theBroker.12345|57=Trade|58=ORDER_NOT_FOUND:Order with
orderId:4429421711699105367 isn't found|379=NXek3EzJvMme|380=0|10=245|
Request
8=FIX.4.4|9=148|35=V|34=2|49=local.1039|50=Quote|52=20170920-
09:52:13.032|56=CSERVER|57=QUOTE|262=CS8260:sXlXex|263=1|264=0|265=1|146=1|55=CS8260|2
67=2|269=0|269=1|10=129|
Reject
8=FIX.4.4|9=164|35=Y|34=2|49=CSERVER|50=QUOTE|52=20170920-
09:52:13.036|56=local.1039|57=Quote|58=INVALID_REQUEST: Expected numeric symbolId, but
got CS8260|262=CS8260:sXlXex|281=0|10=236|
Request
8=FIX.4.4|9=136|35=V|34=6|49=local.1039|50=Quote|52=20170920-
09:52:13.199|56=CSERVER|57=QUOTE|262=EwOhiWvMdCpc|263=1|264=3|146=1|55=1|267=2|269=0|2
69=1|10=182|
Reject
8=FIX.4.4|9=157|35=Y|34=6|49=CSERVER|50=QUOTE|52=20170920-
09:52:13.201|56=local.1039|57=Quote|58=INVALID_REQUEST: MarketDepth should be either 0
or 1|262=EwOhiWvMdCpc|281=5|10=088|
Request
8=FIX.4.4|9=101|35=x|34=2|49=local.1031|50=Trade|52=20180426-
12:07:37.814|56=CSERVER|57=TRADE|320=Sxo2Xlb1jzJC|559=0|10=044|
Response first in the Security List examples
Request
8=FIX.4.4|9=107|35=x|34=3|49=local.1033|50=Trade|52=20180427-
12:24:27.106|56=CSERVER|57=TRADE|55=39|320=ILCea0JkdQEm|559=0|10=248|
Response
8=FIX.4.4|9=158|35=y|34=3|49=CSERVER|50=TRADE|52=20180427-
12:24:27.107|56=local.1033|57=Trade|320=ILCea0JkdQEm|322=responce:ILCea0JkdQEm|560=0|1
46=1|55=39|1007=NZDCHF|1008=4|10=088|
Response
8=FIX.4.4|9=3977|35=y|34=2|49=CSERVER|50=TRADE|52=20180426-
12:07:37.816|56=local.1031|57=Trade|320=Sxo2Xlb1jzJC|322=responce:Sxo2Xlb1jzJC|560=0|1
46=143|55=1|1007=EURUSD|1008=5|55=2|1007=GBPUSD|1008=5|55=3|1007=EURJPY|1008=3|55=4|10
07=USDJPY|1008=3|55=5|1007=AUDUSD|1008=5|55=6|1007=USDCHF|1008=5|55=7|1007=GBPJPY|1008
=3|55=8|1007=USDCAD|1008=5|55=9|1007=EURGBP|1008=5|55=10|1007=EURCHF|1008=5|55=11|1007
=AUDJPY|1008=2|55=12|1007=NZDUSD|1008=5|55=13|1007=CHFJPY|1008=2|55=14|1007=EURAUD|100
8=4|55=15|1007=CADJPY|1008=2|55=16|1007=GBPAUD|1008=4|55=17|1007=EURCAD|1008=4|55=1000
1|1007=USDCFDSAX|1008=5|55=18|1007=AUDCAD|1008=4|55=10002|1007=CD3295|1008=5|55=19|100
7=GBPCAD|1008=4|55=10003|1007=DU3295|1008=5|55=20|1007=AUDNZD|1008=4|55=10004|1007=CS5
965|1008=2|55=21|1007=NZDJPY|1008=2|55=10005|1007=CS6014_3|1008=5|55=22|1007=USDNOK|10
08=4|55=10006|1007=DU6014_3|1008=5|55=23|1007=AUDCHF|1008=4|55=10007|1007=CS6014_4|100
8=5|55=24|1007=USDMXN|1008=4|55=10008|1007=DU6014_4|1008=5|55=25|1007=GBPNZD|1008=4|55
=10009|1007=CS5953|1008=5|55=26|1007=EURNZD|1008=4|55=10010|1007=CS6407_01_EURUSD|1008
=5|55=27|1007=CADCHF|1008=4|55=10011|1007=CS6407_01_GBPUSD|1008=5|55=28|1007=USDSGD|10
08=5|55=10012|1007=CS6407_02_EURUSD|1008=5|55=29|1007=USDSEK|1008=4|55=10013|1007=CS64
07_03_EURUSD|1008=5|55=30|1007=NZDCAD|1008=4|55=31|1007=EURSEK|1008=4|55=10015|1007=CS
7847_01_EURUSD|1008=5|55=32|1007=GBPSGD|1008=4|55=10016|1007=CS7847_01_GBPUSD|1008=5|5
5=33|1007=EURNOK|1008=4|55=10017|1007=CS7847_02_EURUSD|1008=5|55=34|1007=EURHUF|1008=2
|55=10018|1007=CS7847_03_EURUSD|1008=5|55=35|1007=USDPLN|1008=4|55=10019|1007=CS7847_0
4_GBPUSD|1008=5|55=36|1007=USDDKK|1008=4|55=10020|1007=CS9004S|1008=2|10=096|
Response
8=FIX.4.4|9=158|35=y|34=3|49=CSERVER|50=TRADE|52=20180427-
12:24:27.107|56=local.1033|57=Trade|320=ILCea0JkdQEm|322=responce:ILCea0JkdQEm|560=0|1
46=1|55=39|1007=NZDCHF|1008=4|10=088|