feat: integrate iFinD data and refine intelligent workspaces
This commit is contained in:
@@ -1326,6 +1326,58 @@ class TushareClient:
|
||||
"methodology": "同花顺行业最新成分股的 rt_k 等权涨跌、宽度与成交额聚合",
|
||||
}
|
||||
|
||||
def hot_money_profiles(self) -> dict[str, Any]:
|
||||
rows = self.query("hm_list", {}, "name,desc,orgs")
|
||||
profiles: list[dict[str, Any]] = []
|
||||
seen_names: set[str] = set()
|
||||
for row in rows:
|
||||
name = str(row.get("name") or "").strip()
|
||||
if not name or name in seen_names:
|
||||
continue
|
||||
seen_names.add(name)
|
||||
description = _text(row.get("desc"))
|
||||
organization_text = _text(row.get("orgs"))
|
||||
parsed_organizations: Any = None
|
||||
if organization_text.startswith("["):
|
||||
try:
|
||||
parsed_organizations = json.loads(organization_text)
|
||||
except json.JSONDecodeError:
|
||||
parsed_organizations = None
|
||||
organization_parts = (
|
||||
parsed_organizations
|
||||
if isinstance(parsed_organizations, list)
|
||||
else re.split(r"[,,;;\n]+", organization_text)
|
||||
)
|
||||
organizations = list(dict.fromkeys(
|
||||
_text(part)
|
||||
for part in organization_parts
|
||||
if _text(part)
|
||||
))
|
||||
profiles.append(
|
||||
{
|
||||
"id": f"hot-money-profile-{len(profiles) + 1}",
|
||||
"name": name,
|
||||
"description": description,
|
||||
"organizations": organizations,
|
||||
"organization_count": len(organizations),
|
||||
}
|
||||
)
|
||||
return {
|
||||
"meta": {
|
||||
"source": "tushare",
|
||||
"status": "success" if profiles else "empty",
|
||||
"schema_version": 1,
|
||||
"updated_at": datetime.now().astimezone().isoformat(timespec="seconds"),
|
||||
"notice": "",
|
||||
},
|
||||
"summary": {
|
||||
"profile_count": len(profiles),
|
||||
"described_count": sum(bool(item["description"]) for item in profiles),
|
||||
"organization_count": sum(item["organization_count"] for item in profiles),
|
||||
},
|
||||
"profiles": profiles,
|
||||
}
|
||||
|
||||
def dragon_tiger(self, requested_date: str) -> dict[str, Any]:
|
||||
trade_date, _ = self.resolve_trade_context(requested_date)
|
||||
detail_rows = self.query(
|
||||
|
||||
Reference in New Issue
Block a user