pub struct PortfolioManager { /* private fields */ }Expand description
Portfolio manager for investment portfolio management
Implementations§
Source§impl PortfolioManager
impl PortfolioManager
Sourcepub fn initialize(&mut self) -> Result<(), FinancialError>
pub fn initialize(&mut self) -> Result<(), FinancialError>
Initialize PortfolioManager; Ok when ready.
Sourcepub fn validate_portfolio(
&self,
portfolio: &Portfolio,
) -> Result<(), FinancialError>
pub fn validate_portfolio( &self, portfolio: &Portfolio, ) -> Result<(), FinancialError>
Reject portfolio when it has no assets (ValidationError); Ok otherwise. Structural check only — no rule engine.
Sourcepub fn create_portfolio(
&mut self,
portfolio: Portfolio,
) -> Result<Portfolio, FinancialError>
pub fn create_portfolio( &mut self, portfolio: Portfolio, ) -> Result<Portfolio, FinancialError>
Store portfolio via portfolio_storage and return it on success.
Sourcepub fn get_portfolio(
&self,
portfolio_id: &str,
) -> Result<Portfolio, FinancialError>
pub fn get_portfolio( &self, portfolio_id: &str, ) -> Result<Portfolio, FinancialError>
Look up portfolio by id; None/Err when absent.
Sourcepub fn list_portfolios(&self) -> Vec<String>
pub fn list_portfolios(&self) -> Vec<String>
Ids of every registered portfolio.
Sourcepub fn get_performance_metrics(&self) -> FinancialPerformanceMetrics
pub fn get_performance_metrics(&self) -> FinancialPerformanceMetrics
Look up performance_metrics by id; None/Err when absent.
Sourcepub fn register_rebalancing_strategy(&mut self, strategy: RebalancingStrategy)
pub fn register_rebalancing_strategy(&mut self, strategy: RebalancingStrategy)
Register a rebalancing strategy with the underlying engine (keyed by
strategy.strategy_id) so rebalance_portfolio can use it.
Sourcepub fn rebalance_portfolio(
&self,
portfolio_id: &str,
) -> Result<Vec<RebalanceTrade>, FinancialError>
pub fn rebalance_portfolio( &self, portfolio_id: &str, ) -> Result<Vec<RebalanceTrade>, FinancialError>
Public rebalancing API: look up the portfolio, compute drift against a
registered strategy (or a default strategy when none is registered for
the default id), and return the proposed RebalanceTrades. The portfolio
is not mutated — trades are proposals for the execution layer.
Auto Trait Implementations§
impl !Freeze for PortfolioManager
impl RefUnwindSafe for PortfolioManager
impl Send for PortfolioManager
impl Sync for PortfolioManager
impl Unpin for PortfolioManager
impl UnsafeUnpin for PortfolioManager
impl UnwindSafe for PortfolioManager
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more