Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by Physicsman

  1. Order Status Reason 81

    Hi Wertmandu, It's absolutley fine to take things at your own pace - there's no rush and no need to apologise! The JSON for your closing call is correctly setup so the Java implementation should work if there are no errors in the Java. We're leaning towards there being something in the Java code causing the problems for the following reasons: When you send the API call natively via Postman there are no problems. No other clients have encountered this pronblem. (All our clients are using the API, whether directly, or from our trading platforms that uses the API). Might be worth checking through the Java code to see if you can spot something there. One quick question: are you attempting to full close your open position or only partially close it? In answer to your question, closing a position does not split it up. Kind Regards, PM
  2. Williams %R

    Hi Tom, Chart indicators are not carried on the API. They must be calculated manually using the appropriate input data from the API in the indicator formula. Kind Regards, PM
  3. API Limits

    Hi Mike, Apologies for the late reply. For some reason the forum automated software did not notify me about this post (or I somehow missed it), and did not spot this post until now. There is no wieght to the endpoints, each single request counts as 1 out of the 500. It's puzzling that your account is throttled when ther eis no/little activity from it. Presumably you are not doing either of the 2 things listed below? Should it still occur frequently, please take a note of the date/time and activity when throttling occurs. You can contact client services about it with your account details and then can pass that onto the appropriate team to investigage further. Two common cases that can trigger the throttling threshold are: requesting market information requesting price history Market Information Requests When requesting market information, the ListMarketInformation method can accept a list of market IDs. This enables you to retrieve multiple markets in one request, as opposed to making multiple repeated ListMarketInformation calls with one market ID in each request. Price History Requests Client UI applications should not calculate higher time frame prices from lower time frame data. For example, requesting 60x 1-minute price data and then calculating a 1-hour data point. Instead, the client UI should request the 1-hour price history data from the server directly.
  4. /session api error

    Hi Tom, Please use the Live API URL: https://ciapi.cityindex.com/tradingapi. The pre-production URL is no longer available for external use. Kind Regards, PM
  5. Hi Buzz, Apologies for the late reply - you seem to have figured it out. Just in case, it is 7.0.3, which at the time the quoted line was written was the latest version. Clearly this has since been superseded. Kind Regards, PM
  6. API Limits

    Hello, It is tracked by the login session in use. Each user can have 5 concurrent sessions. Across those sessions, within a 5 second window, we allow 500 requests. Kind Regards, PM
  7. API Limits

    Hi, I'll check with the dev team and reply when I have an answer. Cordially, PM
  8. Session Id error return code

    Hi Kevin, Should the Session token expire then it is a 401 error code returned. Kind Regards, PM
  9. Reson Code 75

    Hi Dave, Very happy to hear you managed to sort out the problem. Kind Regards, PM
  10. Hi Kevin, The AuditId is there to help the user in case of any dispute as it exactly tracks what market price the user had received at the time they placed the trade or entry order. I omitted it in my example for expediency, but users should continue to include it in their calls. Kind Regards, PM
  11. Reson Code 75

    Hi Dave, Are you using a demo/test account or a real money Live account? If, and only if you are using a demo/test account, please send me a private message with your account login crednetials. I can then use your account to do some testing directly with API calls and see what happens. Many thanks, PM
  12. Reson Code 75

    Hi Dave, Probably most efficient to show you the API body of a call that successfully places a trade at market with stop losses and take profit limits. You can then re-use this POST body editing for the current BId/Ask prices, the stop/limit levels and Trading Account ID etc. Since we know this POST body works, if it does NOT work for you we can start narrowing down to see where the problem is. { "MarketId": 401484414, "Direction": "sell", "Quantity": 1000, "BidPrice": 110.279, "OfferPrice": 110.29, "AuditId": "EF70508008", "TradingAccountId": 401637645, "PositionMethodId": 1, "IfDone": [ { "Stop": { "OrderId": null, "Direction": "buy", "Applicability": "gtc", "ExpiryDateTimeUTC": null, "Guaranteed": false, "Quantity": 1000, "TriggerPrice": 121.308, "IfDone": [], "OcoOrder": null, "TriggerLevelCalculationTypeId": null, "TriggerLevelCalculationValue": null }, "Limit": { "OrderId": null, "Direction": "buy", "Applicability": "gtc", "ExpiryDateTimeUTC": null, "Quantity": 1000, "TriggerPrice": 99.249, "IfDone": [], "OcoOrder": null, "TriggerLevelCalculationTypeId": null, "TriggerLevelCalculationValue": null } } ], "PriceTolerance": 1000 } Kind Regards, PM
  13. Reson Code 75

    Hi Dave, The code 75 you are seeing is the InstructionStatusReason code, and 75 means "Instruction processing has resulted in a Red Card. Please check details." If you look further into the body of your response you will see there are StatusReason 49 codes as well. It is these that are the OrderStatusReason code, and 49 means "Trigger level does not conform to minimum distance requirements specified for the market." Is the entry price of your order to close to the current Buy/Sell price? Kind Regards, PM
  14. Hi Mike, Are you asking why I mentioned in the Bid and Ask prices in my reply? I'm not quite clear on your question. I mentioned it because since I could see the values in your original order request, this was how I could determine that your entry order was being placed inside the Bid/Ask spread, which caused your order request to fail. Kind Regards, PM
  15. Hello Mike, That error message means: Trigger level does not conform to minimum distance requirements specified for the market. You can see the full list of code explanations at: https://docs.labs.gaincapital.com/#APICodesList.htm?TocPath=Getting%20Started%7CLookup%20Values%7C_____1 Looking at your call parameters, the Bid is 1.16582, and the Offer is 1.17782, whereas the order trigger price you are attempting to place is at 1.17182, which is within the market spread. Entry orders have to be outside the market spread, and many markets have a minimum distance away from the current Bid/Offer price that the Entry order must comply with. Kind Regards, PM
  16. 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
  17. Hello, Our backend execution venue uses the supplied bid/offer in the following way: Kind Regards, PM
  18. 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
  19. Hello, I've sent your question to the API team and will reply again when I have an answer. Kind Regards, PM
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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