Jump to content

Search the Community

Showing results for tags 'stop'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Gain Capital API FAQ
    • General Questions and Discussion

Found 3 results

  1. Hello, I have a service that opens new trades using the /newtradeorder endpoint. This is my request Json: { "Id":0, "IfDone":[ { "Id":0, "Stop":{ "Id":0, "Guaranteed":false, "TriggerPrice":null, "ExpiryDateTimeUTC":null, "Applicability":"gtc", "ParentOrderId":0, "TrailingDistance":10.0, "Associated":false, "Direction":"sell", "Quantity":1000 }, "Limit":{ "Id":0, "Guaranteed":false, "TriggerPrice":106.31527, "ExpiryDateTimeUTC":null, "Applicability":"gtc", "ParentOrderId":0, "TrailingDistance":null, "Associated":false, "Direction":"sell", "Quantity":1000 } } ], "Direction":"buy", "ExpiryDateTimeUTCDate":null, "LastChangedDateTimeUTCDate":null, "OcoOrder":null, "Type":null, "ExpiryDateTimeUTC":null, "Applicability":"gtc", "TriggerPrice":106.31527, "BidPrice":106.251, "AuditId":"LJ40690714", "AutoRollover":false, "MarketId":401484414, "OfferPrice":106.262, "OrderId":0, "Currency":null, "Quantity":1000, "QuoteId":null, "LastChangedDateTimeUTC":null, "PositionMethodId":1, "TradingAccountId":"<removed id>", "MarketName":null, "Status":null, "isTrade":false, "Json":null } Here's my response: { "Status":1, "StatusReason":1, "OrderId":754499310, "Orders":[ { "OrderId":754499310, "StatusReason":1, "Status":3, "OrderTypeId":1, "Price":106.262, "Quantity":1000.0, "TriggerPrice":0.0, "CommissionCharge":0.0, "IfDone":[ ], "GuaranteedPremium":0.0, "OCO":null, "AssociatedOrders":{ "Stop":{ "OrderId":754497194, "StatusReason":1, "Status":2, "OrderTypeId":2, "Price":0.0, "Quantity":9000.0, "TriggerPrice":106.151000, "CommissionCharge":0.0, "IfDone":[ ], "GuaranteedPremium":0.0, "OCO":{ "OrderId":754497195, "StatusReason":1, "Status":2, "OrderTypeId":3, "Price":0.0, "Quantity":9000.0, "TriggerPrice":106.31527, "CommissionCharge":0.0, "IfDone":[ ], "GuaranteedPremium":0.0, "OCO":null, "AssociatedOrders":{ "Stop":null, "Limit":null }, "Associated":true }, "AssociatedOrders":{ "Stop":null, "Limit":null }, "Associated":true }, "Limit":{ "OrderId":754497195, "StatusReason":1, "Status":2, "OrderTypeId":3, "Price":0.0, "Quantity":9000.0, "TriggerPrice":106.31527, "CommissionCharge":0.0, "IfDone":[ ], "GuaranteedPremium":0.0, "OCO":null, "AssociatedOrders":{ "Stop":null, "Limit":null }, "Associated":true } }, "Associated":false } ], "Quote":null, "Actions":[ { "ActionedOrderId":0, "ActioningOrderId":0, "Quantity":1000.0, "ProfitAndLoss":0.0, "ProfitAndLossCurrency":null, "OrderActionTypeId":1 } ], "ErrorMessage":null } The issue: I am trying to open multiple positions (long and short) on the same market. Each of these new positions should have its own unique Stop/Limit with different trigger prices. What is happening now is that any position I open on the same market seems to get overridden by each other. For example: if I open multiple short and long positions in the same Market-- they all seem to default to one position with the same limit and stop: I am wondering what I am doing wrong with my request? Regards, Rony
  2. Hello, This is my first post on this forum :-) I am working with the API, through a demo account, and have created a buy limit order (order/newstoplimitorder) with a corresponding sell stop/limit. Here is my JSON: { "MarketId": 401484347, "AutoRollover": false, "Direction": "Buy", "Quantity": 10000, "PositionMethodId": 1, "BidPrice": 1.18175, "OfferPrice": 1.18187, "TriggerPrice": 1.18237, "TradingAccountId": XXXXXXXXX, "IfDone": [ { "Stop": { "TrailingDistance": 10, "Direction": "SELL", "Quantity": 10000 } }, { "Limit": { "TriggerPrice": 1.18449, "Direction": "SELL", "Quantity": 10000 } } ] } The "problem" is that the Stop/Limit orders need to be OCO orders because after the Buy order goes through, both of these orders are submitted. Once one has completed the other one stays out there. That's why they need to be OCO. I know this can be done because I am able to create that scenario through the tradingview web site. My questions is how can this be accomplished? I have tried several combinations of IFDone and OcoOrder to no avail. A working JSON example would be perfect! An explanation would work also. Thanx in advance!
  3. Hi, This is what I know so far, please correct me if I am wrong: When openning a new trade, you use this API: http://docs.labs.cityindex.com/#HTTP%20Services/Trade.htm%3FTocPath%3DCIAPI%2520Reference|HTTP%2520Services|Trades%2520and%2520Orders|_____12 When closing an existing trade, you use this API to open an trade with trade direction opposite to the existing trade and use the existing trade's order id for the "close" property. http://docs.labs.cityindex.com/#HTTP%20Services/Trade.htm%3FTocPath%3DCIAPI%2520Reference|HTTP%2520Services|Trades%2520and%2520Orders|_____12 Here are the things I am not certain yet: 1. What is best way to modify an existing trade's stop or limit? For example, changing the stop level or limit level. 2. What is best way to remove an existing trade's stop or limit? 3. I noticed that a stop level is not compulsory on City Index platform. Is it true? Thanks.