Struct lfest::Exchange [−][src]
pub struct Exchange { /* fields omitted */ }
The main leveraged futures exchange for simulated trading
Implementations
impl Exchange
[src]
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 RefUnwindSafe for Exchange
impl UnwindSafe for Exchange
impl UnwindSafe for Exchange