[][src]Struct luno_rs::LunoClient

pub struct LunoClient { /* fields omitted */ }

Implementations

impl LunoClient[src]

pub fn new<T: AsRef<str>>(key_id: T, key_secret: T) -> Self[src]

Create a new LunoClient

pub async fn list_balances(&self) -> Result<Vec<AccountBalance>, Error>[src]

List the balances on all assets linked to Luno profile

pub async fn list_orders(&self) -> Result<Vec<Order>, Error>[src]

List all orders on Luno profile

pub async fn get_ticker(
    &self,
    currency_pair: CurrencyPair
) -> Result<Ticker, Error>
[src]

Get ticker for currency pair

pub async fn list_tickers(&self) -> Result<Vec<Ticker>, Error>[src]

List tickers for all currency pairs

pub async fn list_tickers_for_currency_pairs(
    &self,
    currency_pairs: Vec<CurrencyPair>
) -> Result<Vec<Ticker>, Error>
[src]

List tickers for specific currency pairs

pub async fn get_order_book(
    &self,
    currency_pair: CurrencyPair
) -> Result<OrderBook, Error>
[src]

Get order book

pub async fn get_order_book_top_100(
    &self,
    currency_pair: CurrencyPair
) -> Result<OrderBook, Error>
[src]

Get top 100 bids and asks in order book

pub async fn list_trades(
    &self,
    currency_pair: CurrencyPair
) -> Result<Vec<Trade>, Error>
[src]

List the most recent Trades for the specified currency pair in the last 24 hours. At most 100 results are returned per call.

Example

use luno_rs::{LunoClient, CurrencyPair};
use std::env;

let client = LunoClient::new(key_id, key_secret);
let trades = client
    .list_trades(CurrencyPair::XBTNGN)
    .await
    .unwrap();
for (i, trade) in trades.iter().enumerate() {
    println!(
        "{} :: {} -> Type: {}, Price: {} Volume: {}",
        i, trade.timestamp, trade.order_type, trade.price, trade.volume
    );
}

pub async fn list_trades_since(
    &self,
    currency_pair: CurrencyPair,
    duration: Duration
) -> Result<Vec<Trade>, Error>
[src]

List trades since duration ago

Example

use luno_rs::{LunoClient, CurrencyPair};
use std::{env, time::Duration};

let client = LunoClient::new(key_id, key_secret);
let trades = client
    .list_trades_since(CurrencyPair::XBTNGN, Duration::from_secs(20))
    .await
    .unwrap();
for (i, trade) in trades.iter().enumerate() {
    println!(
        "{} :: {} -> Type: {}, Price: {} Volume: {}",
        i, trade.timestamp, trade.order_type, trade.price, trade.volume
    );
}

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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