ctrader-oauth-fetcher
A command-line utility for obtaining OAuth tokens from the cTrader Open API. This tool automates the OAuth 2.0 authorization code flow, handling browser-based authorization and token exchange.
Requirements
- Python 3.14+
- A cTrader Open API application (client ID and secret)
Usage
Run directly without installation using uvx:
uvx ctrader-oauth-fetcher --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET
With all options:
ctrader-oauth-fetcher \
--client-id YOUR_CLIENT_ID \
--client-secret YOUR_CLIENT_SECRET \
--scope trading \
--redirect-uri http://localhost:8080
Options
| Option | Required | Default | Description |
|---|---|---|---|
--client-id |
Yes | - | OAuth application client ID |
--client-secret |
Yes | - | OAuth application client secret |
--scope |
No | trading |
Permission scope: trading or accounts |
--redirect-uri |
No | http://localhost:8080 |
OAuth callback URL |
Scopes
trading- Full trading permissions (place orders, manage positions)accounts- Read-only access to account information
How It Works
- The tool constructs an authorization URL and opens it in your default browser
- A local HTTP server starts to listen for the OAuth callback
- After you authorize the application in your browser, cTrader redirects back to the local server
- The tool exchanges the authorization code for access and refresh tokens
- Tokens are displayed in the terminal
Output
On success, the tool outputs the token response:
Tokens received successfully.
Access token: <TOKEN>
Refresh token: <TOKEN>
Expires in: <SECONDS> seconds
Expires at: <UNIX-EPOCH> (epoch time)
Getting cTrader API Credentials
- Go to cTrader Open API
- Register or log in to your account
- Create a new application
- Note your client ID and client secret
License
MIT License - see LICENSE for details.
Metadata
Release files for ctrader-oauth-fetcher 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ctrader_oauth_fetcher-1.1.0.tar.gz | 3.5 kB | Without provenance | Details for ctrader_oauth_fetcher-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ctrader_oauth_fetcher-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for ctrader_oauth_fetcher-1.1.0-py3-none-any.whl |
Total release size: 8.3 kB
Release files / ctrader_oauth_fetcher-1.1.0.tar.gz
| Download URL | ctrader_oauth_fetcher-1.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68e4900f390e023b1895ba22a001134223c58d0a4bc58aecd5fb880915488fe6
|
|
BLAKE2b-256 checksum How to use checksums |
813900431bf8774438d8f271fed9e4c4d0d2d8e18a81cb2022074aaa118aaf5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / ctrader_oauth_fetcher-1.1.0-py3-none-any.whl
| Download URL | ctrader_oauth_fetcher-1.1.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f381a726ca0bbaa0bba6687f6a3ba0ee4a3a884e415d1f6f99899db1e511a01b
|
|
BLAKE2b-256 checksum How to use checksums |
09918e82b80949b70fca78b76033e509fa5092e5396b0621d22487ba21efc516
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for ctrader-oauth-fetcher 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.