Skip to main content

Client for Capital.com REST API (demo and real)

Project description

CapitalCom PyPI Python License

A lightweight Python wrapper for the Capital.com REST API. Supports demo and live accounts. Designed for algorithmic trading, market data exploration, and automated execution.


Features

  • Open and close market positions
  • Query account/session info
  • Search instruments and market data
  • Supports automatic session renewal
  • Colored CLI feedback (green/red/blue)

Installation

pip install capitalcom

Example usage

from capitalcom_client import CapitalClient

client = CapitalClient(
    api_key="your_api_key",
    login="your_email",
    password="your_password",
    demo=True  # set to False for real account
)

# Open and close a test trade
client.test_trade()

Methods overview

Method Description
open_forex_position(...) Open a market order on forex with SL/TP in pips
get_open_positions() Get all active positions
close_position_by_id(deal_id) Close a position by its deal ID
search_instrument(term) Search instruments by name
list_all_instruments() Recursively list all tradable markets

License

This project is licensed under the CC BY-NC 4.0 License.


Notes

  • Works with REST API only (not streaming).
  • requests is the only dependency.

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

capitalcom-0.1.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

capitalcom-0.1.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file capitalcom-0.1.3.tar.gz.

File metadata

  • Download URL: capitalcom-0.1.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for capitalcom-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d9423162cf4647b759b6ba707b0f22c6f67ffc942991c40123d33d4f14716e77
MD5 0a7f8f8fca651beabcf423bad13fc752
BLAKE2b-256 568c8ae6f4b7e73a15c52e22ab5642798b2fb5264e1af3e398c41c0dbe9fd2a5

See more details on using hashes here.

File details

Details for the file capitalcom-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: capitalcom-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for capitalcom-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5df7eea1cc711d1572d1364ab3c281b7793ea09f175b32d9066fdbf94f3301e2
MD5 9b4ddf11b4cd4a846b1c80de0fff2315
BLAKE2b-256 4ecef0df6a62015d70d3a196c2d70280cb6b176b96fba513330892595d774682

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