Skip to main content

WatchlistService

Trait WatchlistService 

Source
pub trait WatchlistService: Send + Sync {
    // Required methods
    fn get_watchlists<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<WatchlistsResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn create_watchlist<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        epics: Option<&'life2 [String]>,
    ) -> Pin<Box<dyn Future<Output = Result<CreateWatchlistResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_watchlist<'life0, 'life1, 'async_trait>(
        &'life0 self,
        watchlist_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<WatchlistMarketsResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_watchlist<'life0, 'life1, 'async_trait>(
        &'life0 self,
        watchlist_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<StatusResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn add_to_watchlist<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        watchlist_id: &'life1 str,
        epic: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<StatusResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn remove_from_watchlist<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        watchlist_id: &'life1 str,
        epic: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<StatusResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Service for managing watchlists in the IG Markets API

Watchlists allow users to organize and track groups of instruments. This trait provides methods for full CRUD operations on watchlists.

Required Methods§

Source

fn get_watchlists<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<WatchlistsResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns all watchlists belonging to the active account

§Returns
  • Ok(WatchlistsResponse) - List of all watchlists
  • Err(AppError) - If the request fails
Source

fn create_watchlist<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, name: &'life1 str, epics: Option<&'life2 [String]>, ) -> Pin<Box<dyn Future<Output = Result<CreateWatchlistResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Creates a new watchlist with the given name and optional initial instruments

§Arguments
  • name - The name for the new watchlist
  • epics - Optional list of EPICs to add to the watchlist
§Returns
  • Ok(CreateWatchlistResponse) - The created watchlist ID and status
  • Err(AppError) - If the request fails
Source

fn get_watchlist<'life0, 'life1, 'async_trait>( &'life0 self, watchlist_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<WatchlistMarketsResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the markets in a specific watchlist

§Arguments
  • watchlist_id - The ID of the watchlist to retrieve
§Returns
  • Ok(WatchlistMarketsResponse) - The watchlist’s markets
  • Err(AppError) - If the request fails
Source

fn delete_watchlist<'life0, 'life1, 'async_trait>( &'life0 self, watchlist_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<StatusResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes a watchlist

§Arguments
  • watchlist_id - The ID of the watchlist to delete
§Returns
  • Ok(StatusResponse) - The deletion status
  • Err(AppError) - If the request fails
Source

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

Adds an instrument to a watchlist

§Arguments
  • watchlist_id - The ID of the watchlist
  • epic - The EPIC of the instrument to add
§Returns
  • Ok(StatusResponse) - The operation status
  • Err(AppError) - If the request fails
Source

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

Removes an instrument from a watchlist

§Arguments
  • watchlist_id - The ID of the watchlist
  • epic - The EPIC of the instrument to remove
§Returns
  • Ok(StatusResponse) - The operation status
  • Err(AppError) - If the request fails

Implementors§