From b5f0d2d6607063de0fd44e12312177a56f1fc11d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E7=BF=94=E5=AE=87?= Date: Tue, 19 May 2026 17:51:49 +0800 Subject: [PATCH] fix(etf): exclude LOF prefixes from ETF code routing Prior `150...199` range caught 161/162/163/165/166/167/168/169 which are LOF (open-end fund traded on-exchange but priced by 1-day NAV, not intraday ticks). Routing LOF codes through ETFClient pulled stale/wrong-shape data from the Sina sz endpoint. Explicit-deny LOF prefixes; preserve legacy range for everything else. P0 from 2026-05-19 code review. Co-Authored-By: Claude Opus 4.7 (1M context) --- Sources/data/EtfClient.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/data/EtfClient.swift b/Sources/data/EtfClient.swift index d18486d..c0d43d1 100644 --- a/Sources/data/EtfClient.swift +++ b/Sources/data/EtfClient.swift @@ -68,7 +68,19 @@ actor ETFClient { static func isETFCode(_ code: String) -> Bool { guard code.count == 6, let n = Int(code) else { return false } let prefix = n / 1000 + // P0 fix (2026-05-19 review): the prior `150...199` range was + // too wide — it caught LOF codes that aren't ETFs: + // 161xxx 兴全 LOF / 162xxx 黄金 LOF / 163xxx 招商 LOF + // 165xxx 银华 LOF / 166xxx 中欧 LOF / 167xxx 中海 LOF + // 168xxx, 169xxx 多家 LOF + // LOFs trade by 1-day NAV pricing, not by ETF intraday quote + // ticks. Routing them through ETFClient would surface stale + // or wrong-shaped data on the holding row. + // Explicit-deny the LOF prefixes; keep everything else in the + // legacy range routing for backwards compat. switch prefix { + case 161, 162, 163, 165, 166, 167, 168, 169: + return false case 510...599, 150...199: return true default: