Tutorial

How to Read A-Share Sector Rotation

Sectors reveal direction earlier than single stocks: rankings find strength, valuation percentiles judge price, supply chains show the logic. Three endpoints make one sector check-up — code below.

Why sectors before stocks

A single stock can move on a headline; an entire sector moving usually means money is choosing a direction. Fix the direction first, then pick names inside it — that order works better than the reverse.

Three steps: ① ranking (who is rising) → ② valuation percentile (expensive?) → ③ supply chain (why).

Step 1: today’s sector gainers

Python (key required)
import requests

KEY = "ct-your-key"
r = requests.get("https://api.ashareapi.com/v1/sector",
                 headers={"Authorization": "Bearer " + KEY}, timeout=15)
b = r.json()
rows = b.get("structured") or b["data"]

for row in rows[:10]:
    print(row)   # sector name / change % / leading stock / advancers & decliners
  • Covers industry / concept / region sectors
  • Read advancers vs decliners first: a sector up with only 1–2 names rising is leader-driven, not broad

Step 2: is this sector expensive? (valuation percentile)

Python
# Sector codes look like pt01801780 (Shenwan sector)
r = requests.get("https://api.ashareapi.com/v1/sector-valuation",
                 headers={"Authorization": "Bearer " + KEY},
                 params={"code": "pt01801780"}, timeout=15)
print(r.json().get("structured") or r.json()["data"])
# Returns: PE / PB / PS / PCF + dividend yield + historical percentile
  • The percentile is the point: whether PE 20x is high depends on its own history
  • ≥ 80% → expensive (worse odds); ≤ 20% → cheap (but ask *why* it is cheap)
  • Sector codes start with `pt` (e.g. `pt01801780`), not stock codes

Step 3: where is the logic? (supply chain)

Python
# Where a stock sits in its supply chain
r = requests.get("https://api.ashareapi.com/v1/industry-chain",
                 headers={"Authorization": "Bearer " + KEY},
                 params={"mode": "stock", "code": "sh600667"}, timeout=15)
print(r.json().get("structured") or r.json()["data"])
# Returns: chain theme / node / upstream-midstream-downstream / relevance / business description

# Reverse: the chain graph of a theme (which companies, at which positions)
r = requests.get("https://api.ashareapi.com/v1/industry-chain",
                 headers={"Authorization": "Bearer " + KEY},
                 params={"mode": "graph", "topic": "semiconductor"}, timeout=15)
  • `mode=list` → all themes (183) · `mode=graph&topic=X` → graph · `mode=stock&code=X` → single stock
  • Why it matters: when a sector runs, knowing who supplies whom beats reading concept tags

Combining: "strong + not expensive + has logic"

Strong
Low (≤30%)
Clear
Best case: possibly early
Strong
High (≥80%)
Clear
Trend may continue but odds worsen — trade it, do not invest in it
Strong
Low
Vague
Careful: possibly pure money game with no fundamental support
Weak
Low
Clear
Watchlist: logic present, position low, waiting for a catalyst

Common mistakes and boundaries

  • Wrong sector code → must start with `pt` (e.g. `pt01801780`); stock codes will not work
  • One day only → single-day sector moves are noisy; look at 5/20-day too
  • Treating cheap as a buy reason → cheap can be a value trap (a declining industry)
  • Relevance is not a position → high relevance means business overlap, not price synchronicity
  • Rate limits → sector endpoints need a key; anonymous access covers only the five free endpoints

FAQ

How do I get sector codes?

They look like `pt01801780` (`pt` + 8 digits). Use `/v1/sector` for the list of sector names/codes, or `/v1/industry-chain?mode=list` for supply-chain themes.

How is the valuation percentile computed?

It compares the current PE/PB/PS against that sector’s own historical series, giving the current value’s percentile (80% = more expensive than 80% of its history). It describes position, it does not predict direction.

How is a supply chain different from a concept sector?

A concept sector is a market label (some members merely ride the concept). A supply chain is organised by real upstream/midstream/downstream relations with a relevance score. For logic, the chain is more reliable.

The sector is up but my stock is not. Why?

Three common reasons: ① the move is leader-driven and you do not hold the leader; ② your stock is concept-related, not business-related (check chain relevance); ③ money is rotating inside the sector (high to low).

Are these endpoints free?

No — `/v1/sector`, `/v1/sector-valuation` and `/v1/industry-chain` all require an API key. The free five are quote, kline, hot, market overview and breadth.

Last updated: 2026-09-23

Code and fields come from live responses (verified 2026-09-23: sector returns 124 rows; sector-valuation accepts pt codes; industry-chain stock mode returns theme/node/position/relevance). Sector code format follows the endpoint docs.