Broker API HubMenu

cTrader Open API with Python

cTrader's API is not REST. It is Protobuf messages over a persistent socket, which is why a Python script that works against IG or OANDA will not translate. This is what changes.

Independent and unofficialLast reviewed

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Carried over from an earlier version of this site. The links below are the sources it was written from, but its statements have not been re-read at source since the date shown, so check anything you rely on.

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

Where to go next

Sections