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: impl IntoIterator<Item = impl TryInto<AShareCode, Error: Into<ValidationError>>>, stage: AuctionStage, ) -> Result<Response<AuctionSnapshotData>, Error>

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

§示例
use financial_api::{AuctionStage, Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .a_share_auction_snapshot(["600519.SH"], 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: impl TryInto<OptionalInput<NaturalDate>, Error: Into<ValidationError>>, ) -> Result<Response<AuctionBenchmarkData>, Error>

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .a_share_auction_short_term_benchmark("2026-08-25")
        .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 股交易日序列。

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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: impl TryInto<AShareCode, Error: Into<ValidationError>>, from: impl TryInto<OptionalInput<NaturalDate>, Error: Into<ValidationError>>, to: impl TryInto<OptionalInput<NaturalDate>, Error: Into<ValidationError>>, ) -> Result<Response<AdjustmentFactorsData>, Error>

获取原始复权事件。

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .corp_actions_adjustment_factors("600519.SH", "2026-01-01", "2026-08-25")
        .await?;

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

impl Client

Source

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

获取利润表。

§示例
use financial_api::{Client, Error, FinancialPeriod, FinancialRange};

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

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

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

获取资产负债表。

§示例
use financial_api::{Client, Error, FinancialPeriod, FinancialRange};

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

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

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

获取现金流量表。

§示例
use financial_api::{Client, Error, FinancialPeriod, FinancialRange};

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

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

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

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client.financials_indicators("600519.SH", "2025-4").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 股行情快照。

§示例
use financial_api::{Client, Error, PriceSnapshotSelection};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let selection = PriceSnapshotSelection::targets(["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: impl TryInto<AShareCode, Error: Into<ValidationError>>, start: impl TryInto<UnixMillis, Error: Into<ValidationError>>, end: impl TryInto<UnixMillis, Error: Into<ValidationError>>, adjustment: Adjustment, offset: u32, ) -> Result<Response<HistoricalData>, Error>

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

§示例
use financial_api::{Adjustment, Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .prices_historical(
            "600519.SH",
            1_716_105_600_000,
            1_716_192_000_000,
            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>

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

§示例
use financial_api::{AnomalyTag, Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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: impl IntoIterator<Item = impl TryInto<AShareCode, Error: Into<ValidationError>>>, ) -> Result<Response<AnomalyData>, Error>

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .special_data_anomaly_analysis_stock(["600519.SH"])
        .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: impl TryInto<OptionalInput<NaturalDate>, Error: Into<ValidationError>>, ) -> Result<Response<DragonTigerData>, Error>

获取龙虎榜。

§示例
use financial_api::{Client, DragonTigerBoard, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .special_data_dragon_tiger_list(DragonTigerBoard::All, "2026-08-25")
        .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>

获取当前个股热榜。

§示例
use financial_api::{Client, Error, HotListPeriod};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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: impl TryInto<NaturalDate, Error: Into<ValidationError>>, ) -> Result<Response<HotStockHistoryData>, Error>

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .special_data_hot_stock_list_history("2026-08-25")
        .await?;

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

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

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .special_data_hot_stock_rank_trend("600519.SH", "2026-08-01", "2026-08-25")
        .await?;

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

pub async fn special_data_limit_up_pool( &self, date: impl TryInto<OptionalInput<NaturalDate>, Error: Into<ValidationError>>, page: Page, sort_field: LimitUpSortField, sort_dir: SortDirection, ) -> Result<Response<LimitUpData>, Error>

获取涨停池。

§示例
use financial_api::{Client, Error, LimitUpSortField, Page, SortDirection};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .special_data_limit_up_pool(
            "2026-08-25",
            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: impl TryInto<OptionalInput<NaturalDate>, Error: Into<ValidationError>>, page: Page, sort_field: LimitDownSortField, sort_dir: SortDirection, ) -> Result<Response<LimitDownData>, Error>

获取跌停池。

§示例
use financial_api::{Client, Error, LimitDownSortField, Page, SortDirection};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .special_data_limit_down_pool(
            "2026-08-25",
            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: impl TryInto<OptionalInput<NaturalDate>, Error: Into<ValidationError>>, page: Page, sort_field: LimitBreakSortField, sort_dir: SortDirection, ) -> Result<Response<LimitBreakData>, Error>

获取炸板池。

§示例
use financial_api::{Client, Error, LimitBreakSortField, Page, SortDirection};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .special_data_limit_break_pool(
            "2026-08-25",
            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 个交易日的连板天梯。

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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>

获取当前飙升榜。

§示例
use financial_api::{Client, Error, HotListPeriod};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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: impl IntoIterator<Item = impl TryInto<AShareCode, Error: Into<ValidationError>>>, ) -> Result<Response<ValuationsData>, Error>

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client.a_share_valuations_snapshot(["600519.SH"]).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: impl TryInto<CompanyId, Error: Into<ValidationError>>, ) -> Result<Response<FundCompanyData>, Error>

获取基金公司详情。

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    // This identifier is returned by fund_profile_detail for 025480.OF.
    let response = client.fund_companies_detail("00079099").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: impl TryInto<Thscode, Error: Into<ValidationError>>, ) -> Result<Response<FundDividendsData>, Error>

获取基金历史分红记录。

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_corporate_actions_dividends(FundType::Otc, "025480.OF")
        .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: impl TryInto<Thscode, Error: Into<ValidationError>>, ) -> Result<Response<FundDiagnosticsData>, Error>

获取基金诊断维度。

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_diagnostics_detail(FundType::Otc, "025480.OF")
        .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: impl TryInto<Thscode, Error: Into<ValidationError>>, ) -> Result<Response<FundFinancialIndicatorsData>, Error>

