Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

可复用的异步 API 客户端。

Implementations§

Source§

impl Client

Source

pub async fn a_share_auction_snapshot( &self, thscodes: &[AShareCode], stage: AuctionStage, ) -> Result<Response<AuctionSnapshotData>, Error>

获取一个或多个 A 股标的的集合竞价快照。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AShareCode, AuctionStage};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let targets = [AShareCode::new("600519.SH")?];
    let response = client
        .a_share_auction_snapshot(&targets, AuctionStage::Final)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn a_share_auction_short_term_benchmark( &self, date: Option<NaturalDate>, ) -> Result<Response<AuctionBenchmarkData>, Error>

获取集合竞价短线基准,可指定自然日。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::NaturalDate;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let date = NaturalDate::parse("2026-08-25")?;
    let response = client
        .a_share_auction_short_term_benchmark(Some(date))
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn calendar_trading_days( &self, ) -> Result<Response<TradingDaysData>, Error>

获取服务提供的近期 A 股交易日序列。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client.calendar_trading_days().await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn corp_actions_adjustment_factors( &self, thscode: &AShareCode, from: Option<NaturalDate>, to: Option<NaturalDate>, ) -> Result<Response<AdjustmentFactorsData>, Error>

获取原始复权事件。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AShareCode, NaturalDate};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let target = AShareCode::new("600519.SH")?;
    let from = NaturalDate::parse("2026-01-01")?;
    let to = NaturalDate::parse("2026-08-25")?;
    let response = client
        .corp_actions_adjustment_factors(&target, Some(from), Some(to))
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn financials_income_statements( &self, thscode: &AShareCode, period: FinancialPeriod, range: FinancialRange, ) -> Result<Response<IncomeStatementsData>, Error>

获取利润表。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AShareCode, FinancialPeriod, FinancialRange};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let target = AShareCode::new("600519.SH")?;
    let range = FinancialRange::recent(4)?;
    let response = client
        .financials_income_statements(&target, FinancialPeriod::Annual, range)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn financials_balance_sheets( &self, thscode: &AShareCode, period: FinancialPeriod, range: FinancialRange, ) -> Result<Response<BalanceSheetsData>, Error>

获取资产负债表。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AShareCode, FinancialPeriod, FinancialRange};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let target = AShareCode::new("600519.SH")?;
    let range = FinancialRange::recent(4)?;
    let response = client
        .financials_balance_sheets(&target, FinancialPeriod::Annual, range)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn financials_cash_flow_statements( &self, thscode: &AShareCode, period: FinancialPeriod, range: FinancialRange, ) -> Result<Response<CashFlowStatementsData>, Error>

获取现金流量表。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AShareCode, FinancialPeriod, FinancialRange};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let target = AShareCode::new("600519.SH")?;
    let range = FinancialRange::recent(4)?;
    let response = client
        .financials_cash_flow_statements(&target, FinancialPeriod::Annual, range)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn financials_indicators( &self, thscode: &AShareCode, report: &FinancialReport, ) -> Result<Response<FinancialIndicatorsData>, Error>

获取指定报告期的五类财务指标。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AShareCode, FinancialReport};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let target = AShareCode::new("600519.SH")?;
    let report = FinancialReport::parse("2025-4")?;
    let response = client.financials_indicators(&target, &report).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn prices_snapshot( &self, selection: &PriceSnapshotSelection, ) -> Result<Response<PriceSnapshotData>, Error>

获取当前 A 股行情快照。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AShareCode, PriceSnapshotSelection};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let selection = PriceSnapshotSelection::targets(vec![AShareCode::new("600519.SH")?])?;
    let response = client.prices_snapshot(&selection).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn prices_historical( &self, thscode: &AShareCode, start: UnixMillis, end: UnixMillis, adjustment: Adjustment, offset: u32, ) -> Result<Response<HistoricalData>, Error>

