Skip to main content

AccountService

Trait AccountService 

Source
pub trait AccountService: Send + Sync {
    // Required methods
    fn get_accounts<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<AccountsResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_positions<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<PositionsResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_positions_w_filter<'life0, 'life1, 'async_trait>(
        &'life0 self,
        filter: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<PositionsResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_working_orders<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<WorkingOrdersResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_activity<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        from: &'life1 str,
        to: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<AccountActivityResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_activity_with_details<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        from: &'life1 str,
        to: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<AccountActivityResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_transactions<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        from: &'life1 str,
        to: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<TransactionHistoryResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_preferences<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<AccountPreferencesResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_preferences<'life0, 'async_trait>(
        &'life0 self,
        trailing_stops_enabled: bool,
    ) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_activity_by_period<'life0, 'async_trait>(
        &'life0 self,
        period_ms: u64,
    ) -> Pin<Box<dyn Future<Output = Result<AccountActivityResponse, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Interface for the account service

Required Methods§

Source

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

Gets information about all user accounts

Source

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

Gets open positions

Source

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

Gets open positions base in filter

Source

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

Gets working orders

Source

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

Gets account activity

§Arguments
  • session - The current session
  • from - Start date in ISO format (e.g. “2023-01-01T00:00:00Z”)
  • to - End date in ISO format (e.g. “2023-02-01T00:00:00Z”)
§Returns
  • Account activity for the specified period
Source

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

Gets detailed account activity

This method includes additional details for each activity item by using the detailed=true parameter in the API request.

§Arguments
  • session - The current session
  • from - Start date in ISO format (e.g. “2023-01-01T00:00:00Z”)
  • to - End date in ISO format (e.g. “2023-02-01T00:00:00Z”)
§Returns
  • Detailed account activity for the specified period
Source

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

Gets transaction history for a given period, handling pagination automatically.

Source

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

Gets account preferences

§Returns
  • Ok(AccountPreferencesResponse) - The account preferences
  • Err(AppError) - If the request fails
Source

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

Updates account preferences

§Arguments
  • trailing_stops_enabled - Whether trailing stops should be enabled
§Returns
  • Ok(()) - If the update was successful
  • Err(AppError) - If the request fails
Source

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

Gets account activity for a specified period

§Arguments
  • period - Period in milliseconds (e.g., 600000 for 10 minutes)
§Returns
  • Ok(AccountActivityResponse) - Account activity for the period
  • Err(AppError) - If the request fails

Implementors§