news screen enhancement - 1

This commit is contained in:
Kazuma
2026-06-09 20:11:10 -04:00
parent 5655cde6bf
commit f0c794f0c0
13 changed files with 250 additions and 35 deletions
@@ -151,6 +151,20 @@ export const WATCHLIST_QUERIES = {
`,
};
// ── Screening Universe Queries (bin/daily-screen.ts) ────────────────────────
export const UNIVERSE_QUERIES = {
// Every ticker pinned by any user
DISTINCT_WATCHLIST_TICKERS: 'SELECT DISTINCT ticker FROM watchlist ORDER BY ticker',
// Every ticker held by any user (crypto excluded — not fundamentally scored)
DISTINCT_HOLDING_TICKERS: `
SELECT DISTINCT ticker FROM holdings
WHERE type != 'crypto'
ORDER BY ticker
`,
};
// ── Signal Snapshot Queries (P0.1 — signal track record) ────────────────────
export const SIGNAL_SNAPSHOT_QUERIES = {
@@ -87,10 +87,26 @@ export interface AssetResult {
fundamental: ScoreResult;
}
/**
* Data-source health for one screen batch (PRODUCT.md P0.4).
* Degraded = a large share of stocks came back without core fundamentals,
* which usually means the upstream data source changed or is throttling —
* not that the companies are actually missing data.
*/
export interface DataHealth {
degraded: boolean;
stocksChecked: number;
nullPeRatio: number;
nullRoe: number;
message: string | null;
}
export interface ScreenerResult {
STOCK: AssetResult[];
ETF: AssetResult[];
BOND: AssetResult[];
ERROR: Array<{ ticker: string; message: string }>;
marketContext: import('./market.model.js').MarketContext;
/** Set by the screener controller on API responses, not by the engine. */
dataHealth?: DataHealth;
}
+2
View File
@@ -8,6 +8,8 @@ export type {
ScoringRules,
ScoreAudit,
ScoreResult,
VerdictTier,
DataHealth,
AssetResult,
LiveAssetResult,
ScreenerResult,