nautilus_model::accounts::base

Trait Account

Source
pub trait Account: 'static + Send {
Show 22 methods // Required methods fn id(&self) -> AccountId; fn account_type(&self) -> AccountType; fn base_currency(&self) -> Option<Currency>; fn is_cash_account(&self) -> bool; fn is_margin_account(&self) -> bool; fn calculated_account_state(&self) -> bool; fn balance_total(&self, currency: Option<Currency>) -> Option<Money>; fn balances_total(&self) -> HashMap<Currency, Money>; fn balance_free(&self, currency: Option<Currency>) -> Option<Money>; fn balances_free(&self) -> HashMap<Currency, Money>; fn balance_locked(&self, currency: Option<Currency>) -> Option<Money>; fn balances_locked(&self) -> HashMap<Currency, Money>; fn last_event(&self) -> Option<AccountState>; fn events(&self) -> Vec<AccountState>; fn event_count(&self) -> usize; fn currencies(&self) -> Vec<Currency>; fn starting_balances(&self) -> HashMap<Currency, Money>; fn balances(&self) -> HashMap<Currency, AccountBalance>; fn apply(&mut self, event: AccountState); fn calculate_balance_locked( &mut self, instrument: InstrumentAny, side: OrderSide, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, ) -> Result<Money>; fn calculate_pnls( &self, instrument: InstrumentAny, fill: OrderFilled, position: Option<Position>, ) -> Result<Vec<Money>>; fn calculate_commission( &self, instrument: InstrumentAny, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool>, ) -> Result<Money>;
}

Required Methods§

Source

fn id(&self) -> AccountId

Source

fn account_type(&self) -> AccountType

Source

fn base_currency(&self) -> Option<Currency>

Source

fn is_cash_account(&self) -> bool

Source

fn is_margin_account(&self) -> bool

Source

fn calculated_account_state(&self) -> bool

Source

fn balance_total(&self, currency: Option<Currency>) -> Option<Money>

Source

fn balances_total(&self) -> HashMap<Currency, Money>

Source

fn balance_free(&self, currency: Option<Currency>) -> Option<Money>

Source

fn balances_free(&self) -> HashMap<Currency, Money>

Source

fn balance_locked(&self, currency: Option<Currency>) -> Option<Money>

Source

fn balances_locked(&self) -> HashMap<Currency, Money>

Source

fn last_event(&self) -> Option<AccountState>

Source

fn events(&self) -> Vec<AccountState>

Source

fn event_count(&self) -> usize

Source

fn currencies(&self) -> Vec<Currency>

Source

fn starting_balances(&self) -> HashMap<Currency, Money>

Source

fn balances(&self) -> HashMap<Currency, AccountBalance>

Source

fn apply(&mut self, event: AccountState)

Source

fn calculate_balance_locked( &mut self, instrument: InstrumentAny, side: OrderSide, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, ) -> Result<Money>

Source

fn calculate_pnls( &self, instrument: InstrumentAny, fill: OrderFilled, position: Option<Position>, ) -> Result<Vec<Money>>

Source

fn calculate_commission( &self, instrument: InstrumentAny, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool>, ) -> Result<Money>

Implementors§