pub struct Binance<Server> { /* private fields */ }Expand description
Generic Binance<Server> exchange.
§Notes
A Server ExchangeServer implementations exists for
BinanceSpot and BinanceFuturesUsd.
Trait Implementations§
Source§impl<Server> Connector for Binance<Server>where
Server: ExchangeServer,
impl<Server> Connector for Binance<Server>where
Server: ExchangeServer,
Source§const ID: ExchangeId = Server::ID
const ID: ExchangeId = Server::ID
Unique identifier for the exchange server being connected with.
Source§type Channel = BinanceChannel
type Channel = BinanceChannel
Type that defines how to translate a Barter
Subscription into an exchange specific
channel to be subscribed to. Read moreSource§type Market = BinanceMarket
type Market = BinanceMarket
Type that defines how to translate a Barter
Subscription into an exchange specific market that
can be subscribed to. Read moreSource§type Subscriber = WebSocketSubscriber
type Subscriber = WebSocketSubscriber
Subscriber type that establishes a connection with the exchange server, and actions
Subscriptions over the socket.Source§type SubValidator = WebSocketSubValidator
type SubValidator = WebSocketSubValidator
SubscriptionValidator type that listens to responses from the exchange server and
validates if the actioned Subscriptions were
successful.Source§type SubResponse = BinanceSubResponse
type SubResponse = BinanceSubResponse
Deserialisable type that the
Self::SubValidator expects to receive from the exchange server in
response to the Subscription Self::requests
sent over the WebSocket. Implements
Validator in order to determine if Self
communicates a successful Subscription outcome.Source§fn requests(
exchange_subs: Vec<ExchangeSub<Self::Channel, Self::Market>>,
) -> Vec<WsMessage> ⓘ
fn requests( exchange_subs: Vec<ExchangeSub<Self::Channel, Self::Market>>, ) -> Vec<WsMessage> ⓘ
Defines how to translate a collection of
ExchangeSubs into the WsMessage
subscription payloads sent to the exchange server.Source§fn expected_responses<InstrumentKey>(_: &Map<InstrumentKey>) -> usize
fn expected_responses<InstrumentKey>(_: &Map<InstrumentKey>) -> usize
Number of
Subscription responses expected from the
exchange server in responses to the requests send. Used to validate all
Subscriptions were accepted.Source§fn ping_interval() -> Option<PingInterval>
fn ping_interval() -> Option<PingInterval>
Defines
PingInterval of custom application-level
WebSocket pings for the exchange
server being connected with. Read moreSource§fn subscription_timeout() -> Duration
fn subscription_timeout() -> Duration
Expected
Duration the SubscriptionValidator will wait to receive all success
responses to actioned Subscription requests.Source§impl<'de, Server> Deserialize<'de> for Binance<Server>where
Server: ExchangeServer,
impl<'de, Server> Deserialize<'de> for Binance<Server>where
Server: ExchangeServer,
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<InstrumentKey> ExchangeTransformer<Binance<BinanceServerFuturesUsd>, InstrumentKey, OrderBooksL2> for BinanceFuturesUsdOrderBooksL2Transformer<InstrumentKey>
impl<InstrumentKey> ExchangeTransformer<Binance<BinanceServerFuturesUsd>, InstrumentKey, OrderBooksL2> for BinanceFuturesUsdOrderBooksL2Transformer<InstrumentKey>
Source§async fn init(
instrument_map: Map<InstrumentKey>,
initial_snapshots: &[MarketEvent<InstrumentKey, OrderBookEvent>],
_: UnboundedSender<WsMessage>,
) -> Result<Self, DataError>
async fn init( instrument_map: Map<InstrumentKey>, initial_snapshots: &[MarketEvent<InstrumentKey, OrderBookEvent>], _: UnboundedSender<WsMessage>, ) -> Result<Self, DataError>
Source§impl<InstrumentKey> ExchangeTransformer<Binance<BinanceServerSpot>, InstrumentKey, OrderBooksL2> for BinanceSpotOrderBooksL2Transformer<InstrumentKey>
impl<InstrumentKey> ExchangeTransformer<Binance<BinanceServerSpot>, InstrumentKey, OrderBooksL2> for BinanceSpotOrderBooksL2Transformer<InstrumentKey>
Source§async fn init(
instrument_map: Map<InstrumentKey>,
initial_snapshots: &[MarketEvent<InstrumentKey, OrderBookEvent>],
_: UnboundedSender<WsMessage>,
) -> Result<Self, DataError>
async fn init( instrument_map: Map<InstrumentKey>, initial_snapshots: &[MarketEvent<InstrumentKey, OrderBookEvent>], _: UnboundedSender<WsMessage>, ) -> Result<Self, DataError>
Source§impl<Server: Ord> Ord for Binance<Server>
impl<Server: Ord> Ord for Binance<Server>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<Server: PartialEq> PartialEq for Binance<Server>
impl<Server: PartialEq> PartialEq for Binance<Server>
Source§impl<Server: PartialOrd> PartialOrd for Binance<Server>
impl<Server: PartialOrd> PartialOrd for Binance<Server>
Source§impl<Server> Serialize for Binance<Server>where
Server: ExchangeServer,
impl<Server> Serialize for Binance<Server>where
Server: ExchangeServer,
Source§impl SnapshotFetcher<Binance<BinanceServerFuturesUsd>, OrderBooksL2> for BinanceFuturesUsdOrderBooksL2SnapshotFetcher
impl SnapshotFetcher<Binance<BinanceServerFuturesUsd>, OrderBooksL2> for BinanceFuturesUsdOrderBooksL2SnapshotFetcher
fn fetch_snapshots<Instrument>(
subscriptions: &[Subscription<BinanceFuturesUsd, Instrument, OrderBooksL2>],
) -> impl Future<Output = Result<Vec<MarketEvent<Instrument::Key, OrderBookEvent>>, SocketError>> + Sendwhere
Instrument: InstrumentData,
Subscription<BinanceFuturesUsd, Instrument, OrderBooksL2>: Identifier<BinanceMarket>,
Source§impl SnapshotFetcher<Binance<BinanceServerSpot>, OrderBooksL2> for BinanceSpotOrderBooksL2SnapshotFetcher
impl SnapshotFetcher<Binance<BinanceServerSpot>, OrderBooksL2> for BinanceSpotOrderBooksL2SnapshotFetcher
fn fetch_snapshots<Instrument>(
subscriptions: &[Subscription<BinanceSpot, Instrument, OrderBooksL2>],
) -> impl Future<Output = Result<Vec<MarketEvent<Instrument::Key, OrderBookEvent>>, SocketError>> + Sendwhere
Instrument: InstrumentData,
Subscription<BinanceSpot, Instrument, OrderBooksL2>: Identifier<BinanceMarket>,
Source§impl<Instrument, Server> StreamSelector<Instrument, OrderBooksL1> for Binance<Server>
impl<Instrument, Server> StreamSelector<Instrument, OrderBooksL1> for Binance<Server>
type SnapFetcher = NoInitialSnapshots
type Stream = ExchangeStream<WebSocketSerdeParser, SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>, StatelessTransformer<Binance<Server>, <Instrument as InstrumentData>::Key, OrderBooksL1, BinanceOrderBookL1>>
Source§impl<Instrument, Server> StreamSelector<Instrument, PublicTrades> for Binance<Server>
impl<Instrument, Server> StreamSelector<Instrument, PublicTrades> for Binance<Server>
type SnapFetcher = NoInitialSnapshots
type Stream = ExchangeStream<WebSocketSerdeParser, SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>, StatelessTransformer<Binance<Server>, <Instrument as InstrumentData>::Key, PublicTrades, BinanceTrade>>
impl<Server: Copy> Copy for Binance<Server>
impl<Server: Eq> Eq for Binance<Server>
impl<Server> StructuralPartialEq for Binance<Server>
Auto Trait Implementations§
impl<Server> Freeze for Binance<Server>
impl<Server> RefUnwindSafe for Binance<Server>where
Server: RefUnwindSafe,
impl<Server> Send for Binance<Server>where
Server: Send,
impl<Server> Sync for Binance<Server>where
Server: Sync,
impl<Server> Unpin for Binance<Server>where
Server: Unpin,
impl<Server> UnsafeUnpin for Binance<Server>
impl<Server> UnwindSafe for Binance<Server>where
Server: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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