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) <noreply@anthropic.com>
This commit is contained in:
徐翔宇 2026-05-19 17:51:49 +08:00
parent f485093a52
commit b5f0d2d660

View File

@ -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: