Jump to content


  • Content count

  • Joined

  • Last visited

  1. I sent an email to api support two weeks ago per your instructions (and also sent a link to this discussion for reference). I just received a reply today: "Please try to use monthly reports to view older information." I'm not sure how to interpret this response to apply it to an api call. I believe they are referring to the web trader platform. Can you offer any interpretation on this reply? It seems a bit impractical to have a 10 day lag in communication. Is there another channel to go through to get a more in depth response for this bug?
  2. I gave this a try and discovered that my Web Trader report only yields 400 lines of trades. I requested a year of trades up to today, and it returns 400 lines of trades in the date range of 26/05/2020 - 16/07/2020. So again, it cuts off in May but a few days ago it went back to May 14th or so -- which tells me it's only returning a fixed number of trades. Then I requested last years trades (Jan 1 2019 to Jan 1 2020) and the Web Trader report yields 400 lines again spanning from 29/08/2019 - 24/10/2019. This is consistent with the results I got via Postman and the GCAPI, so it looks like the API "MaxResults" parameter is not working on the server side.
  3. That would be excellent. How can I track the status of that feature request and/or get an update when it's implemented? I tried using your GET request string along with my session and username in headers via postman but the result is still the same. I get exactly 200 trades including my latest trade, but it will not return trades before May 2020. Any ideas for troubleshooting this? Request string https://ciapi.cityindex.com/TradingApi/order/tradehistory?MaxResults=10000&from=1529038800 + Session=*** & UserName=*** headers still only returns 200 results going back to may 2020.
  4. Thank you for confirming this for me. Are you able to comment on why it is this way? It would only require a single bit "BuyToOpen = true/false" to achieve this. Could this be a feature request? Also, I am not able to get my entire trade history from this api call. I have actively traded this account for about 2-3 years, but my api call only returns trade history going back to May 20th of this year. Is this by design or is this an error on my part? If so, why -- and how can I retrieve my full trade history? Here is the request string following the api reference here: I've used the "From" parameter here before, but it doesn't make any difference. See notes below. https://ciapi.cityindex.com/TradingAPI/order/tradeHistory?MaxResults=2147483647&From=&UserName=***&Session=*** I have also tried the other method using the ClientAccountID and TradingAccountId: This method states "ClientAccountID can be passed in order to retrieve all information on all trading accounts...". Here the "From" parameter is the number of seconds since 300 days from now. I have tried using the equivalent milliseconds as well, but that produces an error response from the api. https://ciapi.cityindex.com/TradingAPI/order/tradeHistory?TradingAccountId=***&ClientAccountId=***&MaxResults=2147483647&From=1568112932&UserName=***&Session=***
  5. The problem with that is all "scale in trades" have a realized pnl of null, and all "scale out" trades have a non-null realized pnl value. So you cannot distinguish which trade opened a position and which trades were subsequent scale in trades to that position. This is necessary to do things like, get the average price for a historical net position or do an MAE/MFE analysis on a historical net position. Perhaps a more concise way to ask this question is: How to know the transitions from Flat to Long/Short and vice versa using these historical trade objects?
  6. Hello, I am trying to aggregate my historical trades to calculate my average position price and size. To do this I need to know which trades are buy/sell to open (buy/sell to close can be calculated by tracking when size becomes zero). The only other alternative I can think of would be to request ALL history since the account was created and funded to ensure starting from a flat position. Of course, this is highly impractical when we only want to analyze the last month of historical trades. Below is an example simplification of a ApiTradeHistoryDTO[ ] array filtered by a single symbol. As an example: Sell 1 at 99 (closing a previous position) Buy 1 at 100 (opening new position, we need a bit to know to start here rather than the prior order) Buy 1 at 101 Buy 1 at 102 Sell 1 at 103 Sell 1 at 104 Sell 1 at 105 (net position closed) The average position is Long 3 at 101. The only way to calculate this is by knowing that the second order in the array was a buy to open order. Otherwise, we would mistake the first order for an opening order when it is actually a closing order. What is the recommended way to get this result with my historical trades?
  7. GCAPI REST Details

    Thanks for your insight. Regarding issue number 2, I can come up with an algorithm to manually manage user sessions. However, my issue still exists that my session token has now been active for about 2 weeks but you gave a previous answer that "If you close the connection without logging off, then the ID will generally be valid until end of day". Is there anything I can do on my side to prevent this discrepancy? It seems like this might be a server side bug. Please note this is for the Live endpoint and again, I've yet to see it expire after 2 weeks. Forum Discussion "Session Expiration": http://faq.labs.gaincapital.com/topic/1915-session-expiration/?tab=comments#comment-3369
  8. Hello,I have some questions regarding implementation of the GCAPI. I am implementing a REST only client. Please confirm which API call is appropriate forgetting the most up to date price values periodically at ~100 milliseconds. Currently I am making calls to the following endpoints to update the client application. Please advise which is most appropriate or if they are equivalent. Is there a way to get all active sessions for a given user name and app key? During development I have created multiple sessions and they have all been active for about three days now. I would like to delete all client sessions. The documentation states that "You can manually delete a Session token, or leave it to be automatically deleted". The forum discussion also states that "If you close the connection without logging off, then the ID will generally be valid until end of day". But again, I have seen several session tokens remain valid for three days (and counting) which is not acceptable for my client application. An example situation might be: A user logs in and a token is created. Later, the application crashes without logging out. The user restarts the application, and a new session token is created. Now there are TWO valid session tokens active, however, the user can only log out from ONE. Please advise on how to delete all sessions upon logging out. What is the policy for API call frequency? Typically, API documentation has explicit limitations for how frequently you can make calls to a particular endpoint (usually based on the weight of each API call) before the session or IP address is automatically rate-limited by the server. Where can I find this information in the GCAPI documentation? Thanks a bunch for your help.