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>;
}