# 🇭🇰 HKEX Hang Seng Screener · 港交所恒生指數選股 (`nexgendata/hkex-hang-seng-stock-screener`) Actor

HKEX Hang Seng stock screener API — Hang Seng + HSCEI live quotes, market cap (HKD), P/E, P/B, dividend yield, ROE, sector. Tencent, HSBC, AIA, Alibaba, Meituan universe. Bloomberg Terminal / FactSet / Refinitiv Eikon alternative for hedge funds, quants, family offices. Pay-per-result.

- **URL**: https://apify.com/nexgendata/hkex-hang-seng-stock-screener.md
- **Developed by:** [NexGenData](https://apify.com/nexgendata) (community)
- **Categories:** Business, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $250.00 / 1,000 hkex stock records

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## 🇭🇰 HKEX Hang Seng Stock Screener — HK Quotes & Fundamentals

> Track every stock on the **Hong Kong Stock Exchange** (HKEX) and the **Hang Seng Index** (HSI) — with prices in HKD, market cap, P/E, P/B, dividend yield, sector, and the full fundamental stack. The Bloomberg Terminal alternative for HK equities, priced for indie quants, Asia-focused hedge funds, and family offices that don't want to write a check to Refinitiv.

Hong Kong remains one of the most strategically important financial markets in the world. It is the bridge into mainland Chinese tech via the dual-primary listings of Tencent (`0700`), Alibaba (`9988`), JD.com (`9618`), Meituan (`3690`), Xiaomi (`1810`), and Baidu (`9888`); it is the home of the four big Chinese state banks (`1398`, `1288`, `0939`, `3988`); and the Hang Seng Index itself remains the single most-watched gauge of risk appetite into Greater China. Yet for indie analysts and emerging-market hedge funds, getting clean HK equity data is surprisingly painful. Yahoo Finance throttles `.HK` symbols aggressively. HKEX's own data portal is JS-heavy and only ships PDFs and Excel files. AAStocks is fine for one-off lookups but isn't built for batch screening. And **Bloomberg Terminal will charge you USD $24,000/year minimum** for the same data this actor surfaces in seconds.

This actor closes that gap. It returns a **clean, sorted, JSON-native screener** over the full HKEX top-500 by market cap, with an optional fundamental enrichment layer (PE, dividend yield, beta, 52-week range, sector). Filter by `HSI` (Hang Seng Index constituents only — the ~85 blue-chip names) or `HKEX-all` (entire main-board top-500), then narrow further by sector keyword and minimum market cap in HKD.

### 🎯 What you get per stock

Every record returned includes:

| Field | Description |
|---|---|
| `symbol` | 4-digit HKEX ticker (e.g. `0700` for Tencent, `0005` for HSBC) |
| `yahoo_symbol` | Yahoo Finance-formatted ticker (e.g. `0700.HK`) for downstream tooling |
| `name` | Company name in English (`Tencent Holdings Limited`) |
| `exchange` | Always `HKEX` |
| `price_hkd` | Current price in Hong Kong dollars |
| `pct_change` | Today's % change (signed) |
| `market_cap_hkd` | Market capitalization in HKD (base units, not abbreviated) |
| `revenue_ttm_hkd` | Trailing twelve-month revenue in HKD |
| `rank_by_mcap` | Rank among HKEX top-500 by market cap |
| `in_hsi` | Boolean — true if the stock is in the Hang Seng Index |
| `hsi_sub_index` | HSI sub-index classification (Finance, Commerce & Industry, Properties, Utilities) when applicable |
| `stockanalysis_url` | Direct link to the stock's detail page |
| `hkex_url` | Direct link to HKEX's own quote page |
| `aastocks_url` | Direct link to AAStocks' detail page |
| `scraped_at` | UTC timestamp of the scrape |

**With `enrich_fundamentals=true`** you additionally get:

| Field | Description |
|---|---|
| `pe_ratio` | Trailing twelve-month Price/Earnings ratio |
| `forward_pe` | Forward 12-month Price/Earnings ratio |
| `dividend_per_share_hkd` | Annual dividend per share in HKD |
| `dividend_yield_pct` | Annual dividend yield as a % |
| `ex_dividend_date` | Next ex-dividend date |
| `eps` | Earnings per share (trailing) |
| `shares_outstanding` | Total listed shares |
| `volume` | Most-recent session volume |
| `avg_volume` | Trailing-average daily volume |
| `open_hkd`, `previous_close_hkd` | Latest session open / previous close |
| `day_range` | Day's intraday low–high range |
| `week_52_range` | 52-week low–high range |
| `beta` | 5-year beta vs HSI |
| `rsi` | Relative Strength Index (14-day) |
| `earnings_date` | Next expected earnings release date |
| `sector` | Sector classification |
| `industry` | Industry classification |
| `net_income_hkd` | Trailing net income in HKD |

### 🚀 Quick start

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("nexgendata/hkex-hang-seng-stock-screener").call(run_input={
    "market": "HSI",
    "limit": 50,
    "enrich_fundamentals": True
})

for stock in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"{stock['symbol']:<6} {stock['name']:<35} "
          f"HK${stock['price_hkd']:>10,.2f}  "
          f"P/E {stock.get('pe_ratio', '--'):>6}  "
          f"Yield {stock.get('dividend_yield_pct', '--'):>5}%  "
          f"MCap HK${stock['market_cap_hkd']/1e9:>8,.1f}B")
