pub trait MarketService: Send + Sync {
Show 14 methods
// Required methods
fn search_markets<'life0, 'life1, 'async_trait>(
&'life0 self,
search_term: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MarketSearchResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_market_details<'life0, 'life1, 'async_trait>(
&'life0 self,
epic: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MarketDetails, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_multiple_market_details<'life0, 'life1, 'async_trait>(
&'life0 self,
epics: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<MultipleMarketDetailsResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_historical_prices<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
from: &'life3 str,
to: &'life4 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;
fn get_historical_prices_by_date_range<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
start_date: &'life3 str,
end_date: &'life4 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;
fn get_recent_prices<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
params: &'life1 RecentPricesRequest<'life2>,
) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_historical_prices_by_count_v1<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
num_points: i32,
) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_historical_prices_by_count_v2<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
num_points: i32,
) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_market_navigation<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<MarketNavigationResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_market_navigation_node<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MarketNavigationResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_all_markets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<MarketData>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_vec_db_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DBEntryResponse>, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_categories<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CategoriesResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_category_instruments<'life0, 'life1, 'async_trait>(
&'life0 self,
category_id: &'life1 str,
page_number: Option<i32>,
page_size: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<CategoryInstrumentsResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Interface for the market service
Required Methods§
Sourcefn search_markets<'life0, 'life1, 'async_trait>(
&'life0 self,
search_term: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MarketSearchResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_markets<'life0, 'life1, 'async_trait>(
&'life0 self,
search_term: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MarketSearchResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Searches markets by search term
Sourcefn get_market_details<'life0, 'life1, 'async_trait>(
&'life0 self,
epic: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MarketDetails, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_market_details<'life0, 'life1, 'async_trait>(
&'life0 self,
epic: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MarketDetails, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets details of a specific market by its EPIC
Sourcefn get_multiple_market_details<'life0, 'life1, 'async_trait>(
&'life0 self,
epics: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<MultipleMarketDetailsResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_multiple_market_details<'life0, 'life1, 'async_trait>(
&'life0 self,
epics: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<MultipleMarketDetailsResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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 sessionepics- A slice of EPICs to get details for
§Returns
A vector of market details in the same order as the input EPICs
Sourcefn get_historical_prices<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
from: &'life3 str,
to: &'life4 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,
fn get_historical_prices<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
from: &'life3 str,
to: &'life4 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,
Gets historical prices for a market
Sourcefn get_historical_prices_by_date_range<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
start_date: &'life3 str,
end_date: &'life4 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,
fn get_historical_prices_by_date_range<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
start_date: &'life3 str,
end_date: &'life4 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,
Gets historical prices for a market using path parameters (API v2)
§Arguments
epic- Instrument epicresolution- Price resolution (SECOND, MINUTE, MINUTE_2, MINUTE_3, MINUTE_5, MINUTE_10, MINUTE_15, MINUTE_30, HOUR, HOUR_2, HOUR_3, HOUR_4, DAY, WEEK, MONTH)start_date- Start date (yyyy-MM-dd HH:mm:ss)end_date- End date (yyyy-MM-dd HH:mm:ss). Must be later than the start date
Sourcefn get_recent_prices<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
params: &'life1 RecentPricesRequest<'life2>,
) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_recent_prices<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
params: &'life1 RecentPricesRequest<'life2>,
) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn get_historical_prices_by_count_v1<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
num_points: i32,
) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_historical_prices_by_count_v1<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
num_points: i32,
) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Gets historical prices by number of data points (API v1)
§Arguments
epic- Instrument epicresolution- Price resolutionnum_points- Number of data points required
Sourcefn get_historical_prices_by_count_v2<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
num_points: i32,
) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_historical_prices_by_count_v2<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
epic: &'life1 str,
resolution: &'life2 str,
num_points: i32,
) -> Pin<Box<dyn Future<Output = Result<HistoricalPricesResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Gets historical prices by number of data points (API v2)
§Arguments
epic- Instrument epicresolution- Price resolutionnum_points- Number of data points required
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.
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
Sourcefn get_all_markets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<MarketData>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_markets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<MarketData>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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 sessionmax_levels- Maximum depth to traverse (default: 5 levels)
§Returns
Result<Vec<MarketData>, AppError>- Vector containing all found market instruments
Sourcefn get_vec_db_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DBEntryResponse>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_vec_db_entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DBEntryResponse>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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
Sourcefn get_categories<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CategoriesResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_categories<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CategoriesResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets all categories of instruments enabled for the IG account
This method returns a list of all categories of instruments that are available for trading on the account.
§Returns
Result<CategoriesResponse, AppError>- List of available categories
Sourcefn get_category_instruments<'life0, 'life1, 'async_trait>(
&'life0 self,
category_id: &'life1 str,
page_number: Option<i32>,
page_size: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<CategoryInstrumentsResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_category_instruments<'life0, 'life1, 'async_trait>(
&'life0 self,
category_id: &'life1 str,
page_number: Option<i32>,
page_size: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<CategoryInstrumentsResponse, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets all instruments for a specific category
This method returns all instruments belonging to the specified category, with optional pagination support.
§Arguments
category_id- The identifier of the categorypage_number- Optional page number (default: 0)page_size- Optional page size (default: 150, max: 1000)
§Returns
Result<CategoryInstrumentsResponse, AppError>- List of instruments in the category