pub struct BinanceRawSpotHttpClient { /* private fields */ }Expand description
Low-level HTTP client for Binance Spot REST API with SBE encoding.
Handles:
- Base URL resolution by environment.
- Optional HMAC SHA256 signing for private endpoints.
- Rate limiting using Spot API quotas.
- SBE decoding to Binance-specific response types.
Methods are named to match Binance API endpoints and return venue-specific types (decoded from SBE).
Implementations§
Source§impl BinanceRawSpotHttpClient
impl BinanceRawSpotHttpClient
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 raw HTTP client.
§Errors
Returns an error if the underlying HttpClient fails to build.
Sourcepub const fn schema_version() -> u16
pub const fn schema_version() -> u16
Returns the SBE schema version.
Sourcepub async fn get<P>(
&self,
path: &str,
params: Option<&P>,
) -> BinanceSpotHttpResult<Vec<u8>>
pub async fn get<P>( &self, path: &str, params: Option<&P>, ) -> BinanceSpotHttpResult<Vec<u8>>
Performs a GET request and returns raw response bytes.
Sourcepub async fn get_signed<P>(
&self,
path: &str,
params: Option<&P>,
) -> BinanceSpotHttpResult<Vec<u8>>
pub async fn get_signed<P>( &self, path: &str, params: Option<&P>, ) -> BinanceSpotHttpResult<Vec<u8>>
Performs a signed GET request and returns raw response bytes.
Sourcepub async fn post_order<P>(
&self,
path: &str,
params: Option<&P>,
) -> BinanceSpotHttpResult<Vec<u8>>
pub async fn post_order<P>( &self, path: &str, params: Option<&P>, ) -> BinanceSpotHttpResult<Vec<u8>>
Performs a signed POST request for order operations.
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 BinanceRawSpotHttpClient
impl Clone for BinanceRawSpotHttpClient
Source§fn clone(&self) -> BinanceRawSpotHttpClient
fn clone(&self) -> BinanceRawSpotHttpClient
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BinanceRawSpotHttpClient
impl !RefUnwindSafe for BinanceRawSpotHttpClient
impl Send for BinanceRawSpotHttpClient
impl Sync for BinanceRawSpotHttpClient
impl Unpin for BinanceRawSpotHttpClient
impl !UnwindSafe for BinanceRawSpotHttpClient
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> 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)
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>
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