Skip to main content
Glama
lolifamily

ashare-mcp

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
get_historical_k_dataA

Fetch historical K-line (OHLCV + valuation) data for a Chinese A-share stock.

Args: code: Stock code in baostock format, e.g. 'sh.600000', 'sz.000001'. start_date: Start date 'YYYY-MM-DD'. end_date: End date 'YYYY-MM-DD'. frequency: 'd' daily, 'w' weekly, 'm' monthly, '5'/'15'/'30'/'60' minutes. adjust_flag: '1' backward/后复权, '2' forward/前复权, '3' unadjusted/不复权 (default '3'). fields: Comma-separated field list. Defaults to all standard fields.

get_stock_basic_infoB

Fetch basic info: code, code_name, ipoDate, outDate, type, status.

Args: code: Stock code, e.g. 'sh.600519'.

get_dividend_dataA

Fetch a year's dividends: annual cash total plus every payout's detail.

A year with several distributions has one entry per payout in payouts (full detail). annual_cash_per_share_pretax is their summed dividCashPsBeforeTax — the yearly total, so callers needn't add across rows. Within a single payout, semicolon-separated multi-values in the cash-dividend fields are already summed by the client.

annual_cash_per_share_pretax is None when the year had distributions but no cash (pure stock dividend / capital reserve conversion); read each payout's dividStocksPs / dividReserveToStockPs for those.

Args: code: Stock code. year: 4-digit year, e.g. '2023'. year_type: 'report' (announcement year) or 'operate' (ex-dividend year).

Returns: {code, year, annual_cash_per_share_pretax, payout_count, payouts}.

get_adjust_factor_dataA

Fetch adjustment factor data for calculating adjusted prices.

Factors exist only on ex-div / ex-rights dates; a window with none returns an empty list.

Args: code: Stock code. start_date: 'YYYY-MM-DD'. end_date: 'YYYY-MM-DD'.

get_trade_datesA

Fetch trading calendar. Each row has calendar_date and is_trading_day ('1'/'0').

Args: start_date: Optional 'YYYY-MM-DD'. end_date: Optional 'YYYY-MM-DD'.

get_latest_trading_dateA

Most recent trading date with K-line data published. Returns 'YYYY-MM-DD'.

Probes CSI 300 (sh.000300) directly and returns the date of its latest available daily bar. This is the safe anchor date for follow-up K-line queries — guaranteed to have data, regardless of wall-clock time. On a trading day before market close, today's bar is not yet published, so this returns the previous trading date.

get_all_stockA

Search stocks by name. Returns matching code, code_name, and tradeStatus.

Args: query: Search keyword matched against code_name (substring, case-insensitive). An empty string matches every row and returns the full market (~5000+ stocks, ~1 MB). date: Date 'YYYY-MM-DD'. Defaults to the latest trading date.

get_stock_industryA

Fetch industry classification data.

Args: code: Stock code, e.g. 'sh.600519'. date: Optional date 'YYYY-MM-DD'. Defaults to latest.

get_index_constituentsA

Fetch constituent stocks of a major A-share index.

index:

  • 'sz50': SSE 50 (上证50).

  • 'hs300': CSI 300 (沪深300).

  • 'zz500': CSI 500 (中证500).

Args: index: Which index's constituents to fetch. date: Optional date 'YYYY-MM-DD'. Defaults to latest.

get_benchmark_rate_dataA

Fetch PBoC benchmark deposit or loan rates within a date range.

rate_type:

  • 'deposit': benchmark deposit rates — demand plus fixed-term 3-month .. 5-year.

  • 'loan': benchmark loan rates — 6-month .. above-5-year, plus mortgage rates.

Args: rate_type: Which rate table to fetch. start_date: Optional 'YYYY-MM-DD'. end_date: Optional 'YYYY-MM-DD'.

get_required_reserve_ratio_dataB

Fetch required reserve ratio data.

