Trait PositionManager

Source
pub trait PositionManager: Send + Sync {
    // Required methods
    fn update_position<'life0, 'async_trait>(
        &'life0 self,
        update: PositionUpdate,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_position<'life0, 'life1, 'async_trait>(
        &'life0 self,
        position_id: &'life1 PositionId,
    ) -> Pin<Box<dyn Future<Output = Option<FuturesPosition>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_positions_by_symbol<'life0, 'life1, 'async_trait>(
        &'life0 self,
        venue: Venue,
        symbol: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Vec<FuturesPosition>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_all_positions<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<FuturesPosition>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_total_unrealized_pnl<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Decimal> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_total_realized_pnl<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Decimal> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clear_all_positions<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for position management

Required Methods§

Source

fn update_position<'life0, 'async_trait>( &'life0 self, update: PositionUpdate, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update or create a position from exchange update

Source

fn get_position<'life0, 'life1, 'async_trait>( &'life0 self, position_id: &'life1 PositionId, ) -> Pin<Box<dyn Future<Output = Option<FuturesPosition>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get position by ID

Source

fn get_positions_by_symbol<'life0, 'life1, 'async_trait>( &'life0 self, venue: Venue, symbol: &'life1 str, ) -> Pin<Box<dyn Future<Output = Vec<FuturesPosition>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all positions for a symbol on a venue

Source

fn get_all_positions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<FuturesPosition>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all open positions

Source

fn get_total_unrealized_pnl<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Decimal> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get total unrealized PnL across all positions

Source

fn get_total_realized_pnl<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Decimal> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get total realized PnL across all positions

Source

fn clear_all_positions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Clear all positions (useful for testing)

Implementors§