获取基金财务指标。

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_financials_indicators(FundType::Otc, "025480.OF")
        .await?;

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

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

获取基金利润表。

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_financials_income_statements(FundType::Otc, "025480.OF")
        .await?;

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

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

获取基金资产负债表。

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_financials_balance_sheets(FundType::Otc, "025480.OF")
        .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: impl TryInto<Thscode, Error: Into<ValidationError>>, merge_scope: HolderMergeScope, ) -> Result<Response<FundHoldersData>, Error>

获取基金持有人结构。

§示例
use financial_api::{Client, Error, FundType, HolderMergeScope};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_holders_detail(FundType::Otc, "000037.OF", 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: impl TryInto<Thscode, Error: Into<ValidationError>>, limit: Option<u8>, ) -> Result<Response<FundTopHoldersData>, Error>

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

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_holders_top(FundType::Otc, "025480.OF", 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: impl TryInto<ManagerId, Error: Into<ValidationError>>, ) -> Result<Response<FundManagerStyleData>, Error>

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client.fund_managers_investment_style("H002417139").await?;

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

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

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

§示例
use financial_api::{Client, Error, ManagerPerformanceRange};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_managers_performance("H002417139", ManagerPerformanceRange::Month)
        .await?;

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

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

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client.fund_managers_experience("H002417139").await?;

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

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

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client.fund_managers_detail("H002417139").await?;

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

impl Client

Source

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

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client.fund_market_snapshot("510050.SH").await?;

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

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

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_market_historical("510050.SH", 1_716_105_600_000, 1_716_192_000_000)
        .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: impl TryInto<Thscode, Error: Into<ValidationError>>, limit: Option<u32>, offset: Option<&Cursor>, ) -> Result<Response<FundNewsData>, Error>

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

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_news_article_list(FundType::Otc, "025480.OF", 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>

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

§示例
use financial_api::{Client, Error, OfferingStatus};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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: impl TryInto<Thscode, Error: Into<ValidationError>>, range: Option<FundRange>, nav_type: FundNavType, ) -> Result<Response<FundNavData>, Error>

获取基金净值序列。

§示例
use financial_api::{Client, Error, FundNavType, FundRange, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_performance_nav(
            FundType::Otc,
            "025480.OF",
            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: impl TryInto<Thscode, Error: Into<ValidationError>>, ) -> Result<Response<FundReturnsData>, Error>

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

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_performance_returns(FundType::Otc, "025480.OF")
        .await?;

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

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

获取基金历史业绩指标。

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_performance_indicators_historical(
            FundType::Otc,
            "025480.OF",
            1_716_105_600_000,
            1_716_192_000_000,
        )
        .await?;

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

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

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

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_performance_drawdowns(FundType::Otc, "025480.OF")
        .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: impl TryInto<Thscode, Error: Into<ValidationError>>, ) -> Result<Response<FundHoldingsData>, Error>

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

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_portfolio_holdings(FundType::Otc, "025480.OF")
        .await?;

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

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

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

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_portfolio_stock_history(FundType::Otc, "025480.OF", "quarter", "2026-06-30")
        .await?;

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

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

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

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_portfolio_bond_history(FundType::Otc, "025480.OF", "quarter", "2026-06-30")
        .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: impl TryInto<Thscode, Error: Into<ValidationError>>, report_type: impl TryInto<OptionalInput<ReportType>, Error: Into<ValidationError>>, ) -> Result<Response<FundReportDatesData>, Error>

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

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_portfolio_stock_report_dates(FundType::Otc, "025480.OF", "quarter")
        .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: impl TryInto<Thscode, Error: Into<ValidationError>>, report_type: impl TryInto<OptionalInput<ReportType>, Error: Into<ValidationError>>, ) -> Result<Response<FundReportDatesData>, Error>

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

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_portfolio_bond_report_dates(FundType::Otc, "025480.OF", "quarter")
        .await?;

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

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

获取基金资产配置。

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_portfolio_asset_allocation(FundType::Otc, "025480.OF")
        .await?;

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

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

获取基金行业配置。

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_portfolio_industry_allocation(FundType::Otc, "025480.OF")
        .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: impl TryInto<Thscode, Error: Into<ValidationError>>, ) -> Result<Response<FundProfileData>, Error>

获取基金基本资料。

§示例
use financial_api::{Client, Error, FundType};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .fund_profile_detail(FundType::Otc, "025480.OF")
        .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>

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

§示例
use financial_api::{Client, Error, IndexTag};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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: impl TryInto<Thscode, Error: Into<ValidationError>>, ) -> Result<Response<IndexConstituentsData>, Error>

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .index_constituents_ths_stock_list("000300.SH")
        .await?;

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

pub async fn index_prices_snapshot( &self, thscodes: impl IntoIterator<Item = impl TryInto<Thscode, Error: Into<ValidationError>>>, ) -> Result<Response<PriceSnapshotData>, Error>

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .index_prices_snapshot(["000300.SH", "399006.SZ"])
        .await?;

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

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

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

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let response = client
        .index_prices_historical("000300.SH", 1_716_105_600_000, 1_716_192_000_000)
        .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 线数据包的预签名下载地址。

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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 线数据包的预签名下载地址。

§示例
use financial_api::{Client, Error};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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>

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

§示例
use financial_api::{Client, Error};

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

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

impl Client

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

§示例
use financial_api::{Client, Error, TickerSearchRequest};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = Client::from_env()?;
    let request = TickerSearchRequest::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>

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

§示例
use financial_api::{AssetType, Client, Error, TickerListRequest};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = 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) -> Self

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, !>

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