数据源用途稳定性东方财富港股板块API行业/概念板块涨跌排行、热点追踪⭐⭐⭐新浪财经港股接口个股实时行情(最稳定)⭐⭐⭐Yahoo Finance恒生指数实时行情⭐⭐akshare港股实时行情、沪深港通⭐⭐
python
import requests
def get_hsi():
"""恒生指数 + 国企指数 + 恒生科技"""
url = "https://hq.sinajs.cn/list=hkHSI,hkHSTECH,hkHSCEI"
headers = {"Referer": "http://finance.sina.com.cn"}
r = requests.get(url, headers=headers, timeout=10)
r.encoding = 'gbk'
results = {}
for line in r.text.strip().split('\n'):
if '=' not in line:
continue
_, data = line.split('=')
vals = data.replace('"', '').replace(';', '').split(',')
if len(vals) < 6:
continue
name = vals[0]
price = float(vals[1])
chg = float(vals[4])
pct = float(vals[5])
results[name] = {"price": price, "chg": chg, "pct": pct}
return results
python
import requests
def get_hk_quote(codes):
"""查询港股实时行情
codes: str or list, e.g. 'hk00700' or ['hk00700', 'hk09988']
"""
if isinstance(codes, str):
codes = [codes]
url = f"https://hq.sinajs.cn/list={','.join(codes)}"
headers = {"Referer": "http://finance.sina.com.cn"}
r = requests.get(url, headers=headers, timeout=10)
r.encoding = 'gbk'
results = []
for line in r.text.strip().split('\n'):
if '=' not in line:
continue
_, data = line.split('=')
code = _[-7:].replace('"', '') # e.g. hk00700
vals = data.replace('"', '').replace(';', '').split(',')
if len(vals) < 6:
continue
try:
name = vals[0]
price = float(vals[1])
prev = float(vals[2])
chg = price - prev
pct = chg / prev * 100
high = float(vals[4])
low = float(vals[5])
volume = float(vals[3]) / 1e6 # 成交量(手)
arrow = "🔴" if pct > 0 else "🟢" if pct < 0 else "⚪"
results.append({
"code": code, "name": name, "price": price,
"chg": chg, "pct": pct, "high": high, "low": low,
"volume": volume, "arrow": arrow
})
except (ValueError, IndexError):
continue
return results
python
import requests
def get_hk_sector_ranking():
"""港股行业板块涨跌排行"""
url = "http://push2.eastmoney.com/api/qt/clist/get"
params = {
"pn": 1, "pz": 30, "po": 1, "np": 1,
"fltt": 2, "invt": 2,
"fid": "f3",
"fs": "m:1+t:23", # 港股行业板块
"fields": "f12,f14,f2,f3,f5,f6"
}
headers = {"Referer": "http://quote.eastmoney.com/"}
r = requests.get(url, params=params, headers=headers, timeout=10)
diff = r.json()["data"]["diff"]
return [{"板块": x["f14"], "现价": x["f2"], "涨跌幅": x["f3"],
"成交额": x["f6"]} for x in diff]
python
import akshare as ak
def get_southbound_flow():
"""南向资金净流入"""
df = ak.stock_hsgt_north_net_flow_em()
# 沪深港通北向资金
return df.tail(5) # 最近5个交易日
股票代码名称腾讯hk00700腾讯控股阿里hk09988阿里巴巴美团hk03690美团比亚迪hk01211比亚迪股份京东hk09618京东集团小米hk01810小米集团恒生指数hkHSI恒生指数恒生科技hkHSTECH恒生科技指数国企指数hkHSCEI恒生国企指数
text
https://news.google.com/rss/search?q=港股+恒生+今日+when:1h
https://news.google.com/rss/search?q=香港股市+2026+when:1h
https://news.google.com/rss/search?q=南向资金+港股+when:1h
使用 browser 工具访问已登录的 @bearfrom2077:
text
https://x.com/search?q=港股%20恒生指数&f=live
https://x.com/search?q=南向资金&f=live
https://x.com/search?q=hkstocks%20hangseng&f=live
核心关键词组合:
港股 恒生 — 大盘情绪南向资金 — 外资态度HK IPO — 新股动态科技股 港股 — 板块热点指标阈值信号恒生指数跌幅> 1.5%系统性风险预警南向资金净流入> 50亿/日内地资金抄底南向资金净流出> 30亿/日谨慎信号腾讯/阿里/美团同时下跌 > 2%科技股出逃防御板块(银行/公用)领涨资金抱团非系统性风险
分析顺序:
频率内容适用场景每15分钟恒生指数 + 恒生科技盘中监控每30分钟科技股四巨头(腾讯/阿里/美团/小米)港股主线每小时港股板块排行 + 舆情热点追踪有问才查个股行情被动触发
bash
cd C:\Users\gold3\.openclaw\workspace\skills\hk-stock-radar\scripts
# 恒生指数
python hk_index.py
# 个股行情(传入港股代码)
python hk_quote.py hk00700
# 港股板块
python hk_sector.py
# 南向资金
python southbound.py