Args: start_date: Optional 'YYYY-MM-DD'. end_date: Optional 'YYYY-MM-DD'. year_type: '0' announcement date (default), '1' effective date.

get_money_supply_dataA

Fetch money supply data (M0, M1, M2) at monthly or yearly frequency.

freq:

  • 'month': monthly series — m0Month/m1Month/m2Month plus YOY and ChainRelative. Dates are 'YYYY-MM'.

  • 'year': year-end balances — m0Year/m1Year/m2Year plus YearYOY. Dates are 'YYYY'.

Args: freq: 'month' for the monthly series, 'year' for year-end balances. start_date: Optional. Format matches freq: 'YYYY-MM' (month) or 'YYYY' (year). end_date: Optional, same format as start_date.

get_financial_indicatorsA

Fetch a quarterly financial report; report selects which statement.

baostock splits quarterly fundamentals across six statements, each with a distinct field set. All values are cumulative-from-year-start: quarter=1 is 3-month, 2 is H1 (6-month), 3 is 9-month, 4 is FY (12-month).

report:

  • 'profit': profitability — roeAvg, npMargin, gpMargin, netProfit, epsTTM, MBRevenue, totalShare.

  • 'operation': turnover ratios — NRTurnRatio, INVTurnRatio, CATurnRatio, AssetTurnRatio (and matching *Days).

  • 'growth': YoY growth rates — YOYNI, YOYEPSBasic, YOYEquity, YOYAsset, YOYPNI.

  • 'balance': balance-sheet ratios — currentRatio, quickRatio, liabilityToAsset, assetToEquity. liabilityToAsset is rederived as 1 - 1/assetToEquity to work around stale upstream values (falls back to the raw value only when assetToEquity is null or zero).

  • 'cash_flow': cash-flow ratios — CFOToOR, CFOToNP, CFOToGr, CAToAsset.

  • 'dupont': DuPont ROE decomposition — dupontROE, dupontAssetTurn, dupontNitogr, dupontTaxBurden, dupontEbittogr.

Args: code: Stock code, e.g. 'sh.600519'. report: Which statement to fetch (see above). year: 4-digit year, e.g. '2024'. quarter: 1, 2, 3, or 4.

get_performance_reportA

Fetch performance express (业绩快报) or forecast (业绩预告) reports.

kind:

  • 'express': performance express reports — absolute performanceExpressTotalAsset / NetAsset / EPSDiluted / ROEWa / GRYOY for companies that file them ahead of the full report.

  • 'forecast': performance forecast reports — profitForcastChgPctUp / profitForcastChgPctDwn and the forecast type.

Args: code: Stock code. kind: 'express' for filed express reports, 'forecast' for guidance. start_date: 'YYYY-MM-DD'. end_date: 'YYYY-MM-DD'.

get_technical_indicatorsA

Calculate technical indicators for a stock.

Trend/momentum indicators use forward-adjusted prices. Volume indicators (OBV, MFI) transparently fetch a second pass with raw bars because baostock does not split-adjust volume — mixing forward-adjusted price with raw volume would distort money-flow on split / bonus-issue days. Volume indicators thus cost one extra network round-trip when requested.

Returns one row per trading day in [start_date, end_date]. Warmup is auto-prefetched, so values inside the range are not null from warmup.

Args: code: Stock code. start_date: 'YYYY-MM-DD'. end_date: 'YYYY-MM-DD'. indicators: List from ['MACD','RSI','KDJ','BOLL','WR','STOCH','CCI','ATR','ADX','OBV','MFI']. Defaults to all.

get_moving_averagesA

Calculate SMA and EMA for multiple periods over the requested date range.

Returns one row per trading day in [start_date, end_date]. Warmup is auto-prefetched, so values inside the range are not null from warmup. A period exceeding the stock's available history yields present-but-all-null SMA_/EMA_ columns, so a requested period never silently vanishes.

Args: code: Stock code. start_date: 'YYYY-MM-DD'. end_date: 'YYYY-MM-DD'. periods: Period list (each must be >= 1), e.g. [5,10,20,50,120,250]. Defaults to common set.

