Skip to main content

RestClient

Struct RestClient 

Source
pub struct RestClient { /* private fields */ }
Expand description

Async client for the Bitvavo REST API.

Implementations§

Source§

impl RestClient

Source

pub fn new(config: ClientConfig) -> Result<Self>

Creates a client from a configuration.

Source

pub fn public() -> Result<Self>

Creates a client without credentials for public endpoints.

Source

pub fn from_env() -> Result<Self>

Creates a client from the BITVAVO_API_KEY and BITVAVO_API_SECRET environment variables.

Source

pub fn rate_limit_remaining(&self) -> i64

Returns the number of rate limit points left in the current window.

Source

pub fn rate_limit_reset_at(&self) -> i64

Returns the Unix time in milliseconds at which the rate limit resets.

Source

pub async fn time(&self) -> Result<ServerTime>

GET /time. Returns the server time.

Source

pub async fn markets(&self) -> Result<Vec<Market>>

GET /markets. Returns all markets.

Source

pub async fn market(&self, market: &str) -> Result<Market>

GET /markets?market={market}. Returns a single market.

Source

pub async fn assets(&self) -> Result<Vec<Asset>>

GET /assets. Returns all assets.

Source

pub async fn asset(&self, symbol: &str) -> Result<Asset>

GET /assets?symbol={symbol}. Returns a single asset.

Source

pub async fn order_book( &self, market: &str, depth: Option<u32>, ) -> Result<OrderBook>

GET /{market}/book. Returns the order book for a market.

Source

pub async fn public_trades( &self, market: &str, params: &TradesParams, ) -> Result<Vec<PublicTrade>>

GET /{market}/trades. Returns public trades for a market.

Source

pub async fn candles( &self, market: &str, interval: &str, params: &CandlesParams, ) -> Result<Vec<Candle>>

GET /{market}/candles. Returns OHLCV candles for a market. Supported intervals: 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d.

Source

pub async fn ticker_prices(&self) -> Result<Vec<TickerPrice>>

GET /ticker/price. Returns the latest price for all markets.

Source

pub async fn ticker_price(&self, market: &str) -> Result<TickerPrice>

GET /ticker/price?market={market}. Returns the latest price for one market.

Source

pub async fn ticker_books(&self) -> Result<Vec<TickerBook>>

GET /ticker/book. Returns the best bid and ask for all markets.

Source

pub async fn ticker_book(&self, market: &str) -> Result<TickerBook>

GET /ticker/book?market={market}. Returns the best bid and ask for one market.

Source

pub async fn tickers_24h(&self) -> Result<Vec<Ticker24h>>

GET /ticker/24h. Returns 24 hour statistics for all markets.

Source

pub async fn ticker_24h(&self, market: &str) -> Result<Ticker24h>

GET /ticker/24h?market={market}. Returns 24 hour statistics for one market.

Source

pub async fn place_order(&self, order: &OrderRequest) -> Result<Order>

POST /order. Places a new order.

Source

pub async fn get_order(&self, market: &str, order_id: &str) -> Result<Order>

GET /order. Returns a single order.

Source

pub async fn update_order(&self, update: &UpdateOrderRequest) -> Result<Order>

PUT /order. Updates an open order.

Source

pub async fn cancel_order( &self, market: &str, order_id: &str, operator_id: Option<i64>, ) -> Result<CanceledOrder>

DELETE /order. Cancels a single order.

Source

pub async fn get_orders( &self, market: &str, params: &OrdersParams, ) -> Result<Vec<Order>>

GET /orders. Returns orders for a market.

Source

pub async fn cancel_orders( &self, market: Option<&str>, ) -> Result<Vec<CanceledOrder>>

DELETE /orders. Cancels all open orders, optionally for one market.

Source

pub async fn open_orders(&self, market: Option<&str>) -> Result<Vec<Order>>

GET /ordersOpen. Returns all open orders, optionally for one market.

Source

pub async fn trades( &self, market: &str, params: &TradesParams, ) -> Result<Vec<Trade>>

GET /trades. Returns your trades for a market.

Source

pub async fn account(&self) -> Result<Account>

GET /account. Returns account information including fee rates.

Source

pub async fn fees(&self, market: Option<&str>) -> Result<FeeRates>

GET /account/fees. Returns fee rates, optionally for one market.

Source

pub async fn balances(&self) -> Result<Vec<Balance>>

GET /balance. Returns balances for all assets.

Source

pub async fn balance(&self, symbol: &str) -> Result<Vec<Balance>>

GET /balance?symbol={symbol}. Returns the balance for one asset.

Source

pub async fn deposit_assets(&self, symbol: &str) -> Result<DepositInfo>

GET /depositAssets. Returns deposit details for an asset.

Source

pub async fn withdraw_assets( &self, request: &WithdrawalRequest, ) -> Result<WithdrawalResponse>

POST /withdrawal. Requests a withdrawal.

Source

pub async fn deposit_history( &self, params: &HistoryParams, ) -> Result<Vec<DepositEntry>>

GET /depositHistory. Returns the deposit history.

Source

pub async fn withdrawal_history( &self, params: &HistoryParams, ) -> Result<Vec<WithdrawalEntry>>

GET /withdrawalHistory. Returns the withdrawal history.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more