A client for interacting with the Haveno daemon.
Project description
Haveno Client (Python)
The Haveno Client is a Python gRPC client that allows you to interact with Haveno, a decentralized cryptocurrency trading platform. This client enables you to connect to Haveno servers, access market data, manage accounts, and perform trades programmatically.
Features
- Connect to multiple Haveno servers using gRPC.
- Manage accounts, access market data, and make trades.
- Supports SOCKS5 proxy for secure and private connections.
- Modular design for different gRPC services (e.g., Accounts, Trades, Offers).
Requirements
- Python 3.7+
grpcio
andgrpcio-tools
pysocks
for SOCKS5 proxy support (optional)- Haveno server running and accessible
Installation
- Clone the repository:
git clone https://github.com/yourusername/python-haveno-client.git
cd python-haveno-client
- Create a virtual environment (optional but recommended):
python3 -m venv venv
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
{{{bash}}}
Usage
1. Initialize the Haveno Client
Here is an example of how to initialize the client and connect to a Haveno server:
from haveno_client import HavenoClient
# Create a Haveno client instance and connect to the server
client = HavenoClient(host='localhost', port=50051, password='your_password', use_socks5=True, socks5_host='127.0.0.1', socks5_port=9050)
# Perform operations using the client
account_info = client.account_client.get_account_info('account_id')
print(account_info)
# Disconnect from the server
client.disconnect()
2. Connect to Multiple Servers
You can create multiple instances of HavenoClient
to connect to different Haveno servers:
client1 = HavenoClient(host='localhost', port=50051, password='password1')
client2 = HavenoClient(host='localhost', port=50052, password='password2', use_socks5=True)
# Perform operations with each client...
client1.disconnect()
client2.disconnect()
3. Using Modular Service Stubs
The client provides modular stubs for each gRPC service, such as AccountClient
, TradesClient
, and OffersClient
. Each stub can be accessed via the HavenoClient
instance:
# Example: Get account information
account_info = client.account_client.get_account_info('account_id')
Development
Building the Package
To compile the package for distribution:
python -m build
This will create the distribution files in the dist/
directory.
Running Tests
To run the test suite, use:
python -m unittest discover tests/
Contributing
- Fork the repository.
- Create a new branch:
git checkout -b my-feature-branch
. - Make your changes and commit them:
git commit -m 'Add new feature'
. - Push to the branch:
git push origin my-feature-branch
. - Submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE
file for more details.
Acknowledgments
- The Haveno development team for building the Haveno decentralized exchange.
- Contributors to the
grpcio
andpysocks
libraries. - THIS PROJECT IS A WORK IN PROGRESS, ITS IS NOT YET SUITABLE FOR PRODUCTION ENVIRONMENTS
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file haveno_client-0.1.1.tar.gz
.
File metadata
- Download URL: haveno_client-0.1.1.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e67bcf3755b95d1a0518959623c6bb051733ec1f4dd253666abed2b1178a9bbe |
|
MD5 | 7fc3948a444619322c5692cbf16b7347 |
|
BLAKE2b-256 | a931fcd816da67ff18d1df0982c8688c1854a36b6d95830969cd4e2118538cdf |
File details
Details for the file haveno_client-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: haveno_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 45.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9623a3f5333b4433c27e6a7911a7307562a0e94bca9090f950d89bfbcc360b52 |
|
MD5 | f400d43898a980a97b5c265a6108334e |
|
BLAKE2b-256 | 310326b047c1815a1536469ad53902eb7480be72eab41480410db69b5a0ff532 |