# Xueqiu 雪球 Stock Scraper — China A-Share & HK Quotes (`china-data-lab/xueqiu-stock-scraper`) Actor

Scrape Xueqiu (xueqiu.com), China's largest investor community, for real-time quotes and historical K-lines. Covers Shanghai/Shenzhen/Beijing A-shares, indices, Hong Kong and US listings in one normalized schema: price, change, 52-week range, volume, turnover, market cap, PE/PB, EPS, dividend yie...

- **URL**: https://apify.com/china-data-lab/xueqiu-stock-scraper.md
- **Developed by:** [lijinyu](https://apify.com/china-data-lab) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $21.75 / 1,000 quote rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/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

## Xueqiu Stock Scraper — China A-Share & Global Quotes

Scrape **Xueqiu (xueqiu.com)**, China's largest investor community — the place where Chinese retail and institutional investors actually argue about stocks. Pull real-time quotes and historical K-lines for Shanghai, Shenzhen and Beijing A-shares, mainland indices, Hong Kong and US listings, all in one normalized JSON schema.

No API key. No login. No proxy. Session cookies are fetched and refreshed for you.

### Why Xueqiu

Chinese equity research usually starts with the exchange feed and stops there — you get a price but no context. Xueqiu sits on top of the same market data but packages it the way Chinese investors read it: 52-week bands, YTD performance, turnover, float shares, PE/PB/EPS, dividend yield, market open/closed status, and a stable symbol scheme that covers A-shares, Hong Kong and US names without three different integrations.

For an overseas quant, analyst or market-research team this means: one actor, one schema, one bill, and a symbol universe that spans thousands of mainland listings plus HK and US tickers that Chinese investors actually track.

### What you get

`quote` mode returns **40 flat fields** per symbol:

| Field | Meaning | Example |
| --- | --- | --- |
| `symbol` | resolved platform symbol | `00700` |
| `symbol_input` | exactly what you sent | `HK00700` |
| `code` | bare ticker | `00700` |
| `name` | Chinese name, as published | `腾讯控股` |
| `exchange` / `currency` | `SH` `SZ` `BJ` `HK` `NASDAQ` | `HK` / `HKD` |
| `market_region` / `market_status` | `CN` `HK` `US` / `休市` (closed) | `HK` / `休市` |
| `current` | last price | `352.0` |
| `percent` / `chg` | change % and absolute change | `3.23` / `11.0` |
| `open` / `high` / `low` / `last_close` | session OHLC + previous close | `340.0` / `353.4` / `339.6` / `341.0` |
| `avg_price` | volume-weighted average price | `348.6458` |
| `amplitude` | high-low swing % | `4.05` |
| `high_52w` / `low_52w` | 52-week band | `639.0` / `333.0` |
| `ytd_percent` | year-to-date performance % | `-40.55` |
| `volume` / `amount` | shares traded / turnover value | `35593034` / `12403560872.65` |
| `turnover_rate` / `volume_ratio` | turnover % / relative volume | `0.39` / `1.17` |
| `market_capital` / `float_market_capital` | total and free-float cap | `3200610979808.0` |
| `total_shares` / `float_shares` / `lot_size` | share counts and board lot | `9092644829` / `100` |
| `pe_ttm` / `pe_lyr` / `pe_forecast` | trailing, last-year, forward PE | `11.5871` / `12.7885` / `11.544` |
| `pb` / `eps` / `navps` | price-to-book, EPS, NAV per share | `2.2637` / `30.3786` / `155.501` |
| `dividend_yield` | dividend yield % | `1.51` |
| `issue_date` | listing date, ISO 8601 | `2004-06-15T16:00:00+00:00` |
| `url` | Xueqiu quote page | `https://xueqiu.com/S/00700` |
| `quoted_at` | quote timestamp, ISO 8601 UTC | `2026-11-27T08:08:58+00:00` |
| `scraped_at` | when the actor read it | `2026-11-29T02:45:43.858864+00:00` |

`kline` mode returns **15 fields** per bar: `symbol`, `symbol_input`, `period`, `bar_time` (ISO 8601 UTC), `date` (bar label in Beijing time — `2026-11-27`, or `2026-11-27 14:00` for intraday), `open`, `high`, `low`, `close`, `chg`, `percent`, `turnover_rate`, `volume`, `amount`, `scraped_at`.

### Modes

| Mode | What it does | Typical use |
| --- | --- | --- |
| `quote` | Batch snapshot, up to 20 symbols per request | Daily factor refresh, screening, portfolio marking |
| `kline` | OHLCV history per symbol | Backtesting, technicals, volatility modelling |

Supported bar sizes: `day`, `week`, `month`, `quarter`, `year`, `120m`, `60m`, `30m`, `5m`, `1m` — each verified against live data. `adjust` selects `before` (forward adjusted, default), `after` (backward adjusted) or `normal` (raw prices).

### Symbol formats

| Market | What to send | Resolved to |
| --- | --- | --- |
| Shanghai | `SH000001`, `SH600519`, `SH688981` | unchanged |
| Shenzhen | `SZ000001`, `SZ300750` | unchanged |
| Beijing | `BJ430047` | unchanged |
| Hong Kong | `HK00700` or `00700` | `00700` |
| US | `AAPL`, `TSLA` | unchanged |
| Bare 6-digit A-share | `600519` → `SH600519`, `000001` → `SZ000001` | inferred from the leading digit |

`symbol_input` always echoes what you sent, so a normalized Hong Kong ticker is still traceable back to `HK00700`.

### Use cases

- **A-share screening** — bulk-pull PE, PB, turnover and market cap, then rank
- **Quant backtesting** — adjusted daily or intraday OHLCV, in one schema across SH/SZ/BJ/HK/US
- **Index and market dashboards** — `SH000001`, `SH000300` and friends with full session stats
- **Cross-market comparison** — the same Chinese blue chip in A-share and HK form, side by side
- **Valuation research** — dividend yield, EPS, NAV per share and forward PE without a terminal subscription
- **Daily ETL** — one batch request covers 20 tickers; schedule the actor and diff the output

### Input example

```json
{
  "mode": "quote",
  "symbols": ["SH000001", "SZ000001", "HK00700"],
  "maxItems": 50
}
```

```json
{
  "mode": "kline",
  "symbols": ["SH600519"],
  "period": "day",
  "count": 250,
  "adjust": "before"
}
```

### Output example — `quote`

Complete record, all 40 fields, copied verbatim from a real run (Hong Kong market was closed at the time, hence `market_status`):

```json
{
  "symbol": "00700",
  "symbol_input": "HK00700",
  "code": "00700",
  "name": "腾讯控股",
  "exchange": "HK",
  "currency": "HKD",
  "market_region": "HK",
  "market_status": "休市",
  "current": 352.0,
  "percent": 3.23,
  "chg": 11.0,
  "open": 340.0,
  "high": 353.4,
  "low": 339.6,
  "last_close": 341.0,
  "avg_price": 348.6458,
  "amplitude": 4.05,
  "high_52w": 639.0,
  "low_52w": 333.0,
  "ytd_percent": -40.55,
  "volume": 35593034.0,
  "amount": 12403560872.65,
  "turnover_rate": 0.39,
  "volume_ratio": 1.17,
  "market_capital": 3200610979808.0,
  "float_market_capital": 3200610979808.0,
  "total_shares": 9092644829.0,
  "float_shares": 9092644829.0,
  "lot_size": 100.0,
  "pe_ttm": 11.5871,
  "pe_lyr": 12.7885,
  "pe_forecast": 11.544,
  "pb": 2.2637,
  "eps": 30.3786,
  "navps": 155.501,
  "dividend_yield": 1.51,
  "issue_date": "2004-06-15T16:00:00+00:00",
  "url": "https://xueqiu.com/S/00700",
  "quoted_at": "2026-11-27T08:08:58+00:00",
  "scraped_at": "2026-11-29T02:45:43.858864+00:00"
}
```

### Output example — `kline`

One daily bar. `bar_time` is the UTC instant, `date` is the Beijing-time trading day:

```json
{
  "symbol": "SH600519",
  "symbol_input": "SH600519",
  "period": "day",
  "bar_time": "2026-11-26T16:00:00+00:00",
  "date": "2026-11-27",
  "volume": 3980835.0,
  "open": 1469.99,
  "high": 1481.41,
  "low": 1452.99,
  "close": 1472.36,
  "chg": 3.36,
  "percent": 0.23,
  "turnover_rate": 0.32,
  "amount": 5849112431.0,
  "scraped_at": "2026-11-29T02:45:47.679849+00:00"
}
```

### Pricing

Pay per event, one event per record written to the dataset:

| Event | Charged for | Price (FREE / BRONZE) |
| --- | --- | --- |
| `result` | one quote record (`quote` mode) | $0.025 |
| `kline-bar` | one OHLCV bar (`kline` mode) | $0.013 |
| actor start | once per run (one event per GB of memory, minimum one) | $0.03 |

Higher Apify subscription tiers get an automatic discount on every event; the dataset tab shows the exact price for your plan. A record that never reaches the dataset is never charged — the actor pushes first and charges after. Twenty symbols in `quote` mode is twenty `result` events; 250 daily bars is 250 `kline-bar` events, which is why a bar costs about half of a quote. Set `maxItems` low while you explore.

### Notes and limits

- **Cookies are automatic.** Xueqiu answers `400` (`error_code 400016`) without a session token. The actor loads the homepage once per run to pick up `xq_a_token`, reuses it for every call, and re-fetches it once if a request is rejected.
- **Missing values are honest `null`.** Indices carry no PE, PB, EPS or dividend yield (the platform omits them), and some Beijing listings come back without a `percent`. Nothing is zero-filled.
- **Unknown symbols are skipped, not billed.** A wrong prefix or a delisted ticker returns no row; the run log tells you which symbol failed.
- **Hong Kong needs the bare code.** `HK00700` is accepted on input and normalized to `00700`, which is what the platform expects.
- **`market_status` is Chinese**, straight from the feed — e.g. `休市` for a closed market. Map it if you need English.
- **Timestamps are ISO 8601 UTC.** A daily bar's `bar_time` is the UTC instant of the Beijing-time session date; use `date` for the trading day label.
- Data is read from Xueqiu's public web endpoints. Only publicly listed securities are covered — no personal profiles, no user data.
- Transient errors and rate limits are retried three times with backoff; if a cookie is rejected the actor re-fetches it once before giving up.
- Export results as JSON, CSV or Excel from the dataset tab, or pull them with the Apify API.

# Actor input Schema

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

quote = real-time snapshot for every symbol, kline = historical OHLCV bars.

## `symbols` (type: `array`):

Tickers to fetch. A-shares and indices use an exchange prefix (SH000001, SZ000001, BJ430047). Hong Kong uses the 5-digit code, and HK00700 is accepted and normalized for you. US listings use the plain ticker (AAPL).

## `maxItems` (type: `integer`):

Hard cap on returned records. Keep it low while testing — you pay per result.

## `period` (type: `string`):

Bar size for kline mode. 1m/5m/30m/60m/120m are intraday, the rest are daily and above.

## `count` (type: `integer`):

How many bars to pull per symbol in kline mode, ending at the latest bar. Verified up to 300.

## `adjust` (type: `string`):

kline mode only. before = forward adjusted (default, splits and dividends normalized), after = backward adjusted, normal = raw traded prices.

## Actor input object example

```json
{
  "mode": "quote",
  "symbols": [
    "SH000001",
    "SZ000001"
  ],
  "maxItems": 10,
  "period": "day",
  "count": 60,
  "adjust": "before"
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# 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 = {
    "symbols": [
        "SH000001",
        "SZ000001"
    ],
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("china-data-lab/xueqiu-stock-scraper").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 = {
    "symbols": [
        "SH000001",
        "SZ000001",
    ],
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("china-data-lab/xueqiu-stock-scraper").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 '{
  "symbols": [
    "SH000001",
    "SZ000001"
  ],
  "maxItems": 10
}' |
apify call china-data-lab/xueqiu-stock-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,china-data-lab/xueqiu-stock-scraper"
        }
    }
}
```

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/R7HTpGrcz418rRpBq/builds/4z8IashK0qkhgQaBO/openapi.json
