ig_client/application/services/interfaces/
market.rs

1use crate::application::models::market::{
2    HistoricalPricesResponse, MarketDetails, MarketSearchResult,
3};
4use crate::error::AppError;
5use crate::session::interface::IgSession;
6use async_trait::async_trait;
7
8/// Interface for the market service
9#[async_trait]
10pub trait MarketService: Send + Sync {
11    /// Searches markets by search term
12    async fn search_markets(
13        &self,
14        session: &IgSession,
15        search_term: &str,
16    ) -> Result<MarketSearchResult, AppError>;
17
18    /// Gets details of a specific market by its EPIC
19    async fn get_market_details(
20        &self,
21        session: &IgSession,
22        epic: &str,
23    ) -> Result<MarketDetails, AppError>;
24
25    /// Gets historical prices for a market
26    async fn get_historical_prices(
27        &self,
28        session: &IgSession,
29        epic: &str,
30        resolution: &str,
31        from: &str,
32        to: &str,
33    ) -> Result<HistoricalPricesResponse, AppError>;
34}