Struct lfest::Exchange[][src]

pub struct Exchange { /* fields omitted */ }

The main leveraged futures exchange for simulated trading

Implementations

impl Exchange[src]

pub fn new(config: Config) -> Exchange[src]

Create a new Exchange with the desired config and whether to use candles as infomation source

pub fn bid(&self) -> f64[src]

Return the bid price

pub fn ask(&self) -> f64[src]

Return the ask price

pub fn account(&self) -> &Account[src]

Return a reference to Account

pub fn account_mut(&mut self) -> &mut Account[src]

Return a mutable reference to Account

pub fn consume_trade(&mut self, trade: &Trade) -> (Vec<Order>, bool)[src]

Update the exchange state with a new trade.

Returns

executed orders true if position has been liquidated

pub fn consume_candle(&mut self, candle: &Candle) -> (Vec<Order>, bool)[src]

Update the exchange status with a new candle.

Returns

executed orders true if position has been liquidated

pub fn submit_order(&mut self, order: Order) -> Result<Order, OrderError>[src]

Submit a new order to the exchange. Returns the order with timestamp and id filled in or OrderError

Trait Implementations

impl Clone for Exchange[src]

impl Debug for Exchange[src]

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.