pub struct BinanceSpotHttpClient { /* private fields */ }Expand description
High-level HTTP client for Binance Spot API.
Wraps BinanceRawSpotHttpClient and provides domain-level methods:
- Simple types (ping, server_time): Pass through from raw client.
- Complex types (instruments, orders): Transform to Nautilus domain types.
Implementations§
Source§impl BinanceSpotHttpClient
impl BinanceSpotHttpClient
Sourcepub fn new(
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>,
) -> BinanceSpotHttpResult<Self>
pub fn new( 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>, ) -> BinanceSpotHttpResult<Self>
Creates a new Binance Spot HTTP client.
§Errors
Returns an error if the underlying HTTP client cannot be created.
Sourcepub fn inner(&self) -> &BinanceRawSpotHttpClient
pub fn inner(&self) -> &BinanceRawSpotHttpClient
Returns a reference to the inner raw client.
Sourcepub const fn schema_version() -> u16
pub const fn schema_version() -> u16
Returns the SBE schema version.
Sourcepub async fn ping(&self) -> BinanceSpotHttpResult<()>
pub async fn ping(&self) -> BinanceSpotHttpResult<()>
Sourcepub async fn server_time(&self) -> BinanceSpotHttpResult<i64>
pub async fn server_time(&self) -> BinanceSpotHttpResult<i64>
Returns the server time in microseconds since epoch.
Note: SBE provides microsecond precision vs JSON’s milliseconds.
§Errors
Returns an error if the request fails or SBE decoding fails.
Sourcepub async fn depth(
&self,
params: &DepthParams,
) -> BinanceSpotHttpResult<BinanceDepth>
pub async fn depth( &self, params: &DepthParams, ) -> BinanceSpotHttpResult<BinanceDepth>
Returns order book depth for a symbol.
§Errors
Returns an error if the request fails or SBE decoding fails.
Sourcepub async fn trades(
&self,
params: &TradesParams,
) -> BinanceSpotHttpResult<BinanceTrades>
pub async fn trades( &self, params: &TradesParams, ) -> BinanceSpotHttpResult<BinanceTrades>
Returns recent trades for a symbol.
§Errors
Returns an error if the request fails or SBE decoding fails.
Trait Implementations§
Source§impl Clone for BinanceSpotHttpClient
impl Clone for BinanceSpotHttpClient
Source§fn clone(&self) -> BinanceSpotHttpClient
fn clone(&self) -> BinanceSpotHttpClient
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 BinanceSpotHttpClient
impl !RefUnwindSafe for BinanceSpotHttpClient
impl Send for BinanceSpotHttpClient
impl Sync for BinanceSpotHttpClient
impl Unpin for BinanceSpotHttpClient
impl !UnwindSafe for BinanceSpotHttpClient
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