Struct lfest::Exchange [−][src]
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
Auto Trait Implementations
impl RefUnwindSafe for Exchange
impl Send for Exchange
impl Sync for Exchange
impl Unpin for Exchange
impl UnwindSafe for Exchange
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,