DeribitEx (deribit_ex v0.2.0)
View SourceDeribitEx is an Elixir library for interacting with the Deribit cryptocurrency exchange API via WebSocket.
This library handles the following:
- Authentication and token management
- WebSocket communication
- JSON-RPC request/response formatting
- Subscriptions and notifications
- Rate limiting
- Time synchronization
- Cancel-on-disconnect safety
The main entry point for most users will be DeribitEx.Client
.
Architecture
DeribitEx consists of several components:
- Client: High-level API interface for interacting with Deribit
- RPC: Manages JSON-RPC message formatting and parsing
- Adapter: Implements WebsockexNova adapter for WebSocket communication
- TokenManager: Handles authentication token lifecycle
- ResubscriptionHandler: Manages automatic channel resubscription
- TimeSyncService: Synchronizes local and server time
- RateLimitHandler: Implements adaptive rate limiting
Usage Example
# Connect to Deribit
{:ok, client} = DeribitEx.Client.connect(
client_id: "your_client_id",
client_secret: "your_client_secret"
)
# Make requests
{:ok, instruments} = DeribitEx.Client.get_instruments(client, %{
currency: "BTC"
})
# Subscribe to channels
{:ok, sub_id} = DeribitEx.Client.subscribe_book(
client,
"BTC-PERPETUAL",
self()
)
See the README and module documentation for more details.
Summary
Functions
@spec version() :: String.t()
Returns the current version of the DeribitEx library.
Examples
iex> DeribitEx.version()
"0.1.0"