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/
- Simple handling of authentication
- Password encryption end-to-end
- Response exception handling
- Positions opening/closing
- Market prices and sentiment
Register an account with Capital.com.
To use the Demo accounts, pass demo=True when creating the client (default is set to False).
pip install python-capital.comfrom 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)