pub struct Client {
pub access_token: Option<AccessToken>,
/* private fields */
}Expand description
Client for interacting with the TDA API.
Most API methods will panic if an access token is not set.
Fields§
§access_token: Option<AccessToken>Implementations§
Source§impl<'a> Client
impl<'a> Client
Sourcepub fn new(
client_id: &'a str,
refresh_token: &'a str,
access_token: Option<AccessToken>,
) -> Self
pub fn new( client_id: &'a str, refresh_token: &'a str, access_token: Option<AccessToken>, ) -> Self
Create a new client with a client ID and refresh token.
Sourcepub fn set_access_token(
&mut self,
access_token: &Option<AccessToken>,
) -> &mut Self
pub fn set_access_token( &mut self, access_token: &Option<AccessToken>, ) -> &mut Self
Set the internal access token of the client.
Sourcepub fn get_access_token(&self) -> Result<AccessTokenResponse, ClientError>
pub fn get_access_token(&self) -> Result<AccessTokenResponse, ClientError>
Get a new access token from the API.
Sourcepub fn get_account(
&self,
account_id: &'a str,
params: GetAccountParams,
) -> Result<Account, ClientError>
pub fn get_account( &self, account_id: &'a str, params: GetAccountParams, ) -> Result<Account, ClientError>
Account balances, positions, and orders for a specific account.
Sourcepub fn get_accounts(
&self,
params: GetAccountsParams,
) -> Result<Vec<Account>, ClientError>
pub fn get_accounts( &self, params: GetAccountsParams, ) -> Result<Vec<Account>, ClientError>
Account balances, positions, and orders for all linked accounts.
Sourcepub fn get_movers(
&self,
index: &'a str,
params: GetMoversParams,
) -> Result<Vec<Mover>, ClientError>
pub fn get_movers( &self, index: &'a str, params: GetMoversParams, ) -> Result<Vec<Mover>, ClientError>
Top 10 (up or down) movers by value or percent for a particular market
Sourcepub fn get_price_history(
&self,
symbol: &str,
params: GetPriceHistoryParams,
) -> Result<GetPriceHistoryResponse, ClientError>
pub fn get_price_history( &self, symbol: &str, params: GetPriceHistoryParams, ) -> Result<GetPriceHistoryResponse, ClientError>
Get price history for a symbol
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more