# akshare-rs **Repository Path**: kafou/akshare-rs ## Basic Information - **Project Name**: akshare-rs - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-05 - **Last Updated**: 2026-02-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 简介 将[akshare](https://github.com/akfamily/akshare)中的常用API翻译为rust版本。使用[polars](https://github.com/pola-rs/polars)处理数据框。 目前已翻译API: - [stock_zh_a_hist](https://akshare.akfamily.xyz/data/stock/stock.html#id21) 单次返回指定沪深京 A 股上市公司、指定周期和指定日期间的历史行情日频率数据 - [stock_zh_a_spot_em](https://www.akshare.xyz/data/stock/stock.html#id12) 单次返回所有沪深京 A 股上市公司的实时行情数据 - [stock_sse_summary](https://akshare.akfamily.xyz/data/stock/stock.html#id2) 单次返回上证最近交易日的股票数据总貌 ## 用法 使用cargo构建新的rust项目 ```sh cargo new example_akshare ``` 添加依赖项到Cargo.toml ```toml [dependencies] akshare = { git="https://github.com/rikkaka/akshare-rs" } tokio = { version = "1.29.1", features = ["rt-multi-thread"]} ``` 在main.rs中运行 ```rust use akshare::{stock_zh_a_spot_em, stock_zh_a_hist}; #[tokio::main] async fn main() { let current = stock_zh_a_spot_em().await.unwrap(); println!("实时行情:{}", current); let his = stock_zh_a_hist("000001", "daily", "20210601", "20210615", "qfq").await.unwrap(); println!("历史行情:{}", his); } ``` 输出: ```sh 实时行情:shape: (5_000, 22) ┌────────┬──────────┬────────┬────────┬───┬───────┬───────────┬────────────┬────────────────┐ │ 代码 ┆ 名称 ┆ 最新价 ┆ 涨跌幅 ┆ … ┆ 涨速 ┆ 5分钟涨跌 ┆ 60日涨跌幅 ┆ 年初至今涨跌幅 │ │ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ str ┆ f64 ┆ f64 ┆ ┆ f64 ┆ f64 ┆ f64 ┆ f64 │ ╞════════╪══════════╪════════╪════════╪═══╪═══════╪═══════════╪════════════╪════════════════╡ │ 300844 ┆ 山水比德 ┆ 36.01 ┆ 19.99 ┆ … ┆ 0.0 ┆ 0.0 ┆ 42.61 ┆ 60.83 │ │ 300812 ┆ 易天股份 ┆ 31.81 ┆ 19.99 ┆ … ┆ 0.0 ┆ 0.0 ┆ 57.79 ┆ 66.37 │ │ 301365 ┆ 矩阵股份 ┆ 20.15 ┆ 15.54 ┆ … ┆ 0.45 ┆ -1.13 ┆ 19.44 ┆ 22.94 │ │ 301218 ┆ 华是科技 ┆ 38.98 ┆ 14.61 ┆ … ┆ 1.75 ┆ 3.53 ┆ 82.41 ┆ 106.9 │ │ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … │ │ 301071 ┆ 力量钻石 ┆ 39.24 ┆ -1.65 ┆ … ┆ 0.15 ┆ 0.13 ┆ -15.61 ┆ -40.22 │ │ 000826 ┆ 启迪环境 ┆ 2.97 ┆ -1.66 ┆ … ┆ 0.0 ┆ 0.0 ┆ -4.81 ┆ -15.86 │ │ 688601 ┆ 力芯微 ┆ 44.53 ┆ -1.66 ┆ … ┆ -0.02 ┆ -0.02 ┆ -11.14 ┆ 18.72 │ │ 688328 ┆ 深科达 ┆ 27.31 ┆ -1.66 ┆ … ┆ 0.4 ┆ 0.44 ┆ 22.03 ┆ 32.19 │ └────────┴──────────┴────────┴────────┴───┴───────┴───────────┴────────────┴────────────────┘ 历史行情:shape: (10, 11) ┌────────────┬───────┬───────┬───────┬───┬──────┬────────┬────────┬────────┐ │ 日期 ┆ 开盘 ┆ 收盘 ┆ 最高 ┆ … ┆ 振幅 ┆ 涨跌幅 ┆ 涨跌额 ┆ 换手率 │ │ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │ │ date ┆ f64 ┆ f64 ┆ f64 ┆ ┆ f64 ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪═══════╪═══════╪═══════╪═══╪══════╪════════╪════════╪════════╡ │ 2021-06-01 ┆ 23.69 ┆ 23.41 ┆ 23.74 ┆ … ┆ 3.17 ┆ -1.18 ┆ -0.28 ┆ 0.32 │ │ 2021-06-02 ┆ 23.38 ┆ 23.38 ┆ 23.41 ┆ … ┆ 2.31 ┆ -0.13 ┆ -0.03 ┆ 0.26 │ │ 2021-06-03 ┆ 23.21 ┆ 23.26 ┆ 23.63 ┆ … ┆ 1.97 ┆ -0.51 ┆ -0.12 ┆ 0.21 │ │ 2021-06-04 ┆ 23.48 ┆ 24.03 ┆ 24.45 ┆ … ┆ 4.99 ┆ 3.31 ┆ 0.77 ┆ 0.39 │ │ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … ┆ … │ │ 2021-06-09 ┆ 23.92 ┆ 24.14 ┆ 24.37 ┆ … ┆ 2.91 ┆ 0.5 ┆ 0.12 ┆ 0.23 │ │ 2021-06-10 ┆ 24.15 ┆ 23.69 ┆ 24.55 ┆ … ┆ 3.77 ┆ -1.86 ┆ -0.45 ┆ 0.27 │ │ 2021-06-11 ┆ 23.8 ┆ 22.86 ┆ 23.84 ┆ … ┆ 5.19 ┆ -3.5 ┆ -0.83 ┆ 0.43 │ │ 2021-06-15 ┆ 22.84 ┆ 22.71 ┆ 22.92 ┆ … ┆ 2.76 ┆ -0.66 ┆ -0.15 ┆ 0.34 │ └────────────┴───────┴───────┴───────┴───┴──────┴────────┴────────┴────────┘ ```