get_stock_snapshot
Get a stock's latest price, valuation, industry, total shares, and net profit in a single request. Works for indices too, returning price and valuation data with nulls for unavailable fields.
Instructions
One-call snapshot: latest price, valuation, industry, total shares, net profit.
Combines data from K-line, stock_industry, and profit_data.
Designed for individual stocks. An index (sh.000300, etc.) has K-line + valuation but no industry / basic / profit rows; those fields come back null instead of aborting the call, so price + PE/PB/PS are still returned.
Profit fields (net_profit, revenue) come from the most recently
published report, so they may be Q1, H1, 9M, or FY depending on the
calendar. Always inspect profit_period_type ('Q1'/'H1'/'9M'/'FY') and
profit_period_months (3/6/9/12) before comparing across companies:
baostock reports these cumulative-from-year-start, so Q1's net_profit is
3 months, NOT comparable to FY's 12. To annualize, multiply Q1 by 4, H1 by 2.
baostock fills MBRevenue only on H1 / FY reports, so revenue is null
when profit_period_type is 'Q1' or '9M'.
Args: code: Stock code.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |