Jump to content
Sign in to follow this  

Recommended Posts

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.
        GetLatestPriceTicks
        http://docs.labs.cityindex.com/index.html#HTTP%20Services/GetLatestPriceTicks.htm?Highlight=GetLatestPriceTicks

        GetLAtestPriceBars
        http://docs.labs.cityindex.com/index.html#HTTP%20Services/GetLatestPriceBars.htm?Highlight=GetLatestPriceBars
  • 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.
        Obtaining a Session Token:
        http://docs.labs.cityindex.com/index.html#Getting%20Started/CIAPI%20Basics.htm%3FTocPath%3DGetting%2520Started%7C_____2
       
        Forum Discussion "Session Expiration":
        http://faq.labs.gaincapital.com/topic/1915-session-expiration/?tab=comments#comment-3369
  • 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.

Share this post


Link to post

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.

image.png

Kind Regards, PM

Share this post


Link to post

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 

Share this post


Link to post

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

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×