获取指定标的的历史日 K 线数据。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AShareCode, Adjustment, UnixMillis};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let target = AShareCode::new("600519.SH")?;
    let start = UnixMillis::new(1_716_105_600_000)?;
    let end = UnixMillis::new(1_716_192_000_000)?;
    let response = client
        .prices_historical(&target, start, end, Adjustment::None, 0)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn special_data_anomaly_analysis_list( &self, tag_codes: &[AnomalyTag], ) -> Result<Response<AnomalyData>, Error>

获取当日异动分析记录,可按“或”关系组合标签筛选。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::AnomalyTag;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client
        .special_data_anomaly_analysis_list(&[AnomalyTag::LimitUp])
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_anomaly_analysis_stock( &self, thscodes: &[AShareCode], ) -> Result<Response<AnomalyData>, Error>

获取最多 50 个 A 股标的的当日异动分析记录。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::AShareCode;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let targets = [AShareCode::new("600519.SH")?];
    let response = client.special_data_anomaly_analysis_stock(&targets).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_dragon_tiger_list( &self, board_type: DragonTigerBoard, date: Option<NaturalDate>, ) -> Result<Response<DragonTigerData>, Error>

获取龙虎榜。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{DragonTigerBoard, NaturalDate};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let date = NaturalDate::parse("2026-08-25")?;
    let response = client
        .special_data_dragon_tiger_list(DragonTigerBoard::All, Some(date))
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_hot_stock_list( &self, period: HotListPeriod, ) -> Result<Response<HotStockData>, Error>

获取当前个股热榜。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::HotListPeriod;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client
        .special_data_hot_stock_list(HotListPeriod::Day)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_hot_stock_list_history( &self, date: NaturalDate, ) -> Result<Response<HotStockHistoryData>, Error>

获取指定自然日的历史个股热榜。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::NaturalDate;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let date = NaturalDate::parse("2026-08-25")?;
    let response = client.special_data_hot_stock_list_history(date).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_hot_stock_rank_trend( &self, thscode: &AShareCode, start_date: NaturalDate, end_date: NaturalDate, ) -> Result<Response<HotStockTrendData>, Error>

获取指定 A 股标的的热榜排名趋势。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AShareCode, NaturalDate};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let target = AShareCode::new("600519.SH")?;
    let start = NaturalDate::parse("2026-08-01")?;
    let end = NaturalDate::parse("2026-08-25")?;
    let response = client
        .special_data_hot_stock_rank_trend(&target, start, end)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_limit_up_pool( &self, date_ms: Option<ShanghaiDateMillis>, page: Page, sort_field: LimitUpSortField, sort_dir: SortDirection, ) -> Result<Response<LimitUpData>, Error>

获取涨停池。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{LimitUpSortField, Page, SortDirection};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client
        .special_data_limit_up_pool(
            None,
            Page::default(),
            LimitUpSortField::LastPrice,
            SortDirection::Descending,
        )
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_limit_down_pool( &self, date_ms: Option<ShanghaiDateMillis>, page: Page, sort_field: LimitDownSortField, sort_dir: SortDirection, ) -> Result<Response<LimitDownData>, Error>

获取跌停池。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{LimitDownSortField, Page, SortDirection};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client
        .special_data_limit_down_pool(
            None,
            Page::default(),
            LimitDownSortField::LastPrice,
            SortDirection::Descending,
        )
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_limit_break_pool( &self, date_ms: Option<ShanghaiDateMillis>, page: Page, sort_field: LimitBreakSortField, sort_dir: SortDirection, ) -> Result<Response<LimitBreakData>, Error>

获取炸板池。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{LimitBreakSortField, Page, SortDirection};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client
        .special_data_limit_break_pool(
            None,
            Page::default(),
            LimitBreakSortField::LastPrice,
            SortDirection::Descending,
        )
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_limit_up_ladder( &self, ) -> Result<Response<LadderData>, Error>

获取固定覆盖 30 个交易日的连板天梯。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client.special_data_limit_up_ladder().await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn special_data_skyrocket_list( &self, period: HotListPeriod, ) -> Result<Response<HotStockData>, Error>

