What you need to know before you write a line
ctrader-open-api, published by Spotware as spotware/OpenApiPy. Official, asynchronous and built on Twisted, which shapes how your whole script is written: you register callbacks on a reactor rather than awaiting calls.
Source: GitHub: spotware/OpenApiPy checked 18 Sep 2026
192 stars and unpushed since August 2024. It is the official client and there is no serious alternative, but treat it as stable rather than actively developed.
Source: Public GitHub search API checked 19 Sep 2026
A TCP socket, not an HTTP base URL: live.ctraderapi.com or demo.ctraderapi.com on port 5035 for Protobuf and 5036 for JSON. Demo and live are fully separated environments.
Source: cTrader Open API documentation checked 18 Sep 2026
OAuth 2.0 authorisation code flow. The access token lasts about 30 days and the refresh token does not expire. Scopes are accounts or trading, so ask for accounts if you only intend to read.
Source: cTrader Open API documentation checked 18 Sep 2026
Register at openapi.ctrader.com. Spotware reviews new applications, so describe the use case properly rather than leaving the form thin. This is the step that costs days, not the code.
Source: cTrader Open API documentation checked 18 Sep 2026
50 requests a second per connection, and 5 a second for historical data. Exceeding them returns REQUEST_FREQUENCY_EXCEEDED, code 108.
Source: cTrader Open API FAQ checked 19 Sep 2026
The newest protobuf message release is Release 91, 15 Jul 2024. If a tutorial is a year old the message set has probably not changed under it.
Source: spotware/openapi-proto-messages releases checked 19 Sep 2026
What catches Python developers first
- There is no request and response pairing to await. Every reply arrives as a message on the same socket, keyed by payloadType, so you match replies to requests yourself.
- Twisted's reactor runs the show. Mixing it with asyncio or calling it from a Jupyter cell is where most first attempts stall.
- A heartbeat every 10 seconds keeps the connection alive. Drop it and the server drops you.
- Authenticating the application and authenticating the trading account are two separate messages. CH_CLIENT_NOT_AUTHENTICATED, code 102, means you sent a command before finishing both.
Where to go next
- cTrader Open API: app to first call in PythonThe step by step from registering an app to a working request
- Every Open API message with its payloadTypeNumber, direction and purpose for the whole message set
- cTrader Open API error codesWhat each numeric error code means and what to do
- The cTrader Open API platform pageLimits, auth, demo access and the brokers that run cTrader