Skip to content

feat: 选股器重构 V2 — 概念板块/多行业地域/PS/布林带均线/北向资金#56

Merged
chenachen merged 4 commits into
mainfrom
copilot/refactor-stock-selector-functionality
Apr 18, 2026
Merged

feat: 选股器重构 V2 — 概念板块/多行业地域/PS/布林带均线/北向资金#56
chenachen merged 4 commits into
mainfrom
copilot/refactor-stock-selector-functionality

Conversation

Copilot AI commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

选股器已有基础多维度筛选,但未利用项目后续接入的概念板块、北向持仓、技术因子等数据源。本次重构扩展筛选维度并增强返回数据。

新增筛选维度

  • 概念板块 (conceptCodes: string[]) — INNER JOIN ths_index_members 按同花顺概念板块多选过滤
  • 多行业/多地域 (industries/areas: string[]) — 升级为数组,SQL ANY() 匹配,向后兼容旧单选字段
  • PS(TTM) (minPsTtm/maxPsTtm) — 利用已有 stock_daily_valuation_metrics.ps_ttm
  • 布林带信号 (bollSignal: 'above_upper' | 'below_lower' | 'squeeze')
  • 均线趋势 (maTrend: 'bullish' | 'bearish') — 使用 boll_mid 近似 MA20 + MACD DIF 方向
  • 北向资金 (northboundOnly: boolean) — INNER JOIN LATERAL hk_hold_detail 最新持仓

新增端点

  • POST /stock/screener/concepts — 返回同花顺概念板块列表(24h Redis 缓存),供前端下拉多选

返回字段增强

  • psTtm: number | null — 市销率 TTM
  • concepts: string[] | null — 所属概念板块名称列表(批量查询,避免 N+1)

新增排序字段 & 内置预设

排序新增 PS_TTMCLOSE。预设新增 4 个:北向重仓、技术突破、超跌反弹、低PS高成长。

概念名称批量查询示例

// 对返回结果集批量查询概念,降级容错
const conceptRows = await this.prisma.$queryRaw<ConceptRow[]>`
  SELECT tm.con_code AS "conCode", ti.name
  FROM ths_index_members tm
  JOIN ths_index_boards ti ON ti.ts_code = tm.ts_code
  WHERE tm.con_code = ANY(${tsCodes}) AND tm.is_new = 'Y' AND ti.type = 'N'
`

其他

  • 数组字段均加 @ArrayMaxSize() 防止过大查询
  • 布林带缩口阈值提取为 BOLL_SQUEEZE_THRESHOLD 常量
  • 设计文档 docs/design/选股器重构-后端设计.md
  • 39 个单元测试覆盖全部新增逻辑

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint.prisma.io
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node /home/REDACTED/work/server-code/server-code/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.2&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2026-04-18T03:40:52Z&#34;,&#34;project_hash&#34;:&#34;230dd102&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/server-code/server-code/node_modules/.bin/prisma&#34;,&#34;cli_path_hash&#34;:&#34;5a210d3d (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node /home/REDACTED/work/server-code/server-code/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;6.19.2&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2026-04-18T03:41:03Z&#34;,&#34;project_hash&#34;:&#34;230dd102&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/server-code/server-code/node_modules/.bin/prisma&#34;,&#34;cli_path_hash&#34;:&#34;5a210d3d (dns block)
  • scarf.sh
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./report.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

目前项目已经新增了很多功能也接入了很多新的数据,你研究一下整个项目,然后输出选股器的重构方案,让选股器这个功能更加强大好用

Copilot AI changed the title [WIP] Refactor stock selector for enhanced usability and features feat: 选股器重构 V2 — 概念板块/多行业地域/PS/布林带均线/北向资金 Apr 18, 2026
Copilot AI requested a review from chenachen April 18, 2026 03:54
@chenachen
chenachen marked this pull request as ready for review April 18, 2026 14:17
@chenachen
chenachen merged commit 0abcc8b into main Apr 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants