[][src]Struct cxmr_broker::Broker

pub struct Broker { /* fields omitted */ }

Exchanges broker.

Methods

impl Broker[src]

pub fn new(accounts: Vec<BrokerAccount>, exchanges: BrokerExchanges) -> Self[src]

Creates new broker.

pub fn new_simulation(exchanges: BrokerExchanges) -> Self[src]

Creates new broker for simulation.

pub fn accounts(&self) -> &[BrokerAccount][src]

Returns all broker accounts.

pub fn orders(&self) -> &OrderMap[src]

Returns all broker orders.

pub fn exchanges(&self) -> Vec<&ExchangeBroker>[src]

Returns all exchanges brokers.

pub fn get(&self, exchange: &Exchange) -> Option<&ExchangeBroker>[src]

Returns broker exchange by it's identifier.

pub fn get_market(&self, market: Market) -> Option<&MarketBroker>[src]

Gets market by exchange and currency pair.

pub fn get_market_mut(&mut self, market: Market) -> Option<&mut MarketBroker>[src]

Gets market by exchange and currency pair.

pub fn get_ask_price(&self, market: Market) -> Option<u64>[src]

Gets ask price on a market.

pub fn get_bid_price(&self, market: Market) -> Option<u64>[src]

Gets bid price on a market.

pub fn update(&mut self, events: Events) -> Result<Events, Error>[src]

Updates order book and accounts.

pub fn update_private<'a, I>(&mut self, acc: &str, events: Vec<UserEvent>) where
    I: Iterator<Item = &'a UserEvent>, 
[src]

Updates order book and accounts.

pub fn user_data_key(&self, name: &str) -> Option<String>[src]

Returns user data stream key for account, if any.

pub fn set_user_data_key(&mut self, name: String, key: String)[src]

Sets user data stream key for account.

pub fn insert_orders(&mut self, account: String, orders: Vec<MarketOrder>)[src]

Inserts orders under account name.

pub fn update_from_row(
    &mut self,
    market: Market,
    row: &EventData
) -> Result<(), Error>
[src]

Updates market order books from data rows.

pub fn update_from_rows(
    &mut self,
    market: Market,
    rows: &Vec<EventData>
) -> Result<(), Error>
[src]

Updates market order books from data rows.

pub fn update_orderbook(
    &mut self,
    market: Market,
    orderbook: OrderBook
) -> Result<(), Error>
[src]

Updates market order books.

pub fn into_shared(self) -> SharedBroker[src]

Wraps broker in an Arc and RwLock.

Auto Trait Implementations

impl !RefUnwindSafe for Broker

impl Send for Broker

impl Sync for Broker

impl Unpin for Broker

impl !UnwindSafe for Broker

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, 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.