Skip to main content

One-time OAuth token fetcher for cTrader Open API

Project description

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

  1. The tool constructs an authorization URL and opens it in your default browser
  2. A local HTTP server starts to listen for the OAuth callback
  3. After you authorize the application in your browser, cTrader redirects back to the local server
  4. The tool exchanges the authorization code for access and refresh tokens
  5. 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

  1. Go to cTrader Open API
  2. Register or log in to your account
  3. Create a new application
  4. Note your client ID and client secret

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ctrader_oauth_fetcher-1.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ctrader_oauth_fetcher-1.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file ctrader_oauth_fetcher-1.1.0.tar.gz.

File metadata

  • Download URL: ctrader_oauth_fetcher-1.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for ctrader_oauth_fetcher-1.1.0.tar.gz
Algorithm Hash digest
SHA256 68e4900f390e023b1895ba22a001134223c58d0a4bc58aecd5fb880915488fe6
MD5 7d60719eb7e87949bb7ccb45685bdd6b
BLAKE2b-256 813900431bf8774438d8f271fed9e4c4d0d2d8e18a81cb2022074aaa118aaf5a

See more details on using hashes here.

File details

Details for the file ctrader_oauth_fetcher-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: ctrader_oauth_fetcher-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for ctrader_oauth_fetcher-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f381a726ca0bbaa0bba6687f6a3ba0ee4a3a884e415d1f6f99899db1e511a01b
MD5 b8a2777928ecafc28a9f80ff6d408d72
BLAKE2b-256 09918e82b80949b70fca78b76033e509fa5092e5396b0621d22487ba21efc516

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page