Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by Physicsman

  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
  16. Hello Gene, Yes, you can use the API to retrieve historical price data for the entire price history that we store. For daily and above time frames, most markets will have several years worth of data. Intraday data such as tick time frame, we generally store around a few days worth only. Kind Regards, PM
  17. Hi @aperson, Thank you for sending the account details. I have spotted the problem with your first initial call for GetLatestPriceBars, and presumably it is the same issue when you tried the ListMarketSearch call. Both calls are HTTP GET calls. In your first post, I see you put: method: 'POST', It should be GET. Using your account and a GET call I can retrieve price bars for the market as expected. Please change the POST to GET and it should work for you too. Kind Regards, PM
  18. Hi Buzz, Every request to the API must carry 2 pieces of authentication (username and session) in the request header, not in the request body. This is the likely reason why the server is complaining that the session is not valid, as it is not getting that piece of information in the request header. Kind Regards, PM
  19. Price Alerts: Post fail

    Hi Bryson, The returned error message is complaining about the Fillrate parameter. Assuming it is not sending us on a wild goose chase, what value did you use and on what market? Perhaps if you paste in the request payload you are sending I can use that to test your call. As an example, a successful request payload I used to create a new price alert on the USD/JPY market at a price level of 107.00 is: { "alertId": 0, "direction": 1, "expiry": 1, "fillRate": 107, "marketId": 401138125, "notificationMethod": null, "comment": null, "criterion": 2, "expiryDate": null, "emailAddress": "x@x.com" } Kind Regards, PM
  20. Place market order

    Hi, Are you a US or non-European client? It appears that the market you are using is the one used as an example in the documentation, which happens to be a CFD market. CFDs are only tradeable to clients in certain regions. Please try subscribing to a market that you have access to trade. You can complete the following instructions to search for the MarketIDs that you can access: http://docs.labs.gaincapital.com/#How Do I/Find Market ID.htm%3FTocPath%3DHow%20Do%20I...%3F|_____1. Kind Regards, PM
  21. Hello, You mentioned you are using a demo account - since this is the case, please send me a private message on this forum with your demo account credentials. I'm going to try sending some calls with the account to check that everything is working. With the test accounts I am using, the endpoints are responding normally / as expected. Many thanks, PM
  22. Place market order

    Hello, We upgraded our servers at the start of this year to the latest Lightsreamer v7.03. You should be able to find documentation/examples to work with the latest version? To use Lightstreamer, you should use your account username and password to Login to the REST API - see: http://docs.labs.gaincapital.com/#HTTP Services/LogOn.htm%3FTocPath%3DCIAPI%20Reference|HTTP%20Services|Authentication|_____3. With a successful REST API login, you will receive a Session ID back from the API. To authenticate with Lightstreamer, the login credentials are your account username and the Session ID from the REST API as the password. Once authenticated with Lightstreamer, you can then subscribe to receive live streaming market prices. Kind Regards, PM
  23. Hello, Which brand / region are you trading with? For example, are you a Forex.com US client? I suspect the MarketId you are using is not available for your account. You can perform the instructions detailed at: http://docs.labs.gaincapital.com/#How Do I/Find Market ID.htm%3FTocPath%3DHow%20Do%20I...%3F|_____1 to search for a MarketId that your account can trade. Kind Regards, PM
  24. Hi Dee, If you contact Client Services, and explain that you are an API user requiring an AppKey / API Key, they can liaise internally to obtain the AppKey for you. All API users require an AppKey, even if you are using a demo account. I believe demo account users no longer require signing the terms & conditions sheet, please check with Client Services to confirm. Kind Regards, PM
  25. Hello, Yes, they will show up in Web Trader. All our platforms will show the orders/trades since you are logging into the demo account with the trading platform of your choice. Kind Regards, PM