main#1
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
|
merge |
There was a problem hiding this comment.
Pull request overview
This PR expands OpenAshare to support US equities end-to-end (code normalization, search, data/news fetching), and updates the web UI/API to improve perceived responsiveness and information density (two-stage AI loading, portfolio UX, hotspot breakdowns, and news empty states).
Changes:
- Add US stock code system (
US.TICKER), search mappings (中文名→美股代码), and US market routing via yfinance with Finnhub fallbacks (quotes + news). - Improve strategy holdings analysis robustness (server-side caching + degraded status), hotspot scoring transparency (heat breakdown), and chart/news API behaviors.
- Update UI/UX for Stocks/Portfolio/Hotspots/News pages (focus bar, collapsible panels, redirect legacy Charts route) and migrate linting to ESLint flat config.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_us_market.py | Adds unit tests covering US code normalization, search fallback, yfinance/Finnhub parsing, and routing. |
| tests/test_api_app.py | Adds regression test ensuring degraded strategy scores are not treated as reusable. |
| reports/us_tech_h2_2026_sector_analysis.html | Adds a static HTML sector analysis report page. |
| README.md | Documents multi-market (A/HK/US) support and data-source behavior. |
| package.json | Switches lint script to explicit ESLint invocation (flat config). |
| eslint.config.mjs | Adds ESLint flat configuration using eslint-config-next presets and overrides. |
| lib/types.ts | Extends types for hotspot heat breakdown and strategy holding analysis_status. |
| lib/api.ts | Adjusts global news fetch caching and increases strategy analysis timeout; adds refresh/list helpers. |
| data/stock_pool.json | Expands editable stock pool mappings (names → codes). |
| components/stocks-page-client.tsx | Implements two-stage analysis loading (base first, AI later) and adds a sticky focus bar + panel enhancements. |
| components/portfolio-snapshot-panel.tsx | Adds “next action” strip and link to portfolio page. |
| components/portfolio-shell.tsx | Adds client-side strategy analysis caching/merging, better refresh flows, and UI compaction/anchors. |
| components/app-shell.tsx | Adjusts navigation items (removes standalone Charts entry). |
| app/charts/page.tsx | Converts Charts page into a redirect to Stocks panel=chart for backward compatibility. |
| app/news/news-page-client.tsx | Improves empty state UX and refresh behavior; adds link to hotspots. |
| app/hotspots/hotspots-page-client.tsx | Adds collapsible sections and uses new heat breakdown/attention labels. |
| app/globals.css | Adds styles for new focus/action strips, hotspot layout tweaks, and empty states. |
| app/api/[...path]/route.ts | Disables public caching for stock search proxy requests. |
| ashare/stock_pool.py | Adds US code normalization/helpers and US market support level logic. |
| ashare/search.py | Keeps runtime search DB synced with editable stock pool and adjusts caching behavior. |
| ashare/data.py | Routes US market data through yfinance/Finnhub pipeline and normalizes US frames. |
| ashare/config.py | Adds FINNHUB_API_KEY config field. |
| ashare/monitor.py | Routes US stock news through Finnhub and skips CN market-wide feeds for US stocks. |
| ashare/llm.py | Replaces print() debugging with logging calls. |
| api/schemas.py | Adds schema support for hotspot heat breakdown and holding analysis status. |
| api/services.py | Improves chart serialization performance; adds hotspot breakdown math; adds strategy analysis cache + degraded handling + quick news fetching. |
| api/main.py | Adds background warmup for a subset of stock pool analyses; adjusts global news caching behavior. |
| .env.docker.example | Documents Finnhub API key configuration. |
| .gitignore | Ignores a local strategy analysis cache artifact. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+78
to
+88
| def _merge_latest_stock_pool(self) -> None: | ||
| """Keep runtime search data in sync with the editable local stock pool.""" | ||
| for name, code in load_stock_pool().items(): | ||
| self.base_stock_db.setdefault( | ||
| name, | ||
| { | ||
| "code": code, | ||
| "market": get_market_label(code), | ||
| "category": "", | ||
| }, | ||
| ) |
Comment on lines
+501
to
504
| logger.debug(f"错误类型: {type(e)}") | ||
| logger.debug(f"错误追踪:") | ||
| import traceback | ||
| traceback.print_exc() |
Comment on lines
+1120
to
1124
| logger.debug(f"=== 未预期的错误 ===") | ||
| logger.debug(f"生成单股分析失败: {str(e)}") | ||
| logger.debug(f"错误类型: {type(e)}") | ||
| import traceback | ||
| traceback.print_exc() |
Comment on lines
+3093
to
+3103
| def _get_stock_news_quick(self, stock_code: str, stock_name: str, limit: int = 5) -> List[NewsItem]: | ||
| executor = ThreadPoolExecutor(max_workers=1) | ||
| future = executor.submit(self.news_service.get_stock_news, stock_code, stock_name, limit) | ||
| try: | ||
| return future.result(timeout=3) | ||
| except Exception: | ||
| future.cancel() | ||
| return [] | ||
| finally: | ||
| executor.shutdown(wait=False, cancel_futures=True) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.