pub struct PublicClient { /* private fields */ }Expand description
Used to query and subscribe to public market events.
Implementations§
Source§impl PublicClient
impl PublicClient
pub async fn new( private_key: &str, public_key: &str, ) -> Result<PublicClient, Error>
pub async fn authenticate(&self) -> Result<(), Error>
pub async fn subscriptions(&self, channel: &str) -> Result<Response, Error>
Sourcepub async fn subscribe_trades(
&self,
sym: &[&str],
) -> Result<(Receiver<TradeMap>, Subs), Error>
pub async fn subscribe_trades( &self, sym: &[&str], ) -> Result<(Receiver<TradeMap>, Subs), Error>
registers a subscription to the trades channel.
let (tx, res) = client.subscribe_trades().await?;
println!("current subscriptions: {:?}", res);
while Some(trade) = tx.recv().await {
println!("{:?}", trade);
}pub async fn subscribe_full_orderbook( &self, symbols: &[&str], ) -> Result<(Receiver<HashMap<String, Orderbook>>, Subs), Error>
Sourcepub async fn subscribe_partial_orderbook(
&self,
symbols: &[&str],
depth: &str,
speed: &str,
) -> Result<(Receiver<HashMap<String, Orderbook>>, Subs), Error>
pub async fn subscribe_partial_orderbook( &self, symbols: &[&str], depth: &str, speed: &str, ) -> Result<(Receiver<HashMap<String, Orderbook>>, Subs), Error>
The only valid speeds are “100ms”, “500ms” and “1000ms”. The valid depths are top, D5, D10, D20
Sourcepub async fn subscribe_ticker(
&self,
symbols: &[&str],
speed: &str,
) -> Result<(Receiver<Ticker>, Subs), Error>
pub async fn subscribe_ticker( &self, symbols: &[&str], speed: &str, ) -> Result<(Receiver<Ticker>, Subs), Error>
valid channels are 1s and 3s
pub async fn subscribe_top_order( &self, symbols: &[&str], speed: &str, ) -> Result<(Receiver<TopOrderMap>, Subs), Error>
Trait Implementations§
Source§impl Clone for PublicClient
impl Clone for PublicClient
Source§fn clone(&self) -> PublicClient
fn clone(&self) -> PublicClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PublicClient
impl !RefUnwindSafe for PublicClient
impl Send for PublicClient
impl Sync for PublicClient
impl Unpin for PublicClient
impl !UnwindSafe for PublicClient
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