Topics
Replies
massimiliano.quarti
05 Aug 2022, 12:52
( Updated at: 21 Dec 2023, 09:22 )
RE: RE:
That is what i'm trying to do. I think that fixapi is made to this usage from every application like you use to do in the samples in github
@massimiliano.quarti
massimiliano.quarti
05 Aug 2022, 10:51
RE:
That is not a good news. How is possible to build a copier without that mechanism?
My client needs a copier between differents accounts, which api i have to use? Openapi has the same modality of working?
PanagiotisCharalampous said:
Hi massimiliano.quarti,
You should not be acle to trade for a different account than the one that is logged in. If this is the case, we will investigate it and fix it.
Best Regards,
Panagiotis
@massimiliano.quarti
massimiliano.quarti
05 Aug 2022, 10:42
RE:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
You can use FIX API only for the account that is currently logged in.
Best Regards,
Panagiotis
but the fixapi is working, i open the positions to the different accounts, the think that is not working is the usage of 721 field to make the sl and tp orders working as an an OCO order in hedging accounts.
@massimiliano.quarti
massimiliano.quarti
05 Aug 2022, 10:19
RE:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
We checked your messages and it seems that you are trying to modify a position that does not belong to your account.
Best Regards,
Panagiotis
yes is a copier it is replicating the position to other accounts with fixapi, is right
@massimiliano.quarti
massimiliano.quarti
05 Aug 2022, 10:01
RE: RE: RE:
Hi,
did you watched at my post?
Is possible to have a more detailed manual on fix api?
@massimiliano.quarti
massimiliano.quarti
28 Jul 2022, 08:56
RE: RE:
Sorry i wrong version of the robot
the fiz api sequence is that one:
28/07/2022 07:46:43.138 | Send Order: 8=FIX.4.49=19135=D49=demo.icmarkets.829075956=cServer57=TRADE50=TRADE34=252=20220728-05:46:4311=123456789055=1004654=160=20220728-05:46:4338=140=159=1126=20220729-05:46:43494=copy_28637959210=132
28/07/2022 07:46:43.232 | Answer order: 8=FIX.4.49=25235=834=249=cServer50=TRADE52=20220728-05:46:43.18856=demo.icmarkets.829075957=TRADE11=123456789014=037=44074196238=139=040=154=155=1004659=360=20220728-05:46:43.178126=20220729-05:46:43.000150=0151=1494=copy_286379592721=28637959310=195
28/07/2022 07:46:43.232 | Send SL Order: 8=FIX.4.49=21535=D49=demo.icmarkets.829075956=cServer57=TRADE50=TRADE34=352=20220728-05:46:4311=28637959255=1004654=260=20220728-05:46:4338=140=399=13189.359=3126=20220729-05:46:43721=286379592494=copy_28637959210=047
28/07/2022 07:46:43.341 | Answer sl: 8=FIX.4.49=60235=j34=349=cServer50=TRADE52=20220728-05:46:43.28856=demo.icmarkets.829075957=TRADE58=NOT_ENOUGH_RIGHTS:NewOrderReq@408ee527[traderId=1923113,sessionId=127676037,clientRequestId=286379592,label=copy_286379592,channel=FIX,dealerReq=false,ignoreValidation=false,price=1318930000,expirationTimestamp=1659073603000,timeInForce=GOOD_TILL_DATE,volume=100,guaranteedStopLoss=false,mirroringCommissionRate=0,innerMirroringFee=true,stopTriggerMethod=TRADE,positionId=286379592,symbolId=10046,type=STOP,tradeSide=SELL,clientOrderId=286379592,checkTolerance=false,additionalChannel=[]]379=286379592380=010=142
no sl order opened only the position without sl
@massimiliano.quarti
massimiliano.quarti
28 Jul 2022, 08:27
( Updated at: 21 Dec 2023, 09:22 )
RE:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
I need the exact log of exchanged messages to understand what you are sending and what you are receiving e.g.
Request8=FIX.4.4|9=100|35=AN|49=live.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=live.theBroker.12345|57=any_string|55=1|710=876316401|721=101|727=1|72 8=0|730=1.06671|702=1|704=0|705=30000|10=182|Also I need some screenshots from cTrader deomnstrating that the orders have not been placed on the requested position.
Best Regards,
Panagiotis
28/07/2022 07:14:11.806 Send Order: 8=FIX.4.49=19135=D49=demo.icmarkets.829075956=cServer57=TRADE50=TRADE34=252=20220728-05:14:1211=123456789055=1004654=160=20220728-05:14:1238=140=159=1126=20220729-05:14:12494=copy_28635961910=103
28/07/2022 07:14:11.916 Answer order: 8=FIX.4.49=25235=834=249=cServer50=TRADE52=20220728-05:14:11.87956=demo.icmarkets.829075957=TRADE11=123456789014=037=44072041438=139=040=154=155=1004659=360=20220728-05:14:11.865126=20220729-05:14:12.000150=0151=1494=copy_286359619721=28635962710=159
28/07/2022 07:14:11.916 orderid721 286359627
28/07/2022 07:14:11.916 orderid11 1234567890
28/07/2022 07:14:11.916 Send SL Order: 8=FIX.4.49=19135=D49=demo.icmarkets.829075956=cServer57=TRADE50=TRADE34=252=20220728-05:14:1211=123456789055=1004654=160=20220728-05:14:1238=140=159=1126=20220729-05:14:12494=copy_28635961910=103
28/07/2022 07:14:12.010 Answer sl: 8=FIX.4.49=26335=834=349=cServer50=TRADE52=20220728-05:14:11.97956=demo.icmarkets.829075957=TRADE11=123456789014=037=44072041538=139=040=354=255=1004659=660=20220728-05:14:11.96799=13186.8126=20220729-05:14:12.000150=0151=1494=copy_286359619721=28635962810=199
here is the log of the messages printed from the robot: order sent to the destination account ,retrieved 721 and 11 fields and the sl order sent. the answers are still plotted
the screenshot are:
1. the master copier with the opened position
2. the account that received the orders with the opened position
3. the account that received the orders with the ORDER for the sl
so i don't know what is wrong but the position is not taking sl but only the order so i think the usage of 721 field is wrong but i don't understand what i have to do to fix it
@massimiliano.quarti
massimiliano.quarti
20 Jul 2022, 11:03
( Updated at: 20 Jul 2022, 11:12 )
RE:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
Can you provide examples of what you are doing and it doesn't work e.g the messages you are sending and some evidence that it does not work?
Best Regards,
Panagiotis
here ther is my code that tries to open position to different account on the opening position event. I try to get the 721 returned when i open the position to the different account and pass it to the orders that should be work as stop loss passing the same 721 field private void OnPositionsOnOpened(PositionOpenedEventArgs args) { Position pos = args.Position; if (ListaAccount != null) { for (int i = 0; i < ListaAccount.Count; i++) { var message = _messageConstructor[i].NewOrderSingleMessage(MessageConstructor.SessionQualifier.TRADE, _messageSequenceNumber[i], "1234567890", symbofixid, pos.TradeType == TradeType.Buy ? 1 : 2, DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss"), Convert.ToInt32(pos.Quantity), 1, "1", 0, 0, DateTime.UtcNow.AddDays(1).ToString("yyyyMMdd-HH:mm:ss"), "", "copy_" + pos.Id.ToString()); string dd = SendTradeMessage(message, _tradeStreamSSL[i], i); Print("Answer order: " + dd.ToString()); string[] aa = dd.Split('\u0001'); string orderid = ""; string orderid11 = ""; foreach (string item in aa) { if (item.StartsWith("721=")) { orderid = item.Split('=')[1]; break; } } foreach (string item in aa) { if (item.StartsWith("11=")) { orderid11 = item.Split('=')[1]; break; } } Print("orderid721 " + orderid); Print("orderid11 " + orderid11); if (pos.StopLoss != null && pos.StopLoss != 0) { if (pos.TradeType == TradeType.Buy) { var messagesl = _messageConstructor[i].NewOrderSingleMessage(MessageConstructor.SessionQualifier.TRADE, _messageSequenceNumber[i], orderid11, symbofixid, 2, DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss"), Convert.ToInt32(pos.Quantity), 3, "3", 0, Math.Round(Convert.ToDecimal(pos.StopLoss), 1), DateTime.UtcNow.AddDays(1).ToString("yyyyMMdd-HH:mm:ss"), "", "copy_" + pos.Id.ToString()); string ddsl = SendTradeMessage(messagesl, _tradeStreamSSL[i], i); Print("Answer sl: " + ddsl.ToString()); } else { var messagesl = _messageConstructor[i].NewOrderSingleMessage(MessageConstructor.SessionQualifier.TRADE, _messageSequenceNumber[i], orderid11, symbofixid, 1, DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss"), Convert.ToInt32(pos.Quantity), 3, "3", 0, Math.Round(Convert.ToDecimal(pos.StopLoss), 1), DateTime.UtcNow.AddDays(1).ToString("yyyyMMdd-HH:mm:ss"), "", "copy_" + pos.Id.ToString()); string ddsl = SendTradeMessage(messagesl, _tradeStreamSSL[i], i); Print("Answer sl: " + ddsl.ToString()); } } } } }
here the message compisition following your examples in github
public string NewOrderSingleMessage(SessionQualifier qualifier, int messageSequenceNumber, string orderID, long symbol, int side, string transactTime, int orderQuantity, int orderType, string timeInForce, decimal price = 0, decimal stopPrice = 0, string expireTime = "", string positionID = "",string label="") { var body = new StringBuilder(); //Unique identifier for the order, allocated by the client. body.Append("11=" + orderID + "|"); //Instrument identificators are provided by Spotware. body.Append("55=" + symbol + "|"); //1= Buy, 2 = Sell body.Append("54=" + side + "|"); // Client generated request time. body.Append("60=" + transactTime + "|"); //The fixed currency amount. body.Append("38=" + orderQuantity + "|"); //1 = Market, the Order will be processed by 'Immediate Or Cancel'scheme(see TimeInForce(59): IOC); //2 = Limit, the Order will be processed by 'Good Till Cancel' scheme(see TimeInForce(59): GTC). body.Append("40=" + orderType + "|"); if (price != 0) { //Reserved for future use. body.Append("44=" + price.ToString().Replace(",", ".") + "|"); } if (stopPrice != 0) { //The worst client price that the client will accept. //Required when OrdType = 2, in which case the order will notfill unless this price can be met. body.Append("99=" + stopPrice.ToString().Replace(",",".") + "|"); } // 1 = Good Till Cancel (GTC), it will be active only for Limit Orders (see OrdType(40)) ; // 3 = Immediate Or Cancel (IOC), it will be active only for Market Orders(see OrdType(40)); // 6 = Good Till Date(GTD), it will be active only if ExpireTime is defined (see ExpireTime(126)). // GTD has a high priority, so if ExpireTime is defined, GTD will be used for the Order processing. body.Append("59=" + timeInForce + "|"); if (expireTime != string.Empty) { // Expire Time in YYYYMMDDHH:MM:SS format.If is assigned then the Order will be processed by 'Good Till Date' scheme // (see TimeInForce: GTD). body.Append("126=" + expireTime + "|"); } if (positionID != string.Empty) { // Position ID, where this order should be placed. If not set, new position will be created, it’s id will be returned in ExecutionReport(8) message. body.Append("721=" + positionID + "|"); } if (label != string.Empty) { // Position ID, where this order should be placed. If not set, new position will be created, it’s id will be returned in ExecutionReport(8) message. body.Append("494=" + label + "|"); } var header = ConstructHeader(qualifier, ApplicationMessageCode(ApplicationMessageType.NewOrderSingle), messageSequenceNumber, body.ToString()); var headerAndBody = header + body; var trailer = ConstructTrailer(headerAndBody); var headerAndMessageAndTrailer = header + body + trailer; return headerAndMessageAndTrailer.Replace("|", "\u0001"); }
@massimiliano.quarti
massimiliano.quarti
24 Jun 2022, 17:57
721 not working
Hi, i have a question about fix api. I found in the forum that you noticed passing field 721 to correlate orders in hedging account, so you have a position and an order as SL correlated with that position that closes all the order and positio at sl level. I tried all the day to pass 721 in various way but there is no correlation at all, have you some example of usage?
@massimiliano.quarti
massimiliano.quarti
17 Mar 2023, 09:17
RE: RE:
Please contact me i'm still searching a valid solution
ctid5718405 said:
@massimiliano.quarti