Client and Low-Level Utilities

These methods construct clients, manage tokens, perform low-level calls, or maintain push subscription state. Prefer named business APIs; callers of call_* must match the wire method, version, parameters, and target type.

Construct from configuration

Signature

pub fn from_config(config: ClientConfig) -> Self

Parameters

ParameterRust typeRequirementSDK default
QuoteClient.configClientConfigRequired by Rust typeNone
TradeClient.configClientConfigRequired by Rust typeNone
Response example

No synchronous server response. Returns the constructed client.

Explicit constructors

Signature

pub fn new(http_client: HttpClient) -> Self
pub fn new(http_client: HttpClient, account: impl Into<String>) -> Self
pub fn new(config: ClientConfig, options: Option<PushClientOptions>) -> Self

Parameters

ParameterRust typeRequirementSDK default
QuoteClient.http_clientHttpClientRequired by Rust typeNone
TradeClient.http_clientHttpClientRequired by Rust typeNone
TradeClient.accountimpl Into<String>Required by Rust typeNone
PushClient.configClientConfigRequired by Rust typeNone
PushClient.optionsOption<PushClientOptions>OptionalNone (omitted)
Response example

No synchronous server response. Returns the constructed client.

Construct an institutional trade client

Signature

pub fn with_secret_key(http_client: HttpClient, account: impl Into<String>, secret_key: impl Into<String>) -> Self

Parameters

ParameterRust typeRequirementSDK default
http_clientHttpClientRequired by Rust typeNone
accountimpl Into<String>Required by Rust typeNone
secret_keyimpl Into<String>Required by Rust typeNone
Response example

No synchronous server response. Returns a client carrying the institutional trading key.

Query a new token

Signature

pub async fn query_token(&self) -> Result<String, TigerError>

Parameters

ParameterRust typeRequirementSDK default
none-Required by Rust typeNone
Response example
"REDACTED_TOKEN"

Rate limit

The base rate limit is 10 requests/min. query_token and refresh_token both use user_token_refresh and share this quota.

Refresh the token

Signature

pub async fn refresh_token(&self, token_manager: Option<&crate::config::TokenManager>) -> Result<(), TigerError>

Parameters

ParameterRust typeRequirementSDK default
QuoteClient.token_managerOption<&crate::config::TokenManager>OptionalNone (omitted)
TradeClient.token_managerOption<&crate::config::TokenManager>OptionalNone (omitted)
Response example
null

Rate limit

The base rate limit is 10 requests/min. query_token and refresh_token both use user_token_refresh and share this quota.

Start automatic token refresh

Signature

