pub struct Credentials {
pub username: String,
pub password: String,
pub account_id: String,
pub api_key: String,
pub client_token: Option<String>,
pub account_token: Option<String>,
}Expand description
Authentication credentials for the IG Markets API
Fields§
§username: StringUsername for the IG Markets account
password: StringPassword for the IG Markets account
account_id: StringAccount ID for the IG Markets account
api_key: StringAPI key for the IG Markets API
client_token: Option<String>Client token for the IG Markets API
account_token: Option<String>Account token for the IG Markets API
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn new(
username: String,
password: String,
account_id: String,
api_key: String,
) -> Self
pub fn new( username: String, password: String, account_id: String, api_key: String, ) -> Self
Builds credentials from the four required fields, leaving both session tokens unset.
The tokens (client_token / account_token) are populated by the
session layer on login, so callers never provide them.
§Arguments
username- IG account usernamepassword- IG account passwordaccount_id- IG account identifierapi_key- IG API key
Sourcepub fn api_keys(&self) -> Vec<String>
pub fn api_keys(&self) -> Vec<String>
Splits api_key into the individual keys of a pool.
IG enforces its non-trading allowance per API key, so a caller that
owns several keys on the same account can raise its aggregate throughput
by spreading requests across them. To express that, api_key accepts a
comma-separated list; a single key (no comma) yields a one-element pool,
which is the historical behaviour.
Empty entries and surrounding whitespace are discarded, so
"a, b, ,c," yields ["a", "b", "c"]. When the field holds nothing
usable the result is empty and the caller decides how to fail.
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Credentials
impl Debug for Credentials
Source§impl<'de> Deserialize<'de> for Credentials
impl<'de> Deserialize<'de> for Credentials
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Credentials
impl Display for Credentials
Auto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnsafeUnpin for Credentials
impl UnwindSafe for Credentials
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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