````

Sample output:

```
0700   Tencent Holdings Limited            HK$    465.20  P/E  17.54  Yield  1.12%  MCap HK$ 4,250.0B
0005   HSBC Holdings plc                   HK$    139.60  P/E   7.30  Yield  5.40%  MCap HK$ 2,410.0B
9988   Alibaba Group Holding Limited       HK$    134.60  P/E  14.10  Yield  1.20%  MCap HK$ 2,500.0B
1398   Industrial and Commercial Bank      HK$      6.90  P/E   4.95  Yield  6.85%  MCap HK$ 2,920.0B
```

### 🌐 cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/nexgendata~hkex-hang-seng-stock-screener/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"market":"HSI","limit":85,"enrich_fundamentals":true}'
```

### 📊 Real-world use cases

- **Asia hedge-fund daily refresh** — schedule the actor for the post-close HK time (16:00 HKT = 08:00 UTC) and pipe the dataset into your warehouse alongside Eastmoney, KOSPI, and TWSE screens for a complete pan-Asia data layer.
- **HSI-vs-CSI300 relative-value screens** — pair this actor with the [Eastmoney Chinese A-Share Screener](https://apify.com/nexgendata/eastmoney-china-stock-screener?fpr=2ayu9b) to track dual-listed H-share / A-share spreads (Tencent doesn't have A-shares, but most of the big banks and insurers do — and the H/A discount is one of the most-traded signals in the region).
- **High-dividend Asia ETF construction** — filter to `dividend_yield_pct >= 5` to find HSBC, ICBC, Bank of China, CCB, China Mobile, and the rest of HK's classic yield names; rebalance quarterly with the screener as your data feed.
- **Cross-border Greater China factor models** — pull HSI plus the [TWSE Stock Screener](https://apify.com/nexgendata/twse-stock-screener?fpr=2ayu9b) and [KOSPI Stock Screener](https://apify.com/nexgendata/kospi-stock-screener?fpr=2ayu9b) to build factor models on the full Greater-China-plus-Korea universe.
- **Chinese tech basket monitoring** — track Tencent, Alibaba, JD, Meituan, Xiaomi, Baidu, Kuaishou, NetEase, Bilibili, Trip.com, and Li Auto in one screen via the HKEX listing channel.
- **Risk-off regime detection** — monitor HSI subindex weighting shifts; when Finance + Properties as a % of HSI market cap drops below trend, that's classic Greater-China derisking.
- **Family-office portfolio analytics** — drop this dataset into Snowflake/BigQuery and build position-level P/E, dividend yield, and beta dashboards across your HK equity book.
- **Academic research** — Hong Kong is a heavily-studied market in finance research (cross-listing premiums, Stock Connect flows, foreign-ownership dynamics). This actor gives reproducible market snapshots without scraping headaches.
- **Macro dashboards** — combine HSI movers with FX (HKD/CNH, USD/HKD peg dynamics) for a complete Greater China dashboard.

### ⚙️ Input parameters

| Param | Type | Default | Notes |
|---|---|---|---|
| `market` | enum | `HSI` | `HSI` (~85 index constituents) or `HKEX-all` (top-500) |
| `limit` | int | `50` | Max stocks returned (1–500), sorted by market cap descending |
| `min_market_cap_hkd` | int | `0` | Filter: only stocks ≥ this market cap, in HKD base units |
| `sector` | string | `""` | Substring filter on sector / industry / HSI sub-index / name |
| `enrich_fundamentals` | bool | `false` | Hit each detail page for PE / dividend yield / beta / sector (slower) |
| `proxyConfiguration` | object | residential | Apify proxy config |

#### Examples

**Just the top 10 HSI blue chips** (fast smoke test, ~5s):

```json
{ "market": "HSI", "limit": 10 }
```

**Full HSI with fundamentals** (~85 stocks, ~60s):

```json
{ "market": "HSI", "limit": 85, "enrich_fundamentals": true }
```

**Hong Kong banks** (yield play — filter on sector keyword):

```json
{ "market": "HKEX-all", "limit": 200, "sector": "bank", "enrich_fundamentals": true }
```

**HK mega-caps only** (≥ HK$500 billion market cap):

```json
{ "market": "HKEX-all", "limit": 50, "min_market_cap_hkd": 500000000000 }
```

**HK property developers** (Sun Hung Kai, CK Asset, Henderson, etc.):

```json
{ "market": "HKEX-all", "limit": 200, "sector": "real estate", "enrich_fundamentals": true }
```

### 💰 Pricing

This actor uses **pay-per-event** pricing — you only pay for what you actually pull.

- **Actor start:** $0.01 per run
- **Stock record:** $0.25 per stock returned

A full HSI snapshot (~85 names) with fundamentals costs about **$21.25**. A 50-stock blue-chip screen costs **$12.51**. Compare to:

- Bloomberg Terminal — $24,000/year minimum, plus per-seat fees
- Refinitiv (LSEG) Eikon — $22,000+/year
- FactSet — $12,000+/year per user
- S\&P Capital IQ — $13,000+/year per user

If you're a hedge-fund analyst running HK screens once a day, this actor pays back the entire annual data-vendor budget on day one. The pricing reflects the **institutional buyer pool** — this isn't a toy retail tool; it's a Bloomberg replacement for funds that don't have Bloomberg seats for their Asia analysts.

### 🤔 FAQ

**Q: Is the data real-time?**
The source (stockanalysis.com) lags the live HKEX tape by 15–20 minutes during market hours (HKT 09:30–16:00). After-hours, it shows the closing snapshot. This is identical to the delay you'd get on Yahoo Finance or Google Finance — sufficient for end-of-day rebalancing, factor research, screening, and dashboards. For sub-second tick data you need a paid HKEX licensee.

**Q: Why stockanalysis.com vs scraping HKEX directly?**
HKEX's own portal is heavily JavaScript-rendered and ships data through paginated XHR calls with anti-bot protections. Stockanalysis.com mirrors the full HKEX universe in clean server-rendered HTML — which is *dramatically* more reliable to scrape from cloud IPs. We also link out to the HKEX page in every record so you can verify any data point against the source.

**Q: What about southbound Stock Connect flows?**
Stock Connect daily flows are not in this dataset (HKEX publishes them via separate PDFs). If you need southbound flow data, file a feature request and we'll add a companion actor.

**Q: Can I get historical data?**
This actor returns the current snapshot. For historical price series, pair it with the [Yahoo Finance Scraper](https://apify.com/nexgendata/yahoo-finance-scraper?fpr=2ayu9b) using the `yahoo_symbol` field (e.g. `0700.HK`).

**Q: How are HK ticker codes formatted?**
HKEX tickers are 4 or 5 digits, zero-padded. `0700` is Tencent, `0005` is HSBC, `1398` is ICBC, `9988` is Alibaba. We always emit them zero-padded to 4+ digits for consistency. The Yahoo Finance equivalent is `{symbol}.HK`.

**Q: Is HSBC (0005) the same as the NYSE HSBC ADR?**
The HK 0005 listing and the NYSE HSBC ADR represent the same company but trade in separate venues with different prices, liquidities, and tax treatments. This actor returns the HK primary listing only.

**Q: Can I use this commercially?**
The data is aggregated from public sources (stockanalysis.com aggregates from HKEX's own free public feeds). You own the output dataset. For redistribution as a paid product or syndication, consult HKEX's market-data terms and consider licensing direct from HKEX Information Services.

**Q: Is this maintained?**
Yes — NexGenData maintains 140+ Apify actors covering scraping, enrichment, MCP servers, and data automation. We ship fixes within 24 hours of bug reports. File issues via the Apify console's Issues tab on this actor's page.

**Q: Why pay for this when I could scrape HKEX myself?**
You could! But you'd spend a weekend wrestling with stockanalysis.com's table HTML structure (which changes every few months), handling the Hang Seng Index constituent join (we pull it from Wikipedia), normalizing HKD market caps from abbreviated `4.25T` → `4,250,000,000,000`, parsing detail pages for PE/dividend/beta, setting up residential proxies for clean IP rotation, and writing the rate-limit retry logic. Or you can pay a fraction of a Bloomberg seat-fee and get clean JSON in 15 seconds.

***

### Explore the NexGenData Equity Data Suite

This actor is part of NexGenData's global equity data fleet. Whether you cover a single region or a multi-asset macro book, we have a screener for every major market:

#### Regional sisters

- 🔗 **[Eastmoney China A-Share Screener](https://apify.com/nexgendata/eastmoney-china-stock-screener)** — Shanghai + Shenzhen + STAR + ChiNext full A-share universe — the broadest Chinese equity screener.
- 🔗 **[STAR Market Screener (China)](https://apify.com/nexgendata/star-market-china-stock-screener)** — Shanghai STAR Market 50 fundamentals, market cap (RMB), P/E, P/B, sector — China's NASDAQ-equivalent hard-tech board.
- 🔗 **[ChiNext Screener (China)](https://apify.com/nexgendata/chinext-china-stock-screener)** — Shenzhen ChiNext fundamentals, market cap (RMB), P/E, P/B, sector — CATL, Mindray, East Money, Sungrow universe.

#### Cross-region peers

- 🔗 **[TWSE Stock Screener (Taiwan)](https://apify.com/nexgendata/twse-stock-screener)** — TWSE + TPEx fundamentals, market cap (TWD), P/E, dividend yield, sector — TSMC, MediaTek, Hon Hai universe.
- 🔗 **[SGX Singapore Stock Screener](https://apify.com/nexgendata/sgx-singapore-stock-screener)** — Singapore Exchange (STI) fundamentals, market cap (SGD), P/E, dividend yield, REIT yield, sector.

#### Multi-asset / specialty

- 🔗 **[Finance MCP Server](https://apify.com/nexgendata/finance-mcp-server)** — Unified Model Context Protocol server exposing the full NexGenData equity fleet to Claude, Cursor & MCP-aware LLMs.

#### Browse the full NexGenData catalog

**[→ See all 220+ NexGenData actors at apify.com/nexgendata](https://apify.com/nexgendata?fpr=2ayu9b)** — equity screeners across 25+ markets, lead generation, SEC filings, B2B intelligence, MCP servers, and more.

***

### Why NexGenData vs. paid alternatives

| Tool | Annual cost | API access | Coverage |
|------|-------------|------------|----------|
| Bloomberg Terminal | ~$24,000/seat | Limited | Global |
| FactSet | ~$15,000/seat | Paid add-on | Global |
| Refinitiv Eikon | ~$22,000/seat | Paid add-on | Global |
| S\&P Capital IQ | ~$20,000/seat | Paid add-on | Global |
| **NexGenData Hong Kong Screener** | **Pay-per-result** | **Native** | **Hong Kong**          |

Run this actor once per day for a typical institutional-scale workflow (~200 records/day) and your annual cost is approximately **$1,800–2,000** — a 90-95% discount vs. the major paid alternatives, with no seat licensing, no minimum commitment, and full programmatic access.

### 🚀 Apify affiliate program

New to Apify? Sign up with our [referral link](https://apify.com/nexgendata?fpr=2ayu9b) — you get free platform credits on signup, and you help fund the maintenance of this actor fleet.

***

*Built and maintained by [NexGenData](https://apify.com/nexgendata?fpr=2ayu9b) — 140+ actors covering scraping, enrichment, MCP servers, and automation. Home: [thenextgennexus.com](https://thenextgennexus.com).*

### 🌏 Related: Asia & APAC Stock Screeners

Part of the **NexGenData global equity coverage cluster** — 16 stock screeners across Asia, Oceania, and the Middle East with a consistent schema (ticker, name, price, market cap, PE, PB, % change) so you can join them downstream into a single dataset for cross-market screening, factor investing, and quant research.

#### Greater China & Hong Kong

- 🇨🇳 [Eastmoney China A-Shares Screener](https://apify.com/nexgendata/eastmoney-china-stock-screener) — Shanghai/Shenzhen mainboards
- 🇨🇳 [Shanghai STAR Market Screener](https://apify.com/nexgendata/star-market-china-stock-screener) — 上海科创板 · sci-tech innovation
- 🇨🇳 [Shenzhen ChiNext Screener](https://apify.com/nexgendata/chinext-china-stock-screener) — 深圳创业板 · growth board
- 🇨🇳 [Beijing Stock Exchange Screener](https://apify.com/nexgendata/bse-beijing-stock-screener) — 北京证券交易所 · innovation SMEs
- 🇭🇰 **HKEX Hang Seng Screener** — Hong Kong · 香港恒生指數 *(you are here)*

#### Northeast Asia

- 🇹🇼 [Taiwan TWSE Screener](https://apify.com/nexgendata/twse-stock-screener) — 台灣證交所
- 🇰🇷 [KOSPI Stock Screener](https://apify.com/nexgendata/kospi-stock-screener) — South Korea · Korean market cap
- 🇯🇵 [TSE Japan Stock Screener](https://apify.com/nexgendata/tse-japan-stock-screener) — Nikkei 225

#### Southeast Asia (ASEAN)

- 🇸🇬 [SGX Singapore Stock Screener](https://apify.com/nexgendata/sgx-singapore-stock-screener) — STI · Straits Times Index
- 🇻🇳 [HOSE Vietnam Stock Screener](https://apify.com/nexgendata/hose-vietnam-stock-screener) — VN30
- 🇮🇩 [IDX Indonesia Stock Screener](https://apify.com/nexgendata/idx-indonesia-stock-screener) — LQ45
- 🇹🇭 [SET Thailand Stock Screener](https://apify.com/nexgendata/set-thailand-stock-screener) — SET50
- 🇲🇾 [Bursa Malaysia Stock Screener](https://apify.com/nexgendata/bursa-malaysia-stock-screener) — KLCI
- 🇵🇭 [PSE Philippines Stock Screener](https://apify.com/nexgendata/pse-philippines-stock-screener) — PSEi

#### Oceania & Middle East

- 🇦🇺 [ASX Australia Stock Screener](https://apify.com/nexgendata/asx-australia-stock-screener) — ASX 200
- 🇸🇦 [Tadawul Saudi Stock Screener](https://apify.com/nexgendata/tadawul-saudi-stock-screener) — TASI

💡 **Bundle tip:** All 16 screeners share the same output schema. Run them on the same date and stack the datasets to build a complete APAC equity coverage snapshot for portfolio analytics, ETF construction, or regional momentum strategies.

# Actor input Schema

## `market` (type: `string`):

Which Hong Kong universe to screen: HSI (Hang Seng Index constituents — the ~85 blue-chip stocks including 0700 Tencent, 0005 HSBC, 9988 Alibaba), or HKEX-all (the full top-500 HKEX universe by market cap from main board + GEM).

## `limit` (type: `integer`):

Maximum number of stocks to return, sorted by market cap descending. For HSI this caps at ~85 constituents. For HKEX-all the cap is 500 stocks (top-500 by market cap).

## `min_market_cap_hkd` (type: `integer`):

Filter to stocks with market cap above this threshold in Hong Kong Dollars. Examples: 100000000000 = HK$100 billion (mid/large-cap floor), 500000000000 = HK$500 billion (mega-cap floor). Leave at 0 for no filter.

## `sector` (type: `string`):

Optional case-insensitive substring filter applied to sector, industry, and company name. Examples: 'finance', 'tech', 'property', 'utilities', 'tencent', 'bank'. Leave blank for no filter. Note: sector matching requires enrich\_fundamentals=true (for the HSI sub-index assignments and detail-page sectors).

## `enrich_fundamentals` (type: `boolean`):

If true, fetch each stock's detail page on Stockanalysis.com to extract PE ratio, forward PE, dividend yield, beta, 52-week range, and sector classification. Adds ~1 HTTP request per stock and roughly doubles runtime. Required if you want to filter by sector.

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

Apify proxy configuration. Defaults to residential proxy for reliable access to HK financial data from outside the Hong Kong region.

## Actor input object example

```json
{
  "market": "HSI",
  "limit": 50,
  "min_market_cap_hkd": 0,
  "enrich_fundamentals": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "market": "HSI",
    "limit": 50,
    "min_market_cap_hkd": 0,
    "sector": "",
    "enrich_fundamentals": false,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("nexgendata/hkex-hang-seng-stock-screener").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 = {
    "market": "HSI",
    "limit": 50,
    "min_market_cap_hkd": 0,
    "sector": "",
    "enrich_fundamentals": False,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("nexgendata/hkex-hang-seng-stock-screener").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "market": "HSI",
  "limit": 50,
  "min_market_cap_hkd": 0,
  "sector": "",
  "enrich_fundamentals": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call nexgendata/hkex-hang-seng-stock-screener --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=nexgendata/hkex-hang-seng-stock-screener",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "🇭🇰 HKEX Hang Seng Screener · 港交所恒生指數選股",
        "description": "HKEX Hang Seng stock screener API — Hang Seng + HSCEI live quotes, market cap (HKD), P/E, P/B, dividend yield, ROE, sector. Tencent, HSBC, AIA, Alibaba, Meituan universe. Bloomberg Terminal / FactSet / Refinitiv Eikon alternative for hedge funds, quants, family offices. Pay-per-result.",
        "version": "0.0",
        "x-build-id": "LuHDZco2EGhrWWA4i"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/nexgendata~hkex-hang-seng-stock-screener/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-nexgendata-hkex-hang-seng-stock-screener",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/nexgendata~hkex-hang-seng-stock-screener/runs": {
            "post": {
                "operationId": "runs-sync-nexgendata-hkex-hang-seng-stock-screener",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/nexgendata~hkex-hang-seng-stock-screener/run-sync": {
            "post": {
                "operationId": "run-sync-nexgendata-hkex-hang-seng-stock-screener",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "market": {
                        "title": "Market / index",
                        "enum": [
                            "HSI",
                            "HKEX-all"
                        ],
                        "type": "string",
                        "description": "Which Hong Kong universe to screen: HSI (Hang Seng Index constituents — the ~85 blue-chip stocks including 0700 Tencent, 0005 HSBC, 9988 Alibaba), or HKEX-all (the full top-500 HKEX universe by market cap from main board + GEM).",
                        "default": "HSI"
                    },
                    "limit": {
                        "title": "Limit",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of stocks to return, sorted by market cap descending. For HSI this caps at ~85 constituents. For HKEX-all the cap is 500 stocks (top-500 by market cap).",
                        "default": 50
                    },
                    "min_market_cap_hkd": {
                        "title": "Min market cap (HKD)",
                        "minimum": 0,
                        "maximum": 100000000000000,
                        "type": "integer",
                        "description": "Filter to stocks with market cap above this threshold in Hong Kong Dollars. Examples: 100000000000 = HK$100 billion (mid/large-cap floor), 500000000000 = HK$500 billion (mega-cap floor). Leave at 0 for no filter.",
                        "default": 0
                    },
                    "sector": {
                        "title": "Sector / industry / name keyword",
                        "type": "string",
                        "description": "Optional case-insensitive substring filter applied to sector, industry, and company name. Examples: 'finance', 'tech', 'property', 'utilities', 'tencent', 'bank'. Leave blank for no filter. Note: sector matching requires enrich_fundamentals=true (for the HSI sub-index assignments and detail-page sectors)."
                    },
                    "enrich_fundamentals": {
                        "title": "Enrich with P/E, P/B, dividend yield, sector (slower)",
                        "type": "boolean",
                        "description": "If true, fetch each stock's detail page on Stockanalysis.com to extract PE ratio, forward PE, dividend yield, beta, 52-week range, and sector classification. Adds ~1 HTTP request per stock and roughly doubles runtime. Required if you want to filter by sector.",
                        "default": false
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Apify proxy configuration. Defaults to residential proxy for reliable access to HK financial data from outside the Hong Kong region.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
