A Python wrapper for seamless integration with Deribit's trading API, offering easy access to market data, account management, and trading operations.
Project description
deribit-wrapper
Overview
This Python script provides a comprehensive client for interacting with the Deribit API. It encapsulates functionality for both public and private endpoints, covering market data, account information, trading operations, and more. It supports both the production and test environments, making it suitable for developers at all stages of application development.
Features
- Environment Switching: Easily switch between the production and test environments.
- Market Data Retrieval: Access to market data including contract sizes, currencies, ticker information, book summaries, and historical data.
- Account Management: Functionality to authenticate, retrieve account summaries, positions, and transaction logs.
- Trading Operations: Support for placing buy and sell orders, including market and limit orders, as well as bulk ordering.
- Utility Functions: Helper functions to convert timestamps, retrieve specific instruments or markets, and calculate margins.
Installation
Install deribit-wrapper using pip:
pip install deribit-wrapper
Configuration
Instantiate the DeribitClient class with the appropriate parameters:
client_id: Your Deribit client ID.client_secret: Your Deribit client secret.simulated: Set toTrueto use the test environment orFalseto use the production environment.env: Choose between'test'and'prod'environments. Defaults to'prod'.
Example:
from deribit_wrapper import DeribitClient
client = DeribitClient(client_id='your_client_id', client_secret='your_client_secret')
Usage
Market Data
- Get Contract Size:
get_contract_size(asset) - Get Currencies:
get_currencies() - Get Ticker Information:
get_ticker(asset) - Get Book Summary by Currency:
get_complete_market_book() - and more...
Account Information
- Authenticate: Automatically handled during requests to private endpoints.
- Get Account Summary:
get_account_summary(currency) - Get Positions:
get_positions(currency, kind) - and more...
Trading
- Place an Order:
order(asset, amount, limit=None, label=None, reduce_only=False) - Place a Market Order:
market_order(asset, amount, label=None, reduce_only=False) - Bulk Orders:
bulk_order(orders, label=None) - and more...
Examples
- Retrieving Market Data:
ticker_info = client.get_ticker('BTC-25JUN21')
print(ticker_info)
- Placing a Market Order:
order_response = client.market_order('BTC-25JUN21', 1)
print(order_response)
- Getting Account Summary:
account_summary = client.get_account_summary('BTC')
print(account_summary)
Getting Help
If you encounter any issues or have questions about using deribit-wrapper,
please create an issue in the GitHub repository.
Contributing
Contributions to deribit-wrapper are welcome!
Whether it's bug reports, feature requests, or code contributions, please feel free to make a contribution. For code
contributions, please:
- Fork the repository.
- Create a new branch for your feature or fix.
- Submit a pull request.
Please ensure your code adheres to the project's coding standards and includes appropriate tests.
License
deribit-wrapper is released under the MIT License. See the LICENSE file for more details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deribit_wrapper-0.4.2.tar.gz.
File metadata
- Download URL: deribit_wrapper-0.4.2.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec9b72bb0e472c61880524259f01671a6dcb4d53cb98d3b8937f8c6c7e80fcdb
|
|
| MD5 |
113e792632fd944e0503e856adf1318b
|
|
| BLAKE2b-256 |
57d18a9fd17718333c1557617e42dcf829e484656b58cbd4e96ffe0c262f5ccb
|
File details
Details for the file deribit_wrapper-0.4.2-py3-none-any.whl.
File metadata
- Download URL: deribit_wrapper-0.4.2-py3-none-any.whl
- Upload date:
- Size: 23.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7167837df26533012f7a1ef9033d50d3c9a7faff0b8f3472a33e50f6836dbc5
|
|
| MD5 |
01c3a7cafb31f85fedde977dd5fb90e2
|
|
| BLAKE2b-256 |
88d0f29895b98f2e6c8e8119b77d3636896c49e8d0372f5014d9c5a4ad214f72
|