Jump to content

All Activity

This stream auto-updates     

  1. Yesterday
  2. Hello! Thank you for sending your demo account credentials. I have managed to successfully place a trade with attached stop loss order. It looks as though there were a series of issues with the call, which lead us on this chain of error messages. The most recent, and hopefully final problem is that the wrong market ID was used in your call. The MarketID for EUR/USD to use in your calls is 401484347, instead of what you actually used. For future reference, you can follow the directions in https://docs.labs.gaincapital.com/#How Do I/Find Market ID.htm?TocPath=How%20Do%20I...%3F%7C_____1 to search/find the Market IDs you need in your trading. The post body that finally worked is: { "MarketId":401484347, "Direction":"buy", "Quantity":1000, "BidPrice": 1.1762, "OfferPrice": 1.1764, "TradingAccountId":<redacted>, "PositionMethodId":1, "IfDone":[{"Stop":{"OrderId":null,"Direction":"Sell","Applicability":"gtc","ExpiryDateTimeUTC":null,"Quantity":1000,"TriggerPrice":1.1710,"IfDone":[],"OcoOrder":null}, "Limit":null}] } Kind Regards, PM
  3. Hello, Our backend execution venue uses the supplied bid/offer in the following way: Kind Regards, PM
  4. Hello, Are you a Forex.com US client or from some other region? The error message mentioning Lot sizes makes me think your account is not a US account. Presumably you are using a test/demo account and it is NOT a live, real money account? Only if it is a test/demo account, please send me a private message with the account credentials. I'll then log on and try some trade calls to investigate further. Kind Regards, PM
  5. I guess I replied too soon. Didn't test it out earlier when reading your response, but just tried to issue the request and got back Status Code: 12 The Quantity, when divided by the market lot size, should be a whole number. Tried updating quantity to be decimal format (as that is mentioned in the docs), but still receive the same response body. Post Body { "MarketId":401166447, "Direction":"buy", "Quantity":1000, "OfferPrice": 1.17750, "BidPrice": 1.17764, "AuditId": "EF34926025", "TradingAccountId":trading_account_id, "PositionMethodId":1, "IfDone":[ { "Stop":{ "OrderId":null, "Direction":"sell", "Applicability":"gtc", "ExpiryDateTimeUTC":null, "Quantity":1000, "TriggerPrice":1.17640, "IfDone":[], "OcoOrder":null }, "Limit":null } ] }
  6. Jeez, such a simple mistake I made lol. I assumed that because the order was denoted as Stop in the ifDone array, that it wasn't necessary to denote the Direction in the Stop Order's JSON. There are buy stops and sell stops though, so it does make sense... Thank you for your help.
  7. Last week
  8. Hello, I've sent your question to the API team and will reply again when I have an answer. Kind Regards, PM
  9. Ok I'll try to list my most accurate current market price for the bid and ask fields. What is the purpose of including the bid and ask? Is it for optional logging or if my bid and ask prices are not accurate, then would the trade not execute? If it is for precision trading, then if the streaming api is off by a little bit and that affects my bid and ask prices to the call, would my trade not process sometimes?
  10. Hello, You cannot use zero values for bid or offer as they would result in error messages being returned. Theoretically, you could use some inaccurate non-zero value of the bid/offer and it would work, but there could be unforeseen problems or errors that could occur doing this. It is safest and best to follow the specified calls as intended, but it is your choice. Kind Regards, PM
  11. Hello, I've spotted it. There is a missing direction field in the Stop order part of the request. I've used the following code to successfully place a trade with attached stop. If you edit your code to be in the same format with appropriate field values it should now also work for you. { "MarketId":401484347, "Direction":"buy", "Quantity":1000, "BidPrice": 1.17952, "OfferPrice": 1.17968, "AuditId": "EF34926023", "TradingAccountId":401637645, "PositionMethodId":1, "IfDone":[ { "Stop":{ "OrderId":null, "Direction":"Sell", "Applicability":"gtc", "ExpiryDateTimeUTC":null, "Quantity":1000, "TriggerPrice":1.17848, "IfDone":[], "OcoOrder":null }, "Limit":null } ] } Kind Regards, PM
  12. Ok, so clients would get the most accurate current market price for trades by using the streaming API. Are bid and offer prices in the trade call matched with the api backend to check whether the client's current market prices are close enough to the backend's current market prices? If it is, then execute the trade, and if not, would the trade be rejected? I'm wondering if this is for precise trading or just an optional log for the client or Forex.com to track stuff if we want. Can I put 0 for bid and offer prices if I don't wanna use it?
  13. I just made that change, and am receiving the same response body of: { "HttpStatus": 400, "ErrorMessage": "The direction of the request is invalid.", "ErrorCode": 60107 } With Guaranteed set to false. Also, the only reason why I added the true is due to the Status Code 75 message that I was initially receiving before I added any elements to the ifDone array 75 The total quantity of guaranteed stop orders must be equal to trade order quantity.
  14. Hi, By setting "Guaranteed: true", you are attempting to place a guaranteed stop loss order on EUR/USD. Guaranteed orders are not supported/possible for spot FX markets. Please use "Guaranteed: false" in this case. Kind Regards, PM
  15. Hi, The query is missing the search term so is returning the first 50 results. If you want to search for USD currency pairs then try the following: https://ciapi.cityindex.com/TradingApi/market/search?SearchByMarketName=TRUE&Query=USD&MaxResults=50 Kind Regards, PM
  16. Hello, It would be safest to send calls with all the parameters as specified, in this case specifically the Bid, Offer and AuditId. It is possible to drop a few of the parameters in some calls, but you could only find that out by experimentation. Hence it is easier and safer to simply send calls with the specified parameters. For the close trade call, the Bid and Offer prices are required and must be supplied with your close trade call. The call being used is to place a trade at market, which is to say you are trading on the current market price. Hence, you would need a connection through the streaming API call to receive live streaming prices so you know what price you are trading on. Were you to use historical data, then depending on how much time has elapsed since you retrieved the historical prices, the current price on which you are trading could be quite different. Kind Regards, PM
  17. Hello, I've been working on this for at least two hours now. I did a search of the forum for newtradeorder and the error code that was returned in the HTTP Response Body, which yielded no search results. Referencing this documentation: https://docs.labs.gaincapital.com/#HTTP Services/Trade.htm?TocPath=CIAPI%20Reference%7CHTTP%20Services%7CTrades%20and%20Orders%7C_____16 And when I started I was receiving these two StatusCodes fixing one, and then getting the next and resolving that as well before I got stuck. 45 A Guaranteed Order cannot be set to trigger against external price. and 75 The total quantity of guaranteed stop orders must be equal to trade order quantity. Post Body: { "Currency":"EUR/USD", "MarketId": 401166447, "Direction": "buy", "TradingAccountId": trading_account_id, "Quantity": 1000, "AuditId": "EL2131241", "OfferPrice": 1.1776, "BidPrice": 1.1774, "IfDone": [ { "Stop": { "Guaranteed": true, "TriggerPrice": 1.1762, "Applicability": "GTC", "Associated": true } } ] } HTTP Response Body: { "HttpStatus": 400, "ErrorMessage": "The direction of the request is invalid.", "ErrorCode": 60107 } I also tried entering the direction as "Buy", since the docs write it that way. However, I saw a few other forum posts regarding limit orders and saw that direction was specified as all lowercase.
  18. Hi, I used https://ciapi.cityindex.com/TradingAPI/market/search?SearchByMarketName=TRUE (GET) as the only query and I'm on a demo account.
  19. Yes I'm posting to https://ciapi.cityindex.com/TradingAPI/order/newtradeorder Do we need to include the bid, offer, and the AuditId? I was reading some posts about this. Do we need the streaming API to make any trades? The streaming API seems complicated, and I'm not aiming to do very short term trades, so trading off historical data would be ideal. Are these 3 parameters required to be accurate to the current market price to make any trades or is this just an indicator/log to Forex.com about what we saw at the time for the client's optional use and it could be way off, and if we don't care about it then we just put whatever we want in there?
  20. Hi, A valid close request would look like the following: { "MarketId": 401166801, "Direction": "sell", "Close": [ 799731166 ], "Quantity": 1000, "BidPrice": 149.063, "AuditId": "EL35455671", "OfferPrice": 149.109, "TradingAccountId": 401843563 } Presumably you sent to the following endpoint? POST https://ciapi.cityindex.com/TradingAPI/order/newtradeorder Kind Regards, PM
  21. Hi, What was the market search term you used? Please paste in the query you sent and we can investigste further. Kind Regards, PM
  22. So I've tried a payload like this to close an open Long position: (btw, my other api calls work) body ={ "Direction":'sell', "TradingAccountId":mytradeaccountID,"MarketName":"GBP/JPY", "MarketId":401484385,"Quantity":1000, "Close":[id_as_an_integer],"isTrade":true} } but I get a server error 500 with no specific details. Help!
  23. So I tried market/search?SearchByMarketName=TRUE and while it returns many currency pairs and its corresponding ID, the list does not have some USD pairs like USD/JPY and USD/CHF. Am I doing this route correctly? I think my list has 50 currency pairs. Thanks
  24. Earlier
  25. Builder documentation

    Thanks much, this is exactly what I needed. I must say that even though I have been a customer for only a short time the service and support that I have received has been outstanding.
  26. Hello, There are 2 ways you can obtain the P&L for each open position. 1) As you already guessed, the first way is to manually calculate it by subtracting the opening price from the current live market price for long positions, or vice versa for short positions. Alternatively. 2) You can subscribe to the TradeMargin stream, which provides the streaming live P&L value for each open position (amongst other information). https://docs.labs.gaincapital.com/#Streaming Data/TradeMargin.htm?TocPath=CIAPI%20Reference%7CStreaming%20Data%7C_____8 Kind Regards, PM
  27. Builder documentation

    Hi Kevin, Happy to help. The direct URL is: http://www.filesandimages.com/Brand/AT Pro Help/index.htm. Kind Regards, PM
  28. 520 Origin Error

    Hello Superee, There was a service interruption yesterday/overnight due to frontdoor issues with Azure affecting access. This should be resolved now so when you next use the API there should be no further problems. Apologies for any inconvenience caused. Kind Regards, PM
  1. Load more activity
×