pub mod client;
pub mod error;
pub mod event;
#[cfg(any(test, feature = "test-server"))]
#[doc(hidden)]
pub mod fixtures;
mod protocol;
#[cfg(test)]
mod scripted;
pub mod stream;
pub mod supervised;
use std::{fmt, time::Duration};
pub use client::UsdmWs;
pub use error::{StopCause, UsdmWsError};
pub use event::{
AggTradeEvent, BookTickerEvent, KlineBar, KlineEvent, MarkPriceEvent, PartialDepthEvent,
Payload, SymbolType, TickerEvent, Update,
};
pub use stream::{DepthLevels, DepthSpeed, InvalidStreamName, StreamName};
pub use supervised::{DisconnectReason, Event, MembershipHandle, SupervisedUsdmWs, UsdmWsBuilder};
pub const USDM_WS_BASE: &str = "wss://fstream.binance.com";
pub const MAX_STREAMS_PER_CONNECTION: usize = crate::shared::ws::MAX_STREAMS_PER_CONNECTION;
pub const MAX_NAMES_PER_REQUEST: usize = 200;
pub const MIN_REQUEST_INTERVAL: Duration = Duration::from_millis(200);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum StreamPath {
Market,
Public,
}
impl StreamPath {
pub const ALL: &'static [Self] = &[Self::Market, Self::Public];
pub fn as_str(self) -> &'static str {
match self {
Self::Market => "market",
Self::Public => "public",
}
}
pub(crate) fn url(self, base: &str) -> String {
format!("{}/{}/stream", base.trim_end_matches('/'), self.as_str())
}
}
impl fmt::Display for StreamPath {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}