pub struct DeribitRawHttpClient { /* private fields */ }Expand description
Low-level Deribit HTTP client for raw API operations.
This client handles JSON-RPC 2.0 protocol, request signing, rate limiting, and retry logic. It returns venue-specific response types.
Implementations§
Source§impl DeribitRawHttpClient
impl DeribitRawHttpClient
Sourcepub fn new(
base_url: Option<String>,
is_testnet: bool,
timeout_secs: Option<u64>,
max_retries: Option<u32>,
retry_delay_ms: Option<u64>,
retry_delay_max_ms: Option<u64>,
proxy_url: Option<String>,
) -> Result<Self, DeribitHttpError>
pub fn new( base_url: Option<String>, is_testnet: bool, timeout_secs: Option<u64>, max_retries: Option<u32>, retry_delay_ms: Option<u64>, retry_delay_max_ms: Option<u64>, proxy_url: Option<String>, ) -> Result<Self, DeribitHttpError>
Sourcepub fn cancellation_token(&self) -> &CancellationToken
pub fn cancellation_token(&self) -> &CancellationToken
Get the cancellation token for this client.
Sourcepub fn with_credentials(
api_key: String,
api_secret: String,
base_url: Option<String>,
is_testnet: bool,
timeout_secs: Option<u64>,
max_retries: Option<u32>,
retry_delay_ms: Option<u64>,
retry_delay_max_ms: Option<u64>,
proxy_url: Option<String>,
) -> Result<Self, DeribitHttpError>
pub fn with_credentials( api_key: String, api_secret: String, base_url: Option<String>, is_testnet: bool, timeout_secs: Option<u64>, max_retries: Option<u32>, retry_delay_ms: Option<u64>, retry_delay_max_ms: Option<u64>, proxy_url: Option<String>, ) -> Result<Self, DeribitHttpError>
Creates a new DeribitRawHttpClient with explicit credentials.
§Errors
Returns an error if the HTTP client cannot be created.
Sourcepub fn new_with_env(
api_key: Option<String>,
api_secret: Option<String>,
is_testnet: bool,
timeout_secs: Option<u64>,
max_retries: Option<u32>,
retry_delay_ms: Option<u64>,
retry_delay_max_ms: Option<u64>,
proxy_url: Option<String>,
) -> Result<Self, DeribitHttpError>
pub fn new_with_env( api_key: Option<String>, api_secret: Option<String>, is_testnet: bool, timeout_secs: Option<u64>, max_retries: Option<u32>, retry_delay_ms: Option<u64>, retry_delay_max_ms: Option<u64>, proxy_url: Option<String>, ) -> Result<Self, DeribitHttpError>
Creates a new DeribitRawHttpClient with credentials from environment variables.
If api_key or api_secret are not provided, they will be loaded from environment:
- Mainnet:
DERIBIT_API_KEY,DERIBIT_API_SECRET - Testnet:
DERIBIT_TESTNET_API_KEY,DERIBIT_TESTNET_API_SECRET
§Errors
Returns an error if:
- The HTTP client cannot be created
- Credentials are not provided and environment variables are not set
Sourcepub async fn get_instruments(
&self,
params: GetInstrumentsParams,
) -> Result<DeribitJsonRpcResponse<Vec<DeribitInstrument>>, DeribitHttpError>
pub async fn get_instruments( &self, params: GetInstrumentsParams, ) -> Result<DeribitJsonRpcResponse<Vec<DeribitInstrument>>, DeribitHttpError>
Gets available trading instruments.
§Errors
Returns an error if the request fails or the response cannot be parsed.
Sourcepub async fn get_instrument(
&self,
params: GetInstrumentParams,
) -> Result<DeribitJsonRpcResponse<DeribitInstrument>, DeribitHttpError>
pub async fn get_instrument( &self, params: GetInstrumentParams, ) -> Result<DeribitJsonRpcResponse<DeribitInstrument>, DeribitHttpError>
Gets details for a specific trading instrument.
§Errors
Returns an error if the request fails or the response cannot be parsed.
Sourcepub async fn get_account_summaries(
&self,
params: GetAccountSummariesParams,
) -> Result<DeribitJsonRpcResponse<DeribitAccountSummariesResponse>, DeribitHttpError>
pub async fn get_account_summaries( &self, params: GetAccountSummariesParams, ) -> Result<DeribitJsonRpcResponse<DeribitAccountSummariesResponse>, DeribitHttpError>
Gets account summaries for all currencies.
§Errors
Returns an error if:
- Credentials are missing (
DeribitHttpError::MissingCredentials) - Authentication fails (invalid signature, expired timestamp)
- The request fails or the response cannot be parsed
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DeribitRawHttpClient
impl !RefUnwindSafe for DeribitRawHttpClient
impl Send for DeribitRawHttpClient
impl Sync for DeribitRawHttpClient
impl Unpin for DeribitRawHttpClient
impl !UnwindSafe for DeribitRawHttpClient
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more