Skip to main content

CostsService

Trait CostsService 

Source
pub trait CostsService: Send + Sync {
    // Required methods
    fn get_indicative_costs_open<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 OpenCostsRequest,
    ) -> Pin<Box<dyn Future<Output = Result<IndicativeCostsResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_indicative_costs_close<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 CloseCostsRequest,
    ) -> Pin<Box<dyn Future<Output = Result<IndicativeCostsResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_indicative_costs_edit<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 EditCostsRequest,
    ) -> Pin<Box<dyn Future<Output = Result<IndicativeCostsResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_costs_history<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        from: &'life1 str,
        to: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<CostsHistoryResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_durable_medium<'life0, 'life1, 'async_trait>(
        &'life0 self,
        quote_reference: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<DurableMediumResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Service for retrieving indicative costs and charges from the IG Markets API

This service provides regulatory cost information for trading activities, including costs for opening, closing, and editing positions.

Required Methods§

Source

fn get_indicative_costs_open<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 OpenCostsRequest, ) -> Pin<Box<dyn Future<Output = Result<IndicativeCostsResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns indicative costs and charges for opening a position

§Arguments
  • request - The request containing position details
§Returns
  • Ok(IndicativeCostsResponse) - The indicative costs and charges
  • Err(AppError) - If the request fails
Source

fn get_indicative_costs_close<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 CloseCostsRequest, ) -> Pin<Box<dyn Future<Output = Result<IndicativeCostsResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns indicative costs and charges for closing a position

§Arguments
  • request - The request containing position details
§Returns
  • Ok(IndicativeCostsResponse) - The indicative costs and charges
  • Err(AppError) - If the request fails
Source

fn get_indicative_costs_edit<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 EditCostsRequest, ) -> Pin<Box<dyn Future<Output = Result<IndicativeCostsResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns indicative costs and charges for editing a position

§Arguments
  • request - The request containing position edit details
§Returns
  • Ok(IndicativeCostsResponse) - The indicative costs and charges
  • Err(AppError) - If the request fails
Source

fn get_costs_history<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 str, to: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<CostsHistoryResponse, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns historical costs and charges for a date range

§Arguments
  • from - Start date in ISO format (e.g., “2023-01-01”)
  • to - End date in ISO format (e.g., “2023-12-31”)
§Returns
  • Ok(CostsHistoryResponse) - Historical costs data
  • Err(AppError) - If the request fails
Source

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

Returns a durable medium document for a quote reference

§Arguments
  • quote_reference - The indicative quote reference
§Returns
  • Ok(DurableMediumResponse) - The durable medium document
  • Err(AppError) - If the request fails

Implementors§