Routes natural-language data requests to the correct panda_data Python SDK method using bundled API docs. Helps select, call, and troubleshoot Pandadata interfaces for Chinese market data.
Ships in pandadata-api. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
{
"version": 1,
"task": {
"placeholder": "请描述需要查询的数据、市场、标的、日期范围、字段,或贴出待排查的 panda_data 调用与报错",
"required": true
},
"prompt_template": "{{#task}}任务与材料:\n{{task}}\n\n{{/task}}{{#attachments}}用户上传的材料(已放入工作区):\n{{attachments}}\n\n{{/attachments}}请先读取 references/sdk-1.0.6.md,再从随附 Pandadata 文档中定位准确的 panda_data.get_* 方法及参数/返回字段契约;不得为标记为 not exported 的接口生成 Python SDK 调用,不得臆造方法、字段、标的格式或认证步骤。按文档编写或排查最小可运行调用,附上验证结果,输出中文报告。"
}
Use this skill to route natural-language data requests to the correct panda_data API method, load the exact parameter/field contract from the bundled Pandadata interface document, and write runnable Python calls.
references/sdk-1.0.6.md, then references/method-index.md, or run ./.venv/bin/python scripts/search_api_docs.py --list-methods when .venv exists.PYTHON_BIN="${PANDADATA_PYTHON:-./.venv/bin/python}"
[ -x "$PYTHON_BIN" ] || PYTHON_BIN=python3
"$PYTHON_BIN" scripts/search_api_docs.py --method get_stock_daily
"$PYTHON_BIN" scripts/search_api_docs.py 股票 分红 --context-lines 4
references/api-docs.md. If the index marks a method not exported, do not generate a Python SDK call. Do not invent parameters, field names, symbols, or authentication steps.scripts/call_api.py; it loads saved credentials, runs setup when credentials are missing, initializes panda_data in the same process, then calls the API.Use import panda_data; this skill requires panda_data==1.0.6 and Python 3.10 or newer. Pandadata calls return DataFrame-like tabular results in the examples.
Run SDK commands with an interpreter that has 1.0.6 installed. Set PANDADATA_PYTHON when needed; common virtual-environment paths are .venv/bin/python on POSIX and .venv\Scripts\python.exe on Windows. The runtime scripts reject any other installed SDK version. The searchable reference covers all 323 data entrypoints exported by 1.0.6, including aliases and compatibility names; the original gateway catalog retains 218 dispatch paths.
Install the runtime SDK when real API calls are required:
PYTHON_BIN="${PANDADATA_PYTHON:-./.venv/bin/python}"
[ -x "$PYTHON_BIN" ] || PYTHON_BIN=python3
"$PYTHON_BIN" -m pip install -r requirements.txt
For first-time setup, prefer the interactive setup script. It installs the pinned SDK, verifies version 1.0.6, prompts for credentials without echoing the password, validates login, and can optionally save a shell env file at ~/.pandadata/pandadata.env.
PYTHON_BIN="${PANDADATA_PYTHON:-./.venv/bin/python}"
[ -x "$PYTHON_BIN" ] || PYTHON_BIN=python3
"$PYTHON_BIN" scripts/setup_runtime.py
Initialize the SDK before any get_* call. The installed SDK raises ClientNotInitializedError until init_token() succeeds.
import panda_data
import os
panda_data.init_token(
username="YOUR_USERNAME",
password="YOUR_PASSWORD",
base_url=os.environ["JAVA_SERVICE_BASE_URL"],
)
The SDK can also read DEFAULT_USERNAME, DEFAULT_PASSWORD, and JAVA_SERVICE_BASE_URL from environment variables. Pass the plain password; the SDK hashes it internally. Do not assume a fixed service URL; use the configured environment or the saved env file. SDK 1.0.6 keeps the token in memory and persists encrypted credentials in user.json when init_token() succeeds; --no-save-env only disables the separate plaintext shell env file.
If credentials were saved by scripts/setup_runtime.py, load them before running data scripts:
source ~/.pandadata/pandadata.env
Preferred CLI runner for agents:
PYTHON_BIN="${PANDADATA_PYTHON:-./.venv/bin/python}"
[ -x "$PYTHON_BIN" ] || PYTHON_BIN=python3
"$PYTHON_BIN" scripts/call_api.py \
--method get_stock_daily \
--params '{"symbol":["000001.SZ"],"start_date":"20250101","end_date":"20250131","fields":[],"indicator":"000300","st":true}'
call_api.py behavior:
~/.pandadata/pandadata.env.scripts/setup_runtime.py interactively.panda_data.init_token() in the same Python process.panda_data.get_* method and emit JSON by default.For custom Python scripts, import the runtime helper so the login check happens in the same process as the API call:
from pathlib import Path
import sys
sys.path.append(str(Path("scripts").resolve()))
from pandadata_runtime import init_pandadata
panda_data = init_pandadata()
result = panda_data.get_stock_daily(
symbol=["000001.SZ"],
start_date="20250101",
end_date="20250131",
fields=[],
)
print(result)
import panda_data
result = panda_data.get_stock_daily(
symbol=["000001.SZ"],
start_date="20250101",
end_date="20250131",
fields=[],
indicator="000300",
st=True,
)
print(result)
Before running real calls in a new environment:
python - <<'PY'
from importlib.metadata import version
import panda_data
print("panda_data import ok", version("panda-data"), panda_data.__file__)
PY
If panda_data is unavailable or credentials are missing, report that the SDK/runtime is not configured. The supplied interface document does not define installation, token, or login setup.
PyPI runtime dependencies from panda_data==1.0.6: pandas>=2.0.0, numpy>=1.22,<2.0, python-snappy>=0.7.3, python-dotenv>=1.0.0, PyYAML>=6.0, zstandard>=0.22.0, duckdb, pyarrow, websockets>=13.0, and requests.
YYYYMMDD strings, for example 20250131.000001.SZ or 600000.SH.SH, HK, and US.fields=[] for all fields, but some tables describe fields as string; follow the exact method example when present.symbol=["000001.SZ"]; others show scalar strings such as symbol="000001.SZ". Match the target method's own example.get_future_daily_post uses underlying_symbol, and get_oversea_stock_list returns lists.references/sdk-1.0.6.md; the CLI runner handles synchronous get_* data calls.references/sdk-1.0.6.md.references/sdk-contract.json: wheel baseline tied to the published SHA-256 for automated consumer checks; bounded live service checks are tracked separately.
scripts/check_sdk_contract.py: offline contract checker for consumer source and version declarations.
references/method-index.md: compact method map grouped by domain, with line numbers into api-docs.md.
references/sdk-1.0.6.md: supported SDK contract, authentication changes, method reconciliation, and known upstream limitations.
references/api_catalog.json: method-to-gateway endpoint mapping for API routing checks, preserving the MCP gateway's /pandaData/... dispatch paths.
references/api-docs.md: Chinese gateway reference plus 105 SDK supplemental data entrypoints, reconciled with SDK 1.0.6. Newly exported methods can still carry upstream server-availability warnings.
references/agent-integration.md: installation, loading, and smoke-test patterns for Claude Code, Codex, Hermes, OpenClaw, Cursor, and WorkBuddy.
scripts/call_api.py --method <method> --params '{}' --dry-run when validating that SDK 1.0.6 exports a method.head(), shape, or explicit row counts when validating.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/pandadata-api:pandadata-apifrom pandadata-api
pandadata-api@quantskills is listed by quantskills/registry — review the source before installing
npx claudepluginhub quantskills/registry --plugin pandadata-apiOther plugins' skills for the same job