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) -> SelfParameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| QuoteClient.config | ClientConfig | Required by Rust type | None |
| TradeClient.config | ClientConfig | Required by Rust type | None |
| 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>) -> SelfParameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| QuoteClient.http_client | HttpClient | Required by Rust type | None |
| TradeClient.http_client | HttpClient | Required by Rust type | None |
| TradeClient.account | impl Into<String> | Required by Rust type | None |
| PushClient.config | ClientConfig | Required by Rust type | None |
| PushClient.options | Option<PushClientOptions> | Optional | None (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>) -> SelfParameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| http_client | HttpClient | Required by Rust type | None |
| account | impl Into<String> | Required by Rust type | None |
| secret_key | impl Into<String> | Required by Rust type | None |
| 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| none | - | Required by Rust type | None |
| 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| QuoteClient.token_manager | Option<&crate::config::TokenManager> | Optional | None (omitted) |
| TradeClient.token_manager | Option<&crate::config::TokenManager> | Optional | None (omitted) |
| Response example |
nullRate 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| QuoteClient.refresh_duration_secs | i64 | Required by Rust type | None |
| QuoteClient.check_interval_secs | u64 | Required by Rust type | None |
| QuoteClient.token_writer | Option<Box<dyn Fn(String) + Send + Sync + 'static>> | Optional | None (omitted) |
| TradeClient.refresh_duration_secs | i64 | Required by Rust type | None |
| TradeClient.check_interval_secs | u64 | Required by Rust type | None |
| TradeClient.token_writer | Option<Box<dyn Fn(String) + Send + Sync + 'static>> | Optional | None (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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| method | &str | Required by Rust type | None |
| params | P | Required by Rust type | None |
| 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| method | &str | Required by Rust type | None |
| params | P | Required by Rust type | None |
| version | Option<&str> | Optional | None (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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| QuoteClient.method | &str | Required by Rust type | None |
| QuoteClient.params | P | Required by Rust type | None |
| TradeClient.method | &str | Required by Rust type | None |
| TradeClient.params | P | Required by Rust type | None |
| 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| method | &str | Required by Rust type | None |
| params | P | Required by Rust type | None |
| Response example |
[]Optional low-level call
Signature
pub async fn call_optional<T, P>(&self, method: &str, params: P) -> Result<Option<T>, TigerError>Parameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| QuoteClient.method | &str | Required by Rust type | None |
| QuoteClient.params | P | Required by Rust type | None |
| TradeClient.method | &str | Required by Rust type | None |
| TradeClient.params | P | Required by Rust type | None |
| 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| method | &str | Required by Rust type | None |
| params | P | Required by Rust type | None |
| version | Option<&str> | Optional | None (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>) -> boolParameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| subject | &SubjectType | Required by Rust type | None |
| symbols | Option<&str> | Optional | None (omitted) |
| account | Option<&str> | Optional | None (omitted) |
| market | Option<&str> | Optional | None (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>) -> boolParameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| subject | &SubjectType | Required by Rust type | None |
| symbols | Option<&str> | Optional | None (omitted) |
| account | Option<&str> | Optional | None (omitted) |
| market | Option<&str> | Optional | None (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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| subject | SubjectType | Required by Rust type | None |
| symbols | &[String] | Required by Rust type | None |
| Response example |
No synchronous server response.
Remove a local market subscription
Signature
pub fn remove_subscription(&self, subject: SubjectType, symbols: Option<&[String]>)Parameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| subject | SubjectType | Required by Rust type | None |
| symbols | Option<&[String]> | Optional | None (omitted) |
| Response example |
No synchronous server response.
Read local market subscriptions
Signature
pub fn get_subscriptions(&self) -> HashMap<SubjectType, Vec<String>>Parameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| none | - | Required by Rust type | None |
| 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| subject | SubjectType | Required by Rust type | None |
| Response example |
No synchronous server response.
Remove a local account subscription
Signature
pub fn remove_account_sub(&self, subject: &SubjectType)Parameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| subject | &SubjectType | Required by Rust type | None |
| Response example |
No synchronous server response.
Read local account subscriptions
Signature
pub fn get_account_subscriptions(&self) -> Vec<SubjectType>Parameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| none | - | Required by Rust type | None |
| 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| symbols | &[&str] | Required by Rust type | None |
| 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| symbols | Option<&[&str]> | Optional | None (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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| market | &str | Required by Rust type | None |
| 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
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| market | &str | Required by Rust type | None |
| Response example |
No synchronous server response. Success only means the local flow completed.
Updated 3 days ago
