forked from ZhuLinsen/daily_stock_analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreen.ts
More file actions
36 lines (30 loc) · 949 Bytes
/
Copy pathscreen.ts
File metadata and controls
36 lines (30 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import apiClient from './index';
import { toCamelCase } from './utils';
// ============ Types ============
/** A single stock row returned by the AI screen endpoint. */
export type ScreenResultRow = Record<string, string>;
export interface ScreenResponse {
success: boolean;
query: string;
resultsCount: number;
returnedCount: number;
dataSource?: string;
results: ScreenResultRow[];
message?: string;
error?: string;
}
// ============ API ============
export const screenApi = {
/**
* Trigger an AI-powered stock screen using natural language conditions.
* @param query Natural language screening query (e.g. "今天涨幅超过5%的A股")
*/
query: async (query: string): Promise<ScreenResponse> => {
const response = await apiClient.post<Record<string, unknown>>(
'/api/v1/screen/query',
{ query },
);
return toCamelCase<ScreenResponse>(response.data);
},
};
export default screenApi;