Jump to content

jflaggs

Members
  • Content count

    5
  • Joined

  • Last visited

  1. 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=***
  2. 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?
  3. 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?
  4. 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
  5. 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.
×