pub trait PositionHandler {
    fn set_open_position(
        &mut self,
        position: Position
    ) -> Result<(), RepositoryError>; fn get_open_position(
        &mut self,
        position_id: &PositionId
    ) -> Result<Option<Position>, RepositoryError>; fn get_open_positions<'a, Markets: Iterator<Item = &'a Market>>(
        &mut self,
        engine_id: Uuid,
        markets: Markets
    ) -> Result<Vec<Position>, RepositoryError>; fn remove_position(
        &mut self,
        position_id: &PositionId
    ) -> Result<Option<Position>, RepositoryError>; fn set_exited_position(
        &mut self,
        engine_id: Uuid,
        position: Position
    ) -> Result<(), RepositoryError>; fn get_exited_positions(
        &mut self,
        engine_id: Uuid
    ) -> Result<Vec<Position>, RepositoryError>; }
Expand description

Handles the reading & writing of a Position to/from the persistence layer.

Required methods

Upsert the open Position using it’s PositionId.

Get an open Position using the PositionId provided.

Get all open Positions associated with a Portfolio.

Remove the Position at the PositionId.

Append an exited Position to the Portfolio’s exited position list.

Get every exited Position associated with the engine_id.

Implementors