Struct coinbase_rs::public::Public
source · pub struct Public { /* private fields */ }
Implementations§
source§impl Public
impl Public
sourcepub fn new(uri: &str) -> Self
pub fn new(uri: &str) -> Self
Examples found in repository?
More examples
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
async fn main() {
let client = Public::new(MAIN_URL);
let currencies = client.currencies();
pin_mut!(currencies);
while let Some(currencies_result) = currencies.next().await {
for currency in currencies_result.unwrap() {
println!(
"Currency {} mininum size = {}",
currency.name, currency.min_size
);
}
}
}
sourcepub fn currencies<'a>(
&'a self
) -> impl Stream<Item = Result<Vec<Currency>>> + 'a
pub fn currencies<'a>( &'a self ) -> impl Stream<Item = Result<Vec<Currency>>> + 'a
Get currencies
List known currencies. Currency codes will conform to the ISO 4217 standard where possible. Currencies which have or had no representation in ISO 4217 may use a custom code (e.g. BTC).
https://developers.coinbase.com/api/v2#currencies
Examples found in repository?
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
async fn main() {
let client = Public::new(MAIN_URL);
let currencies = client.currencies();
pin_mut!(currencies);
while let Some(currencies_result) = currencies.next().await {
for currency in currencies_result.unwrap() {
println!(
"Currency {} mininum size = {}",
currency.name, currency.min_size
);
}
}
}
sourcepub async fn exchange_rates(&self, currency: &str) -> Result<ExchangeRates>
pub async fn exchange_rates(&self, currency: &str) -> Result<ExchangeRates>
Get exchange rates
Get current exchange rates. Default base currency is USD but it can be defined as any supported currency. Returned rates will define the exchange rate for one unit of the base currency.
https://developers.coinbase.com/api/v2#exchange-rates
sourcepub async fn buy_price(&self, pair: &str) -> Result<CurrencyPrice>
pub async fn buy_price(&self, pair: &str) -> Result<CurrencyPrice>
Get buy price
Get the total price to buy one bitcoin or ether.
https://developers.coinbase.com/api/v2#get-buy-price
sourcepub async fn sell_price(&self, currency_pair: &str) -> Result<CurrencyPrice>
pub async fn sell_price(&self, currency_pair: &str) -> Result<CurrencyPrice>
Get sell price
Get the total price to sell one bitcoin or ether.
https://developers.coinbase.com/api/v2#get-sell-price
sourcepub async fn spot_price(
&self,
currency_pair: &str,
_date: Option<NaiveDate>
) -> Result<CurrencyPrice>
pub async fn spot_price( &self, currency_pair: &str, _date: Option<NaiveDate> ) -> Result<CurrencyPrice>
Get spot price
Get the current market price for a currency pair. This is usually somewhere in between the buy and sell price.
https://developers.coinbase.com/api/v2#get-spot-price
sourcepub async fn current_time(&self) -> Result<Time>
pub async fn current_time(&self) -> Result<Time>
Get current time
Get the API server time.
https://developers.coinbase.com/api/v2#time