diff --git a/backend/services/tencent.py b/backend/services/tencent.py index 098424e..615028a 100644 --- a/backend/services/tencent.py +++ b/backend/services/tencent.py @@ -142,11 +142,11 @@ async def fetch_quote(code: str) -> Optional[dict]: return None text = resp.content.decode("gbk", errors="replace") parts = parse_tencent_data(text) - if not parts or len(parts) < 46: + if not parts or len(parts) < 47: return None # 字段索引:1=名称, 3=当前价, 4=昨收, 5=今开, 6=成交量(手) # 7=外盘, 8=内盘, 31=涨跌额, 32=涨跌幅%, 33=最高, 34=最低, 37=成交额(万) - # 38=换手率%, 39=市盈率, 43=总市值, 44=流通市值, 45=市净率 + # 38=换手率%, 39=市盈率, 43=振幅%, 44=流通市值(亿), 45=总市值(亿), 46=市净率 name = parts[1] or "" current_price = float(parts[3]) if parts[3] else 0 yesterday_close = float(parts[4]) if parts[4] else 0 @@ -161,9 +161,10 @@ async def fetch_quote(code: str) -> Optional[dict]: inner_disk = float(parts[8]) if parts[8] else 0 turnover_rate = float(parts[38]) if parts[38] else 0 # 换手率% pe = float(parts[39]) if parts[39] else 0 # 市盈率 - total_market_cap = float(parts[43]) if parts[43] else 0 # 总市值 - circulating_market_cap = float(parts[44]) if parts[44] else 0 # 流通市值 - pb = float(parts[45]) if parts[45] else 0 # 市净率 + # 腾讯API返回的市值单位是亿, formatMoney期望元, 需×1e8 + total_market_cap = float(parts[45]) * 1e8 if parts[45] else 0 # 总市值(亿→元) + circulating_market_cap = float(parts[44]) * 1e8 if parts[44] else 0 # 流通市值(亿→元) + pb = float(parts[46]) if parts[46] else 0 # 市净率 if not name or current_price == 0: return None diff --git a/src/routes/sectors.tsx b/src/routes/sectors.tsx index 6fb6eac..2f7e0da 100644 --- a/src/routes/sectors.tsx +++ b/src/routes/sectors.tsx @@ -75,7 +75,13 @@ function SectorsPage() { {TABS.map((t) => (