a45aa5b033
Co-Authored-By: Claude <noreply@anthropic.com>
71 lines
3.0 KiB
TypeScript
71 lines
3.0 KiB
TypeScript
/**
|
|
* 集中管理所有 React Query key。
|
|
*
|
|
* - 新增查询只需在此加一行,所有消费方自动引用。
|
|
*/
|
|
|
|
// ===== Query Key 工厂 =====
|
|
|
|
export const QK = {
|
|
// 全局 / 共享 (Layout 预取)
|
|
capabilities: ['capabilities'] as const,
|
|
settings: ['settings'] as const,
|
|
endpoints: ['endpoints'] as const,
|
|
version: ['version'] as const,
|
|
preferences: ['preferences'] as const,
|
|
overviewMarket: (asOf?: string) => ['overview-market', asOf ?? 'latest'] as const,
|
|
indexList: ['index-list'] as const,
|
|
|
|
// Search
|
|
instrumentSearch: (q: string) => ['instrument-search', q] as const,
|
|
|
|
// Screener
|
|
screener: ['screener'] as const,
|
|
screenerStrategies: ['screener-strategies'] as const,
|
|
screenerCached: (ext?: string) => ['screener-cached', ext] as const,
|
|
screenerKlineBatch: (symbols: string) => ['screener-kline-batch', symbols] as const,
|
|
marketSnapshot: ['market-snapshot'] as const,
|
|
limitLadder: (asOf?: string) => ['limit-ladder', asOf] as const,
|
|
|
|
// Data / Pipeline
|
|
dataStatus: ['data-status'] as const,
|
|
pipelineJobs: ['pipeline-jobs'] as const,
|
|
pipelineJob: (id: string) => ['pipeline-job', id] as const,
|
|
extData: ['ext-data'] as const,
|
|
extDataRows: (id: string, date?: string, limit?: number, columns?: string) => ['ext-data-rows', id, date, limit, columns] as const,
|
|
analysisMenus: ['analysis-menus'] as const,
|
|
analysisMenu: (id: string) => ['analysis-menu', id] as const,
|
|
|
|
// Kline
|
|
kline: (symbol: string, start: string, end: string, extColumns?: string) =>
|
|
['kline', symbol, start, end, extColumns ?? ''] as const,
|
|
stockLevels: (symbol: string, days?: number) => ['stock-levels', symbol, days ?? 120] as const,
|
|
klineMinute: (symbol: string, date: string) =>
|
|
['kline-minute', symbol, date] as const,
|
|
indexDaily: (symbol: string, start: string, end: string) =>
|
|
['index-daily', symbol, start, end] as const,
|
|
indexMinute: (symbol: string, date: string) =>
|
|
['index-minute', symbol, date] as const,
|
|
|
|
// Schema
|
|
extDataSchemaAll: ['ext-data-schema-all'] as const,
|
|
tableSchema: (table: string) => ['table-schema', table] as const,
|
|
|
|
// Custom Signals
|
|
customSignals: ['custom-signals'] as const,
|
|
customSignalsOptions: ['custom-signals-options'] as const,
|
|
|
|
// Monitor (监控规则 + 触发记录)
|
|
monitorRules: ['monitor-rules'] as const,
|
|
monitorRuleOptions: ['monitor-rule-options'] as const,
|
|
alerts: (source?: string) => ['alerts', source ?? ''] as const,
|
|
|
|
// AI 大盘复盘
|
|
reviewReports: ['review-reports'] as const,
|
|
|
|
// 概念涨幅轮动矩阵
|
|
rpsRotation: (days: number) => ['rps-rotation', days] as const,
|
|
} as const
|
|
|
|
// SSE invalidation has been removed along with real-time functionality.
|