Jump to content


  • Content count

  • Joined

  • Last visited

  1. I've been able to get things going with this feedback. Thank you for the help!
  2. Hello! I want to adjust an existing Stop on an open trade. What is the best way to do this? My working understanding is that UpateTrade is the best route, but I'm having trouble understanding it. I'm attempting to use the UpdateTrade endpoint as documented at http://docs.labs.gaincapital.com/#HTTP Services/UpdateTrade.htm%3FTocPath%3DCIAPI%20Reference|HTTP%20Services|Trades%20and%20Orders|_____18 I'm getting a 500 server error response. What am I doing wrong? I'm opening a trade using the newtradeorder endpoint. I'll paste an example response at the bottom of this post. I'm then trying to use UpdateTrade to alter it. I've tried to mimic the example provided on the documentation page, but get the same error. Below is an example of what I have sent with most of the fields stripped out. Which fields should be required? As always, your advice and guidance is hugely appreciated! UpateTrade request, which results in the 500 error 'OrderId' => "702495938", 'TradingAccountId' => "xxxxxxx", 'IfDone' => [ [ 'Stop' => [ 'Applicability' => 'GTC', 'Direction' => 'Sell', 'ExpiryDateTimeUTC' => null, 'IfDone' => [], 'OcoOrder' => null, 'OrderId' => null, 'Quantity' => 1, 'TriggerPrice' => 1450.00, ], ], ], Response from newtradeorder, which created an open trade I can see in forex.com panel and provided the OrderId I am attempting to update. "Orders": [ { "OrderId": 702495938, "StatusReason": 1, "Status": 3, "OrderTypeId": 1, "Price": 1505.57, "Quantity": 1, "TriggerPrice": 0, "CommissionCharge": 0, "IfDone": [], "GuaranteedPremium": 0, "OCO": null, "AssociatedOrders": { "Stop": { "OrderId": 702495939, "StatusReason": 1, "Status": 2, "OrderTypeId": 2, "Price": 0, "Quantity": 1, "TriggerPrice": 1400, "CommissionCharge": 0, "IfDone": [], "GuaranteedPremium": 0, "OCO": { "OrderId": 702495940, "StatusReason": 1, "Status": 2, "OrderTypeId": 3, "Price": 0, "Quantity": 1, "TriggerPrice": 1700, "CommissionCharge": 0, "IfDone": [], "GuaranteedPremium": 0, "OCO": null, "AssociatedOrders": { "Stop": null, "Limit": null }, "Associated": true }, "AssociatedOrders": { "Stop": null, "Limit": null }, "Associated": true }, "Limit": { "OrderId": 702495940, "StatusReason": 1, "Status": 2, "OrderTypeId": 3, "Price": 0, "Quantity": 1, "TriggerPrice": 1700, "CommissionCharge": 0, "IfDone": [], "GuaranteedPremium": 0, "OCO": null, "AssociatedOrders": { "Stop": null, "Limit": null }, "Associated": true } }, "Associated": false } ], "Quote": null, "Actions": [ { "ActionedOrderId": 0, "ActioningOrderId": 0, "Quantity": 1, "ProfitAndLoss": 0, "ProfitAndLossCurrency": null, "OrderActionTypeId": 1 } ], "ErrorMessage": null }
  3. That did it. I cannot believe I overlooked such a simple problem so many times. Thank you!
  4. I may well have done this in the course of exploring the api. The information about Price Tolerance is very appreciated, I misunderstood how that worked. I set Price Tolerance to 2 in my requests, and have not seen a red card since. If I understand you correctly, setting this on any given trade will set that value as a default on subsequent trades, unless overwritten? If so, I should be set on this front. Thank you!
  5. I realize my follow up question on a previous thread was confusing, so I'm moving it here. As always, I really appreciate all of your help and patience! I'm having trouble getting a stop and limit set when I open a new position using the /newtradeorder api endpoint. The request gets accepted, the response looks okay other than IfDone being empty, and I can see the open position when logging in via the platform with no stop or limit set. What am I doing wrong? I'm spinning my wheels, and need the insights of some smarter eyes. Here is the request I am sending: { "BidPrice": "1511.21", "Direction": "buy", "MarketId": "401153870", "OfferPrice": "1511.66", "PositionMethodId": 1, "Quantity": 1, "TradingAccountId": "401589313", "IfDone": { "Stop": { "Applicability": "gtc", "Direction": "sell", "ExpiryDateTimeUTC": null, "Guaranteed": false, "IfDone": [], "OcoOrder": null, "OrderId": null, "Quantity": 1, "TriggerPrice": 1510.94 }, "Limit": { "Applicability": "gtc", "Direction": "sell", "ExpiryDateTimeUTC": null, "IfDone": [], "OcoOrder": null, "OrderId": null, "Quantity": 1, "TriggerPrice": 1511.94 } } } and here is the response: { "Status": 1, "StatusReason": 1, "OrderId": 693438627, "Orders": [ { "OrderId": 693438627, "StatusReason": 1, "Status": 3, "OrderTypeId": 1, "Price": 1511.58, "Quantity": 1, "TriggerPrice": 0, "CommissionCharge": 0, "IfDone": [], "GuaranteedPremium": 0, "OCO": null, "AssociatedOrders": { "Stop": null, "Limit": null }, "Associated": false } ], "Quote": null, "Actions": [ { "ActionedOrderId": 0, "ActioningOrderId": 0, "Quantity": 1, "ProfitAndLoss": 0, "ProfitAndLossCurrency": null, "OrderActionTypeId": 1 } ], "ErrorMessage": null } Thank you! - James
  6. I have re-examined the red card scenario. The root of my confusion was down to an error in OrderStatusResponse lookups - I was seeing the InstructionStatusResponse on screen twice rather than seeing both of them. It looks like I am getting an "Price Tolerance Exceeded" error. I still have some questions around stop / limit, but I also realize this topic has strayed and gotten very confusing. I'm going to open a new thread for those. Thank you for all the help!
  7. The orderStatusResponse was included in the post along with the request I was sending. I will add it again here: The request is accepted. The position is opened. However, the stop and limit portion of the request is not present in the reply or on the position when viewed on the platform. What do I need to do differently to get the stop / limit to work? { "Status": 1, "StatusReason": 1, "OrderId": 693438627, "Orders": [ { "OrderId": 693438627, "StatusReason": 1, "Status": 3, "OrderTypeId": 1, "Price": 1511.58, "Quantity": 1, "TriggerPrice": 0, "CommissionCharge": 0, "IfDone": [], "GuaranteedPremium": 0, "OCO": null, "AssociatedOrders": { "Stop": null, "Limit": null }, "Associated": false } ], "Quote": null, "Actions": [ { "ActionedOrderId": 0, "ActioningOrderId": 0, "Quantity": 1, "ProfitAndLoss": 0, "ProfitAndLossCurrency": null, "OrderActionTypeId": 1 } ], "ErrorMessage": null }
  8. I will paste the red card response shortly. Do you think there is any more that can be done to establish why the stop and limit are not present in the response I did post?
  9. I am after case 1. I want an immediate position at the current market price. So I will stick with /newtradeorder I've compared the payload example you have provided with what I am sending. I did have a number of extra parameters which I understood to be required, and have removed those. I have run a number of tests. Bid Price and Offer Price are always set on the latest price obtained from a lightstreamer connection. I am seeing mixed results. Most often the response status code is: Other times the response is okay, and the trade is accepted. However, in those cases, I am not seeing the stop or limit in the response or when I view the position via the trading platform. I have two questions - 1) What might be causing the red card? I don't see any additional information in the response - what details is it referencing? 2) Am I understanding correctly that the null IfDone array in the response points towards those values having been rejected? If so, what might be causing that? Here is the request I am sending: { "BidPrice": "1511.21", "Direction": "buy", "MarketId": "401153870", "OfferPrice": "1511.66", "PositionMethodId": 1, "Quantity": 1, "TradingAccountId": "401589313", "IfDone": { "Stop": { "Applicability": "gtc", "Direction": "sell", "ExpiryDateTimeUTC": null, "Guaranteed": false, "IfDone": [], "OcoOrder": null, "OrderId": null, "Quantity": 1, "TriggerPrice": 1510.94 }, "Limit": { "Applicability": "gtc", "Direction": "sell", "ExpiryDateTimeUTC": null, "IfDone": [], "OcoOrder": null, "OrderId": null, "Quantity": 1, "TriggerPrice": 1511.94 } } } and here is the response: { "Status": 1, "StatusReason": 1, "OrderId": 693438627, "Orders": [ { "OrderId": 693438627, "StatusReason": 1, "Status": 3, "OrderTypeId": 1, "Price": 1511.58, "Quantity": 1, "TriggerPrice": 0, "CommissionCharge": 0, "IfDone": [], "GuaranteedPremium": 0, "OCO": null, "AssociatedOrders": { "Stop": null, "Limit": null }, "Associated": false } ], "Quote": null, "Actions": [ { "ActionedOrderId": 0, "ActioningOrderId": 0, "Quantity": 1, "ProfitAndLoss": 0, "ProfitAndLossCurrency": null, "OrderActionTypeId": 1 } ], "ErrorMessage": null } Thanks so much for all your help and advice! - James
  10. Hi PM, I think I'm getting confused on language here. I am indeed a FOREX.com US client. My end goal is to have an open trade with a stop and limit set. Is there a good way for me to achieve that? EDIT: I've switched back to using the /newtradeorder endpoint. Does the NFA regulation you cited apply to calls to this endpoint as well? I'm referencing another forum post as an example, but the response I receive doesn't have if/then values set: The data I am sending is:
  11. Sorry to be such a pest... I have a follow up question. I'm now posting to /newstoplimitorder as you hinted at. I can see the orders showing up via the platform - verifying things on that side is a huge step forward! I aspire to set 'stop' and 'limit' values, and do not see those correctly set when viewing via the platform. What is the correct way to set these values via the /newstoplimitorder endpoint? I am currently trying to do so using the ifDone parameter thusly:
  12. I tried to login as you described when the account was first set up and wasn't able to. I've just retried and was able to get right in. I must have been making an error with a username and password during the earlier attempts. Thank you for the information and prompting me to retry! I also really appreciate you pointing out that I am creating a trade rather than an entry order. It seems like I need to switch to the newstoplimitorder endpoint.
  13. Thank you for this information. It does seem like I am on track and doing what I want to be doing. I don't know what this means. What is a trading platform? If I can access information for this demo account in some way other than via the api, that would be most useful. Is there a web interface somewhere I can use?
  14. Hello! I am attempting to place new orders via the /newtradeorder as described on http://docs.labs.gaincapital.com/#HTTP Services/Trade.htm%3FTocPath%3DCIAPI%20Reference|HTTP%20Services|Trades%20and%20Orders|_____16 In trying to interpret the response, I am confused by the nested Status and StatusReason codes. Which lookup tables do each of these reference, and what do they tell me? I believe my order is in 'open'' status, is that accurate? What does the Status of 1 on the first line represent, and which lookup table does that reference? Is that a 'Pending' status? Perhaps I'm just too close to it for too long, but what exactly does a status of 'open' in this context mean? I am working from a demo account, will behavior be different in this context than a normal, live interaction? I really appreciate any help or guidance! Here is the response I receive: { +"Status": 1 +"StatusReason": 1 +"OrderId": 692995594 +"Orders": array:1 [ 0 => {#690 +"OrderId": 692995594 +"StatusReason": 1 +"Status": 3 +"OrderTypeId": 1 +"Price": 1504.14 +"Quantity": 1.0 +"TriggerPrice": 0.0 +"CommissionCharge": 0.0 +"IfDone": [] +"GuaranteedPremium": 0.0 +"OCO": null +"AssociatedOrders": {#692 +"Stop": null +"Limit": null } +"Associated": false } ] +"Quote": null +"Actions": array:1 [ 0 => {#727 +"ActionedOrderId": 0 +"ActioningOrderId": 0 +"Quantity": 1.0 +"ProfitAndLoss": 0.0 +"ProfitAndLossCurrency": null +"OrderActionTypeId": 1 } ] +"ErrorMessage": null }
  15. Hello. In the course of building out functionality against the api, I've wound up with a negative total account balance in my demo account. I'd like to reset this so I can continue to build things out, but haven't been able to find a way to do so. Is this something which can be done? Thanks!