Struct Questrade

Source
pub struct Questrade { /* private fields */ }
Expand description

Questrade client

Implementations§

Source§

impl Questrade

Source

pub fn new() -> Self

Creates a new API instance with the default client.

Source

pub fn with_client(client: Client) -> Self

Creates a new API instance with the specified client

Source

pub fn with_authentication_only(auth_info: AuthenticationInfo) -> Self

Creates a new API instance with the specified auth info.

Source

pub fn with_authentication( auth_info: AuthenticationInfo, client: Client, ) -> Self

Creates a new API instance with the specified auth info.

Source

pub async fn authenticate( &self, refresh_token: &str, is_demo: bool, ) -> Result<(), ApiError>

Authenticates using the supplied token.

Source

pub async fn get_auth_info(&self) -> Option<AuthenticationInfo>

Retrieves the current authentication info (if set).

Source

pub async fn accounts(&self) -> Result<Vec<Account>, ApiError>

List all accounts associated with the authenticated user.

Source

pub async fn account_activity( &self, account_number: &str, start_time: DateTime<Utc>, end_time: DateTime<Utc>, ) -> Result<Vec<AccountActivity>, ApiError>

Retrieve account activities, including cash transactions, dividends, trades, etc.

Source

pub async fn account_orders( &self, account_number: &str, start_time: Option<DateTime<Utc>>, end_time: Option<DateTime<Utc>>, state: Option<OrderStateFilter>, ) -> Result<Vec<AccountOrder>, ApiError>

Search for account orders.

Parameters: - start_time optional start of time range. Defaults to start of today, 12:00am - end_time optional end of time range. Defaults to end of today, 11:59pm - state_filter optionally filters order states

Source

pub async fn account_order( &self, account_number: &str, order_id: u32, ) -> Result<Option<AccountOrder>, ApiError>

Retrieve details for an order with a specific id

Source

pub async fn account_executions( &self, account_number: &str, start_time: Option<DateTime<Utc>>, end_time: Option<DateTime<Utc>>, ) -> Result<Vec<AccountExecution>, ApiError>

Retrieves executions for a specific account.

Parameters: - start_time optional start of time range. Defaults to start of today, 12:00am - end_time optional end of time range. Defaults to end of today, 11:59pm

Source

pub async fn account_balance( &self, account_number: &str, ) -> Result<AccountBalances, ApiError>

Retrieves per-currency and combined balances for a specified account.

Source

pub async fn account_positions( &self, account_number: &str, ) -> Result<Vec<AccountPosition>, ApiError>

Retrieves positions in a specified account.

Source

pub async fn market_quote( &self, ids: &[u32], ) -> Result<Vec<MarketQuote>, ApiError>

Retrieves a single Level 1 market data quote for one or more symbols.

IMPORTANT NOTE: Questrade user needs to be subscribed to a real-time data package, to receive market quotes in real-time, otherwise call to get quote is considered snap quote and limit per market can be quickly reached. Without real-time data package, once limit is reached, the response will return delayed data. (Please check “delay” parameter in response always)

Searches for the specified symbol.

params

  • prefix Prefix of a symbol or any word in the description.
  • offset Offset in number of records from the beginning of a result set.
Source

pub async fn time(&self) -> Result<DateTime<Utc>, ApiError>

Retrieves current server time.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,