pub struct Coinbase {
pub ids: SubscriptionIds,
}Expand description
Coinbase Subscriber & ExchangeTransformer implementor for the collection
of Spot & Futures data.
Fields
ids: SubscriptionIdsImplementations
sourceimpl Coinbase
impl Coinbase
sourcepub const CHANNEL_TRADES: &'static str = "matches"
pub const CHANNEL_TRADES: &'static str = "matches"
Coinbase trades channel name.
See docs: https://docs.cloud.coinbase.com/exchange/docs/websocket-channels#match
sourcepub fn build_channel_meta(
sub: &Subscription
) -> Result<(&str, String), SocketError>
pub fn build_channel_meta(
sub: &Subscription
) -> Result<(&str, String), SocketError>
Determine the Coinbase channel metadata associated with an input Barter Subscription.
This includes the Coinbase &str channel, and a String market identifier. Both are
used to build an Coinbase subscription payload.
Example Ok return: Ok(“matches”, “BTC-USD”) where channel == “matches” & market == “BTC-USD”.
sourcepub fn subscription(channel: &str, market: &str) -> WsMessage
pub fn subscription(channel: &str, market: &str) -> WsMessage
Build a Coinbase compatible subscription message using the channel & market provided.
sourcepub fn subscription_id(channel: &str, market: &str) -> SubscriptionId
pub fn subscription_id(channel: &str, market: &str) -> SubscriptionId
Build a Coinbase compatible SubscriptionId using the channel & market provided.
This is used to associate Coinbase data structures received over the WebSocket with it’s
original Barter Subscription.
eg/ SubscriptionId(“matches|ETH-USD”)
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Coinbase
impl<'de> Deserialize<'de> for Coinbase
sourcefn 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>,
sourceimpl ExchangeTransformer for Coinbase
impl ExchangeTransformer for Coinbase
sourceconst EXCHANGE: ExchangeId = ExchangeId::Coinbase
const EXCHANGE: ExchangeId = ExchangeId::Coinbase
ExchangeTransformer.sourcefn new(_: UnboundedSender<WsMessage>, ids: SubscriptionIds) -> Self
fn new(_: UnboundedSender<WsMessage>, ids: SubscriptionIds) -> Self
ExchangeTransformer using a transmitter to the WsSink and the
SubscriptionIds HashMap. Read moresourceimpl Subscriber for Coinbase
impl Subscriber for Coinbase
type SubResponse = CoinbaseSubResponse
type SubResponse = CoinbaseSubResponse
Subscriber expects to receive from the exchange in
response to Subscription requests. Implements Validator in order to determine
if the SubResponse communicates a successful outcome. Read moresourcefn base_url() -> &'static str
fn base_url() -> &'static str
sourcefn build_subscription_meta(
subscriptions: &[Subscription]
) -> Result<SubscriptionMeta, SocketError>
fn build_subscription_meta(
subscriptions: &[Subscription]
) -> Result<SubscriptionMeta, SocketError>
Subscriptions to build exchange specific subscription
payloads. Generates a SubscriptionIds Hashmap that is used by an ExchangeTransformer
to identify the Barter Subscriptions associated with received messages. Read moresourcefn subscribe<'life0, 'async_trait>(
subscriptions: &'life0 [Subscription]
) -> Pin<Box<dyn Future<Output = Result<(WebSocket, SubscriptionIds), SocketError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
fn subscribe<'life0, 'async_trait>(
subscriptions: &'life0 [Subscription]
) -> Pin<Box<dyn Future<Output = Result<(WebSocket, SubscriptionIds), SocketError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
WebSocket connection, actions the provided collection of Barter
Subscriptions, and validates that the Subscription were accepted by the exchange. Read moresourcefn validate<'life0, 'async_trait>(
ids: SubscriptionIds,
websocket: &'life0 mut WebSocket,
expected_responses: usize
) -> Pin<Box<dyn Future<Output = Result<SubscriptionIds, SocketError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
fn validate<'life0, 'async_trait>(
ids: SubscriptionIds,
websocket: &'life0 mut WebSocket,
expected_responses: usize
) -> Pin<Box<dyn Future<Output = Result<SubscriptionIds, SocketError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Send + 'async_trait,
WebSocket connection to consume Subscription responses and
validate their outcomes. Read moresourcefn subscription_timeout() -> Duration
fn subscription_timeout() -> Duration
Duration in which the exchange will respond to all actioned
WebSocket Subscription requests. Read more