Commit Graph

89 Commits

Author SHA1 Message Date
zhulinsen
ef9371003c feat: harden JP/KR suffix market support (#1817)
* feat: harden JP/KR suffix market support

* fix: define yfinance index quote metadata

* fix(review-feedback-1817): Handle JP 4-digit bare-code lookup in analysis paths

* fix(review-feedback-1817): Route 4-digit JP bases through API normalization

* fix(review-feedback-1817): 补齐外部 API/provider/运行时配置风险说明或证明该检测为误报
2026-06-27 22:10:08 +08:00
Wenyu Chiou
2086e3cca4 feat(market): Taiwan (台股) suffix-only market detection + routing (#1773)
Per the maintainer review on #1772/#1773, scope this PR to market detection
and data routing only — no Taiwan stock-index / seed / pool-resolution, so a
bare code can never be silently rewritten to a .TW suffix (the index path is a
deferred follow-up with the jp/kr-style honest doc + entry-point tests).

- data_provider/base.py: _is_tw_market / _is_tw_suffix_stock, _market_tag,
  normalize_stock_code, get_daily_data + get_realtime_quote routing,
  _DAILY_MARKET_FETCHER_SUPPORT (YfinanceFetcher only), offshore fundamental path
- data_provider/yfinance_fetcher.py: _get_tw_main_indices (^TWII / ^TWOII) +
  .TW/.TWO suffix passthrough
- src/core/trading_calendar.py: XTAI / Asia/Taipei + get_market_for_stock
- src/market_context.py: detect_market + Taiwan prompt guidelines
- src/{market_phase_summary, services/stock_code_utils, core/pipeline}: tw plumbing
  (stock_code_utils only recognizes .TW/.TWO codes; no bare->suffix rewrite)
- src/services/decision_signal_extractor.py: gracefully skip tw (recognized by
  the data layer but not yet supported by the signal service) — no swallowed
  ValueError + traceback
- tests: test_tw_market_support.py + test_decision_signal_extractor.py
  (test_build_payload_skips_tw_market_gracefully — real tw skip regression)
- docs/market-support.md + CHANGELOG

Deferred follow-ups: stock index/seed + autocomplete + frontend, API market
enums + api_spec, and the service-layer market enums.

Bare numeric codes keep A-share semantics; only an explicit .TW/.TWO suffix
opts into Taiwan.

Refs #1772
2026-06-25 22:55:08 +08:00
mumu
e49301a79f feat: 支持日本/韩国 suffix-only 个股分析 (#1720)
* feat: support JP/KR suffix stock analysis

* fix(review-feedback-1720): 解决冲突后再合入
2026-06-19 11:59:59 +08:00
mumu
3b5ef16144 feat: harden AlphaSift data source routing (#1680)
* feat: harden alphasift data source routing

* fix(review-feedback-1680): Keep the sample AlphaSift pin in sync and Avoid circuit-breaking

* fix(review-feedback-1680): Defer half-open health checks until a source is attempted and Treat

* fix(review-feedback-1680): fix only bypasses this branch for fetchers that opt into allow empty

* fix(review-feedback-1680): Avoid accepting truncated Tencent histories

* fix(review-feedback-1680): 修正 .env.example 的 AlphaSift 快照源默认说明,并避免在 docs/CHANGELOG.md

* fix(review-feedback-1680): src/config.py、src/services/alphasift service.py

* fix(review-feedback-1680): requirements.txt、src/config.py、.env.example、src/services/alphasift

* fix(review-feedback-1680): 修复 TencentFetcher 对显式历史窗口的处理问题

* fix(review-feedback-1680): Check the cap was hit before rejecting Tencent history

* fix(review-feedback-1680): Use Tencent's hyphenated date format and Convert Tencent daily volume

* fix(review-feedback-1680): Accept the executor timeout argument and preserve capped windows with

* fix: limit empty daily data opt-in behavior

* docs: restore AlphaSift 3.22 changelog entry
2026-06-14 18:47:41 +08:00
LouisHong
145ee6b5a5 fix: [issue #1652] stabilize run-flow live states and layout polish (#1682)
* fix: polish run-flow topology layout and i18n

* fix: prevent task panel layout squeeze

* test: update run flow frontend coverage

* fix: isolate market context run flow

* fix: handle completed task flow refresh

* feat: show running run-flow nodes

* fix: show chip provider runs in flow

* fix: stabilize stock run flow live updates

* fix: refine run-flow history lookup and spacing

* fix: update run-flow edge states and layout gaps

* fix: polish run-flow task panel text
2026-06-14 17:57:16 +08:00
LouisHong
4f536026f8 fix: clarify runtime logging context (#1643)
* fix: clarify market review logging context

* docs: update changelog for logging context
2026-06-09 01:08:55 +08:00
Alfred
9f14850265 feat: add intraday realtime quality metadata (#1538)
Refs #1386

Refs #1389
2026-05-31 21:05:12 +08:00
Alfred
b22d7e0277 fix: correct ETF secid routing for efinance (#1535)
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-05-31 09:27:54 +08:00
mumu
647b9d24e5 fix: support Longbridge OAuth token cache (#1490)
* fix: support Longbridge OAuth token cache

* fix(review-feedback-1490): bump the runtime dependency minimum or fail with a clear upgrade

* fix(review-feedback-1490): 补充对应回归测试

* fix(review-feedback-1490): Point OAuth cache at the dsa home in Docker

* fix(review-feedback-1490): 修复或给出明确的 CI 重跑通过证据

* fix(review-feedback-1490): 处理 Docker/Actions 持久化 token cache 已损坏时无法被新的 LONGBRIDGE OAUTH TOKEN

* fix: tighten Longbridge OAuth compatibility

* fix: refresh stale Longbridge OAuth cache

* fix: guard Longbridge OAuth SDK availability
2026-05-29 23:08:16 +08:00
mumu
a13863e50e fix: 为 Akshare 历史兜底接口增加超时保护 (#1465)
* fix(issue-1464): [bug]-scheduled-analysis-hangs-when-stoc

* fix(review-feedback-1465): Avoid leaking daemon threads on timed-out Akshare calls

* fix(review-feedback-1465): fix can reintroduce hangs/crashes in the exact scheduled pipeline it

* fix(review-feedback-1465): Use a safe start method for timeout subprocesses

* fix(review-feedback-1465): Call freeze support before spawning timeout workers
2026-05-27 21:18:23 +08:00
mumu
e0e5fa6870 feat: add #1391 Phase 1 run diagnostics trace plumbing (#1441)
* fix(issue-1412): [bug]-stock_list格式问题

* fix(review-feedback-1413): preserve exchange hint for dotted A-share inputs

* fix(review-feedback-1413): Keep normalized A-share codes usable by market routing and preserve

* fix(review-feedback-1413): Limit raw dotted codes to fetchers that can parse them

* fix(review-feedback-1413): Keep Tushare daily input normalized for ETF detection

* fix(review-feedback-1413): 澄清结构化检测中的外部模型/API 与运行时配置迁移风险

* fix(review-feedback-1413): 处理或明确确认该失败与本 PR 无关且已有维护者豁免依据

* fix: keep stock list input as bare codes

* docs: add phase-0 run diagnostics contract

* fix(review-feedback-1435): 修正描述并澄清/补齐运行时代码变更的验证证据

* fix(review-feedback-1435): 补齐前缀提示识别,并增加对应回归测试

* fix(review-feedback-1435): 修正

* fix(review-feedback-1435): 解决冲突并更新描述/验证记录后再合入

* fix(review-feedback-1435): 解决冲突,并在最终 head 上重新确认 python -m pytest tests/test a share fetcher code

* fix(review-feedback-1435): 修复并补齐回归覆盖后再复核最终 head

* fix(review-feedback-1435): data provider/baostock fetcher.py 的 convert stock code 只从 .SH/.SS/.SZ

* fix: preserve A-share exchange hints

* fix(review-feedback-1435): 修正 docs/run-diagnostics-p0.md 对 Tushare 本轮范围的矛盾描述

* feat: add phase 1 run diagnostics trace plumbing

* fix(review-feedback-1441): 打通 trace id 与数据源运行快照,改动目标明确
2026-05-25 21:01:40 +08:00
mumu
09afbf566f fix: add #1391 Phase 0 diagnostics and A-share code guards (#1435)
* fix(issue-1412): [bug]-stock_list格式问题

* fix(review-feedback-1413): preserve exchange hint for dotted A-share inputs

* fix(review-feedback-1413): Keep normalized A-share codes usable by market routing and preserve

* fix(review-feedback-1413): Limit raw dotted codes to fetchers that can parse them

* fix(review-feedback-1413): Keep Tushare daily input normalized for ETF detection

* fix(review-feedback-1413): 澄清结构化检测中的外部模型/API 与运行时配置迁移风险

* fix(review-feedback-1413): 处理或明确确认该失败与本 PR 无关且已有维护者豁免依据

* fix: keep stock list input as bare codes

* docs: add phase-0 run diagnostics contract

* fix(review-feedback-1435): 修正描述并澄清/补齐运行时代码变更的验证证据

* fix(review-feedback-1435): 补齐前缀提示识别,并增加对应回归测试

* fix(review-feedback-1435): 修正

* fix(review-feedback-1435): 解决冲突并更新描述/验证记录后再合入

* fix(review-feedback-1435): 解决冲突,并在最终 head 上重新确认 python -m pytest tests/test a share fetcher code

* fix(review-feedback-1435): 修复并补齐回归覆盖后再复核最终 head

* fix(review-feedback-1435): data provider/baostock fetcher.py 的 convert stock code 只从 .SH/.SS/.SZ

* fix: preserve A-share exchange hints

* fix(review-feedback-1435): 修正 docs/run-diagnostics-p0.md 对 Tushare 本轮范围的矛盾描述
2026-05-25 20:38:22 +08:00
mumu
8777439f1c fix: stock_list格式问题 (#1412) (#1413) 2026-05-23 19:15:23 +08:00
vinvcn
2c26203c24 fix: normalize Tencent realtime volume (#1409)
* fix: normalize Tencent realtime volume

* fix: harden Tencent realtime normalization

* docs: localize Tencent realtime comments

---------

Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-05-22 22:42:05 +08:00
TianleZhang
bb814ff89d feat: 邮件报告补充 财务摘要 / 股东回报 / 关联板块,并接入 HK/US 基本面 (#1369)
* feat: enrich email report with financial / dividend / related-boards blocks for CN/HK/US

Render three structured sections in single-stock and dashboard markdown reports
(used by email and other static channels) sourced from fundamental_context:

- 财务摘要: report date, revenue, parent net profit, operating cash flow, ROE,
  YoY growth, gross margin
- 股东回报: TTM cash dividend per share (pre-tax), TTM event count, TTM yield,
  latest ex-dividend date
- 关联板块: belong_boards with sector-leading/lagging signal & change_pct when
  available; auto-collapses to a 2-col (name / type) layout when no sector
  ranking data exists (typical for HK/US)

To unlock the offshore (HK/US) data path:

- Add YfinanceFundamentalAdapter producing the same bundle shape as the
  AkShare adapter, with growth, financial_report (incl. currency),
  TTM dividend events, and sector+industry as belong_boards
- Route get_fundamental_context for hk/us through a new
  _build_offshore_fundamental_context helper instead of short-circuiting
  to not_supported; keep capital_flow / dragon_tiger / boards as
  not_supported (no equivalent feed)
- Stop overwriting belong_boards in the pipeline for non-CN markets so the
  adapter-provided sector/industry data survives

Notification renderer:

- Attach fundamental_context onto AnalysisResult so the notification layer
  can reach it without an extra DB round-trip
- Currency-aware formatting: USD -> 亿/万美元, HKD -> 亿/万港元,
  CNY/other -> 亿/万元; per-share amounts get the same suffix
- Right-align numeric columns and center the report-date column in the
  financial summary and shareholder return tables for cleaner rendering

Tests:

- Offline coverage for the new yfinance adapter (symbol conversion, bundle
  shape, refusal to use QoQ as YoY, graceful degradation when yfinance is
  unavailable)
- Offshore market path through DataFetcherManager.get_fundamental_context
- Adaptive related-boards rendering (2-col when no sector signal,
  4-col when at least one row carries data)
- Currency-aware amount formatting for AAPL (USD) and HK09988 (CNY)

* fix: split financial vs dividend currency and recompute TTM yield for HK/US

HK ADRs typically report financialCurrency=CNY but pay dividends in HKD
(live yfinance confirms: 9988.HK / 0700.HK both have financialCurrency=CNY
and currency=HKD; BABA US ADR has financialCurrency=CNY and currency=USD).
Previously the adapter wrote a single currency field shared by both the
financial report and the dividend block, which rendered HK dividends as
yuan in the email report.

This change writes earnings.financial_report.currency from
info.financialCurrency and earnings.dividend.currency from info.currency
independently, and the notification renderer reads each block's own
currency (falling back to financial_report.currency when dividend.currency
is absent, which keeps AkShare A-share rendering unchanged).

TTM dividend yield was sourced from info.dividendYield, mixing the
numerator (TTM cash window) with a denominator-defined yield from a
different yfinance computation. The yield is now recomputed as
ttm_cash_dividend_per_share / latest_price * 100 with both sides in the
trading currency (latest_price falls through info.currentPrice ->
regularMarketPrice -> previousClose). info.dividendYield is now a
last-resort passthrough (no *100, since current yfinance already returns
percent), behind info.trailingAnnualDividendYield (decimal).

Docs (full-guide / full-guide_EN) updated: HK/US now returns
valuation/growth/earnings/belong_boards rather than not_supported, with
the dual-currency split and the TTM yield formula explicitly documented.
CHANGELOG entries rewritten to reflect the corrected behavior.

Verified live against 9988.HK / 0700.HK / AAPL / 600519: the rendered
email shows financial summary in 亿元 for HK ADRs (CNY statements) while
the shareholder return block shows 港元 (HKD dividends), and the
recomputed yields match ttm_cash / latest_price in the same currency.

---------

Co-authored-by: suan baby <suanai@tianle.me>
2026-05-21 20:04:32 +08:00
mumu
b7d449783c fix: 资金流数据缺失 (#1367) (#1368)
* fix(issue-1367): [bug]-资金流数据缺失

* fix(review-feedback-1368): preserve agent-provided chip data when prefetch is unavailable and

* fix(review-feedback-1368): 补充具体受影响文件/字段、是否会清理或迁移用户已有配置、用户可见恢复方式,以及对应回归测试或确认不涉及运行时行为的证据

* fix(review-feedback-1368): 结构化检测显示本 PR 涉及模型名、provider、Base URL、废弃日期、LiteLLM 或 LLM

* docs: trim issue 1367 compatibility notes

* docs: keep issue 1367 note in changelog only
2026-05-20 23:32:14 +08:00
wqlC
5029605efa fix: clear AlphaVantage fetcher index name to avoid 'date' ambiguity (#1351)
_fetch_raw_data 中 `df.index = pd.to_datetime(df['date'])` 会让
DatetimeIndex 继承源 Series 的 name='date',随后 _normalize_data
重新添加 'date' 列时与索引 level 同名,导致 pandas 在
sort_values('date') 处抛出 ValueError。

复现:load_history_df('AAPL') 走 AlphaVantage 通道时返回 0 行,
报错 "'date' is both an index level and a column label"。

修复:assign 索引后立刻清空 index.name,下游可无歧义引用 'date' 列。
影响范围仅 data_provider/alphavantage_fetcher.py 一行,
其他数据源链路未触及。

Co-authored-by: 贞元 <zhenyuan.wql@alibaba-inc.com>
2026-05-19 22:00:12 +08:00
DragonL641
51e7337882 feat: add Finnhub & AlphaVantage US market data source adapters (#1313)
* feat: add Finnhub and AlphaVantage API key config fields

* feat: add FinnhubFetcher for US market OHLCV and realtime quotes

* feat: add AlphaVantageFetcher for US market OHLCV and realtime quotes

* feat: register FinnhubFetcher and AlphaVantageFetcher in DataFetcherManager

* fix: address PR review feedback on US fetcher routing and AlphaVantage pct_chg

- Fix AlphaVantage pct_chg calculation: sort by date ascending before
  computing percentage change to handle newest-first API response
- Extend US daily routing source_order to include FinnhubFetcher and
  AlphaVantageFetcher in the failover chain
- Add newest-first pct_chg regression test for AlphaVantage
- Add US routing fallback order test
- Update CHANGELOG.md with new feature and fix entries
- Add docs/specs/ to .gitignore to prevent accidental commits

Verified: 1956 tests passed, ci_gate.sh clean

* fix: address third round PR review - routing gaps, index isolation, CHANGELOG cleanup

- Isolate US index routing: YFinance-first, skip Finnhub/AlphaVantage for index codes
- Add Finnhub/AlphaVantage to US realtime_quote and get_stock_name routing
- Clean CHANGELOG.md: only our 3 Finnhub/AlphaVantage entries in [Unreleased]
2026-05-17 21:24:34 +08:00
mumu
0fb6c9c5b8 feat: add market review data sources (#1278)
* feat: add market review data sources
2026-05-15 20:51:22 +08:00
zbl-96
72da793233 fix(data-provider): skip unavailable optional fetchers and back off longbridge reconnects (#1249)
* fix(data-provider): skip unavailable optional fetchers and back off longbridge reconnects

* fix(data-provider): back off unavailable longbridge routes

* fix(data-provider): back off noisy pytdx name lookups

* docs: align PR 1249 changelog and compatibility notes

* fix(config): preserve legacy schedule override precedence
2026-05-10 23:28:30 +08:00
mumu
595908c81a chore: reorganize root files (#1257)
* chore: reorganize root files

* fix: mark moved docs assets as binary
2026-05-10 19:50:22 +08:00
mumu
7bb7dc99dd Fix HK historical data provider routing (#1232) 2026-05-09 19:57:42 +08:00
Jonty Wang
07b4fe5795 feat: Add Hong Kong market support (#1068)
* fix: update report title from 'A股智能分析报告' to '股票智能分析报告'

* feat: add support for Hong Kong market in market review and analysis features

* fix: update daily_analysis workflow name and adjust region check in market analyzer

* fix: enhance market region handling in run_market_review and compute_effective_region functions

* test: add Hong Kong market support in MarketReviewLocalizationTestCase

* fix: update market review region handling to include Hong Kong support in documentation and logic

* fix: update daily_analysis workflow name to Chinese and adjust Hong Kong index symbols in yfinance_fetcher

* fix: refactor market review execution to use run_market_review for improved handling

* fix: implement trading day filtering in MarketCommand to skip reviews on market holidays

* fix: update changelog and README to reflect market command enhancements and support for multiple regions

* fix: update YfinanceFetcher to include HK index symbol mappings for improved data retrieval

Co-authored-by: Jonty <jonty.wang@hk.com.sg>
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-04-28 22:25:29 +08:00
mumu
efd2bce694 fix: handle efinance index open column fallback (#1051)
* fix: handle efinance index open column fallback
2026-04-19 22:27:25 +08:00
SophiaJiaLi
0e8728fdcf fix: return latest trade date on non-trade days for chip distribution and sector rankings(Fix #1009) (#1067)
Problem Statement:
On non-trade dats, get_trade_time() returned the second-to-last trade instead of the latest one.

Root Cause:
_pick_trade_date(trade_dates,use_today=False) skips trade_dates[0], but on non-trade days trade_dates[0] is already the most recent trade date

Solution:
for non-trade days, put use_today=Ture
2026-04-17 22:18:59 +08:00
mumu
edab25d880 feat: 让后端优先复用现有 stocks.index.json 解析股票名称映射,在缺失时保持现有回退链路… (#1027) (#1033)
* feat(issue-1027): [feature]-后端复用前端-stocks.index.json-作为全量股
2026-04-10 15:40:55 +08:00
jiangmin168168
bfa7b8cd89 Feat/tushare增加港股查询支持 (#994) 2026-04-08 23:03:14 +08:00
mumu
44d3b65a40 fix: 缺失值判断逻辑不应静默吞掉非预期异常 (#996) (#997)
* fix(issue-996): [bug]-缺失值判断逻辑不应静默吞掉非预期异常
2026-04-04 10:21:01 +08:00
mumu
314de7fb58 fix: akshare港股增强 (#940) (#964) 2026-04-03 22:49:15 +08:00
Rules
dd89d06a7d feat:修复美股数据丢失,新增长桥数据源 (#981)
* fix:新增长桥数据源,补充美港股数据

* ci: Actions 注入 LONGBRIDGE_* 环境变量并增加数据源检查;full-guide 补充 CI 配置说明

Made-with: Cursor

* fix:长桥参数初始化时机调整

* fix:添加长桥初始化调试日志

* fix:调整数据源优先级

* Update tests/test_search_searxng.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update data_provider/base.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update data_provider/longbridge_fetcher.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update docs/README_CHT.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update docs/README_EN.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update README.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update docs/README_EN.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update docs/README_CHT.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(longbridge): 使用 get_config() 替代不存在的 config 导入(_is_available)

* fix:CHANGELOG、联调脚本重命名、繁中 README 英文链接、PRINT_QUOTE_PACKAGES 默认值已对齐。

* fix:调整审核中的问题

---------

Co-authored-by: xuxiong <xiong.xu@xsgames.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-02 23:05:08 +08:00
mumu
066a597028 fix: 减少实时行情链路的误报和重复调用,让系统只有在全部数据源都不可用时才对用户提示“实时行情获取失败” (#792) (#905)
* fix(issue-792): 总是提示实时行情获取失败是为啥啊?
2026-04-01 10:19:12 +08:00
mumu
c89fd9cf20 fix: 修复并发执行时共享状态缺少统一加锁的问题 (#881) (#928)
* fix(issue-881): [bug]-修复并发执行时共享状态缺少统一加锁的问题
2026-03-31 22:53:56 +08:00
mumu
8b51d5133c fix: patch recent Telegram and A-share regressions (#857)
* fix: patch recent Telegram and A-share regressions

* fix: address review feedback for bug triage
2026-03-26 00:16:01 +08:00
mumu
9eacecb521 fix: decouple tushare init from sdk runtime dependency (#856) 2026-03-25 23:51:11 +08:00
LouisHong
73d524a186 #730 [PR1] 首页股票分析输入框自动补全 AutoComplete (#775)
* feat(autocomplete): rebuild web autocomplete mvp

* feat(autocomplete): add error boundary and runtime fallback

Add error boundary and runtime error handling to improve autocomplete stability:

- Add StockAutocompleteBoundary class component to catch render errors
- Add FallbackInput component for graceful degradation
- Add runtimeFallback state and error handling in useAutocomplete hook
- Wrap search logic with try-catch to prevent crashes
- Add comprehensive tests for error scenarios

This ensures the autocomplete degrades to a plain input when:
- Index loading fails (existing behavior)
- Runtime search throws (new)
- Component tree throws during render (new)

* feat(autocomplete): add input validation and optimize name resolution

- Add early rejection for obviously invalid mixed alphanumeric input
- Skip expensive AkShare/fuzzy fallback for non-CJK free text
- Enhance frontend validation with isObviouslyInvalidStockQuery
- Increase minimum query length from 1 to 2 characters
- Add comprehensive test coverage for validation logic
- Update E2E test placeholder text to reflect new capabilities

These changes address code review feedback about:
- Preventing abuse from invalid input patterns
- Improving performance by avoiding unnecessary network calls
- Ensuring consistent validation between frontend and backend

* fix(autocomplete): harden input validation and runtime guards

* update doc

* style(autocomplete): adjust suggestion item hover effect

- Reduce hover background opacity from 35% to 25% for lighter visual effect
- Brighten hover color in dark theme from #257280 to #2dcae6

* fix(autocomplete): do not auto-highlight first suggestion to preserve raw input on Enter

* test(home): align report fixture with report language metadata

* fix: unify task queue stock dedupe key
2026-03-20 11:35:00 +08:00
Alfred
905b366ef1 feat: integrate TickFlow market review enhancement (#632) (#745)
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-03-18 19:19:08 +08:00
mumu
97a3c37760 fix: close logout gap and harden tushare follow-ups (#732)
* fix: close logout gap and harden tushare follow-ups

* test: avoid masking optional deps in tushare follow-up test
2026-03-17 22:17:39 +08:00
Alfred
274720234a fix: add A-share financial/dividend context outputs (#710) (#731)
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-03-17 21:38:31 +08:00
Gu Jiacheng
0f1aefa1fc feat:增加tushare筹码分析接口、行业板块接口 (#717)
* feat:增加tushare筹码分析接口、行业板块接口

* -fix 多余改动

* - fix 删除多余提交

* - docs 补充描述
2026-03-17 21:25:56 +08:00
mumu
56772ec38e fix: 修复港股代码全链路支持 (Fixes #629, Fixes #691) (#694)
* fix: 修复港股代码全链路支持,避免误走 A 股路径 (Fixes #629, Fixes #691)

- validation.ts: 新增 /^HK\d{5}$/ 港股前缀格式校验,修复 Web 端 HK01810 被拒问题
- base.py: normalize_stock_code 支持 1810.HK / hk1810 归一为 HK01810;
         _is_hk_market 精确匹配 HK+纯数字,防止误匹配;
         DataFetcherManager.get_realtime_quote 新增港股专用快速路径,
         直接调用 akshare_hk,不再按 A 股 source_priority 多次尝试
- tushare_fetcher.py: 四处方法(_convert_stock_code / _fetch_raw_data /
  get_realtime_quote / get_stock_name)增加 HK 早退,避免港股误走深市
- baostock_fetcher.py: 两处方法增加 HK 早退,防止生成 sz.HK01810 等无效请求
- pytdx_fetcher.py: 两处方法增加 HK 早退,规避 36 秒连接超时
- akshare_fetcher.py: get_chip_distribution 增加 HK 早退(stock_cyq_em 仅支持 A 股)
- data_tools.py: DataFetcherManager 改为 singleton,避免每次工具调用重置熔断器;
                 get_realtime_quote 失败时返回 retriable=false,阻止 LLM 重试
- runner.py: 新增工具调用非兼容缓存(non_retriable_tool_results),
             HK 代码不同写法(HK01810 / 1810.HK)共享同一缓存 key
- tests: 新增 test_hk_realtime_routing.py;补充 test_stock_code_bse / test_agent_executor

* fix: reset agent fetcher singleton on config reload

* fix: align web hk validation with backend formats
2026-03-16 00:24:54 +08:00
mumu
f6bcb8d383 fix: runtime robustness — efinance timeout, type-safe integrity, report save decoupling (#660)
* fix: runtime robustness — efinance timeout, type-safe integrity, report save decoupling

- efinance_fetcher: wrap all efinance API calls with _ef_call_with_timeout()
  to prevent indefinite hangs when eastmoney hosts are unreachable (was 81min+)
- analyzer: make check_content_integrity() type-safe when LLM returns dict
  for operation_advice or string for core_conclusion/intelligence/battle_plan
- pipeline: decouple report saving from notification flag (--no-notify no longer
  skips local report generation); normalize operation_advice dict to string
- backtest_engine: handle operation_advice as dict in _compute_advice_breakdown
- runner: guard response.usage against None to prevent AttributeError
- orchestrator: log non-critical stage failures (intel/risk) instead of silent skip

* fix: address PR #660 review — timeout shutdown, env guard, decision_type normalize, non-str advice

- efinance_fetcher: _ef_call_with_timeout() now uses explicit executor.shutdown(
  wait=False) to avoid re-blocking on hung thread after FuturesTimeoutError
- efinance_fetcher: guard _EF_CALL_TIMEOUT parsing with try/except to prevent
  module load failure on invalid EFINANCE_CALL_TIMEOUT env value
- pipeline: normalize decision_type with strip/lower before operation_advice
  dict lookup so 'BUY'/'Buy' variants map correctly instead of falling to default
- analyzer: treat non-str operation_advice/analysis_summary as missing to
  prevent downstream TypeError (e.g. get_emoji() with unhashable dict)
- .env.example: add EFINANCE_CALL_TIMEOUT config entry
2026-03-14 21:39:27 +08:00
Alfred
8cfcf7f6ef [Feature] [P0] 基本面数据管道程序化改造 Issue #614 (#626)
* fix: stabilize P0 fundamental context pipeline (#614)

* test: mock fundamental bundle for ETF context stability

* fix: preserve remaining budget and lock fundamental cache

* fix: harden adapter row matching and bound timeout workers

* fix: refine fundamental status semantics and dragon tiger completion

* test: cover get_stock_info board semantics contract

* docs: clarify board field contract in fundamental outputs

* fix: normalize belong board metadata keys across payload shapes

* fix: harden valuation status and scope fundamental cache keys

* fix: align belong board dict aliases with dataframe normalization

---------

Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-03-13 16:36:52 +08:00
zhulinsen
1c475fd49b chore: release v3.5.0 — changelog, code cleanup #minor 2026-03-12 22:41:22 +08:00
LouisHong
028e57e3f9 #602[PR 1]: 数据源韧性增强与代码清理 (#609)
* feat: enhance yfinance fetcher with Stooq fallback and stock mapping

- Implement _get_us_stock_quote_from_stooq for US stock data resilience
- Add stock_mapping.py for common stock code-to-name conversion
- Add unit test for Stooq fallback logic
- Part of #1

* feat: expand STOCK_NAME_MAP with major A-share stocks

* refactor: decouple stock_mapping from yfinance_fetcher (optional import)

* fix: correct Stooq fallback prev close and lint

* fix: data fetcher improvements and gitignore updates

- Prefer static stock name mapping for prefetch
- Fix gitignore to track src/data
- Document Stooq fallback prev close behavior in CHANGELOG

This combines the last three commits while excluding README.md changes.
2026-03-12 20:43:27 +08:00
Gu Jiacheng
0389d0937b fix: Bug 修复akshare市场分析中涨跌停计算错误(已验证),efinance(未验证),tushare积分不够待改 (#555)
* fix: Bug 修复akshare市场分析中涨跌停计算错误(已验证),efinance(未验证),tushare积分不够待改

* fix: Bug修复akshare市场分析中涨跌停计算错误(已验证),efinance(已验证),tushare(已验证)

* fix: Bug修复akshare、efinance、tushare市场分析中涨跌停计算错误
2026-03-10 12:49:44 +08:00
aoshuangzhitou
c4e94203ff fix: 修正 akshare 腾讯数据源字段索引和 ETF 行情字段映射 (#579)
* fix: add TRADING_DAY_CHECK_ENABLED env var and --force-run support for GitHub Actions

- Add TRADING_DAY_CHECK_ENABLED to workflow env (reads from vars/secrets)
- Add force_run workflow_dispatch input for manual trigger
- Pass --force-run arg to main.py when enabled

#patch

* 增加对两种跳过交易日检查机制的说明

* fix: 修正 akshare 腾讯数据源字段索引和 ETF 行情字段映射

- 修正腾讯数据源最高价字段索引从 34 改为 33
- 修正腾讯数据源最低价字段索引从 35 改为 34
- 修正 ETF 行情字段映射:今开->开盘价,最高->最高价,最低->最低价
- efinance: 清理多余空行

* 修改腾讯数据 35的描述

---------

Co-authored-by: mushi <ruiheng.drh@antgroup.com>
2026-03-09 22:49:46 +08:00
Homeran
e831c91d01 fix: paginate pytdx stock name cache (#573)
* fix: paginate pytdx stock name cache

* Document SECURITY_LIST_PAGE_SIZE in pytdx_fetcher

Add comment about SECURITY_LIST_PAGE_SIZE limit

---------

Co-authored-by: Zane <zane@bigo.sg>
Co-authored-by: Alfred <massif0601@gmail.com>
2026-03-09 21:55:20 +08:00
Alfred
633bdda1e2 [feat] 2.2 智能导入 - 名称解析、图片提取、CSV/Excel 导入、预览确认 (#546)
* feat(#455): Markdown-to-image for dashboard, m2f engine, prefetch controls

- Dashboard report supports markdown-to-image (Telegram/WeChat/Custom/Email)
- MD2IMG_ENGINE=markdown-to-file for better emoji support
- PREFETCH_REALTIME_QUOTES to disable full-market quote prefetch
- Stock name prefetch with allow_realtime=False to reduce network overhead
- Email groups and Custom webhook image routing
- Enhanced failure hint (wkhtmltopdf or m2f)
- Docs: README, full-guide, CHANGELOG, .env.example
- Tests: prefetch_stock_names, pipeline notification routing, prefetch dry_run

Fixes #455

* chore: trigger CI and AI review refresh

* feat: intelligent import P1 - name resolver, image extract, CSV/Excel import, preview UI

- Extract STOCK_NAME_MAP to src/data/stock_mapping.py
- Add name_to_code_resolver (local map, pinyin, AkShare, fuzzy match)
- Add stock_code_utils for shared is_code_like/normalize_code
- Enhance image_stock_extractor: code+name+confidence prompt, multi-key, retry
- Add import_parser for CSV/Excel/clipboard with parse-import API
- Add IntelligentImport component (image+file+paste, dedup, confidence-based check)
- Fix single-column code import, preserve name when code dirty
- Deduplicate codes in parse-import response
- Add unit tests for resolver and import_parser

* fix: resolve TS2339 Property 'id' does not exist on type 'never'

In mergeItems when !existing, use fallback id directly instead of existing?.id
to avoid TypeScript narrowing existing to never in that branch.

* chore: address PR review - deps doc, file size check, json_repair, logging, tests

- docs/full-guide: document pypinyin and openpyxl for 智能导入
- api: add file size check before reading in parse-import
- image_stock_extractor: use json_repair fallback for malformed JSON
- import_parser/name_to_code_resolver: add debug logging
- CHANGELOG: add extract-from-image items field compatibility note
- tests: VISION_MODEL priority, json_repair when JSON invalid

* fix(image-extract): markdown strip bug, fake codes filter, EXTRACT_PROMPT doc, parse_import errors

- Fix markdown strip: only remove opening fence to avoid wiping JSON
- Add JSON to _FAKE_CODES; filter field names in fallback
- Add docs/image-extract-prompt.md; PR template EXTRACT_PROMPT block
- Refine parse_import errors: Excel/CSV actionable hints

* chore(parse_import): add detailed error logs, document AkShare cache

- Log file type, size, error on parse_import failures (JSON, file read, parse)
- Add AkShare name resolver 1h TTL cache note to docs/full-guide.md

* fix(import): handle space-separated pairs and confidence upgrade

* fix(import): address PR #546 review - Excel no-header, fuzzy cutoff, code prefix

- fix(import_parser): use header=None for read_excel; detect header row the same
  way as the CSV path to avoid silently consuming first data row as column names
- fix(name_to_code_resolver): raise difflib cutoff 0.6->0.8 and skip fuzzy
  matching for inputs of length <=2 to prevent false-positive short
  matches (e.g. '中国' matching arbitrary stocks in a 5000+ name pool)
- fix(stock_code_utils): normalize_code and is_code_like now recognise
  exchange-prefix formats SH600519, SZ000001, HK00700 (case-insensitive),
  aligning with data_provider/base.py normalize_stock_code behaviour
- tests: add test_parses_xlsx_without_header to TestParseImportFromBytesExcel;
  add tests/test_stock_code_utils.py covering prefix/suffix/plain/edge cases

---------

Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-03-09 19:21:50 +08:00
LouisHong
738723d148 fix: improve fetcher and realtime error logging (#548)
Co-authored-by: mumu <42829555+ZhuLinsen@users.noreply.github.com>
2026-03-08 16:32:17 +08:00
zhulinsen
43dc266d46 fix(etf+tiktoken): use stock API for ETF OHLCV data, pin tiktoken <0.12 #patch
- EfinanceFetcher: switch ETF from ef.fund.get_quote_history (NAV only)
  to ef.stock.get_quote_history (full OHLCV) so ETFs get proper
  open/high/low/close/volume/amount data instead of zeros
- Remove obsolete NAV column mappings from _normalize_data
- Pin tiktoken>=0.8.0,<0.12.0 to avoid 'Unknown encoding cl100k_base'
  plugin registration issue in tiktoken 0.12.0

Fixes #541
Fixes #527
Fixes #537
2026-03-07 21:06:50 +08:00