MarketService

Trait MarketService 

Source
pub trait MarketService: Send + Sync {
    // Required methods
    fn search_markets<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
        search_term: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<MarketSearchResult, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_market_details<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
        epic: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<MarketDetails, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_multiple_market_details<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
        epics: &'life2 [String],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MarketDetails>, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_historical_prices<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
        epic: &'life2 str,
        resolution: &'life3 str,
        from: &'life4 str,
        to: &'life5 str,
    ) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             'life5: 'async_trait;
    fn get_market_navigation<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
    ) -> Pin<Box<dyn Future<Output = Result<MarketNavigationResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_market_navigation_node<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
        node_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<MarketNavigationResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_all_markets<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<MarketData>, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_vec_db_entries<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DBEntry>, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Interface for the market service

Required Methods§

Source

fn search_markets<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session: &'life1 IgSession, search_term: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<MarketSearchResult, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Searches markets by search term

Source

fn get_market_details<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session: &'life1 IgSession, epic: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<MarketDetails, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Gets details of a specific market by its EPIC

Source

fn get_multiple_market_details<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session: &'life1 IgSession, epics: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<Vec<MarketDetails>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Gets details of multiple markets by their EPICs in a single request

This method accepts a vector of EPICs and returns a vector of market details. The EPICs are sent as a comma-separated list in a single API request.

§Arguments
  • session - The active IG session
  • epics - A slice of EPICs to get details for
§Returns

A vector of market details in the same order as the input EPICs

Source

fn get_historical_prices<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, session: &'life1 IgSession, epic: &'life2 str, resolution: &'life3 str, from: &'life4 str, to: &'life5 str, ) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Gets historical prices for a market

Source

fn get_market_navigation<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 IgSession, ) -> Pin<Box<dyn Future<Output = Result<MarketNavigationResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the top-level market navigation nodes

This method returns the root nodes of the market hierarchy, which can be used to navigate through the available markets.

Source

fn get_market_navigation_node<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session: &'life1 IgSession, node_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<MarketNavigationResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Gets the market navigation node with the specified ID

This method returns the child nodes and markets under the specified node ID.

§Arguments
  • node_id - The ID of the navigation node to retrieve
Source

fn get_all_markets<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 IgSession, ) -> Pin<Box<dyn Future<Output = Result<Vec<MarketData>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Navigates through all levels of the market hierarchy and collects all MarketData

This method performs a comprehensive traversal of the IG Markets hierarchy, starting from the root navigation and going through multiple levels to collect all available market instruments.

§Arguments
  • session - The authenticated IG session
  • max_levels - Maximum depth to traverse (default: 5 levels)
§Returns
  • Result<Vec<MarketData>, AppError> - Vector containing all found market instruments
Source

fn get_vec_db_entries<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 IgSession, ) -> Pin<Box<dyn Future<Output = Result<Vec<DBEntry>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets all markets converted to database entries format

This method retrieves all available markets and converts them to a standardized database entry format for storage or further processing.

§Arguments
  • session - The authenticated IG session
§Returns
  • Result<Vec<DBEntry>, AppError> - Vector of database entries representing all markets

Implementors§