stock-cache-utils

v1.0.0

股票技能通用缓存工具模块。支持交易时间检测、自动缓存、有效期管理。

0· 152·3 current·3 all-time
byGeorge Tao@georgetao730

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for georgetao730/shared.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "stock-cache-utils" (georgetao730/shared) from ClawHub.
Skill page: https://clawhub.ai/georgetao730/shared
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install shared

ClawHub CLI

Package manager switcher

npx clawhub@latest install shared
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description promise a stock-cache utility and the code implements trading-time checks, cache save/load/clear, and expiry management. There are no unrelated environment variables, binaries, or external services requested.
Instruction Scope
SKILL.md instructs the agent to import and use StockDataCache and check_trading_status only. The instructions do not direct the agent to read unrelated files, environment variables, or send data externally. They do instruct local cache reads/writes as expected.
Install Mechanism
No install spec; the package is instruction-only but includes a Python module. The module is pure Python and does not download or execute remote code. Note: the module writes a local cache file (cache.json) into the provided cache_dir, which is expected for this functionality.
Credentials
The skill requests no environment variables, credentials, or config paths. The code uses only local filesystem and system time, which is proportionate to its stated purpose.
Persistence & Privilege
The skill is not always-enabled, does not request elevated privileges, and does not modify other skills or system-wide settings. It only creates/reads a cache file in the configured directory.
Assessment
This module appears coherent and limited in scope: it checks trading hours and reads/writes a local cache file (cache.json) in the cache_dir you pass. Before installing or using it, pick a safe cache_dir (avoid system or sensitive directories), and be aware cached data will be written to disk and printed to stdout by the module’s print statements. The shebang references a Homebrew Python path (non-portable but not harmful); run it in your Python 3.10+ environment or inspect the file locally before use if you want to be extra cautious.

Like a lobster shell, security has layers — review code before you run it.

latestvk97540fqqqqh12evgp8z3ddffx839g4r
152downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

股票技能缓存工具模块

为所有股票交易 skill 提供统一的缓存机制。

功能

  • ✅ 交易时间自动检测(A 股交易时段)
  • ✅ 缓存读取/保存
  • ✅ 缓存有效期管理(24 小时)
  • ✅ 自动降级处理

使用方法

from cache_utils import StockDataCache, check_trading_status

# 初始化缓存
cache = StockDataCache(cache_dir='./.cache', cache_max_age_hours=24)

# 检查交易状态
status = check_trading_status()
if status['is_trading_time']:
    # 交易时间:获取实时数据
    data = fetch_realtime_data()
    cache.save(data)
else:
    # 非交易时间:使用缓存
    if cache.should_use_cache():
        data = cache.load()
    else:
        data = fetch_realtime_data()

API

StockDataCache

cache = StockDataCache(cache_dir, cache_max_age_hours=24)

# 判断是否使用缓存
cache.should_use_cache()

# 加载缓存
data = cache.load()

# 保存缓存
cache.save(data)

# 清除缓存
cache.clear()

# 获取缓存信息
info = cache.get_cache_info()

check_trading_status

status = check_trading_status()
# 返回:
# {
#   'current_time': '2026-03-21 00:07:49',
#   'weekday': 'Saturday',
#   'is_trading_day': False,
#   'is_trading_time': False,
#   'next_trading_time': '2026-03-23 09:30:00'
# }

缓存策略

时段行为
交易日 9:30-15:30获取实时数据
其他时间使用缓存(24 小时有效)

依赖

  • Python 3.10+
  • 无额外依赖

许可证

MIT

Comments

Loading comments...