pub enum AccountAny {
Margin(MarginAccount),
Cash(CashAccount),
}
Variants§
Margin(MarginAccount)
Cash(CashAccount)
Implementations§
Source§impl AccountAny
impl AccountAny
pub fn id(&self) -> AccountId
pub fn last_event(&self) -> Option<AccountState>
pub fn events(&self) -> Vec<AccountState>
pub fn apply(&mut self, event: AccountState)
pub fn balances(&self) -> HashMap<Currency, AccountBalance>
pub fn balances_locked(&self) -> HashMap<Currency, Money>
pub fn base_currency(&self) -> Option<Currency>
Sourcepub fn from_events(events: Vec<AccountState>) -> Result<Self>
pub fn from_events(events: Vec<AccountState>) -> Result<Self>
Sourcepub fn calculate_pnls(
&self,
instrument: InstrumentAny,
fill: OrderFilled,
position: Option<Position>,
) -> Result<Vec<Money>>
pub fn calculate_pnls( &self, instrument: InstrumentAny, fill: OrderFilled, position: Option<Position>, ) -> Result<Vec<Money>>
§Errors
Returns an error if calculating P&Ls fails for the underlying account.
Sourcepub fn calculate_commission(
&self,
instrument: InstrumentAny,
last_qty: Quantity,
last_px: Price,
liquidity_side: LiquiditySide,
use_quote_for_inverse: Option<bool>,
) -> Result<Money>
pub fn calculate_commission( &self, instrument: InstrumentAny, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool>, ) -> Result<Money>
§Errors
Returns an error if calculating commission fails for the underlying account.
pub fn balance(&self, currency: Option<Currency>) -> Option<&AccountBalance>
Trait Implementations§
Source§impl Account for AccountAny
impl Account for AccountAny
Source§fn calculate_balance_locked(
&mut self,
__enum_dispatch_arg_0: InstrumentAny,
__enum_dispatch_arg_1: OrderSide,
__enum_dispatch_arg_2: Quantity,
__enum_dispatch_arg_3: Price,
__enum_dispatch_arg_4: Option<bool>,
) -> Result<Money>
fn calculate_balance_locked( &mut self, __enum_dispatch_arg_0: InstrumentAny, __enum_dispatch_arg_1: OrderSide, __enum_dispatch_arg_2: Quantity, __enum_dispatch_arg_3: Price, __enum_dispatch_arg_4: Option<bool>, ) -> Result<Money>
Calculates locked balance for the order parameters.
§Errors
Returns an error if calculating locked balance fails.
Source§fn calculate_pnls(
&self,
__enum_dispatch_arg_0: InstrumentAny,
__enum_dispatch_arg_1: OrderFilled,
__enum_dispatch_arg_2: Option<Position>,
) -> Result<Vec<Money>>
fn calculate_pnls( &self, __enum_dispatch_arg_0: InstrumentAny, __enum_dispatch_arg_1: OrderFilled, __enum_dispatch_arg_2: Option<Position>, ) -> Result<Vec<Money>>
Source§fn calculate_commission(
&self,
__enum_dispatch_arg_0: InstrumentAny,
__enum_dispatch_arg_1: Quantity,
__enum_dispatch_arg_2: Price,
__enum_dispatch_arg_3: LiquiditySide,
__enum_dispatch_arg_4: Option<bool>,
) -> Result<Money>
fn calculate_commission( &self, __enum_dispatch_arg_0: InstrumentAny, __enum_dispatch_arg_1: Quantity, __enum_dispatch_arg_2: Price, __enum_dispatch_arg_3: LiquiditySide, __enum_dispatch_arg_4: Option<bool>, ) -> Result<Money>
Calculates commission for the order fill parameters.
§Errors
Returns an error if calculating commission fails.
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, __enum_dispatch_arg_0: Option<Currency>, ) -> Option<Money>
fn balances_total(&self) -> HashMap<Currency, Money>
fn balance_free(&self, __enum_dispatch_arg_0: Option<Currency>) -> Option<Money>
fn balances_free(&self) -> HashMap<Currency, Money>
fn balance_locked( &self, __enum_dispatch_arg_0: Option<Currency>, ) -> Option<Money>
fn balances_locked(&self) -> HashMap<Currency, Money>
fn balance( &self, __enum_dispatch_arg_0: Option<Currency>, ) -> Option<&AccountBalance>
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, __enum_dispatch_arg_0: AccountState)
fn purge_account_events( &mut self, __enum_dispatch_arg_0: UnixNanos, __enum_dispatch_arg_1: u64, )
Source§impl Clone for AccountAny
impl Clone for AccountAny
Source§fn clone(&self) -> AccountAny
fn clone(&self) -> AccountAny
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AccountAny
impl Debug for AccountAny
Source§impl Default for AccountAny
impl Default for AccountAny
Source§fn default() -> Self
fn default() -> Self
Creates a new default AccountAny
instance.
Source§impl<'de> Deserialize<'de> for AccountAny
impl<'de> Deserialize<'de> for AccountAny
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<AccountState> for AccountAny
impl From<AccountState> for AccountAny
Source§fn from(event: AccountState) -> Self
fn from(event: AccountState) -> Self
Converts to this type from the input type.
Source§impl From<CashAccount> for AccountAny
impl From<CashAccount> for AccountAny
Source§fn from(v: CashAccount) -> AccountAny
fn from(v: CashAccount) -> AccountAny
Converts to this type from the input type.
Source§impl From<MarginAccount> for AccountAny
impl From<MarginAccount> for AccountAny
Source§fn from(v: MarginAccount) -> AccountAny
fn from(v: MarginAccount) -> AccountAny
Converts to this type from the input type.
Source§impl PartialEq for AccountAny
impl PartialEq for AccountAny
Source§impl Serialize for AccountAny
impl Serialize for AccountAny
Source§impl TryInto<CashAccount> for AccountAny
impl TryInto<CashAccount> for AccountAny
Source§impl TryInto<MarginAccount> for AccountAny
impl TryInto<MarginAccount> for AccountAny
Auto Trait Implementations§
impl Freeze for AccountAny
impl RefUnwindSafe for AccountAny
impl Send for AccountAny
impl Sync for AccountAny
impl Unpin for AccountAny
impl UnwindSafe for AccountAny
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