Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


Physicsman last won the day on January 9

Physicsman had the most liked content!

1 Follower

About Physicsman

  • Rank

Profile Information

  • Gender
  • Location
    London, Great Britain

Recent Profile Visitors

962 profile views
  1. Hello, Yes they should be identical. to help us investigate, please tell us: which Market ID you were using when this happened (the times of the Lightstreamer ticks) also, please send me a PM of your username only Many thanks, PM
  2. Not able to set the stop loss

    I forgot to address your other query about minimum order distance. The minimum order distance is a restriction set on every market, not a limitation of the API. For most markets it is quite small, for example EUR/USD is 0.8 pips outside the spread. You can view the minimum order distance by sending a ListMarketInformation call for the markets you are interested in trading. In the reponse, there will be a field MinDistance, that shows how close to the current market spread you can place your stop or limit orders.
  3. Not able to set the stop loss

    Hi Danilo, Since you mentioned you have a test account (NOT a Live account), please send me a DM with the test account credentials. I can then use that test account to send the API requests to perform Steps 1, 2, and 3 as you have described. We can see what happens and investigate from there as needed. http://docs.labs.gaincapital.com/ is the correct URL. The other one is the old address - we moved the API documentation to http://docs.labs.gaincapital.com/ so no need to use the other address. Kind Regards, PM
  4. Not able to set the stop loss

    Hello Danilo, I very much appreciate your laying out the exact steps you are taking and the requests/responses. It makes everything very clear and significantly easier to troubleshoot. Thank you! Looking through your requests I believe I have found the reason why your step 3 (editing the stop loss trigger) price is failing. In your update stop request, the OrderID of the Stop loss (received in the response to step 2) must be supplied. Your request has: "OrderId": 0 It should be for example based on the stop loss order ID you received from step 2: "OrderId": 711777646, // stop order id Note 1 In your step 2 when you are first adding a stop loss to your open position, although it appears to be working you should set the order ID as null instead of zero. "OrderId": null, Note 2 You mentioned using the web trading platform to attempt moving the stop loss and receiving a validation warning preventing you from moving the stop loss. I presume this is because you attempted to update the stop level too close to the current price? Some markets have a minimum distance for stop/limit orders away from the the current price. Kind Regards, PM
  5. Watchlist retrive market information

    Hello, Good to see you already spotted the solution. Since you are POSTing the call, the parameter is added in the POST body instead of in the query string. Kind Regards, PM
  6. Not able to set the stop loss

    Hi Danilo, I see 2 anomalies in the pasted JSON request and response that is most puzzling indeed. The request is to place an entry order to Sell with quantity 2 should the market price reach 1.99237. Yet the response is that of a trade where you have opened a position at 1.99237 with quantity 1000!?! 1) How did you manage to send an entry order that results in placing a trade with an open position instead? 2) How did sending the entry order request with quantity = 2 result in a trade with open position quantity = 1000? The only thing we have managed to answer is why the stop loss attached is accepted in this case. It is because the open position has quantity = 1000 and the stop loss quantity also = 1000, so you do not receive the Error 75 as you did in the previous case. My suggestions are to ensure that you are sending the entry order requests to the /newstoplimitorder endpoint, and to ensure that the quantities of the stop loss and entry orders are equal. This will result in a full close should the stop loss order be triggered. The system will never accept orders when you have an open position of quantity = 2 and a stop loss of quantity = 1000. Kind Regards, PM
  7. Not able to set the stop loss

    Hello, I "prettified" the JSON in your request and saw that the you did have mismatching trade quantities. Your entry order has a quantity of 2, whereas the stop you are trying to attach to the entry order has a trade size of 1000. The stop must have a trade size equal to the original entry order, if you want the stop to fully close, or less than the entry order size if your stop is only a partial close. Kind Regards, PM
  8. Python Library for GC API

    Hi Ricky, Many thanks for sharing the Library, it's very kind of you! I'm sure other Python users will be very appreciative of your generosity! Kind Regards, PM
  9. Not able to set the stop loss

    Hi Danilo, Is that OrderStatusReason code 75 you are talking about or InstructionStatusReason code? OrderStatusReason code 75 states "The total quantity of guaranteed stop orders must be equal to trade order quantity." Have you accidentally set the total quantity of all your stops to be greater than the total position you have open? You can find all the lookup codes at: http://docs.labs.gaincapital.com/#APICodesList.htm%3FTocPath%3DGetting%20Started|Lookup%20Values|_____1 If it is the InstructionStatusReason code of 75 you are receiving, then what is the corresponding OrderStatusReason code? The OrderStatusReason code provides the explanatory information as to why your orders were rejected/failed. Kind Regards, PM
  10. GCAPI REST Details

    Hi Jflaggs, There isn't an error on your side. The quote you are referring to is talking more about the minimum time frame you can expect a session to be active, if the user does not manually log out. We run a task to clear out any leftover sessions on the back-end every so often, but until that task is run a session will remain open unless the user has manually closed it. This is why you are still seeing open sessions. Kind Regards, PM
  11. GCAPI REST Details

    Hello JFlaggs, 1) The REST API is not designed to update live market prices by calling for example GetLatestPriceTicks repeatedly. These calls are designed for retrieving price history to use in analysis etc. You should use the Streaming part of the API via the 3rd part Lightstreamer. Subscribe to the markets that you wish to view live streaming prices, and they are then streamed to you updating as the market prices update. 2) We don't have a call to retrieve all active sessions for a given user name. The closest we have is by using the ValidateSession call to check whether a session is still active for a given username. To delete a session manually, use the DeleteSession call for each session that you wish to close. 3) Throttling / Rate Limitation is mentioned in the section at the bottom of the GCAPI Basics page. Kind Regards, PM
  12. Price Alerts: Post fail

    Hi Bryson, Many thanks for updating us and we're happy to hear that you solved it. We very much appreciate your feedback regarding the API documentation - it is very helpful! A note has been made to improve it along the lines you have suggested at the next documentation refresh. Kind Regards, PM
  13. Get Order ID

    Hi M133, If you send a ListOpenPostions call, this returns all your current open positions including the Order IDs. Similarly, sending a ListActiveStopLimitOrders call will return all your active orders including the Order IDs. Kind Regards, PM
  14. This forum will be unmonitored over the holiday period from Monday 23rd December through to Wednesday 8th January 2020. Should you have an urgent API query please contact your account manager or client services.
  15. Trades with cross pairs

    Hello, Natively, we do not have any API command that will cancel one trade request dependent upon the response from a 2nd trade request. Both trade requests are sent simultaneously and filled if valid. If one trade request responds with an error, you will have to manually close the other leg, which is now a new open position. Kind Regards, PM