feat(selection): 集成 B1 FastDTW 图形评分
This commit is contained in:
@@ -17,6 +17,7 @@ describe("selection API adapters", () => {
|
||||
page: 2,
|
||||
pageSize: 15,
|
||||
search: "平安银行",
|
||||
sort: "score_desc",
|
||||
})
|
||||
|
||||
const [input, init] = requestJson.mock.calls[0] as [
|
||||
@@ -30,6 +31,7 @@ describe("selection API adapters", () => {
|
||||
expect(params.get("page_size")).toBe("15")
|
||||
expect(params.get("search")).toBe("平安银行")
|
||||
expect(params.get("category")).toBe("pullback")
|
||||
expect(params.get("sort")).toBe("score_desc")
|
||||
expect(init).toEqual({ signal: undefined })
|
||||
})
|
||||
|
||||
@@ -43,5 +45,6 @@ describe("selection API adapters", () => {
|
||||
expect(params.get("page_size")).toBe("5")
|
||||
expect(params.has("search")).toBe(false)
|
||||
expect(params.has("category")).toBe(false)
|
||||
expect(params.has("sort")).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -44,6 +44,7 @@ function buildSelectionQueryParams(query: SelectionResultsQuery) {
|
||||
})
|
||||
if (query.search) params.set("search", query.search)
|
||||
if (query.category) params.set("category", query.category)
|
||||
if (query.sort) params.set("sort", query.sort)
|
||||
return params
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ export const selectionResultsQueryKey = (
|
||||
query.pageSize,
|
||||
query.search ?? "",
|
||||
query.category ?? "all",
|
||||
query.sort ?? "code",
|
||||
] as const
|
||||
|
||||
export const selectionRunQueryKey = (
|
||||
@@ -45,6 +46,7 @@ export const selectionRunQueryKey = (
|
||||
query.pageSize,
|
||||
query.search ?? "",
|
||||
query.category ?? "all",
|
||||
query.sort ?? "code",
|
||||
] as const
|
||||
|
||||
export function useSelectionResults(
|
||||
|
||||
@@ -10,11 +10,16 @@ export const selectionCategoryFilters = [
|
||||
"original",
|
||||
] as const
|
||||
|
||||
export type SelectionSort = "code" | "score_desc" | "score_asc"
|
||||
|
||||
export const selectionSorts = ["code", "score_desc", "score_asc"] as const
|
||||
|
||||
export interface SelectionResultsQuery {
|
||||
page: number
|
||||
pageSize: number
|
||||
search?: string
|
||||
category?: Exclude<SelectionCategoryFilter, "all">
|
||||
sort?: SelectionSort
|
||||
}
|
||||
|
||||
export type SelectionRunStatus =
|
||||
@@ -49,9 +54,33 @@ export interface SelectionStockResult {
|
||||
target_trade_date: string
|
||||
strategy: SelectionStrategy
|
||||
close: number
|
||||
score: SelectionPatternScore | null
|
||||
signals: SelectionSignal[]
|
||||
}
|
||||
|
||||
export interface SelectionPatternScore {
|
||||
status: "matched" | "below_threshold" | "failed"
|
||||
value: number | null
|
||||
threshold: number | null
|
||||
version: string | null
|
||||
case: SelectionPatternCase | null
|
||||
breakdown: SelectionPatternBreakdown | null
|
||||
reason: string | null
|
||||
}
|
||||
|
||||
export interface SelectionPatternCase {
|
||||
id: string
|
||||
name: string
|
||||
breakout_date: string
|
||||
}
|
||||
|
||||
export interface SelectionPatternBreakdown {
|
||||
trend_structure: number
|
||||
kdj_state: number
|
||||
volume_pattern: number
|
||||
price_shape: number
|
||||
}
|
||||
|
||||
export interface SelectionFailure {
|
||||
ts_code: string
|
||||
name: string
|
||||
|
||||
Reference in New Issue
Block a user