Skip to main content

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 to True to use the test environment or False to 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

  1. Retrieving Market Data:
ticker_info = client.get_ticker('BTC-25JUN21')
print(ticker_info)
  1. Placing a Market Order:
order_response = client.market_order('BTC-25JUN21', 1)
print(order_response)
  1. 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:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deribit_wrapper-0.3.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deribit_wrapper-0.3.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file deribit_wrapper-0.3.0.tar.gz.

File metadata

  • Download URL: deribit_wrapper-0.3.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for deribit_wrapper-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2c94872e86cde2d7e9fe7be4fd38901adae0900fdb2aa23379c5939d2f1baa59
MD5 fc5a69764fc32be1e4e9ef07a1b3dcc1
BLAKE2b-256 6bfd7ec75c70c93eb2221dec1f5a664541bf5d2581c676b67c3c36d9ff2e90cd

See more details on using hashes here.

File details

Details for the file deribit_wrapper-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for deribit_wrapper-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 691007bc5668358c009a35dcbdbee207584fb1272a732d42b04bd6cc222980b1
MD5 801e20dd0e0c192787e69bae751f80a2
BLAKE2b-256 9dfa362b7b82147f01d102a18d88bbf88ae42c5ad56a99e824b218ba458f5347

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page