获取当前飙升榜。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::HotListPeriod;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client
        .special_data_skyrocket_list(HotListPeriod::Hour)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn a_share_valuations_snapshot( &self, thscodes: &[AShareCode], ) -> Result<Response<ValuationsData>, Error>

获取最多 100 个 A 股标的的最新估值指标。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::AShareCode;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let targets = [AShareCode::new("600519.SH")?];
    let response = client.a_share_valuations_snapshot(&targets).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub fn builder(api_key: ApiKey) -> ClientBuilder

使用显式 API Key 开始配置客户端。

Source

pub fn from_env() -> Result<Self, Error>

使用环境变量 HITHINK_FINANCE_API_KEY 构造客户端。

Source§

impl Client

Source

pub async fn fund_companies_detail( &self, company_id: &CompanyId, ) -> Result<Response<FundCompanyData>, Error>

获取基金公司详情。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::CompanyId;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    // This identifier is returned by fund_profile_detail for 025480.OF.
    let company_id = CompanyId::new("00079099")?;
    let response = client.fund_companies_detail(&company_id).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_corporate_actions_dividends( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundDividendsData>, Error>

获取基金历史分红记录。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_corporate_actions_dividends(FundType::Otc, &fund)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_diagnostics_detail( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundDiagnosticsData>, Error>

获取基金诊断维度。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client.fund_diagnostics_detail(FundType::Otc, &fund).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_financials_indicators( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundFinancialIndicatorsData>, Error>

获取基金财务指标。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_financials_indicators(FundType::Otc, &fund)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_financials_income_statements( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundIncomeStatementsData>, Error>

获取基金利润表。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_financials_income_statements(FundType::Otc, &fund)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_financials_balance_sheets( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundBalanceSheetsData>, Error>

获取基金资产负债表。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_financials_balance_sheets(FundType::Otc, &fund)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_holders_detail( &self, fund_type: FundType, thscode: &Thscode, merge_scope: HolderMergeScope, ) -> Result<Response<FundHoldersData>, Error>

获取基金持有人结构。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, HolderMergeScope, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("000037.OF")?;
    let response = client
        .fund_holders_detail(FundType::Otc, &fund, HolderMergeScope::All)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_holders_top( &self, fund_type: FundType, thscode: &Thscode, limit: Option<u8>, ) -> Result<Response<FundTopHoldersData>, Error>

获取最多十名主要基金持有人。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_holders_top(FundType::Otc, &fund, Some(10))
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_managers_investment_style( &self, manager_id: &ManagerId, ) -> Result<Response<FundManagerStyleData>, Error>

获取基金经理的投资风格。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));
mod example_fund {
    include!(concat!(
        env!("CARGO_MANIFEST_DIR"),
        "/examples/configuration/fund.rs"
    ));
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let manager_id = example_fund::manager_id(&client).await?;
    let response = client.fund_managers_investment_style(&manager_id).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_managers_performance( &self, manager_id: &ManagerId, range: ManagerPerformanceRange, ) -> Result<Response<FundManagerPerformanceData>, Error>

获取基金经理的业绩序列。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));
mod example_fund {
    include!(concat!(
        env!("CARGO_MANIFEST_DIR"),
        "/examples/configuration/fund.rs"
    ));
}

use financial_api::ManagerPerformanceRange;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let manager_id = example_fund::manager_id(&client).await?;
    let response = client
        .fund_managers_performance(&manager_id, ManagerPerformanceRange::Month)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_managers_experience( &self, manager_id: &ManagerId, ) -> Result<Response<FundManagerExperienceData>, Error>

获取基金经理的从业经历。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));
mod example_fund {
    include!(concat!(
        env!("CARGO_MANIFEST_DIR"),
        "/examples/configuration/fund.rs"
    ));
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let manager_id = example_fund::manager_id(&client).await?;
    let response = client.fund_managers_experience(&manager_id).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_managers_detail( &self, manager_id: &ManagerId, ) -> Result<Response<FundManagerDetailData>, Error>

获取基金经理的详细资料。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));
mod example_fund {
    include!(concat!(
        env!("CARGO_MANIFEST_DIR"),
        "/examples/configuration/fund.rs"
    ));
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let manager_id = example_fund::manager_id(&client).await?;
    let response = client.fund_managers_detail(&manager_id).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_market_snapshot( &self, thscode: &Thscode, ) -> Result<Response<FundMarketSnapshotData>, Error>

获取场内基金的最新行情快照。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::Thscode;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("510050.SH")?;
    let response = client.fund_market_snapshot(&fund).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_market_historical( &self, thscode: &Thscode, start: UnixMillis, end: UnixMillis, ) -> Result<Response<FundMarketHistoricalData>, Error>

获取场内基金的历史日 K 线。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{Thscode, UnixMillis};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("510050.SH")?;
    let start = UnixMillis::new(1_716_105_600_000)?;
    let end = UnixMillis::new(1_716_192_000_000)?;
    let response = client.fund_market_historical(&fund, start, end).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_news_article_list( &self, fund_type: FundType, thscode: &Thscode, limit: Option<u32>, offset: Option<&Cursor>, ) -> Result<Response<FundNewsData>, Error>

按不透明游标分页获取基金新闻。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_news_article_list(FundType::Otc, &fund, Some(20), None)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_offerings_list( &self, status: OfferingStatus, ) -> Result<Response<FundOfferingsData>, Error>

获取正在认购或即将认购的新发基金。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::OfferingStatus;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client.fund_offerings_list(OfferingStatus::Active).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_performance_nav( &self, fund_type: FundType, thscode: &Thscode, range: Option<FundRange>, nav_type: FundNavType, ) -> Result<Response<FundNavData>, Error>

获取基金净值序列。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundNavType, FundRange, FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_performance_nav(
            FundType::Otc,
            &fund,
            Some(FundRange::Month),
            FundNavType::Unit,
        )
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_performance_returns( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundReturnsData>, Error>

获取基金多个区间的收益率及同类排名。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_performance_returns(FundType::Otc, &fund)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_performance_indicators_historical( &self, fund_type: FundType, thscode: &Thscode, start: UnixMillis, end: UnixMillis, ) -> Result<Response<FundIndicatorHistoryData>, Error>

获取基金历史业绩指标。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode, UnixMillis};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let start = UnixMillis::new(1_716_105_600_000)?;
    let end = UnixMillis::new(1_716_192_000_000)?;
    let response = client
        .fund_performance_indicators_historical(FundType::Otc, &fund, start, end)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_performance_drawdowns( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundDrawdownsData>, Error>

获取标准区间的最大回撤。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_performance_drawdowns(FundType::Otc, &fund)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_portfolio_holdings( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundHoldingsData>, Error>

获取定期披露的基金持仓及汇总比例。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client.fund_portfolio_holdings(FundType::Otc, &fund).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_portfolio_stock_history( &self, fund_type: FundType, thscode: &Thscode, report_type: &ReportType, end_date: NaturalDate, ) -> Result<Response<FundPortfolioHistoryData>, Error>

获取历史披露的股票持仓。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, NaturalDate, ReportType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let report_type = ReportType::new("quarter")?;
    let end_date = NaturalDate::parse("2026-06-30")?;
    let response = client
        .fund_portfolio_stock_history(FundType::Otc, &fund, &report_type, end_date)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_portfolio_bond_history( &self, fund_type: FundType, thscode: &Thscode, report_type: &ReportType, end_date: NaturalDate, ) -> Result<Response<FundPortfolioHistoryData>, Error>

获取历史披露的债券持仓。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, NaturalDate, ReportType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let report_type = ReportType::new("quarter")?;
    let end_date = NaturalDate::parse("2026-06-30")?;
    let response = client
        .fund_portfolio_bond_history(FundType::Otc, &fund, &report_type, end_date)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_portfolio_stock_report_dates( &self, fund_type: FundType, thscode: &Thscode, report_type: Option<&ReportType>, ) -> Result<Response<FundReportDatesData>, Error>

获取可用的股票持仓报告期。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, ReportType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let report_type = ReportType::new("quarter")?;
    let response = client
        .fund_portfolio_stock_report_dates(FundType::Otc, &fund, Some(&report_type))
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_portfolio_bond_report_dates( &self, fund_type: FundType, thscode: &Thscode, report_type: Option<&ReportType>, ) -> Result<Response<FundReportDatesData>, Error>

获取可用的债券持仓报告期。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, ReportType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let report_type = ReportType::new("quarter")?;
    let response = client
        .fund_portfolio_bond_report_dates(FundType::Otc, &fund, Some(&report_type))
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_portfolio_asset_allocation( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundAssetAllocationData>, Error>

获取基金资产配置。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_portfolio_asset_allocation(FundType::Otc, &fund)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn fund_portfolio_industry_allocation( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundIndustryAllocationData>, Error>

获取基金行业配置。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client
        .fund_portfolio_industry_allocation(FundType::Otc, &fund)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn fund_profile_detail( &self, fund_type: FundType, thscode: &Thscode, ) -> Result<Response<FundProfileData>, Error>

获取基金基本资料。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{FundType, Thscode};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let fund = Thscode::new("025480.OF")?;
    let response = client.fund_profile_detail(FundType::Otc, &fund).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn index_catalog_ths_index_list( &self, tag: IndexTag, ) -> Result<Response<IndexCatalogData>, Error>

按目录标签列出同花顺指数。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::IndexTag;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client
        .index_catalog_ths_index_list(IndexTag::Concept)
        .await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn index_constituents_ths_stock_list( &self, thscode: &Thscode, ) -> Result<Response<IndexConstituentsData>, Error>

获取指定指数当前的成分股列表。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::Thscode;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let index = Thscode::new("000300.SH")?;
    let response = client.index_constituents_ths_stock_list(&index).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn index_prices_snapshot( &self, thscodes: &[Thscode], ) -> Result<Response<PriceSnapshotData>, Error>

获取一个或多个交易所指数或同花顺指数的行情快照。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::Thscode;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let indices = [Thscode::new("000300.SH")?, Thscode::new("399006.SZ")?];
    let response = client.index_prices_snapshot(&indices).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn index_prices_historical( &self, thscode: &Thscode, start: UnixMillis, end: UnixMillis, ) -> Result<Response<IndexHistoricalData>, Error>

获取指定指数的历史日 K 线。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{Thscode, UnixMillis};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let index = Thscode::new("000300.SH")?;
    let start = UnixMillis::new(1_716_105_600_000)?;
    let end = UnixMillis::new(1_716_192_000_000)?;
    let response = client.index_prices_historical(&index, start, end).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn market_dump_daily_k( &self, ) -> Result<Response<MarketDumpUrl>, Error>

获取完整十年日 K 线数据包的预签名下载地址。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client.market_dump_daily_k().await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn market_dump_daily_k_10d( &self, ) -> Result<Response<MarketDumpUrl>, Error>

获取最近十个交易日日 K 线数据包的预签名下载地址。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client.market_dump_daily_k_10d().await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source

pub async fn market_dump_adjustment_factors( &self, ) -> Result<Response<MarketDumpUrl>, Error>

获取完整复权事件数据包的预签名下载地址。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let response = client.market_dump_adjustment_factors().await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

按完整标的代码、纯代码或名称搜索标的。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{SearchQuery, TickerSearchRequest};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let request = TickerSearchRequest::new(SearchQuery::new("贵州茅台")?);
    let response = client.tickers_search(&request).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}
Source§

impl Client

Source

pub async fn tickers_list( &self, request: &TickerListRequest, ) -> Result<Response<TickerData>, Error>

分页浏览规范化的标的代码表。

§示例
include!(concat!(
    env!("CARGO_MANIFEST_DIR"),
    "/examples/configuration/client.rs"
));

use financial_api::{AssetType, TickerListRequest};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = from_env()?;
    let request = TickerListRequest::new().asset_types([AssetType::AShare]);
    let response = client.tickers_list(&request).await?;

    println!("request_id={}", response.request_id());
    println!("{:#?}", response.data());
    Ok(())
}

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more