This release is a pre-release and may not be stable for production use.
XTBApi
Api for XTB trading platform.
A python based API for XTB trading using websocket_client.
Installing / Getting started
To install the API, just clone the repository.
git clone git@github.com:federico123579/XTBApi.git
cd XTBApi/
python3 -m venv env
. env/bin/activate
pip install .
Then you can use XTBApi like this simple tutorial.
from XTBApi.api import Client
# FIRST INIT THE CLIENT
client = Client()
# THEN LOGIN
client.login("{user_id}", "{password}", mode={demo,real})
# CHECK IF MARKET IS OPEN FOR EURUSD
client.check_if_market_open([EURUSD])
# BUY ONE VOLUME (FOR EURUSD THAT CORRESPONDS TO 100000 units)
client.open_trade('buy', EURUSD, 1)
# SEE IF ACTUAL GAIN IS ABOVE 100 THEN CLOSE THE TRADE
trades = client.update_trades() # GET CURRENT TRADES
trade_ids = [trade_id for trade_id in trades.keys()]
for trade in trade_ids:
actual_profit = client.get_trade_profit(trade) # CHECK PROFIT
if actual_profit >= 100:
client.close_trade(trade) # CLOSE TRADE
# CLOSE ALL OPEN TRADES
client.close_all_trades()
# THEN LOGOUT
client.logout()
Api Reference
REQUIRED - SOON
Documentation still in progess
Metadata
Release files for XTBApi 1.0a7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| XTBApi-1.0a7.tar.gz | 9.0 kB | Without provenance | Details for XTBApi-1.0a7.tar.gz |
Release files / XTBApi-1.0a7.tar.gz
| Download URL | XTBApi-1.0a7.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05d3ef8a49e3ed502121cffe3ee9e01cc1beddfe01080f9a3f8cd814d14974fa
|
|
BLAKE2b-256 checksum How to use checksums |
e690a36a2304f1a73f789cc5f2560a2ce4704a48bdb61058dd84a431dd29f655
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9
|
Security for XTBApi 1.0a7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.