pub struct BinanceHttpClient { /* private fields */ }Expand description
Higher-level HTTP client providing typed endpoints and instrument caching.
Implementations§
Source§impl BinanceHttpClient
impl BinanceHttpClient
Sourcepub fn new(
product_type: BinanceProductType,
environment: BinanceEnvironment,
api_key: Option<String>,
api_secret: Option<String>,
base_url_override: Option<String>,
recv_window: Option<u64>,
timeout_secs: Option<u64>,
proxy_url: Option<String>,
) -> BinanceHttpResult<Self>
pub fn new( product_type: BinanceProductType, environment: BinanceEnvironment, api_key: Option<String>, api_secret: Option<String>, base_url_override: Option<String>, recv_window: Option<u64>, timeout_secs: Option<u64>, proxy_url: Option<String>, ) -> BinanceHttpResult<Self>
Creates a new BinanceHttpClient wrapping the raw client with an instrument cache.
§Errors
Returns an error if the underlying HTTP client cannot be created or credentials are invalid.
Sourcepub const fn raw(&self) -> &BinanceRawHttpClient
pub const fn raw(&self) -> &BinanceRawHttpClient
Returns a reference to the underlying raw client.
Sourcepub async fn server_time(&self) -> BinanceHttpResult<BinanceServerTime>
pub async fn server_time(&self) -> BinanceHttpResult<BinanceServerTime>
Returns server time for the configured product type.
Sourcepub async fn exchange_info(&self) -> BinanceHttpResult<()>
pub async fn exchange_info(&self) -> BinanceHttpResult<()>
Fetches exchange information and populates the instrument cache.
Sourcepub async fn get_instrument(
&self,
symbol: &str,
) -> BinanceHttpResult<Option<BinanceInstrument>>
pub async fn get_instrument( &self, symbol: &str, ) -> BinanceHttpResult<Option<BinanceInstrument>>
Retrieves an instrument from cache, optionally fetching exchange info first.
Sourcepub async fn ticker_24h(
&self,
params: &BinanceTicker24hrParams,
) -> BinanceHttpResult<BinanceTicker24hrEither>
pub async fn ticker_24h( &self, params: &BinanceTicker24hrParams, ) -> BinanceHttpResult<BinanceTicker24hrEither>
24h ticker endpoint.
Sourcepub async fn book_ticker(
&self,
params: &BinanceBookTickerParams,
) -> BinanceHttpResult<Vec<BinanceBookTicker>>
pub async fn book_ticker( &self, params: &BinanceBookTickerParams, ) -> BinanceHttpResult<Vec<BinanceBookTicker>>
Book ticker endpoint.
Sourcepub async fn price_ticker(
&self,
params: &BinancePriceTickerParams,
) -> BinanceHttpResult<Vec<BinancePriceTicker>>
pub async fn price_ticker( &self, params: &BinancePriceTickerParams, ) -> BinanceHttpResult<Vec<BinancePriceTicker>>
Price ticker endpoint.
Sourcepub async fn depth(
&self,
params: &BinanceDepthParams,
) -> BinanceHttpResult<BinanceOrderBook>
pub async fn depth( &self, params: &BinanceDepthParams, ) -> BinanceHttpResult<BinanceOrderBook>
Order book depth endpoint.
Trait Implementations§
Source§impl Clone for BinanceHttpClient
impl Clone for BinanceHttpClient
Source§fn clone(&self) -> BinanceHttpClient
fn clone(&self) -> BinanceHttpClient
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BinanceHttpClient
impl !RefUnwindSafe for BinanceHttpClient
impl Send for BinanceHttpClient
impl Sync for BinanceHttpClient
impl Unpin for BinanceHttpClient
impl !UnwindSafe for BinanceHttpClient
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
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)§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>
Converts
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>
Converts
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