Credential Configuration
API keys, tokens, and cookies are uniformly recommended to be written in the repository root directory .env(refer to .env.example), and loaded by the runtime or user as environment variables with the same names before execution. Scripts still only read credentials from environment variables or explicit CLI parameters; do not write real keys into skill payloads, reports, logs, or commits.
Used for retrieval of securities, indices, funds, financial statements, market quotes, candlestick charts, announcement leads, financial news, and company fundamentals. API scripts and browser-use can be mixed; choose according to task needs, with no fixed priority.
Workflow
- First confirm the market and target: A-shares/Hong Kong stocks/US stocks/global tickers, company name, securities code, time range, and required data specifications.
- For structured data use
scripts/finance_search.py: yfinance for global tickers, market quotes, financials, news, SEC filings; mootdx for Tongdaxin/A-share market quotes, candlestick charts, financial packages. - When page evidence, news body text, interactive filtering, chart verification, script failure, or missing fields are needed, use browser-use to open Yahoo Finance, exchanges, listed company IR, announcement pages, or search result pages for cross-checking.
- When outputting conclusions, retain ticker/securities code, market, data range, metric specifications, and source URL; do not treat script results as investment advice.
- When encountering login walls, CAPTCHAs, paywalls, commercial licensing, abnormal rate limiting, or prohibited-use notices, stop using that source and switch to publicly accessible pages or explain that it cannot be obtained.
API Scripts
Script:scripts/finance_search.py. Output JSON. Dependencies are lazily loaded according to the command.
On first run or when the script prompts that libraries are missing, use this skill's dependency list to install into the current Python environment:
python3 -m pip install -r requirements.txt
Do not automatically install dependencies inside the script. If installation fails, the network is unavailable, or the package is unavailable, stop using the corresponding command and switch to public web sources, explaining that dependencies are missing.
yfinance
Yahoo Finance code suffixes: US stocks directly use AAPL; Hong Kong stocks can use 0700.HK; A-shares can use 600036.SH、600036.SS、000001.SZ, and the script will automatically convert .SH to .SS. To disable automatic conversion, add --no-normalize。
python scripts/finance_search.py yf-search "Tesla" --limit 5 --news-count 5
python scripts/finance_search.py yf-lookup "Tencent" --type stock --limit 10
python scripts/finance_search.py yf-profile AAPL --fields longName,sector,industry,marketCap,currentPrice,trailingPE
python scripts/finance_search.py yf-history AAPL --period 6mo --interval 1d --limit 120
python scripts/finance_search.py yf-download AAPL MSFT NVDA --period 1mo --interval 1d --group-by ticker
python scripts/finance_search.py yf-financials MSFT --statement income --freq yearly
python scripts/finance_search.py yf-financials MSFT --statement balance --freq quarterly
python scripts/finance_search.py yf-news TSLA --limit 8
python scripts/finance_search.py yf-sec-filings AAPL
Common commands:
| Command | Purpose |
|---|---|
yf-search |
Search companies, tickers, news, and research entry points |
yf-lookup |
Find stocks, ETFs, indices, funds, futures, forex, and crypto assets by financial instrument type |
yf-profile |
Fundamental profile and fast_info |
yf-history / yf-download |
Historical quotes for a single target or multiple targets |
yf-financials |
Income statement, balance sheet, cash flow, earnings data |
yf-news |
Ticker-related news leads |
yf-sec-filings |
SEC filings leads |
mootdx
mootdx uses the Tongdaxin code format, usually pure numbers. The script will convert 600036.SH、600036.SS、000001.SZ to 600036、000001。
python scripts/finance_search.py tdx-quotes 600036 000001
python scripts/finance_search.py tdx-bars 600036 --frequency day --offset 120 --adjust qfq
python scripts/finance_search.py tdx-index 000001 --market sh --frequency day --offset 60
python scripts/finance_search.py tdx-stocks --market sh --limit 50
python scripts/finance_search.py tdx-finance 600036
python scripts/finance_search.py tdx-xdxr 600036
python scripts/finance_search.py tdx-affair-files --limit 10
python scripts/finance_search.py tdx-affair-fetch gpcw20231231.zip --downdir tmp
python scripts/finance_search.py tdx-affair-parse gpcw20231231.zip --downdir tmp --limit 100
Candlestick chart --frequency available options:1m、5m、15m、30m、1h、day、week、mon、3mon、year, or you can directly pass mootdx numeric frequencies.
browser-use Scenarios
| Scenario | Usage |
|---|---|
| Script returns news leads | Open the news URL or Yahoo Finance news page to verify the title, publication time, and body key points |
| Financial fields incomplete | Open Yahoo Finance Financials, SEC, exchange announcements, and company IR pages to corroborate |
| A-share announcements/periodic reports | In conjunction with sn-search-year-report or search-market skills to check official disclosure sources |
| Charts, adjusted prices, market data anomalies | Open the quote page or exchange page to verify the methodology |
| Company name cannot be mapped to a ticker | Use yf-search、yf-lookup and web search to cross-verify each other |