feat(selection): show gold brick chart below volume in stock detail panel

Add an optional brick_chart series to the selection chart API, computed
from the shared gold-brick formula when strategy=gold_brick, and render
a fourth grid with red/green brick bars between the volume and J grids.
This commit is contained in:
yuxuanhui
2026-09-05 13:41:25 +08:00
parent 79476252b1
commit 3b50e75ef8
13 changed files with 249 additions and 36 deletions
@@ -31,8 +31,15 @@ const defaultListQuery: SelectionResultsListQuery = {
export const selectionChartQueryKey = (
tsCode?: string,
targetTradeDate?: string,
strategy?: SelectionStrategy,
) =>
["selection", "chart", tsCode ?? "none", targetTradeDate ?? "none"] as const
[
"selection",
"chart",
tsCode ?? "none",
targetTradeDate ?? "none",
strategy ?? "none",
] as const
export const selectionResultsQueryKey = (
strategy: SelectionStrategy,
@@ -100,12 +107,16 @@ export function useSelectionResults(
})
}
export function useSelectionChart(tsCode?: string, targetTradeDate?: string) {
export function useSelectionChart(
tsCode?: string,
targetTradeDate?: string,
strategy?: SelectionStrategy,
) {
return useQuery({
enabled: Boolean(tsCode && targetTradeDate),
queryFn: ({ signal }) =>
getSelectionChart(tsCode ?? "", targetTradeDate ?? "", signal),
queryKey: selectionChartQueryKey(tsCode, targetTradeDate),
getSelectionChart(tsCode ?? "", targetTradeDate ?? "", strategy, signal),
queryKey: selectionChartQueryKey(tsCode, targetTradeDate, strategy),
})
}