calculate_risk_metricsA

Calculate risk metrics: beta, Sharpe, max drawdown, volatility, correlation.

Args: code: Stock code. benchmark_code: Benchmark index, default 'sh.000300' (CSI 300). lookback_days: Calendar days to look back. 365 ≈ 1 year, 730 ≈ 2 years. Must yield >= 30 trading-day bars (~45+ calendar days, more if the span crosses a long holiday) or the call is rejected. ~245 calendar days ≈ 1 trading year (CN A-share). risk_free_rate: Annualized risk-free rate for Sharpe ratio. Default ~3% (approximate CN 10Y bond yield); override for non-CN markets.

get_financial_statementA

Fetch a full financial statement (all periods, all columns) from EastMoney via akshare.

statement selects which one (each is a separate EastMoney endpoint — one fetch per call, so request only the statement you need):

  • "balance" 资产负债表 — point-in-time snapshot per report date.

  • "income" 利润表 — key fields OPERATE_INCOME, NETPROFIT, ...

  • "cash_flow" 现金流量表 — key fields NETCASH_OPERATE (operating cash flow), CONSTRUCT_LONG_ASSET (capex).

Returns raw EastMoney field names (English uppercase keys), rows ordered most-recent-first (newest period at index 0). Columns entirely empty across the returned periods are dropped.

IMPORTANT — for "income" and "cash_flow", quarterly values are cumulative YTD (year-to-date), not single-quarter:

  • Q1 (一季报) = 3 months

  • H1 (半年报) = 6 months

  • Q3 (三季报) = 9 months

  • FY (年报) = 12 months Inspect REPORT_DATE_NAME before comparing across periods. To get a single quarter, subtract the previous cumulative period (e.g. Q3_single = Q3 - H1). The balance sheet is a snapshot, so this does not apply to it.

Args: code: Stock code in baostock format, e.g. 'sh.600519'. statement: Which statement — "balance", "income", or "cash_flow". periods: How many most-recent report periods to return (default 8 ≈ 2 years of quarterly filings). Raise only when you need older periods — the full history is large.

get_net_debtA

Compute net debt from the latest balance sheet (conservative upper bound).

net_debt = SHORT_LOAN + LONG_LOAN + BOND_PAYABLE + NONCURRENT_LIAB_1YEAR - MONETARYFUNDS

NONCURRENT_LIAB_1YEAR is a CN-GAAP aggregate bucket containing both long-term-debt current portion (interest-bearing) and lease-liability / long-payable current portions (not interest-bearing); the breakdown is not exposed by EastMoney. For lease-heavy or zero-leverage firms the returned net_debt is overstated by the non-interest portion of this bucket.

Data source: EastMoney via akshare. Returns net_debt value, component breakdown, and the report date of the balance sheet used.

Args: code: Stock code in baostock format, e.g. 'sh.600519'.

get_valuation_metricsA

Fetch valuation metrics (PE/PB/PS/PCF) history and current snapshot.

Each metric in metrics independently reports current and as_of (the date of its last valid observation), since close and PE/PB/PS can be missing on different days. period.last_trading_date reports the last K-line bar in the window, separate from any metric's as_of.

Each non-close metric also reports positive_mean/positive_median/ positive_min/positive_max plus percentile_pct (0-100 rank of current: a fresh low ~0.4, an all-time high ~100), computed over POSITIVE values only. sample_size is the positive-observation count; percentile_pct is null when current is non-positive.

Args: code: Stock code. start_date: Optional, defaults to 1 year ago. end_date: Optional, defaults to today.

calculate_peg_ratioA

Calculate PEG = current PE_TTM / G, with G the latest published YoY net profit growth.

PE is the latest available quote; G is the most recently disclosed YoY growth, returned as growth_period (statDate) and growth_period_type (Q1/H1/9M/FY). baostock's YOYNI is a ratio (0.1858 = +18.58% YoY); PEG uses the percent number (18.58).

