pub struct RestClient { /* private fields */ }Expand description
Async client for the Bitvavo REST API.
Implementations§
Source§impl RestClient
impl RestClient
Sourcepub fn new(config: ClientConfig) -> Result<Self>
pub fn new(config: ClientConfig) -> Result<Self>
Creates a client from a configuration.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Creates a client from the BITVAVO_API_KEY and BITVAVO_API_SECRET
environment variables.
Sourcepub fn rate_limit_remaining(&self) -> i64
pub fn rate_limit_remaining(&self) -> i64
Returns the number of rate limit points left in the current window.
Sourcepub fn rate_limit_reset_at(&self) -> i64
pub fn rate_limit_reset_at(&self) -> i64
Returns the Unix time in milliseconds at which the rate limit resets.
Sourcepub async fn time(&self) -> Result<ServerTime>
pub async fn time(&self) -> Result<ServerTime>
GET /time. Returns the server time.
Sourcepub async fn market(&self, market: &str) -> Result<Market>
pub async fn market(&self, market: &str) -> Result<Market>
GET /markets?market={market}. Returns a single market.
Sourcepub async fn asset(&self, symbol: &str) -> Result<Asset>
pub async fn asset(&self, symbol: &str) -> Result<Asset>
GET /assets?symbol={symbol}. Returns a single asset.
Sourcepub async fn order_book(
&self,
market: &str,
depth: Option<u32>,
) -> Result<OrderBook>
pub async fn order_book( &self, market: &str, depth: Option<u32>, ) -> Result<OrderBook>
GET /{market}/book. Returns the order book for a market.
Sourcepub async fn public_trades(
&self,
market: &str,
params: &TradesParams,
) -> Result<Vec<PublicTrade>>
pub async fn public_trades( &self, market: &str, params: &TradesParams, ) -> Result<Vec<PublicTrade>>
GET /{market}/trades. Returns public trades for a market.
Sourcepub async fn candles(
&self,
market: &str,
interval: &str,
params: &CandlesParams,
) -> Result<Vec<Candle>>
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.
Sourcepub async fn ticker_prices(&self) -> Result<Vec<TickerPrice>>
pub async fn ticker_prices(&self) -> Result<Vec<TickerPrice>>
GET /ticker/price. Returns the latest price for all markets.
Sourcepub async fn ticker_price(&self, market: &str) -> Result<TickerPrice>
pub async fn ticker_price(&self, market: &str) -> Result<TickerPrice>
GET /ticker/price?market={market}. Returns the latest price for one market.
Sourcepub async fn ticker_books(&self) -> Result<Vec<TickerBook>>
pub async fn ticker_books(&self) -> Result<Vec<TickerBook>>
GET /ticker/book. Returns the best bid and ask for all markets.
Sourcepub async fn ticker_book(&self, market: &str) -> Result<TickerBook>
pub async fn ticker_book(&self, market: &str) -> Result<TickerBook>
GET /ticker/book?market={market}. Returns the best bid and ask for one market.
Sourcepub async fn tickers_24h(&self) -> Result<Vec<Ticker24h>>
pub async fn tickers_24h(&self) -> Result<Vec<Ticker24h>>
GET /ticker/24h. Returns 24 hour statistics for all markets.
Sourcepub async fn ticker_24h(&self, market: &str) -> Result<Ticker24h>
pub async fn ticker_24h(&self, market: &str) -> Result<Ticker24h>
GET /ticker/24h?market={market}. Returns 24 hour statistics for one market.
Sourcepub async fn place_order(&self, order: &OrderRequest) -> Result<Order>
pub async fn place_order(&self, order: &OrderRequest) -> Result<Order>
POST /order. Places a new order.
Sourcepub async fn get_order(&self, market: &str, order_id: &str) -> Result<Order>
pub async fn get_order(&self, market: &str, order_id: &str) -> Result<Order>
GET /order. Returns a single order.
Sourcepub async fn update_order(&self, update: &UpdateOrderRequest) -> Result<Order>
pub async fn update_order(&self, update: &UpdateOrderRequest) -> Result<Order>
PUT /order. Updates an open order.
Sourcepub async fn cancel_order(
&self,
market: &str,
order_id: &str,
operator_id: Option<i64>,
) -> Result<CanceledOrder>
pub async fn cancel_order( &self, market: &str, order_id: &str, operator_id: Option<i64>, ) -> Result<CanceledOrder>
DELETE /order. Cancels a single order.
Sourcepub async fn get_orders(
&self,
market: &str,
params: &OrdersParams,
) -> Result<Vec<Order>>
pub async fn get_orders( &self, market: &str, params: &OrdersParams, ) -> Result<Vec<Order>>
GET /orders. Returns orders for a market.
Sourcepub async fn cancel_orders(
&self,
market: Option<&str>,
) -> Result<Vec<CanceledOrder>>
pub async fn cancel_orders( &self, market: Option<&str>, ) -> Result<Vec<CanceledOrder>>
DELETE /orders. Cancels all open orders, optionally for one market.
Sourcepub async fn open_orders(&self, market: Option<&str>) -> Result<Vec<Order>>
pub async fn open_orders(&self, market: Option<&str>) -> Result<Vec<Order>>
GET /ordersOpen. Returns all open orders, optionally for one market.
Sourcepub async fn trades(
&self,
market: &str,
params: &TradesParams,
) -> Result<Vec<Trade>>
pub async fn trades( &self, market: &str, params: &TradesParams, ) -> Result<Vec<Trade>>
GET /trades. Returns your trades for a market.
Sourcepub async fn account(&self) -> Result<Account>
pub async fn account(&self) -> Result<Account>
GET /account. Returns account information including fee rates.
Sourcepub async fn fees(&self, market: Option<&str>) -> Result<FeeRates>
pub async fn fees(&self, market: Option<&str>) -> Result<FeeRates>
GET /account/fees. Returns fee rates, optionally for one market.
Sourcepub async fn balances(&self) -> Result<Vec<Balance>>
pub async fn balances(&self) -> Result<Vec<Balance>>
GET /balance. Returns balances for all assets.
Sourcepub async fn balance(&self, symbol: &str) -> Result<Vec<Balance>>
pub async fn balance(&self, symbol: &str) -> Result<Vec<Balance>>
GET /balance?symbol={symbol}. Returns the balance for one asset.
Sourcepub async fn deposit_assets(&self, symbol: &str) -> Result<DepositInfo>
pub async fn deposit_assets(&self, symbol: &str) -> Result<DepositInfo>
GET /depositAssets. Returns deposit details for an asset.
Sourcepub async fn withdraw_assets(
&self,
request: &WithdrawalRequest,
) -> Result<WithdrawalResponse>
pub async fn withdraw_assets( &self, request: &WithdrawalRequest, ) -> Result<WithdrawalResponse>
POST /withdrawal. Requests a withdrawal.
Sourcepub async fn deposit_history(
&self,
params: &HistoryParams,
) -> Result<Vec<DepositEntry>>
pub async fn deposit_history( &self, params: &HistoryParams, ) -> Result<Vec<DepositEntry>>
GET /depositHistory. Returns the deposit history.
Sourcepub async fn withdrawal_history(
&self,
params: &HistoryParams,
) -> Result<Vec<WithdrawalEntry>>
pub async fn withdrawal_history( &self, params: &HistoryParams, ) -> Result<Vec<WithdrawalEntry>>
GET /withdrawalHistory. Returns the withdrawal history.