pub struct Portfolio { /* private fields */ }
Implementations§
Source§impl Portfolio
impl Portfolio
pub fn new( cache: Rc<RefCell<Cache>>, clock: Rc<RefCell<dyn Clock>>, config: Option<PortfolioConfig>, ) -> Self
pub fn reset(&mut self)
pub fn is_initialized(&self) -> bool
pub fn balances_locked(&self, venue: &Venue) -> HashMap<Currency, Money>
pub fn margins_init(&self, venue: &Venue) -> HashMap<InstrumentId, Money>
pub fn margins_maint(&self, venue: &Venue) -> HashMap<InstrumentId, Money>
pub fn unrealized_pnls(&mut self, venue: &Venue) -> HashMap<Currency, Money>
pub fn realized_pnls(&mut self, venue: &Venue) -> HashMap<Currency, Money>
pub fn net_exposures(&self, venue: &Venue) -> Option<HashMap<Currency, Money>>
pub fn unrealized_pnl(&mut self, instrument_id: &InstrumentId) -> Option<Money>
pub fn realized_pnl(&mut self, instrument_id: &InstrumentId) -> Option<Money>
pub fn net_exposure(&self, instrument_id: &InstrumentId) -> Option<Money>
pub fn net_position(&self, instrument_id: &InstrumentId) -> Decimal
pub fn is_net_long(&self, instrument_id: &InstrumentId) -> bool
pub fn is_net_short(&self, instrument_id: &InstrumentId) -> bool
pub fn is_flat(&self, instrument_id: &InstrumentId) -> bool
pub fn is_completely_flat(&self) -> bool
Sourcepub fn initialize_orders(&mut self)
pub fn initialize_orders(&mut self)
Initializes account margin based on existing open orders.
§Panics
Panics if updating the cache with a mutated account fails.
Sourcepub fn initialize_positions(&mut self)
pub fn initialize_positions(&mut self)
Initializes account margin based on existing open positions.
§Panics
Panics if calculation of PnL or updating the cache with a mutated account fails.
pub fn update_quote_tick(&mut self, quote: &QuoteTick)
pub fn update_bar(&mut self, bar: &Bar)
pub fn update_account(&mut self, event: &AccountState)
pub fn update_order(&mut self, event: &OrderEventAny)
pub fn update_position(&mut self, event: &PositionEvent)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Portfolio
impl !RefUnwindSafe for Portfolio
impl !Send for Portfolio
impl !Sync for Portfolio
impl Unpin for Portfolio
impl !UnwindSafe for Portfolio
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