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.env: Which Deribit environment to talk to,'test'or'prod'. Defaults to'prod'.simulated: Defaults toTrue. Every state-changing trading call —order,market_order,bulk_order,close_positionandcancel_orders— returns a simulated result instead of submitting anything. It does not change the environment.
⚠️
simulatedis not an environment switch.envalone decides whether you are on production or test, and it defaults to'prod'. A client left at the defaults reads real production data (balances, positions, transaction logs); only the trading calls above are simulated. To keep everything off production, passenv="test".
Example — production reads, simulated order placement (the defaults):
from deribit_wrapper import DeribitClient
client = DeribitClient(client_id="your_client_id", client_secret="your_client_secret")
Example — fully isolated on the test environment:
client = DeribitClient(
env="test",
client_id="your_test_client_id",
client_secret="your_test_client_secret",
)
Example — placing real orders (production, nothing simulated):
client = DeribitClient(
client_id="your_client_id",
client_secret="your_client_secret",
simulated=False,
)
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)— simulated whensimulated=True - Place a Market Order:
market_order(asset, amount, label=None, reduce_only=False)— simulated whensimulated=True - Bulk Orders:
bulk_order(orders, label=None)— simulated whensimulated=True - Close a Position:
close_position(asset, limit=None)— simulated whensimulated=True - Cancel Orders:
cancel_orders(currency=None, kind=None, order_type=None, label=None)— simulated whensimulated=True - 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.
Metadata
Release files for deribit-wrapper 0.6.4
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 |
|---|---|---|---|---|
| deribit_wrapper-0.6.4.tar.gz | 36.0 kB | Without provenance | Details for deribit_wrapper-0.6.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deribit_wrapper-0.6.4-py3-none-any.whl | Python 3 | none | any | Details for deribit_wrapper-0.6.4-py3-none-any.whl |
Total release size: 61.1 kB
Release files / deribit_wrapper-0.6.4.tar.gz
| Download URL | deribit_wrapper-0.6.4.tar.gz |
|---|---|
| Size | 36.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63f2e36ccff02332b485f5faf260431c875eca10e03dac3562a9407c6ecde884
|
|
BLAKE2b-256 checksum How to use checksums |
8296760812da0a0e86cfabe1b10ec7311f26f96f560ec207d4bbee9c69b5a4df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / deribit_wrapper-0.6.4-py3-none-any.whl
| Download URL | deribit_wrapper-0.6.4-py3-none-any.whl |
|---|---|
| Size | 25.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa07f2f531f037cd7e3452fd500abb3f228ddf7b54d59dcc4b87f06e569a2d59
|
|
BLAKE2b-256 checksum How to use checksums |
cc92e4c77cf3cda675506c3c13d01e17913af0a63555b5ddedfce54281f56919
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for deribit-wrapper 0.6.4
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.