PortfolioManager

Trait PortfolioManager 

Source
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§

Source

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

Source

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

Source

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

Source

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

Source

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,

Get realized P&L

Source

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,

Rebalance portfolio to target allocations

Implementors§