Static credentials for trading bots

Created at 30 Dec 2023, 19:50
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
LE

leechy

Joined 30.12.2023

Static credentials for trading bots
30 Dec 2023, 19:50


When using the Open API you need to have a refresh token. This refresh token you can generate once initially in Playground. Then every time you get an access token or refresh the access token, a new refresh token is generated and the old one invalidated. This makes it incredibly painful when you want to run multiple instances of a trading bot or want to test locally at the same time. Each time the refresh token changes, every other instance needs to receive the updated refresh token, so you need to have some kind of reactive configuration system in place. What to do? Some ideas I came up with:
 

  •  Generate a separate refresh token for each instance. This is still painful, because you need to generate the credentials manually every time from the Playground. Also currently there is no way to know which refresh token you are revoking when you have multiple entries here (https://id.ctrader.com/my/settings/openapi). Also every instance needs to have some kind of state where it puts the current refresh token in case a restart is needed.
  • Have multiple OAuth applications. This fixes the revocation issue above, but increases the time to create new credentials.
  • Use the FIX API instead. I'd like to avoid this because the protocol is dated and offers less features. Getting the current margin available is important which is not available in FIX it seems.
  • cBots are not an option for various reasons.

 

So I'm looking for static credentials like you have for FIX or some API key. Or even service accounts like in Google Cloud if you want to stay within OAuth.

Any hints on what's the best way forward? Thanks.


@leechy