Us stock

From Starchild-ai-agent/official-skills · View interactive version

Us stock is an AI agent skill from the GitHub repository Starchild-ai-agent/official-skills. US stock fundamentals: financials, holders, insiders, earnings, dividends, splits. Use for any US ticker beyond price (e.g. AAPL financials, NVDA top holders, MSFT insider trades, TSLA earnings calendar).

How to use this skill

Skill file

🇺🇸 us-stock — US Equities Data

Single Python module with multi-source fallback for US stocks. Mirror of cn-stock for the US market. Use whenever the user asks about a US ticker — fundamentals, holders, insiders, financials. For pure price/K-line on US tickers, this skill internally calls the paid TwelveData skill, so you get one consistent interface.

Architecture

your call → exports.py
            ├─ twelvedata (paid, primary)  → realtime quote, time series
            └─ yfinance (free, primary for fundamentals)
                                          → info, holders, insiders,
                                            financials, news, options,
                                            dividends, splits, earnings

Most functions return a uniform envelope:

{"ok": bool, "source": str, "data": <payload>, "error": str|None, "ts": int}

Exception: get_full_report(symbol) returns a combined dict of sub-results (quote/company/holders/insiders/earnings/news).

Quick Start

Preferred — use core.skill_tools (handles import isolation):

python3 - <<'EOF'
from core.skill_tools import _modules
us = _modules["us-stock"]

q = us.get_realtime_quote("AAPL")
print(q["data"]["last"], q["data"]["pct_change"], "%")

c = us.get_company_info("NVDA")
d = c["data"]
print(f"{d['name']} | mcap ${d['market_cap']/1e12:.2f}T | shares {d['shares_outstanding']/1e9:.2f}B")

full = us.get_full_report("MSFT")
print(full["company"]["data"]["sector"])
EOF

Fallback (single-skill scripts only):

python3 - <<'EOF'
import importlib.util as ilu
spec = ilu.spec_from_file_location("us_stock_mod", "/data/workspace/skills/us-stock/exports.py")
us = ilu.module_from_spec(spec); spec.loader.exec_module(us)
print(us.get_realtime_quote("AAPL")["data"])
EOF

⚠️ Do NOT use sys.path.insert + from exports import ... — cn-stock also defines exports.py and they will collide in the same process.

Function Map

| Function | Returns | Source |

|---|---|---|

| get_realtime_quote(symbol) | price, OHLC, change, 52w range, mcap | twelvedata → yfinance fallback |

| get_company_info(symbol) | mcap, shares_outstanding, float_shares, pct_held_insiders, pct_held_institutions, sector, industry, business summary, valuation, margins, dividend, analyst targets | yfinance.get_info |

| get_institutional_holders(symbol, top=15) | Top N institutional holders + value + pctChange | yfinance |

| get_mutualfund_holders(symbol, top=15) | Top N mutual fund holders | yfinance |

| get_insider_transactions(symbol, limit=20) | Recent Form 4 buys/sells | yfinance |

| get_financials(symbol, statement, period, max_periods=5) | Income / Balance / Cashflow, annual or quarterly | yfinance |

| get_earnings(symbol, limit=8) | Past + upcoming earnings dates with EPS est. vs actual | yfinance |

| get_dividends(symbol, limit=20) | Historical dividends | yfinance |

| get_splits(symbol, limit=10) | Historical splits | yfinance |

| get_news(symbol, limit=10) | Recent news titles + summaries + URLs | yfinance |

| get_kline(symbol, interval, outputsize) | OHLCV bars | twelvedata → yfinance fallback |

| get_recommendations(symbol, limit=12) | Analyst rating buckets per period | yfinance |

| get_options_expirations(symbol) | All available option expiry dates | yfinance |

| get_etf_holdings(symbol, top=15) | ETF/fund top holdings + sector/asset weights (e.g. SPY/QQQ) | yfinance.funds_data |

| get_full_report(symbol) | quote + company + institutional + insiders + earnings + news combined | combo |

Symbol Format

Pure US ticker — no exchange suffix:

TwelveData Reuse (important)

This skill does not register a separate TwelveData credential. It loads the existing TwelveData skill by explicit file path (/data/workspace/skills/twelvedata/exports.py) via importlib, avoiding exports.py name collisions with other skills.

Starchild's TwelveData billing covers these calls. If TwelveData fails, yfinance fallback kicks in automatically.

get_company_info Field Reference

Fields most useful for Telegram replies (all from yfinance):

| Field | Meaning | Notes |

|---|---|---|

| market_cap | 总市值 (USD) | divide by 1e9 → 十亿, 1e12 → 万亿 |

| enterprise_value | EV | mcap + debt − cash |

| shares_outstanding | 流通股 (实际为已发行股数) | divide by 1e9 |

| float_shares | 自由流通股 (排除限售) | usually slightly < shares_outstanding |

| shares_short | 当前空头持仓 | |

| short_pct_of_float | 空头占流通比 | already ratio, ×100 for % |

| pct_held_insiders | 内部人持股比例 | already ratio |

| pct_held_institutions | 机构持股比例 | already ratio |

| trailing_pe / forward_pe | 静态/动态 PE | |

| price_to_book | 市净率 | |

| dividend_yield | 股息率 | already ratio (0.0036 = 0.36%) |

| beta | 贝塔系数 | vs SP500 |

| recommendation | 'buy' / 'hold' / 'sell' | analyst consensus |

| target_mean_price | 分析师目标均价 | |

Gotchas

Output Style for User-Facing Replies

Telegram users want plain text, no markdown. Follow these conventions:

Future Enhancements (not implemented)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.