Jump to content

Search the Community

Showing results for tags 'closing'.



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. Hello Physicsman, have a question using Close key value pair to close an existing trade. See: https://docs.labs.gaincapital.com/#Data Types/NewTradeOrderRequestDTO.htm Close integer[] List of existing open trade order IDs that require part or full closure. I tied it out on Postman with below JSON object: { "MarketId": 401484406, "Currency": null, "AutoRollover": false, "Direction": "sell", "Quantity": 1000, "QuoteId": 0, "PositionMethodId": 0, "BidPrice": 1.0001, "OfferPrice": 1.5001, "AuditId": "939239####", "TradingAccountId": ##########, "IfDone": null, "Close": ["779386607"], "Reference": null, "AllocationProfileId": 0, "OrderReference": null, "Source": null, "PriceTolerance": 0, "isTrade":true } And the response I get: { "Status": 4, "StatusReason": 112, "OrderId": 0, "Orders": [], "Quote": null, "Actions": [], "ErrorMessage": null } I looked up 112 StatusReason and according the documentation: https://docs.labs.gaincapital.com/#APICodesList.htm?Highlight=API Code Lookup Values I see it say, "NFA FIFO Account - Target closure restricted." What am I doing wrong here? How do I use Close with API NewTradeOrderRequest to close an existing trade? Thank you.
  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.
×