PHPackages                             zyan/stock-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. zyan/stock-api

ActiveLibrary[API Development](/categories/api)

zyan/stock-api
==============

股票api

2.1.1(8mo ago)0921MITPHPPHP &gt;=7.4

Since Feb 12Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/aa24615/stock-api)[ Packagist](https://packagist.org/packages/zyan/stock-api)[ RSS](/packages/zyan-stock-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

zyan/stock-api
==============

[](#zyanstock-api)

股票api

要求
--

[](#要求)

1. php &gt;= 7.4
2. composer 2.x

安装
--

[](#安装)

```
composer require zyan/stock-api -vvv
```

用法
--

[](#用法)

#### 配置

[](#配置)

```
StockApi::setConfig([
    'cache_path' => '/tmp/', //默认 ./runtime
]);
```

#### 开始

[](#开始)

```
$stockApi = StockApi::getXueqiu(); //获取雪球api
```

目前只有雪球api,后面版本会增加其他api

#### 股票列表

[](#股票列表)

```
//深圳A股
$xueQiuApi->getSzListAllToA();
//深圳B股
$xueQiuApi->getSzListAllToB();
//上海A股
$xueQiuApi->getShListAllToA();
//上海B股
$xueQiuApi->getShListAllToB();
//美股
$xueQiuApi->getUsListAll();
//港股
$xueQiuApi->getHkListAll();
```

return

```
(
    [count] => 2840
    [raw_count] => 2840
    [size] => 100
    [total_page] => 29
    [type] => 'sz'
    [market] => 'CN'
    [list] => Array
    (
        [0] => Array
            (
            [symbol] => SZ300043
            [net_profit_cagr] => -44.773510944738
            [north_net_inflow] =>
            [ps] => 4.4096797096154
            [type] => 11
            [percent] => 20.05
            [has_follow] =>
            [tick_size] => 0.01
            [pb_ttm] => 3.384
            [float_shares] => 1243539501
            [current] => 4.61
            [amplitude] => 24.74
            [pcf] => 38.22815900534
            [current_year_percent] => 24.26
            [float_market_capital] => 5732717100
            [north_net_inflow_time] =>
            [market_capital] => 5735754629
            [dividend_yield] =>
            [lot_size] => 100
            [roe_ttm] => -14.291383768457
            [total_percent] => 94.69
            [percent5m] => 0
            [income_cagr] => -4.5863830118018
            [amount] => 1398782578.23
            [chg] => 0.77
            [issue_date_ts] => 1263916800000
            [eps] => -0.21
            [main_net_inflows] => 148868900
            [volume] => 325274271
            [volume_ratio] => 2.23
            [pb] => 3.384
            [followers] => 29531
            [turnover_rate] => 26.16
            [mapping_quote_current] =>
            [first_percent] => 13.73
            [name] => 星辉娱乐
            [pe_ttm] =>
            [dual_counter_mapping_symbol] =>
            [total_shares] => 1244198401
            [limitup_days] => 1
        )
        ...
    )
)

```

注意: 以上方法都是全量的,就是分页获取所有数据,如果只需要部分数据,请自行分页获取

```
$stockApi->list(string $market,string $type,int $currentPage,int $size)
```

return

```
(
    [data] => Array
        (
            [count] => 5000
            [list] => Array
            (
                [0] => Array
                    (
                    [symbol] => SZ300043
                    [net_profit_cagr] => -44.773510944738
                    [north_net_inflow] =>
                    [ps] => 4.4096797096154
                    [type] => 11
                    [percent] => 20.05
                    [has_follow] =>
                    [tick_size] => 0.01
                    [pb_ttm] => 3.384
                    [float_shares] => 1243539501
                    [current] => 4.61
                    [amplitude] => 24.74
                    [pcf] => 38.22815900534
                    [current_year_percent] => 24.26
                    [float_market_capital] => 5732717100
                    [north_net_inflow_time] =>
                    [market_capital] => 5735754629
                    [dividend_yield] =>
                    [lot_size] => 100
                    [roe_ttm] => -14.291383768457
                    [total_percent] => 94.69
                    [percent5m] => 0
                    [income_cagr] => -4.5863830118018
                    [amount] => 1398782578.23
                    [chg] => 0.77
                    [issue_date_ts] => 1263916800000
                    [eps] => -0.21
                    [main_net_inflows] => 148868900
                    [volume] => 325274271
                    [volume_ratio] => 2.23
                    [pb] => 3.384
                    [followers] => 29531
                    [turnover_rate] => 26.16
                    [mapping_quote_current] =>
                    [first_percent] => 13.73
                    [name] => 星辉娱乐
                    [pe_ttm] =>
                    [dual_counter_mapping_symbol] =>
                    [total_shares] => 1244198401
                    [limitup_days] => 1
                )
                ...
            )
        )
    )
    [error_code] => 0
    [error_msg] => 'ok'
)
```

参与贡献
----

[](#参与贡献)

1. fork 当前库到你的名下。
2. 在你的本地修改完成审阅过后提交到你的仓库。
3. 提交 PR 并描述你的修改，等待合并。

License
-------

[](#license)

[MIT license](https://opensource.org/licenses/MIT)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance60

Regular maintenance activity

Popularity11

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~51 days

Total

5

Last Release

254d ago

Major Versions

1.0.0 → 2.0.02025-02-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbcdf7ec634eb735375fa4f6046f91646934f9eb07456f4b4dcbdec545c6435b?d=identicon)[aa24615](/maintainers/aa24615)

---

Tags

api

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/zyan-stock-api/health.svg)

```
[![Health](https://phpackages.com/badges/zyan-stock-api/health.svg)](https://phpackages.com/packages/zyan-stock-api)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
