Jump to content

Search the Community

Showing results for tags 'order'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Gain Capital API FAQ
    • General Questions and Discussion

Found 2 results

  1. Hi, After reading this good education material on order types (https://www.forex.com/en/education/education-themes/managing-risk/introduction-to-order-types/), I wanted to try out creating a "stop entry buy order" to see how that would look using the API. I tried out the /order/newstoplimitorder end point (assuming that was the correct one in this case), using this JSON: { "Direction": "buy", "MarketId": EUR-USD-market-id-here, "Quantity": 1000, "TradingAccountId": trading-account-id-here, "TriggerPrice": 1.1829, "BidPrice": 1.184, "OfferPrice": 1.185 } where at the time I did the testing all the three prices were above the current spread. On all my attempts it failed with: {'Status': 2, 'StatusReason': 75, 'OrderId': 0, 'Orders': [{'OrderId': 0, 'StatusReason': 49, 'Status': 10, 'OrderTypeId': 3, 'Price': 0.0, 'Quantity': 1000.0, 'TriggerPrice': 1.1829, 'CommissionCharge': 0.0, 'IfDone': [], 'GuaranteedPremium': 0.0, 'OCO': null, 'AssociatedOrders': {'Stop': null, 'Limit': null}, 'Associated': false}], 'Quote': null, 'Actions': [], 'ErrorMessage': null} Apparently I'm doing it wrong. How should a stop entry order (i.e. "an order that triggers a market order when a predefined rate is reached") be created using the API? Thanks for all input. 🙏
  2. Hello I have been running into the following json response when my program is attempting to close a position: {"Status":2,"Quote":null,"Orders":[{"Status":10,"CommissionCharge":0,"Associated":false,"StatusReason":81,"AssociatedOrders":{"Stop":null,"Limit":null},"Quantity":0,"OrderId":0,"TriggerPrice":0,"GuaranteedPremium":0,"IfDone":[],"Price":0,"OrderTypeId":1,"OCO":null}],"Actions":[],"StatusReason":75,"OrderId":0,"ErrorMessage":null} So far I have gathered that it means something with Web Min Size. My question is what is Web Min Size? My call on my java backend looks like this: String TradeBaseUrl = "https://ciapi.cityindex.com/TradingAPI/order/newtradeorder/"; CloseableHttpClient httpclient = HttpClients.createDefault(); HttpPost postRequest = new HttpPost(TradeBaseUrl + "?UserName=" + username + "&Session=" + session); String direction; if(tradeType.contentEquals("BULL")) direction = "sell"; else if(tradeType.contentEquals("BEAR")) direction = "buy"; else direction = "Not Determined"; String jsonBody = "{" + "\"MarketID\": " + marketID + ", " + "\"Direction\": \""+direction+"\", " + "\"BidPrice\": " + bidPrice + ", " + "\"OfferPrice\": " + offerPrice + ", " + "\"Quantity\": " + quantity + ", " + "\"OrderID\": "+openingID+", " + "\"positionMethodId\": 1, " + "\"TradingAccountId\": " + tradingAccountID + ", " + "\"MarketName\": \"" + marketName + "\", " + "\"isTrade\": true" + "}"; I only started to get these errors when I started testing with quantities greater than 1000.
×