fix(HEL-494): 切断网站生产装配外源直连,iFinD 与实时观察改走中枢
生产 gateway 不再实例化 iFinD、东财图和免费实时聚合器;问财与竞价快照作为中枢内部数据源。全站阻断外源测试覆盖日K、报价、图表、问财和竞价快照。 Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Cursor
multica-agent
parent
0b8419abca
commit
100752f43c
@@ -13,11 +13,12 @@ from datahub.timeutil import isoformat, now_shanghai, session_phase, yyyymmdd
|
||||
|
||||
|
||||
class AdminAPI:
|
||||
def __init__(self, db: HubDB, pipeline: Pipeline, scheduler: Scheduler, auth: AuthService) -> None:
|
||||
def __init__(self, db: HubDB, pipeline: Pipeline, scheduler: Scheduler, auth: AuthService, ifind: Any = None) -> None:
|
||||
self.db = db
|
||||
self.pipeline = pipeline
|
||||
self.scheduler = scheduler
|
||||
self.auth = auth
|
||||
self.ifind = ifind
|
||||
|
||||
def overview(self) -> dict[str, Any]:
|
||||
today = yyyymmdd(now_shanghai())
|
||||
@@ -57,10 +58,26 @@ class AdminAPI:
|
||||
}
|
||||
]
|
||||
for name, adapter in RESERVED.items():
|
||||
if name == "ifind":
|
||||
live = self.ifind or adapter
|
||||
cred = self.auth.credential_status("ifind_refresh_token") or {
|
||||
"configured": bool(getattr(live, "configured", False)),
|
||||
"last4": "",
|
||||
"updated_at": "",
|
||||
}
|
||||
items.append(
|
||||
{
|
||||
"provider": name,
|
||||
"role": "licensed",
|
||||
"health": live.probe(),
|
||||
"credential": cred,
|
||||
}
|
||||
)
|
||||
continue
|
||||
items.append(
|
||||
{
|
||||
"provider": name,
|
||||
"role": "reserved",
|
||||
"role": "reserved" if name in {"ths", "xgb", "akshare"} else "free",
|
||||
"health": adapter.probe(),
|
||||
"credential": {"configured": False, "last4": "", "updated_at": ""},
|
||||
}
|
||||
@@ -78,6 +95,11 @@ class AdminAPI:
|
||||
def probe(self, provider: str) -> dict[str, Any]:
|
||||
if provider == "tushare":
|
||||
return self.pipeline.adapter.probe()
|
||||
if provider == "ifind":
|
||||
adapter = self.ifind or RESERVED.get("ifind")
|
||||
if adapter is None:
|
||||
raise ApiError("INVALID_ARGUMENT", "unknown provider: ifind")
|
||||
return adapter.probe()
|
||||
adapter = RESERVED.get(provider)
|
||||
if adapter is None:
|
||||
raise ApiError("INVALID_ARGUMENT", f"unknown provider: {provider}")
|
||||
|
||||
Reference in New Issue
Block a user