Skip to content

main#1

Merged
ZhiweiChen-coder merged 1 commit into
mainfrom
feat/us-market-and-chart-merge
Jun 13, 2026
Merged

main#1
ZhiweiChen-coder merged 1 commit into
mainfrom
feat/us-market-and-chart-merge

Conversation

@ZhiweiChen-coder

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings June 13, 2026 02:53
@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
open-ashare Ready Ready Preview, Comment Jun 13, 2026 2:53am

@ZhiweiChen-coder ZhiweiChen-coder merged commit 8af24b5 into main Jun 13, 2026
4 checks passed
@ZhiweiChen-coder

Copy link
Copy Markdown
Owner Author

merge

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread ashare/search.py
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 thread ashare/llm.py
Comment on lines +501 to 504
logger.debug(f"错误类型: {type(e)}")
logger.debug(f"错误追踪:")
import traceback
traceback.print_exc()
Comment thread ashare/llm.py
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 thread api/services.py
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)

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