feat: expand screeners and stabilize interactive feedback

This commit is contained in:
leefer
2026-07-28 22:47:50 +08:00
parent f4b2d7152a
commit 1cc80583b3
22 changed files with 2707 additions and 509 deletions
+24 -4
View File
@@ -467,9 +467,23 @@ class MarketInsightsService:
def _auction_amount_history(self, trade_date: str) -> list[dict[str, Any]]:
dates = self.database.auction_factor_dates(trade_date, 10)
stock_list_dates = {
str(item.get("ts_code") or ""): str(item.get("list_date") or "")
for item in self.database.list_stock_master()
if item.get("ts_code")
}
history = []
for current_date in dates:
rows = self.database.auction_factors_for_date(current_date)
rows = [
row for row in self.database.auction_factors_for_date(current_date)
if (
str(row.get("ts_code") or "") in stock_list_dates
and (
not stock_list_dates[str(row.get("ts_code") or "")]
or stock_list_dates[str(row.get("ts_code") or "")] < current_date
)
)
]
history.append(
{
"trade_date": _display_date(current_date),
@@ -726,7 +740,7 @@ class MarketInsightsService:
carried_forward = data_date != trade_date
cache_key = data_date
if not force and not dynamic:
cached = self.database.get_data_snapshot("auction_center_v5", cache_key)
cached = self.database.get_data_snapshot("auction_center_v6", cache_key)
if cached:
result = copy.deepcopy(cached)
result["meta"] = {
@@ -790,7 +804,13 @@ class MarketInsightsService:
stock = master.get(ts_code)
price = _number(row.get("price"))
pre_close = _number(row.get("pre_close"))
if not stock or price <= 0 or pre_close <= 0:
list_date = str((stock or {}).get("list_date") or "")
if (
not stock
or price <= 0
or pre_close <= 0
or (list_date and list_date >= data_date)
):
continue
change = (price / pre_close - 1) * 100
amount_million = _number(row.get("amount")) / 1_000_000
@@ -908,7 +928,7 @@ class MarketInsightsService:
"rows": candidates,
}
if not dynamic:
self.database.save_data_snapshot("auction_center_v5", cache_key, "market", result)
self.database.save_data_snapshot("auction_center_v6", cache_key, "market", result)
return self._with_auction_watchlist(result, data_date, user_id)
def _theme_directory(self) -> list[dict[str, Any]]: