pub struct BarBroker<F: FillModel> { /* private fields */ }Implementations§
Source§impl<F: FillModel> BarBroker<F>
impl<F: FillModel> BarBroker<F>
pub fn new(fills: F, initial_capital: f64) -> Self
pub fn with_commission(self, commission: Commission) -> Self
pub fn with_sizing(self, sizing: Sizing) -> Self
pub fn with_mintick(self, mintick: f64) -> Self
pub fn with_pyramiding(self, pyramiding: usize) -> Self
Trait Implementations§
Source§impl<F: FillModel> Broker for BarBroker<F>
impl<F: FillModel> Broker for BarBroker<F>
Source§fn submit(&mut self, order: Order)
fn submit(&mut self, order: Order)
Submit an order, replacing any pending one with the same id.
Source§fn submit_exit(&mut self, exit: Exit)
fn submit_exit(&mut self, exit: Exit)
Submit a stop-loss / take-profit bracket, replacing any with the same id.
Source§fn cancel_all(&mut self)
fn cancel_all(&mut self)
Cancel every pending order.
Source§fn advance(&mut self, bar: &Bar)
fn advance(&mut self, bar: &Bar)
Fill whatever
bar allows, updating the position and trade log.Source§fn initial_capital(&self) -> f64
fn initial_capital(&self) -> f64
The capital the account started with, before any trade or commission.
Source§fn equity(&self, price: f64) -> f64
fn equity(&self, price: f64) -> f64
Account value: capital plus realised and unrealised profit, marked at
price (typically the latest close).Source§fn open_trades(&self) -> Vec<&Trade>
fn open_trades(&self) -> Vec<&Trade>
Trades still open, oldest first.
Source§fn closed_trades(&self) -> &[Trade]
fn closed_trades(&self) -> &[Trade]
Trades already closed, in the order they closed.
Auto Trait Implementations§
impl<F> Freeze for BarBroker<F>where
F: Freeze,
impl<F> RefUnwindSafe for BarBroker<F>where
F: RefUnwindSafe,
impl<F> Send for BarBroker<F>where
F: Send,
impl<F> Sync for BarBroker<F>where
F: Sync,
impl<F> Unpin for BarBroker<F>where
F: Unpin,
impl<F> UnsafeUnpin for BarBroker<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for BarBroker<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more