AgentStack
SKILL verified MIT Self-run

Astock Cache

skill-zicxr-a-stock-skills-astock-cache · by ZICXR

磁盘缓存 + K线 parquet。当用户跑全市场筛选每次都要等 30 分钟时,Claude 应使用此 Skill。K线缓存到 ~/.astock_skills/cache/kline/ 目录,5 秒 vs 30 分钟,差 360 倍。

No reviews yet
0 installs
9 views
0.0% view→install

Install

$ agentstack add skill-zicxr-a-stock-skills-astock-cache

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Astock Cache? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

astock-cache

何时使用

  • 全市场筛选太慢 (每次 30 分钟)
  • 反复拉同一只股票 K 线
  • 跑 screener 跑 2 遍
  • 想要"盘后更新一次,白天用一天"

🚀 快速上手

# 看缓存多少了
python main.py kline-stats

# 跑一次全市场 K 线更新 (15-30 分钟, 但之后都是 5 秒)
python daily_update.py

# 单独看某只股票
python main.py kline-stats
# {"count": 5028, "size_mb": 18.4}

提供能力

通用 Key-Value 缓存

  • cache_set/get/delete/clear
  • cached(key, ttl) 装饰器
  • 存储: ~/.astock_skills/cache/*.pkl

K 线 parquet 缓存 (新,推荐)

  • kline_save(code, df, days) 存 parquet
  • kline_load(code, days, max_age_hours)
  • kline_get_or_fetch(code, fetch_fn, days) 智能模式
  • 存储: ~/.astock_skills/cache/kline/{code}_{days}d.parquet

screener 集成示例

from skills.01-infra.astock-cache.main import kline_get_or_fetch
from skills.01-infra.astock-data-source.main import get_kline

def smart_kline(code, days=60):
    """优先读缓存, 缓存没有才拉网络"""
    return kline_get_or_fetch(code, get_kline, days=days)

# 第一次慢 (拉网络), 之后 5 秒
df = smart_kline("601991", 60)

性能

| 场景 | 无缓存 | 有缓存 | 加速比 | |------|--------|--------|--------| | 单股 60 日 K 线 | 1.2s | 0.05s | 24x | | 全市场 5028 只 60 日 | 30min | 5s | 360x |

依赖

pandas>=1.5.0
pyarrow>=10.0.0  # parquet 引擎

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.