Cryptocurrency
Cryptocurrency HTTP market data supports K-line data and current timelines. It does not support historical timelines.
Get Kline
Signature
pub async fn get_kline(&self, req: KlineRequest) -> Result<Vec<Kline>, TigerError>Description
Returns cryptocurrency bars. symbols and period are required by the server; set sec_type to Some("CC".into()).
Parameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| req.symbols | Option<Vec<String>> | Required by the server; not prevalidated by the SDK | None (omitted) |
| req.period | Option<String> | Required by the server; not prevalidated by the SDK | None (omitted) |
| req.right | Option<String> | Optional | None (omitted) |
| req.begin_time | Option<i64> | Optional | None (omitted) |
| req.end_time | Option<i64> | Optional | None (omitted) |
| req.limit | Option<i32> | Optional | None (omitted) |
| req.begin_index | Option<i32> | Optional | None (omitted) |
| req.end_index | Option<i32> | Optional | None (omitted) |
| req.page_token | Option<String> | Optional | None (omitted) |
| req.trade_session | Option<String> | Optional | None (omitted) |
| req.date | Option<String> | Optional | None (omitted) |
| req.with_fundamental | Option<bool> | Optional | None (omitted) |
| req.sec_type | Option<String> | Required for cryptocurrency; use CC | None (omitted) |
| req.lang | Option<String> | Optional | None (omitted) |
Return
Result<Vec<Kline>, TigerError>
| Rust field | JSON field | Type | Description |
|---|---|---|---|
| symbol | symbol | String | Cryptocurrency symbol |
| period | period | String | Period |
| next_page_token | nextPageToken | String | Next page token |
| items | items | Vec | Data items |
items elements (KlineItem):
| Rust field | JSON field | Type | Description |
|---|---|---|---|
| time | time | i64 | Timestamp |
| volume | volume | i64 | Integer volume; use when volume_decimal is absent |
| volume_decimal | volumeDecimal | Option<f64> | Optional fractional cryptocurrency volume; use volume when absent |
| open | open | f64 | Open price |
| close | close | f64 | Close price |
| high | high | f64 | High price |
| low | low | f64 | Low price |
| amount | amount | f64 | Turnover amount |
Example
use tigeropen::config::ClientConfig;
use tigeropen::model::quote_requests::KlineRequest;
use tigeropen::quote::QuoteClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig::builder().build()?;
let quote = QuoteClient::from_config(config);
let kline = quote.get_kline(KlineRequest {
symbols: Some(vec!["BTC.USD".into()]),
period: Some("day".into()),
sec_type: Some("CC".into()),
..Default::default()
}).await?;
Ok(())
}Rate limit
The base rate limit is 60 requests/min. Methods documented here that use kline share this quota.
Get Kline By Page
Signature
pub async fn get_kline_by_page(&self, req: KlineByPageRequest) -> Result<Vec<KlineItem>, TigerError>Description
Client pagination for cryptocurrency bars. The SDK defaults page_size to 200 and total_size to 1000, then continues from the oldest bar time minus one. It passes sec_type to every page request; set it to Some("CC".into()).
Parameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| req.symbols | Option<Vec<String>> | Optional | None (omitted) |
| req.period | Option<String> | Optional | None (omitted) |
| req.begin_time | Option<i64> | Optional | None (omitted) |
| req.end_time | Option<i64> | Optional | None (omitted) |
| req.total_size | Option<i32> | Optional | 1000 when None |
| req.page_size | Option<i32> | Optional | 200 when None |
| req.right | Option<String> | Optional | None (omitted) |
| req.trade_session | Option<String> | Optional | None (omitted) |
| req.sec_type | Option<String> | Required for cryptocurrency; use CC | None (omitted) |
| req.lang | Option<String> | Optional | None (omitted) |
Return
Result<Vec<KlineItem>, TigerError>
| Rust field | JSON field | Type | Description |
|---|---|---|---|
| time | time | i64 | Timestamp |
| volume | volume | i64 | Integer volume; use when volume_decimal is absent |
| volume_decimal | volumeDecimal | Option<f64> | Optional fractional cryptocurrency volume; use volume when absent |
| open | open | f64 | Open price |
| close | close | f64 | Close price |
| high | high | f64 | High price |
| low | low | f64 | Low price |
| amount | amount | f64 | Turnover amount |
Example
use tigeropen::config::ClientConfig;
use tigeropen::model::quote_requests::KlineByPageRequest;
use tigeropen::quote::QuoteClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig::builder().build()?;
let quote = QuoteClient::from_config(config);
let kline = quote.get_kline_by_page(KlineByPageRequest {
symbols: Some(vec!["BTC.USD".into()]),
period: Some("day".into()),
sec_type: Some("CC".into()),
total_size: Some(100),
..Default::default()
}).await?;
Ok(())
}Rate limit
The base rate limit is 60 requests/min. Methods documented here that use kline share this quota.
Get Current Timeline With Request
Signature
pub async fn get_timeline_with_request(&self, req: TimelineRequest) -> Result<Vec<Timeline>, TigerError>Description
Returns current cryptocurrency timeline data. Set sec_type to Some("CC".into()). This method does not provide cryptocurrency historical timelines.
Parameters
| Parameter | Rust type | Requirement | SDK default |
|---|---|---|---|
| req.symbols | Option<Vec<String>> | Required by the server; not prevalidated by the SDK | None (omitted) |
| req.sec_type | Option<String> | Required for cryptocurrency; use CC | None (omitted) |
Return
Result<Vec<Timeline>, TigerError>
| Rust field | JSON field | Type | Description |
|---|---|---|---|
| symbol | symbol | String | Cryptocurrency symbol |
| period | period | String | Period |
| pre_close | preClose | f64 | Previous close |
| intraday | intraday | Option<TimelineBucket> | Intraday timeline data |
| pre_hours | preHours | Option<TimelineBucket> | Pre-market timeline data |
| after_hours | afterHours | Option<TimelineBucket> | After-hours timeline data |
TimelineBucket fields:
| Rust field | JSON field | Type | Description |
|---|---|---|---|
| items | items | Vec<TimelineItem> | Timeline point list |
Each TimelineBucket.items element is a TimelineItem:
| Rust field | JSON field | Type | Description |
|---|---|---|---|
| time | time | i64 | Timestamp |
| volume | volume | i64 | Integer volume; use when volume_decimal is absent |
| volume_decimal | volumeDecimal | Option<f64> | Optional fractional cryptocurrency volume; use volume when absent |
| price | price | f64 | Price |
| avg_price | avgPrice | f64 | Average price |
Example
use tigeropen::config::ClientConfig;
use tigeropen::model::quote_requests::TimelineRequest;
use tigeropen::quote::QuoteClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig::builder().build()?;
let quote = QuoteClient::from_config(config);
let timeline = quote.get_timeline_with_request(TimelineRequest {
symbols: Some(vec!["BTC.USD".into()]),
sec_type: Some("CC".into()),
}).await?;
Ok(())
}Rate limit
The base rate limit is 120 requests/min.
Updated about 14 hours ago
