BatchRepository

Trait BatchRepository 

Source
pub trait BatchRepository<T: Solver<Self::DemandId, Self::PortfolioId, Self::ProductId>>: Repository {
    // Required methods
    fn run_batch(
        &self,
        timestamp: Self::DateTime,
        solver: T,
        state: T::State,
    ) -> impl Future<Output = Result<Result<(), T::Error>, Self::Error>> + Send;
    fn get_portfolio_outcomes(
        &self,
        portfolio_id: Self::PortfolioId,
        query: DateTimeRangeQuery<Self::DateTime>,
        limit: usize,
    ) -> impl Future<Output = Result<DateTimeRangeResponse<OutcomeRecord<Self::DateTime, T::PortfolioOutcome>, Self::DateTime>, Self::Error>> + Send;
    fn get_product_outcomes(
        &self,
        product_id: Self::ProductId,
        query: DateTimeRangeQuery<Self::DateTime>,
        limit: usize,
    ) -> impl Future<Output = Result<DateTimeRangeResponse<OutcomeRecord<Self::DateTime, T::ProductOutcome>, Self::DateTime>, Self::Error>> + Send;
}
Expand description

Repository interface for batch auction execution and outcome retrieval.

This trait provides methods for running batch auctions at specific timestamps and retrieving the resulting allocations and prices.

Required Methods§

Source

fn run_batch( &self, timestamp: Self::DateTime, solver: T, state: T::State, ) -> impl Future<Output = Result<Result<(), T::Error>, Self::Error>> + Send

Execute a batch auction for a specific timestamp.

Gather all the portfolios and demand curves for the requested time and solve the corresponding auction using solver.

§Returns
  • Ok(Ok(())) if the batch completed successfully
  • Ok(Err(solver_error)) if the solver failed
  • Err(repository_error) if there is some other error
Source

fn get_portfolio_outcomes( &self, portfolio_id: Self::PortfolioId, query: DateTimeRangeQuery<Self::DateTime>, limit: usize, ) -> impl Future<Output = Result<DateTimeRangeResponse<OutcomeRecord<Self::DateTime, T::PortfolioOutcome>, Self::DateTime>, Self::Error>> + Send

Retrieve historical batch outcomes for a portfolio.

§Returns

A paginated response containing the portfolio’s allocations from past batches.

Source

fn get_product_outcomes( &self, product_id: Self::ProductId, query: DateTimeRangeQuery<Self::DateTime>, limit: usize, ) -> impl Future<Output = Result<DateTimeRangeResponse<OutcomeRecord<Self::DateTime, T::ProductOutcome>, Self::DateTime>, Self::Error>> + Send

Retrieve historical batch outcomes for a product.

§Returns

A paginated response containing the product’s clearing prices from past batches.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§