pub fn start_token_auto_refresh(&self, refresh_duration_secs: i64, check_interval_secs: u64, token_writer: Option<Box<dyn Fn(String) + Send + Sync + 'static>>) -> std::sync::Arc<crate::config::TokenManager>

Parameters

ParameterRust typeRequirementSDK default
QuoteClient.refresh_duration_secsi64Required by Rust typeNone
QuoteClient.check_interval_secsu64Required by Rust typeNone
QuoteClient.token_writerOption<Box<dyn Fn(String) + Send + Sync + 'static>>OptionalNone (omitted)
TradeClient.refresh_duration_secsi64Required by Rust typeNone
TradeClient.check_interval_secsu64Required by Rust typeNone
TradeClient.token_writerOption<Box<dyn Fn(String) + Send + Sync + 'static>>OptionalNone (omitted)
Response example

No synchronous server response. Returns a TokenManager handle used to stop the background refresh task.

Decode a low-level call

Signature

pub async fn call_into<T, P>(&self, method: &str, params: P) -> Result<T, TigerError>

Parameters

ParameterRust typeRequirementSDK default
method&strRequired by Rust typeNone
paramsPRequired by Rust typeNone
Response example
{}

This example assumes the caller selects a JSON object for T; the actual shape is defined by T.

Versioned low-level call

Signature

pub async fn call_into_versioned<T, P>(&self, method: &str, params: P, version: Option<&str>) -> Result<T, TigerError>

Parameters

ParameterRust typeRequirementSDK default
method&strRequired by Rust typeNone
paramsPRequired by Rust typeNone
versionOption<&str>OptionalNone (omitted)
Response example
{}

This example assumes the caller selects a JSON object for T; the actual shape is defined by T.

Unwrap an items list

Signature

pub async fn call_into_items<T, P>(&self, method: &str, params: P) -> Result<Vec<T>, TigerError>

Parameters

ParameterRust typeRequirementSDK default
QuoteClient.method&strRequired by Rust typeNone
QuoteClient.paramsPRequired by Rust typeNone
TradeClient.method&strRequired by Rust typeNone
TradeClient.paramsPRequired by Rust typeNone
Response example
[]

Normalize a list or object

Signature

pub async fn call_into_list_or_object<T, P>(&self, method: &str, params: P) -> Result<Vec<T>, TigerError>

Parameters

ParameterRust typeRequirementSDK default
method&strRequired by Rust typeNone
paramsPRequired by Rust typeNone
Response example
[]

Optional low-level call

Signature

pub async fn call_optional<T, P>(&self, method: &str, params: P) -> Result<Option<T>, TigerError>

Parameters

ParameterRust typeRequirementSDK default
QuoteClient.method&strRequired by Rust typeNone
QuoteClient.paramsPRequired by Rust typeNone
TradeClient.method&strRequired by Rust typeNone
TradeClient.paramsPRequired by Rust typeNone
Response example
{}

This example assumes the caller selects a JSON object for T; the result may also be null, and its shape is defined by T.

Versioned optional call

Signature

pub async fn call_optional_versioned<T, P>(&self, method: &str, params: P, version: Option<&str>) -> Result<Option<T>, TigerError>

Parameters

ParameterRust typeRequirementSDK default
method&strRequired by Rust typeNone
paramsPRequired by Rust typeNone
versionOption<&str>OptionalNone (omitted)
Response example
{}

This example assumes the caller selects a JSON object for T; the result may also be null, and its shape is defined by T.

Queue a generic subscription

Signature

pub fn subscribe(&self, subject: &SubjectType, symbols: Option<&str>, account: Option<&str>, market: Option<&str>) -> bool

Parameters

ParameterRust typeRequirementSDK default
subject&SubjectTypeRequired by Rust typeNone
symbolsOption<&str>OptionalNone (omitted)
accountOption<&str>OptionalNone (omitted)
marketOption<&str>OptionalNone (omitted)
Response example

No synchronous server response. The return only reports whether the frame entered the local channel.

Queue a generic unsubscription

Signature

pub fn unsubscribe(&self, subject: &SubjectType, symbols: Option<&str>, account: Option<&str>, market: Option<&str>) -> bool

Parameters

ParameterRust typeRequirementSDK default
subject&SubjectTypeRequired by Rust typeNone
symbolsOption<&str>OptionalNone (omitted)
accountOption<&str>OptionalNone (omitted)
marketOption<&str>OptionalNone (omitted)
Response example

No synchronous server response. The return only reports whether the frame entered the local channel.

Record a local market subscription

Signature

pub fn add_subscription(&self, subject: SubjectType, symbols: &[String])

Parameters

ParameterRust typeRequirementSDK default
subjectSubjectTypeRequired by Rust typeNone
symbols&[String]Required by Rust typeNone
Response example

No synchronous server response.

Remove a local market subscription

Signature

pub fn remove_subscription(&self, subject: SubjectType, symbols: Option<&[String]>)

Parameters

ParameterRust typeRequirementSDK default
subjectSubjectTypeRequired by Rust typeNone
symbolsOption<&[String]>OptionalNone (omitted)
Response example

No synchronous server response.

Read local market subscriptions

Signature

pub fn get_subscriptions(&self) -> HashMap<SubjectType, Vec<String>>

Parameters

ParameterRust typeRequirementSDK default
none-Required by Rust typeNone
Response example

No synchronous server response. Returns the local subject-to-symbol snapshot.

Record a local account subscription

Signature

pub fn add_account_sub(&self, subject: SubjectType)

Parameters

ParameterRust typeRequirementSDK default
subjectSubjectTypeRequired by Rust typeNone
Response example

No synchronous server response.

Remove a local account subscription

Signature

pub fn remove_account_sub(&self, subject: &SubjectType)

Parameters

ParameterRust typeRequirementSDK default
subject&SubjectTypeRequired by Rust typeNone
Response example

No synchronous server response.

Read local account subscriptions

Signature

pub fn get_account_subscriptions(&self) -> Vec<SubjectType>

Parameters

ParameterRust typeRequirementSDK default
none-Required by Rust typeNone
Response example

No synchronous server response. Returns the local account-subject snapshot.

Subscribe to cryptocurrency quotes

Signature

pub fn subscribe_cc(&self, symbols: &[&str]) -> Result<(), TigerError>

Parameters

ParameterRust typeRequirementSDK default
symbols&[&str]Required by Rust typeNone
Response example

No synchronous server response. Success only means the local flow completed.

Unsubscribe from cryptocurrency quotes

Signature

pub fn unsubscribe_cc(&self, symbols: Option<&[&str]>) -> Result<(), TigerError>

Parameters

ParameterRust typeRequirementSDK default
symbolsOption<&[&str]>OptionalNone (omitted)
Response example

No synchronous server response. Success only means the local flow completed.

Subscribe to a market ranking

Signature

pub fn subscribe_market(&self, market: &str) -> Result<(), TigerError>

Parameters

ParameterRust typeRequirementSDK default
market&strRequired by Rust typeNone
Response example

No synchronous server response. Success only means the local flow completed.

Unsubscribe from a market ranking

Signature

pub fn unsubscribe_market(&self, market: &str) -> Result<(), TigerError>

Parameters

ParameterRust typeRequirementSDK default
market&strRequired by Rust typeNone
Response example

No synchronous server response. Success only means the local flow completed.


Did this page help you?