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

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).
requestsis 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.2.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file capitalcom-0.1.2.tar.gz.
File metadata
- Download URL: capitalcom-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7abe50f8fb803c70ec049779710f786923860b99b497c672b3caed4ea52f6feb
|
|
| MD5 |
9fb24ee1f27f68e8afd29c9d1ff8ac05
|
|
| BLAKE2b-256 |
626c2998f0c5045a5d52b015e426b6ada405415ff28e1bbfd5500ba19ebc6a94
|
File details
Details for the file capitalcom-0.1.2-py3-none-any.whl.
File metadata
- Download URL: capitalcom-0.1.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93e1d4e00a80ddeac3a35844db5b339d864b68161121af00efc175337af02e1a
|
|
| MD5 |
73aa7c069ed5877718f2046ff07ea3ed
|
|
| BLAKE2b-256 |
077673bcf75d72cf7d5645f82cf8d5aa9c00cae56638a1ad885eeee8d15d9787
|