PEG is undefined and returns peg=None when:

  • PE == 0 (no TTM earnings data: index / non-equity, not loss-making)

  • PE < 0 (loss-making company; PE has no valuation meaning)

  • no growth report has been published yet (fresh IPO / data delay)

  • YoY growth <= 0 (PEG is a growth-stock metric; declining earnings yield a negative or nonsensical value that LLMs would misread as cheap)

Args: code: Stock code.

calculate_ddm_valuationA

DDM (Dividend Discount Model) valuation.

Uses dividCashPsBeforeTax from baostock. Auto-sums semicolon-separated multi-payouts. Current price from latest K-line close. Excludes the current calendar year, whose dividend bucket is usually incomplete mid-year. Buckets are by announcement year, so a prior fiscal year's final payout and the next year's interim can land in the same bucket, distorting dividend_cagr.

forecast_growth caps dividend_cagr at growth_clamp_bounds.max (20%); negative CAGR passes through unchanged. growth_clamped is "exceeded_max" if the cap fired, else null.

Args: code: Stock code. discount_rate: Required rate of return, e.g. 0.10. terminal_growth_rate: Perpetual growth rate, e.g. 0.025. years_back: Years of dividend history to use. forecast_years: Projection period (must be in [1, 20]).

calculate_dcf_valuationA

Simplified DCF valuation. OCF derived as MBRevenue * CFOToOR (~2% precision).

FCF = OCF * (1 - capex_to_ocf_ratio). Caller must supply capex_to_ocf_ratio because baostock provides no Capex data.

Enterprise value (EV) is always returned. To derive equity value and per-share intrinsic value, caller must provide net_debt, which baostock does NOT publish — it must come from the balance sheet (interest-bearing debt minus cash & equivalents). Without it, only EV is returned and the caller can compute equity = ev - (their own net_debt).

When akshare is installed and reachable, real operating cash flow (NETCASH_OPERATE) and real capex (CONSTRUCT_LONG_ASSET) are used automatically (capex_to_ocf_ratio is then ignored), and net_debt is computed from the balance sheet if not provided. If akshare is absent or fails at runtime (rate-limit, anti-scrape), the calculation falls back to baostock estimation using capex_to_ocf_ratio. data_provenance indicates which path.

Uses a fixed 5-year FCF history, degrading gracefully to as few as 2 years when reports are missing.

forecast_growth clamps fcf_cagr to growth_clamp_bounds ([-5%, 15%]); growth_clamped reports which bound (if any) was hit. Read it before using forecast_growth -- a raw CAGR outside the band was silently overridden.

intermediates.fcf_quality reports negative_years / sign_changes / min / max on the historical FCF series; fcf_cagr is endpoint-anchored and does not reflect intra-period volatility.

Args: code: Stock code. discount_rate: WACC / discount rate, e.g. 0.10. terminal_growth_rate: Perpetual growth rate, e.g. 0.025. capex_to_ocf_ratio: Capex as a fraction of OCF. Always required, but used only on the baostock fallback path; ignored when akshare's real capex is available. net_debt: Interest-bearing debt minus cash & equivalents (CNY). Negative = net cash position. Required for per-share valuation. forecast_years: Projection period (must be in [1, 20]).

compare_industry_valuationA

Compare a stock's valuation (PE/PB/PS) against its industry peers.

Behavior contract:

  • Raises NoDataFoundError if code is absent from the industry table for date, has no industry classification (delisted / legacy stock), or has no K-line in the lookback window — it will not return a result without the target.

  • Peers whose K-line is missing are listed in peer_coverage.skipped with the reason. Industry statistics exclude the target itself and use POSITIVE values only; the center stat is trimmed_mean (10% per tail, >=1 each side), not a raw mean. industry_stats[metric].count reports peers per statistic.

Args: code: Target stock code. date: Comparison date 'YYYY-MM-DD'. Defaults to latest.

get_stock_snapshotA

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.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lolifamily/ashare-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server