mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
5c655ee3c8
* feat(sinafinance): rewrite stock as public API adapter Replace browser-based DOM scraping with direct Sina public APIs: suggest3.sinajs.cn — symbol search (GBK, no auth) hq.sinajs.cn — real-time quote (GBK, no auth) Strategy.PUBLIC, browser: false — no Chrome or login required. Supports A股 (sh/sz), 港股 (hk prefix), 美股 (gb_ prefix). US MarketCap parsed from hq field [12]; formatted as T/B/M. * feat(exit-codes): add Unix-standard exit codes to all CliError types Introduce EXIT_CODES constant table (sysexits.h conventions) and wire exitCode into every CliError subclass so the process exit code reflects the semantic type of failure: 0 success (default) 1 generic / unexpected error 2 argument / usage error (ArgumentError) 66 empty result / not found (EmptyResultError, SelectorError) 69 service unavailable (BrowserConnectError, AdapterLoadError) 77 permission / auth required (AuthRequiredError) 78 configuration error (ConfigError) 124 timeout (TimeoutError) 130 Ctrl-C / SIGINT (unchanged, tui.ts) resolveExitCode() in commanderAdapter.ts reads err.exitCode for typed CliErrors, and falls back to pattern-matching message text for untyped adapter errors (auth pattern → 77, not-found pattern → 66, else → 1). Shell scripts can now distinguish error categories: opencli spotify status || echo "exit $?" # 69 if browser not running opencli github issues --repo x 2>/dev/null; [ $? -eq 77 ] && opencli github auth * review: regex escape sym, fix change precision, optimize suggest type param
2.3 KiB
2.3 KiB
新浪财经 (Sina Finance)
Mode: 🌐 Public / 🔐 Browser · Domain: finance.sina.com.cn
Commands
| Command | Description | Mode |
|---|---|---|
opencli sinafinance news |
新浪财经 7×24 小时实时快讯 | 🌐 Public |
opencli sinafinance rolling-news |
新浪财经滚动新闻 | 🔐 Browser |
opencli sinafinance stock |
新浪财经行情(A股/港股/美股) | 🌐 Public |
Usage Examples
news - 7×24 实时快讯
# Latest financial news
opencli sinafinance news --limit 20
# Filter by type
opencli sinafinance news --type 1 # A股
opencli sinafinance news --type 2 # 宏观
opencli sinafinance news --type 6 # 国际
# JSON output
opencli sinafinance news -f json
rolling-news - 滚动新闻
# Rolling news feed
opencli sinafinance rolling-news
# JSON output
opencli sinafinance rolling-news -f json
stock - 股票行情
# Search and view A-share stock
opencli sinafinance stock 贵州茅台 --market cn
# Search and view HK stock
opencli sinafinance stock 腾讯控股 --market hk
# Search and view US stock
opencli sinafinance stock aapl --market us
# Auto-detect market (searches cn, hk, us in order)
opencli sinafinance stock 招商证券
# JSON output
opencli sinafinance stock 贵州茅台 -f json
Options
news
| Option | Description |
|---|---|
--limit |
Max results, up to 50 (default: 20) |
--type |
News type: 0=全部, 1=A股, 2=宏观, 3=公司, 4=数据, 5=市场, 6=国际, 7=观点, 8=央行, 9=其它 |
stock
| Option | Description |
|---|---|
--market |
Market: cn, hk, us, auto (default: auto). When auto, searches in cn, hk, us order |
Prerequisites
news&stock: No browser required — uses public APIrolling-news: Chrome running and logged intofinance.sina.com.cn- For
rolling-news: Browser Bridge extension installed
Notes
newsandstockuse public APIs — no browser or login neededstocksupports Chinese names, Chinese codes, and ticker symbols; auto-detects market- Market priority for auto-detection: cn (A股) → hk (港股) → us (美股)
- US stock
High/Lowcolumns show 52-week range; A股/港股 show today's range