Struct kraken_ws_client::client::PublicClient

source ·
pub struct PublicClient { /* private fields */ }

Implementations§

source§

impl PublicClient

source

pub fn book_delta_events(&mut self) -> impl Stream<Item = BookEvent>

Examples found in repository?
examples/book.rs (line 15)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
async fn main() {
    let mut client = kraken_ws_client::connect_public()
        .await
        .expect("cannot connect");

    client
        .send(SubscribeBookRequest::symbol("BTC/USD").depth(Depth::D10))
        .await
        .expect("cannot send request");

    while let Some(event) = client.book_delta_events().next().await {
        dbg!(&event);
    }
}
source§

impl PublicClient

source

pub fn instrument_events(&mut self) -> impl Stream<Item = InstrumentEvent>

source§

impl PublicClient

source

pub fn ticker_events(&mut self) -> impl Stream<Item = TickerEvent>

Examples found in repository?
examples/ticker.rs (line 15)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
async fn main() {
    let mut client = kraken_ws_client::connect_public()
        .await
        .expect("cannot connect");

    client
        .send(SubscribeTickerRequest::symbol("BTC/USD"))
        .await
        .expect("cannot send request");

    while let Some(event) = client.ticker_events().next().await {
        dbg!(&event);
    }
}
source§

impl PublicClient

source

pub fn trade_events(&mut self) -> impl Stream<Item = TradeEvent>

source§

impl PublicClient

source

pub fn ohlc_events(&mut self) -> impl Stream<Item = OhlcEvent>

source§

impl PublicClient

source

pub async fn connect() -> Result<Self>

source

pub async fn send<P>(&mut self, req: PublicRequest<P>) -> Result<()>
where P: Serialize,

Examples found in repository?
examples/ticker.rs (line 11)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
async fn main() {
    let mut client = kraken_ws_client::connect_public()
        .await
        .expect("cannot connect");

    client
        .send(SubscribeTickerRequest::symbol("BTC/USD"))
        .await
        .expect("cannot send request");

    while let Some(event) = client.ticker_events().next().await {
        dbg!(&event);
    }
}
More examples
Hide additional examples
examples/book.rs (line 11)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
async fn main() {
    let mut client = kraken_ws_client::connect_public()
        .await
        .expect("cannot connect");

    client
        .send(SubscribeBookRequest::symbol("BTC/USD").depth(Depth::D10))
        .await
        .expect("cannot send request");

    while let Some(event) = client.book_delta_events().next().await {
        dbg!(&event);
    }
}
source

pub fn messages(&mut self) -> Receiver<String>

Trait Implementations§

source§

impl Debug for PublicClient

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V