# China A-Share Fund Flow API 主力资金流向 · Eastmoney · A股资金流 (`jfishpw/china-a-share-fund-flow`) Actor

Real-time main-force capital flow (主力资金流向) for all China A-shares (沪深京 5930 只) — main/super-large/large/medium/small order net amounts AND net ratios, price and change %. One API call = entire market. A股资金流 · Eastmoney · China stock money flow. Clean JSON for quants and AI agents. $3.9 per snapshot.

- **URL**: https://apify.com/jfishpw/china-a-share-fund-flow.md
- **Developed by:** [peng wang](https://apify.com/jfishpw) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.90 / full a-share market fund flow

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## China A-Share Fund Flow API 主力资金流向 · Eastmoney · A股资金流

**China A-share fund flow / 主力资金流向 / A股资金流 / Eastmoney API** — real-time **main-force capital flow (主力资金流向)** for every China A-share — main / super-large / large / medium / small order net amounts **and** net ratios, plus price and change %.

**One API call returns the entire market (5,900+ stocks, 沪深京) with `"mode": "market"`.** Clean JSON, ready for analysts, quants and AI agents.

**Pricing: $3.9 per full-market snapshot · $0.005 per stock · $0.02 per stock-day of history.** Pay per event, no subscription.

**Search terms:** China A-share fund flow · 主力资金流向 · A股资金流 · Eastmoney scraper · China stock money flow · a-share capital flow · 资金流向 API · China stock screener data · Shanghai / Shenzhen stock data · Chinese equity API for AI agents

***

### Why this Actor

Getting money-flow data for China A-shares usually means one of two things:

| Problem | This Actor |
|---|---|
| The free JSON APIs get rate-limited or blocked from outside China | Uses the same endpoints the site itself uses, with paging + retry + browser fallback |
| You get Eastmoney's raw `f62`/`f66`/`f72` field codes and have to decode them | Returns semantic names (`main_net`, `super_large_net`, …) plus ratio fields |
| Some fields silently return garbage constants | Fixed-value fields are detected and excluded; every record carries a `main_net_check` integrity flag |

***

### Input

```json
{
  "mode": "single",
  "codes": ["002112", "600519"],
  "historyDays": 5,
  "includeQuote": true,
  "browserFallback": true,
  "maxRetries": 3,
  "debug": false
}
```

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | string | `single` | `single` (default) = only `codes` · `market` = whole market (5,900+ stocks) · `history` = daily history per code |
| `codes` | array | `["002112", "600519"]` | 6-digit A-share codes, e.g. `["002112", "600519"]`. In `single`/`history` mode, defaults to the sample codes when empty. |
| `historyDays` | integer | `30` | Only for `mode=history`. 1–120 days per stock. |
| `includeQuote` | boolean | `true` | Include `price` and `change_pct`. |
| `browserFallback` | boolean | `true` | If the JSON API fails, retry with a real headless browser. |
| `maxRetries` | integer | `3` | Retry attempts per request. |
| `debug` | boolean | `false` | Include raw diagnostics. |

#### Examples

Default (empty input or no `codes`) returns the two sample stocks:

```json
{}
```

Whole market (takes several minutes — set this explicitly):

```json
{ "mode": "market" }
```

```json
{ "mode": "single", "codes": ["002112", "600519", "000001"] }
```

```json
{ "mode": "history", "codes": ["002112"], "historyDays": 60 }
```

***

### How to call it (API / SDK)

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("jfishpw/china-a-share-fund-flow").call(
    run_input={"mode": "single", "codes": ["002112", "600519"]},
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["code"], item["name"], item["main_net"], item["main_ratio"])
```

**JavaScript**

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });
const run = await client.actor('jfishpw/china-a-share-fund-flow').call({
  mode: 'single',
  codes: ['002112', '600519'],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].main_net);
```

**cURL**

```bash
curl "https://api.apify.com/v2/acts/jfishpw/china-a-share-fund-flow/runs?token=<YOUR_API_TOKEN>" \
  -X POST -H "Content-Type: application/json" \
  -d '{"mode":"single","codes":["002112","600519"]}'
```

***

### Output

#### `mode: market` / `mode: single`

```json
{
  "code": "002112",
  "name": "三变科技",
  "price": 12.0,
  "change_pct": -2.44,
  "main_net": -1834716.0,
  "super_large_net": -1779763.0,
  "large_net": -54953.0,
  "medium_net": 5227471.0,
  "small_net": -3392755.0,
  "main_ratio": -1.27,
  "super_large_ratio": -1.23,
  "large_ratio": -0.04,
  "medium_ratio": 3.62,
  "small_ratio": -2.35,
  "timestamp": 1794898488,
  "has_data": true,
  "main_net_check": true
}
```

| Field | Meaning |
|---|---|
| `main_net` | Main-force net inflow (主力净额), CNY. **= `super_large_net` + `large_net`** |
| `super_large_net` | Super-large order net (超大单净额) |
| `large_net` | Large order net (大单净额) |
| `medium_net` | Medium order net (中单净额) |
| `small_net` | Small order net (小单净额) |
| `*_ratio` | Net inflow as % of turnover for that order tier |
| `has_data` | `false` for delisted / suspended stocks (Eastmoney returns `"-"`) |
| `main_net_check` | `true` when `super_large_net + large_net == main_net` (integrity flag) |

#### `mode: history`

```json
{
  "code": "002112",
  "name": "三变科技",
  "date": "2026-11-16",
  "main_net": 10117184.0,
  "small_net": -16287294.0,
  "medium_net": 6170110.0,
  "large_net": 10117184.0,
  "super_large_net": 0.0,
  "main_ratio": 6.41,
  "small_ratio": -10.31,
  "medium_ratio": 3.91,
  "large_ratio": 6.41,
  "super_large_ratio": 0.0,
  "close_price": 12.3,
  "change_pct": 0.24,
  "source": "eastmoney_push2his_daykline"
}
```

***

### Use cases

| Your goal | How | Rough cost |
|---|---|---|
| **Snapshot the whole market's money flow** | `{"mode": "market"}` — all ~5,900 A-shares in one call, five order tiers + ratios + price + change % | $3.9 per snapshot |
| **Track specific stocks** | `{"mode": "single", "codes": ["002112","600519"]}` — net inflow per tier for a watchlist | $0.005 per stock |
| **Build a money-flow history series** | `{"mode": "history", "codes": ["600519"], "historyDays": 30}` — daily net flow + ratio + close, per trading day | $0.02 per stock-day |
| **Screen for main-force accumulation** | Take `market` mode, sort by `main_net` descending — the names with the biggest positive main-force net inflow that day | $3.9 per snapshot |
| **Verify the numbers yourself** | Every row has `main_net_check` — `true` when `super_large_net + large_net == main_net` | included |

### FAQ

**Do I need an API key or a paid subscription?**
No. The Actor reads Eastmoney's public market-data endpoints. You pay per event, per run.

**How fresh is the data?**
`market` mode returns the live intraday snapshot for the current trading session. `history` mode returns closing values per trading day.

**Are all five order tiers' ratios populated?**
Yes. `super_large_ratio`, `large_ratio`, `medium_ratio`, `small_ratio` and `main_ratio` are all real values in every mode — including `market`. The market-wide endpoint returns the genuine per-stock super-large ratio, and `main_ratio` is derived as `super_large_ratio + large_ratio` (verified against Eastmoney's own day-end value, difference 0.00).

**What about delisted or suspended stocks?**
They come back with `has_data: false` and null amounts, so you can filter them out — or set `includeQuote: false` to slim the payload.

**Can an AI agent call this?**
Yes. It works through Apify's MCP server with the pay-per-event model — see [MCP / AI agent usage](#mcp--ai-agent-usage).

**How long does a full-market run take?**
A few minutes — it pages through ~5,900 stocks. Use `single` mode for a fast per-stock answer.

***

### Notes

- **Amounts are in CNY.** `1e8` = 1 亿 (100 million), `1e4` = 1 万 (10 thousand).
- **`main_net == super_large_net + large_net` always holds** — this is Eastmoney's own definition of "main force". Each record carries `main_net_check` so you can verify.
- **`main_ratio` = `super_large_ratio` + `large_ratio`** — this identity holds by definition (main force = super-large + large orders). Verified per-stock against Eastmoney's own day-end value.
- **All five order-tier ratios are real in every mode**, including `market`. Values that would be unreliable are returned as `null`, never faked.
- **Delisted and suspended stocks** (PTxx, 退, ST) have no money-flow data. They are included with `has_data: false` so you can filter them out — or set `includeQuote: false` to slim the payload.
- **Data source**: Eastmoney (东方财富) public market-data endpoints.

***

### MCP / AI agent usage

This Actor is fully compatible with Apify's MCP server and the pay-per-event model, so an AI agent can call it directly and pay per event.

```bash
## Claude Code
claude mcp add --transport http apify "https://mcp.apify.com?tools=jfishpw/china-a-share-fund-flow"
```

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=jfishpw/china-a-share-fund-flow"
    }
  }
}
```

***

### Support

Issues with the data source (Eastmoney endpoint changes) or with this Actor? Open a GitHub issue or contact support.

# Actor input Schema

## `codes` (type: `array`):

6-digit A-share codes, e.g. 002112, 600519. Default sample codes are used in single/history mode when left empty. Leave empty only with mode=market for the whole market.

## `mode` (type: `string`):

single (default) = only requested codes; market = whole market (5,900+ stocks, takes several minutes); history = per-code daily history; debug = diagnose which upstream hosts are reachable from the Apify node.

## `historyDays` (type: `integer`):

Only for mode=history. Number of daily records per stock (1-30).

## `includeQuote` (type: `boolean`):

Include price, change % and market cap in each record.

## `browserFallback` (type: `boolean`):

If the JSON API fails, fall back to a real headless browser (slower, more expensive, but harder to block).

## `maxRetries` (type: `integer`):

Retry attempts per request.

## `debug` (type: `boolean`):

Include raw API diagnostics in the dataset.

## `proxyConfiguration` (type: `object`):

Eastmoney rate-limits direct requests from cloud data-centre IPs, so the whole-market mode routes requests through Apify Proxy and rotates the exit IP. Residential proxies work best for this endpoint; switch groups if a run reports many failed pages.

## Actor input object example

```json
{
  "codes": [
    "002112",
    "600519"
  ],
  "mode": "single",
  "historyDays": 5,
  "includeQuote": true,
  "browserFallback": true,
  "maxRetries": 3,
  "debug": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `records` (type: `string`):

JSON dataset of stock records with money-flow fields (main-force net amount, order-size breakdown, net ratios, price and change).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("jfishpw/china-a-share-fund-flow").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("jfishpw/china-a-share-fund-flow").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call jfishpw/china-a-share-fund-flow --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jfishpw/china-a-share-fund-flow"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/b6p3hEF3j8LXyL5JN/builds/Z0uViNbtNdQTJcFhd/openapi.json
