42 lines
849 B
TypeScript
42 lines
849 B
TypeScript
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<RunResponse>('/run', req).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<ActiveContract>('/contracts/active', { params: { symbol } })
|
|
.then((r) => r.data)
|
|
}
|