pub trait PortfolioManager: Send + Sync {
// Required methods
fn get_portfolio_value<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_positions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Position>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_position<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
quantity: Decimal,
price: Decimal,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_unrealized_pnl<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_realized_pnl<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn rebalance<'life0, 'async_trait>(
&'life0 self,
target_allocations: Vec<(Symbol, f64)>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for portfolio management
Required Methods§
Sourcefn get_portfolio_value<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_portfolio_value<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get current portfolio value
Sourcefn get_positions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Position>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_positions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Position>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all positions
Sourcefn update_position<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
quantity: Decimal,
price: Decimal,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_position<'life0, 'life1, 'async_trait>(
&'life0 self,
symbol: &'life1 Symbol,
quantity: Decimal,
price: Decimal,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update position based on fill
Sourcefn get_unrealized_pnl<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_unrealized_pnl<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get unrealized P&L