Skip to content

Releases: lolifamily/ashare-mcp

v0.2.2: style Apply ruff format across the tree; fence hand-grouped field tables

Choose a tag to compare

@lolifamily lolifamily released this 21 Jun 10:25
9ea1b60
The lint CI added earlier runs `ruff format --check`, but the source was
never actually run through the formatter, so CI would fail on its first
run. Reflow everything to what ruff format produces: one argument per
line in multi-arg signatures, one key per line in dict literals, expanded
bs.query(...) calls. Pure whitespace, zero behavior change.

One exception is fenced off: baostock_client's SEMICOLON_FIELDS /
NUMERIC_FIELDS are hand-grouped by baostock API family (several fields
per line). ruff format only knows one-per-line or all-on-one-line, either
of which explodes ~50 readable lines into 100+ and destroys the grouping,
so those tables now sit inside `# fmt: off` / `# fmt: on`. Added a note
that the directives must each be alone on their line — trailing prose
turns them into ordinary comments and silently disables the fence.

_RETRY_ERROR_CODES and _INDICATORS are deliberately left unfenced: their
per-entry comments and table shape survive the reflow, so they aren't
worth the fence noise.

Bump version 0.2.1 -> 0.2.2; uv.lock follows.

v0.1.0: feat(akshare) Optional EastMoney source + data-source hardening pass

Choose a tag to compare

@lolifamily lolifamily released this 21 Jun 07:07
585cb34
Introduce akshare as an optional dependency (`uv sync --extra akshare`)
that adds real financial-statement data, and fix the broad set of
correctness/robustness issues surfaced while wiring it in. Without the
extra installed, every existing tool behaves exactly as before.

akshare data source (new, opt-in):
- AkshareSource adapter over EastMoney F10 statements (balance/income/
  cash_flow), net_debt, and per-year OCF/Capex history. Field contract
  verified against real API calls and pinned in docs/akshare-contract.md,
  with a typings/ stub.
- New tools get_financial_statement and get_net_debt, registered only
  when akshare imports.
- AkshareError carries a no_data flag so a caller refuses to fall back to
  an estimate when the estimate's own inputs are equally unavailable.

DCF / DDM (valuation):
- DCF auto-uses real OCF (NETCASH_OPERATE) and Capex (CONSTRUCT_LONG_ASSET)
  and auto-computes net_debt from the balance sheet when akshare is present,
  falling back to baostock estimation otherwise; data_provenance reports
  which path ran. capex_to_ocf_ratio stays required for the fallback.
- Fix CAGR to span calendar years, not array length: a missing report year
  was absent from the series and silently inflated the rate (DCF + DDM).
- DDM clamp now caps only the +20% upside; negative CAGR passes through
  instead of being floored to +1%, which had inflated shrinking-dividend
  stocks. Round hand-built payloads to 10dp to kill IEEE-754 noise.

baostock client:
- Re-login + single retry on session-expired / network error codes; an
  evicted server-side session no longer fails every later call forever.
- Set an OS-level recv/send timeout on the socket after login: a malformed
  param could make recv() block forever and pin the entire server.
- Reject a blank `code` (baostock silently treats it as "all securities").

technical indicators:
- KDJ now follows the CN convention (RSV smoothed twice via an alpha=1/3
  EMA); ta's raw American stochastic did not match domestic terminals.
- Auto-prefetch warmup so values inside [start_date, end_date] are never
  null from warmup; mask ta's 0-fill warmup span on ATR/ADX back to NaN.
- risk_metrics: reject zero-variance series (limit-up/down lock or halt),
  floor on 30 real trading-day bars (not calendar days), info_ratio None
  when undefined. One indicator failing on a short window no longer aborts
  the whole call.

data quality:
- valuation_metrics / industry comparison compute statistics over positive
  values only (a negative PE is loss-making, not cheap); the industry
  center stat is a trimmed mean and excludes the target itself; baostock's
  0-fill multiples are surfaced as missing.
- liabilityToAsset rederived as 1 - 1/assetToEquity around a stale upstream
  value.
- get_stock_snapshot now handles indices (null industry/profit instead of
  aborting). get_dividend_data returns the annual total plus per-payout
  detail.

tool signature changes (breaking):
- calculate_peg_ratio drops year/quarter — it now pairs the current PE with
  the latest published growth automatically, and distinguishes PE==0
  (no earnings data) from PE<0 (loss-making).
- get_all_stock takes a required `query` and searches by name (substring)
  instead of dumping the whole market.
- get_stock_industry requires `code` (no longer "all stocks when None").

refactor / infra:
- Extract pure helpers (scalar/as_float/df_to_records/lookback_range/
  safe_float, MARKET_TZ, ZERO_THRESHOLD) into utils.py; drop valuation's
  duplicate _safe_float.
- UnstructuredFastMCP defaults tools to unstructured output — the structured
  copy duplicated the whole payload on the wire and every known client reads
  content[0].text anyway.
- Track .claude/settings.json, add CLAUDE.md conventions.

v0.0.1

Choose a tag to compare

@lolifamily lolifamily released this 18 Jun 06:13
4c7a61d
fix(license) Add MIT license