import client from './client' export interface RunRequest { ts_code?: string symbol?: string trade_date?: string } export interface RunResponse { ts_code: string trade_date: string close: number oi: number oi_chg: number short_term: number medium_term: number long_term: number composite: number signal: string } export interface ActiveContract { symbol: string ts_code: string min_date: string max_date: string } export function runPipeline(req: RunRequest) { return client.post('/run', req).then((r) => r.data) } export interface RunRangeRequest { symbol: string start_date: string end_date: string } export interface RunRangeResult { trade_date: string close: number composite: number signal: string } export interface RunRangeResponse { ts_code: string start_date: string end_date: string scored: number skipped: number warnings: string[] results: RunRangeResult[] } export interface RunFullRequest { ts_code: string } export interface RunFullResult { trade_date: string close: number composite: number signal: string } export interface RunFullResponse { ts_code: string total_days: number scored_count: number skipped_count: number warnings: string[] results: RunFullResult[] } export function runRange(req: RunRangeRequest) { return client.post('/run/range', req, { timeout: 180_000 }).then((r) => r.data) } export function runFull(req: RunFullRequest) { return client.post('/run/full', req, { timeout: 300_000 }).then((r) => r.data) } export function runBatch() { return client.post('/run/batch', null, { timeout: 180_000 }).then((r) => r.data) } export function getActiveContract(symbol: string) { return client .get('/contracts/active', { params: { symbol } }) .then((r) => r.data) }