astock-utils

astock-utils is a skill for Claude Code, Codex from ZICXR/A-Stock-Skills. It costs 91 tokens per session (614 once invoked), scanned A, original, MIT.

A general-purpose toolkit for Chinese A-share stock data, including code conversion, market identification, trading dates, technical indicators, and number formatting.

In plain words
What is it for?
Use it to normalize stock codes, identify Shanghai, Shenzhen, or Beijing listings, find recent trading days, calculate indicators such as moving averages and RSI, and format volumes or percentages.
Why use it?
It prevents repeated implementations of common stock-data calculations and display rules.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to normalize stock codes, identify Shanghai, Shenzhen, or Beijing listings, find recent trading days, calculate indicators such as moving averages and RSI, and format volumes or percentages.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zicxr/a-stock-skills/astock-utils
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ZICXR/A-Stock-Skills --skill astock-utils
Clone the repo
git clone --depth 1 https://github.com/ZICXR/A-Stock-Skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for astock-utils

README.md
[![agentmods](https://agentmods.dev/badge/skills/zicxr/a-stock-skills/astock-utils/github.svg)](https://agentmods.dev/skills/zicxr/a-stock-skills/astock-utils)
Your own site
<a href="https://agentmods.dev/skills/zicxr/a-stock-skills/astock-utils"><img src="https://agentmods.dev/badge/skills/zicxr/a-stock-skills/astock-utils/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for astock-utils

Your own site · 80×15
<a href="https://agentmods.dev/skills/zicxr/a-stock-skills/astock-utils"><img src="https://agentmods.dev/badge/skills/zicxr/a-stock-skills/astock-utils.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 614 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00091 $0.00614
Opus 5 $0.00046 $0.00307
Sonnet 5 $0.00018 $0.00123
Haiku 4.5 $0.00009 $0.00061

Measured 11d ago against content hash df492bcdee97, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

astock-utils scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (main.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/01-infra/astock-utils/SKILL.md · 76 lines

What it actually says

A 股通用工具 Skill

何时使用

  • 处理股票代码格式转换
  • 判断股票所属市场
  • 计算技术指标
  • 格式化输出
  • 解析交易日

提供能力

代码处理

  • normalize_code(code) - 规范化代码 (统一 6 位)
  • get_market(code) - 判断市场 (sh/sz/bj)
  • is_cyb(code) - 是否创业板
  • is_kcb(code) - 是否科创板
  • is_bj(code) - 是否北交所
  • is_st(name) - 是否 ST 股

日期工具

  • today_str() - 今天
  • parse_date(s) - 解析日期
  • last_n_trade_days(n) - 最近 N 个交易日
  • date_str(dt) - 日期转字符串

技术指标 (输入: DataFrame, 输出: 增加列后的 DataFrame)

  • add_ma(df, [5,10,20,60]) - 均线
  • add_macd(df) - MACD
  • add_kdj(df) - KDJ
  • add_rsi(df) - RSI
  • add_boll(df) - 布林带
  • add_all_indicators(df) - 一次性添加所有

格式化

  • fmt_volume(v) - 成交量 (1.23亿)
  • fmt_money(v) - 金额
  • fmt_pct(v) - 百分比

使用方式

# 命令行
python main.py normalize-code sh600000
python main.py market 300750
python main.py is-cyb 300750
python main.py trade-days 5

Python API

from skills.01-infra.astock-utils.main import (
    normalize_code, get_market, add_all_indicators,
    fmt_volume, fmt_pct
)

code = normalize_code("sh600000")  # "600000"
market = get_market("300750")  # "sz"
df_with_indicators = add_all_indicators(df)
print(fmt_volume(123456789))  # "1.23亿"

依赖

pandas>=1.5.0
numpy>=1.22.0
akshare>=1.12.0  # 交易日历
Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 76 lines · 91 tokens per session scan A df492bcdee97

Subscribe to this mod's changes

astock-utils is a skill published in the GitHub repository ZICXR/A-Stock-Skills (25 stars, last pushed 2mo ago), licensed MIT. It adds 91 tokens to every session and 614 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.