Skip to main content

A simple wrapper for capital.com exchange API

Project description

Welcome to python-capital

This is an unofficial Python wrapper for the Capital.com Public API v1.
I am in no way affiliated with Capital.com, use at your own risk.

If you came here looking for the Capital.com exchange to invest in CFDs, then go here.
If you want to automate interactions with Capital.com, stick around.

Source code:
https://github.com/

Features

  • Simple handling of authentication
  • Password encryption end-to-end
  • Response exception handling
  • Positions opening/closing
  • Market prices and sentiment

Quick Start

Register an account with Capital.com.

Generate an API Key.

To use the Demo accounts, pass demo=True when creating the client (default is set to False).

pip install python-capital.com
from capital.client import Client

client = Client(username, api_key, api_password)

# get all open positions
positions = client.all_positions()

# to create a position
order = client.create_position(epic, direction, size)

# to close a position
close = client.close_position(deal_id)

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

python_capital-0.2.2.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

python_capital-0.2.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file python_capital-0.2.2.tar.gz.

File metadata

  • Download URL: python_capital-0.2.2.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for python_capital-0.2.2.tar.gz
Algorithm Hash digest
SHA256 32bd187b61f6031f49267c0582a01db45b583790c16e603f517c917a3b2fce09
MD5 65f8847c9263d937523f3e66822fc85f
BLAKE2b-256 dcb222c53b9ce575dcdf7dff9682d1d9816e6058c4604b03a271c0849717543a

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_capital-0.2.2.tar.gz:

Publisher: publish.yml on iribeirocampos/python-capital

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_capital-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: python_capital-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for python_capital-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab8647a0546b036f5af955303ff7616d472610016d7c64f866817f2fa85a61d7
MD5 93749519096f5cd90e70babc8e112327
BLAKE2b-256 fed971673496a3b608ca10855ddfcc18eba9a0ad67fb0046d3fed4703055ac8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_capital-0.2.2-py3-none-any.whl:

Publisher: publish.yml on iribeirocampos/python-capital

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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