python-deriv-api
A python implementation of deriv api library.
Go through api.deriv.com to know simple easy steps on how to register and get access. Use this all-in-one python library to set up and make your app running or you can extend it.
Requirement
Python (3.9.6 or higher is recommended) and pip3
Note: There is bug in 'websockets' package with python 3.9.7, hope that will be fixed in 3.9.8 as mentioned in https://github.com/aaugustin/websockets/issues/1051. Please exclude python 3.9.7.
Installation
python3 -m pip install python_deriv_api
Usage
This is basic deriv-api python library which helps to make websockets connection and deal the API calls (including subscription).
Import the module
from deriv_api import DerivAPI
Access
api = DerivAPI(endpoint='ws://...', app_id=1234);
response = await api.ping({'ping': 1})
print(response)
Creating a websockets connection and API instantiation
You can either create an instance of websockets and pass it as connection or pass the endpoint and app_id to the constructor to create the connection for you.
If you pass the connection it's up to you to reconnect in case the connection drops (cause API doesn't know how to create the same connection).
- Pass the arguments needed to create a connection:
api = DerivAPI(endpoint='ws://...', app_id=1234);
- create and use a previously opened connection:
connection = await websockets.connect('ws://...')
api = DerivAPI(connection=connection)
Documentation
API reference
The complete API reference is hosted here
Examples here
Development
git clone https://github.com/binary-com/python-deriv-api
cd python-deriv-api
Setup environment
make setup
Setup environment and run test
make all
Run test
python setup.py pytest
or
pytest
or
make test
Generate documentations
Generate html version of the docs and publish it to gh-pages
make gh-pages
Build the package
make build
Run examples
set token and run example
export DERIV_TOKEN=xxxTokenxxx
PYTHONPATH=. python3 examples/simple_bot1.py
Metadata
Release files for python-deriv-api 0.1.6
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 |
|---|---|---|---|---|
| python_deriv_api-0.1.6.tar.gz | 46.1 kB | Without provenance | Details for python_deriv_api-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_deriv_api-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for python_deriv_api-0.1.6-py3-none-any.whl |
Total release size: 86.9 kB
Release files / python_deriv_api-0.1.6.tar.gz
| Download URL | python_deriv_api-0.1.6.tar.gz |
|---|---|
| Size | 46.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f267dcdf062ecff408c5af2dfd5de27f6040b694db1261c182ff37a96107aad7
|
|
BLAKE2b-256 checksum How to use checksums |
30925e87ca080ae5cbdca1d4c626da20b8c51db12d5ef1699d58835001e9eaa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Release files / python_deriv_api-0.1.6-py3-none-any.whl
| Download URL | python_deriv_api-0.1.6-py3-none-any.whl |
|---|---|
| Size | 40.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a07c8872487e19137fd602771ad310d3d924d67d4da906e8b0fd9437b824fce2
|
|
BLAKE2b-256 checksum How to use checksums |
59b1949fa2aff2000ca48d29e6aab8c8ea12c4b5591a7887ef5b9fd27a87bcd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Security for python-deriv-api 0.1.6
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.