pub struct BaseAccount {
pub id: AccountId,
pub account_type: AccountType,
pub base_currency: Option<Currency>,
pub calculate_account_state: bool,
pub events: Vec<AccountState>,
pub commissions: HashMap<Currency, f64>,
pub balances: HashMap<Currency, AccountBalance>,
pub balances_starting: HashMap<Currency, Money>,
}
Fields§
§id: AccountId
§account_type: AccountType
§base_currency: Option<Currency>
§calculate_account_state: bool
§events: Vec<AccountState>
§commissions: HashMap<Currency, f64>
§balances: HashMap<Currency, AccountBalance>
§balances_starting: HashMap<Currency, Money>
Implementations§
Source§impl BaseAccount
impl BaseAccount
Sourcepub fn new(event: AccountState, calculate_account_state: bool) -> Self
pub fn new(event: AccountState, calculate_account_state: bool) -> Self
Creates a new BaseAccount
instance.
pub fn base_balance_total(&self, currency: Option<Currency>) -> Option<Money>
pub fn base_balances_total(&self) -> HashMap<Currency, Money>
pub fn base_balance_free(&self, currency: Option<Currency>) -> Option<Money>
pub fn base_balances_free(&self) -> HashMap<Currency, Money>
pub fn base_balance_locked(&self, currency: Option<Currency>) -> Option<Money>
pub fn base_balances_locked(&self) -> HashMap<Currency, Money>
pub fn base_last_event(&self) -> Option<AccountState>
pub fn update_balances(&mut self, balances: Vec<AccountBalance>)
pub fn base_apply(&mut self, event: AccountState)
pub fn base_calculate_balance_locked( &mut self, instrument: InstrumentAny, side: OrderSide, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, ) -> Result<Money>
pub fn base_calculate_pnls( &self, instrument: InstrumentAny, fill: OrderFilled, position: Option<Position>, ) -> Result<Vec<Money>>
pub fn base_calculate_commission( &self, instrument: InstrumentAny, last_qty: Quantity, last_px: Price, liquidity_side: LiquiditySide, use_quote_for_inverse: Option<bool>, ) -> Result<Money>
Trait Implementations§
Source§impl Clone for BaseAccount
impl Clone for BaseAccount
Source§fn clone(&self) -> BaseAccount
fn clone(&self) -> BaseAccount
Returns a copy 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 BaseAccount
impl Debug for BaseAccount
Source§impl<'de> Deserialize<'de> for BaseAccount
impl<'de> Deserialize<'de> for BaseAccount
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 IntoPy<Py<PyAny>> for BaseAccount
impl IntoPy<Py<PyAny>> for BaseAccount
Source§impl PyClass for BaseAccount
impl PyClass for BaseAccount
Source§impl PyClassImpl for BaseAccount
impl PyClassImpl for BaseAccount
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
#[pyclass(subclass)]
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
Source§type ThreadChecker = SendablePyClass<BaseAccount>
type ThreadChecker = SendablePyClass<BaseAccount>
This handles following two situations: Read more
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a BaseAccount
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a BaseAccount
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut BaseAccount
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut BaseAccount
Source§impl PyTypeInfo for BaseAccount
impl PyTypeInfo for BaseAccount
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
Returns the safe abstraction over the type object.
§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type or a subclass of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
Checks if
object
is an instance of this type.Source§impl Serialize for BaseAccount
impl Serialize for BaseAccount
impl DerefToPyAny for BaseAccount
Auto Trait Implementations§
impl Freeze for BaseAccount
impl RefUnwindSafe for BaseAccount
impl Send for BaseAccount
impl Sync for BaseAccount
impl Unpin for BaseAccount
impl UnwindSafe for BaseAccount
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