PyneCore Capital.com Plugin
Capital.com integration for PyneCore: historical and live market data plus live order execution over the public REST v1 + WebSocket API.
Status
Both the data provider (LiveProviderPlugin) and live order execution
(BrokerPlugin) are implemented: session-based authentication, historical
plus live OHLCV, and position-based order routing with server-side stop-loss /
take-profit / trailing stop.
Demo first
Capital.com has a full demo environment
(demo-api-capital.backend-capital.com) — run your strategy there before
risking funds. Set demo = true and the plugin talks to the demo host; the
same API key works on both hosts, and the host you authenticate against
decides which account list (demo or live) you see. Note two demo-side
differences: fills are effectively deterministic at the requested price
(slippage and partial fills are simulated away), and the hourly order-POST
rate limit is tighter than on live.
Configuration
Settings live in workdir/config/plugins/capitalcom.toml, auto-generated
from CapitalComConfig on first run.
One credential block serves both market data and order execution:
demo = false # demo host vs. live real funds
user_email = "" # your Capital.com account email
api_key = "" # API key from Settings -> API integrations
api_password = "" # the password you set when generating the key
Generating the key: enable two-factor authentication on your account first (Capital.com requires 2FA before API key generation), then create the key under Settings -> API integrations on the platform; the API password is set there as part of key creation. The plugin encrypts the password with the server-provided RSA key at login and keeps the session tokens refreshed proactively.
Capital.com limits POST /session to one request per second per API key.
Concurrent broker/provider instances in one process therefore share a keyed
bootstrap gate. Session POST starts are spaced by at least one second, and a
bootstrap throttle receives one bounded retry. Existing tokens stay visible
while a replacement session is created, so an active WebSocket is never sent
an empty credential pair.
Symbols
Capital.com identifies instruments by epic (e.g. EURUSD, GOLD) —
use the epic directly in the provider string:
capitalcom:EURUSD@1
Pine scripts written with TradingView-style symbols keep working through
the optional symbol_map translation table in the config:
[symbol_map]
"FX:EURUSD" = "EURUSD"
"OANDA:XAUUSD" = "GOLD"
Architecture
- Transport: REST v1 (
api-capital.backend-capital.com, or the demo host withdemo = true) for account, orders, and history; WebSocket for live quotes and OHLC updates. Execution events are polled from REST (/positions,/workingorders,/history/activity) — Capital.com has no order-event WebSocket channel. - Authentication: API key + email + API password. The plugin encrypts the password with the server-provided RSA key and keeps the session tokens refreshed proactively.
- Order model: position-based (
dealIdrows) with server-side stop-loss / take-profit / trailing stop as position attributes. One-way (netting) accounts use the direct execution path; hedging-mode accounts run through PyneCore's one-way emulation layer, so Pine one-way semantics hold on both.
Account-mode notes
- Hedging mode is detected at connect time (
GET /accounts/preferences) and handled transparently: closes, reversals, and brackets are decomposed per position row by the core one-way emulator. - Partial closes on a hedging account are not supported:
DELETE /positions/{dealId}is full-row only (it ignores anysizeparameter), so a fractionalstrategy.close(qty=...)becomes a loud, non-halting skip. Use a one-way (netting) account for partial closes — there the plugin emulates them via opposite-direction orders. - Deferred trailing activation (Pine
trail_price+trail_points) is only available on netting accounts; on a hedging account the trailing stop arms immediately at the given offset (logged as a warning).
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 pynesys_pynecore_capitalcom-0.9.1.tar.gz.
File metadata
- Download URL: pynesys_pynecore_capitalcom-0.9.1.tar.gz
- Upload date:
- Size: 264.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cc66f0fba2b3c9fcef3ad65e23787f9f1efa1fd0afea821cba01a0bc613ff0b
|
|
| MD5 |
1210402d204be1ef37fa2ca0ae5081b6
|
|
| BLAKE2b-256 |
b576c39dfa646e55e9acf1198a757c8be8eb7e7eeea14d468a2e98ed5bf43be3
|
Provenance
The following attestation bundles were made for pynesys_pynecore_capitalcom-0.9.1.tar.gz:
Publisher:
release.yml on PyneSys/pynecore-plugin-capitalcom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynesys_pynecore_capitalcom-0.9.1.tar.gz -
Subject digest:
1cc66f0fba2b3c9fcef3ad65e23787f9f1efa1fd0afea821cba01a0bc613ff0b - Sigstore transparency entry: 2238928271
- Sigstore integration time:
-
Permalink:
PyneSys/pynecore-plugin-capitalcom@9455d3a038c1da753939a84e81ad93005064d361 -
Branch / Tag:
refs/tags/v0.9.1 - Owner: https://github.com/PyneSys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9455d3a038c1da753939a84e81ad93005064d361 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pynesys_pynecore_capitalcom-0.9.1-py3-none-any.whl.
File metadata
- Download URL: pynesys_pynecore_capitalcom-0.9.1-py3-none-any.whl
- Upload date:
- Size: 166.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96fe6ee7a94e44ee2ffe03459d1adc3fca5cc514928eb2a36be70e284e414e98
|
|
| MD5 |
7d2e6ac4aba353cc5d77fa6902c83318
|
|
| BLAKE2b-256 |
bac50fbccfd1d2755ca4d581fd5cf89e4fd4f6e85f4dccd27ff4b91ebed2fb6d
|
Provenance
The following attestation bundles were made for pynesys_pynecore_capitalcom-0.9.1-py3-none-any.whl:
Publisher:
release.yml on PyneSys/pynecore-plugin-capitalcom
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynesys_pynecore_capitalcom-0.9.1-py3-none-any.whl -
Subject digest:
96fe6ee7a94e44ee2ffe03459d1adc3fca5cc514928eb2a36be70e284e414e98 - Sigstore transparency entry: 2238928940
- Sigstore integration time:
-
Permalink:
PyneSys/pynecore-plugin-capitalcom@9455d3a038c1da753939a84e81ad93005064d361 -
Branch / Tag:
refs/tags/v0.9.1 - Owner: https://github.com/PyneSys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9455d3a038c1da753939a84e81ad93005064d361 -
Trigger Event:
release
-
Statement type: