← Back to Skills Marketplace
u91win

Crypto Kline BTC加密货币K线数据-Binance

by u91win · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
313
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install crypto-kline-bn
Description
通过Binance API采集BTC等加密货币多周期K线数据,支持历史完整获取及代理配置。
README (SKILL.md)

Crypto K线采集器

通过Binance API采集加密货币K线数据的工具。

功能

  • 支持BTC、ETH等主流加密货币
  • 支持多种时间周期(1m, 5m, 15m, 30m, 1h, 4h, 6h, 12h, 1d, 1w)
  • 自动获取完整历史数据
  • 支持代理配置

使用方法

Python脚本(推荐)

# 采集BTC 1小时K线数据
python3 ~/.openclaw/workspace/skills/crypto-kline/scripts/crypto-kline.py --symbol BTCUSDT --interval 1h

# 采集ETH 4小时K线数据
python3 ~/.openclaw/workspace/skills/crypto-kline/scripts/crypto-kline.py --symbol ETHUSDT --interval 4h

# 采集并保存到指定数据库
python3 ~/.openclaw/workspace/skills/crypto-kline/scripts/crypto-kline.py --symbol BTCUSDT --interval 1h --db-path /path/to/db.db

参数说明

参数 说明 默认值
--symbol 交易对 (如 BTCUSDT, ETHUSDT) BTCUSDT
--interval K线周期 1h
--start-date 开始日期 (YYYY-MM-DD) 2024-01-01
--end-date 结束日期 (YYYY-MM-DD) 今天
--db-path 数据库路径 ~/.openclaw/workspace/data/{symbol}_{interval}_kline.db
--proxy HTTP代理 http://192.168.10.188:7897

支持的交易对

  • BTCUSDT, ETHUSDT, BNBUSDT, SOLUSDT, XRPUSDT
  • 以及其他Binance支持的USDT交易对

支持的时间周期

周期 说明
1m 1分钟
5m 5分钟
15m 15分钟
30m 30分钟
1h 1小时
4h 4小时
6h 6小时
12h 12小时
1d 1天
1w 1周

Node.js脚本

# 基本用法
node ~/.openclaw/workspace/skills/crypto-kline/scripts/binance-kline.js BTCUSDT 1h 100

# 指定日期范围
node ~/.openclaw/workspace/skills/crypto-kline/scripts/binance-kline.js BTCUSDT 1h 1000 --start 2024-01-01 --end 2025-01-01

数据库表结构

CREATE TABLE {symbol}_{interval}_kline (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    timestamp INTEGER,
    open_time TEXT,
    open REAL,
    high REAL,
    low REAL,
    close REAL,
    volume REAL,
    quote_volume REAL,
    created_at TEXT DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_timestamp ON {symbol}_{interval}_kline(timestamp);

示例

采集BTC 1小时数据并重采样为6小时

# 1. 采集1小时数据
python3 ~/.openclaw/workspace/skills/crypto-kline/scripts/crypto-kline.py --symbol BTCUSDT --interval 1h

# 2. 使用resample脚本转换为6小时
python3 ~/.openclaw/workspace/scripts/resample_1h_to_6h.py --input ~/.openclaw/workspace/data/btcusdt_1h_kline.db --output ~/.openclaw/workspace/data/btcusdt_6h_kline.db

注意事项

  • 需要网络访问Binance API
  • 建议使用代理以提高稳定性
  • 获取大量历史数据时会有请求频率限制
Usage Guidance
This skill largely matches its description (fetches Binance klines and stores them locally), but it uses a default/hard-coded proxy (http://192.168.10.188:7897) in the Python script and promotes proxy use in the documentation. A proxy can see and tamper with your requests/responses, so do NOT use the bundled default proxy. Before installing or running: 1) Inspect the scripts locally (you already have them) and remove or change the --proxy default in crypto-kline.py or call it with --proxy '' (empty) to avoid using a proxy. 2) Prefer running without a proxy or specify a trusted proxy you control. 3) Be aware of the metadata mismatch: ensure node and python3 are available if you plan to use the Node script. 4) Note the SKILL.md references a resample script that is not included — don’t expect it to be present. If you need higher assurance, run the scripts in an isolated environment or sandbox and monitor outgoing network connections to confirm traffic only goes to api.binance.com (or your allowed endpoints).
Capability Analysis
Type: OpenClaw Skill Name: crypto-kline-bn Version: 1.0.0 The skill bundle contains a SQL injection vulnerability in `scripts/crypto-kline.py`, where table names are constructed using f-strings from user-supplied arguments (`--symbol` and `--interval`) without sanitization. Additionally, both `SKILL.md` and `scripts/crypto-kline.py` include a hardcoded local network proxy (http://192.168.10.188:7897), which is atypical for a general-purpose tool and could lead to connection failures or unexpected routing in different environments. While the code's logic is consistent with its stated purpose of fetching Binance K-line data, these implementation flaws pose a security risk.
Capability Assessment
Purpose & Capability
The code and SKILL.md implement Binance K-line fetching and local SQLite storage, which matches the name/description. However _meta.json declares required binaries (node, python3) while the registry metadata shown earlier listed none — a metadata inconsistency. The SKILL.md references an external resample script (resample_1h_to_6h.py) that is not included.
Instruction Scope
Instructions instruct running the included Python/Node scripts and storing DB files under ~/.openclaw/workspace — expected. But SKILL.md and the Python script strongly push using an HTTP proxy (examples and default --proxy), and SKILL.md recommends using a proxy for stability. The example resample script referenced is missing. The instruction set therefore implicitly directs network traffic through a specific proxy by default, which exceeds what is necessary for the stated task.
Install Mechanism
No install spec (instruction-only with bundled scripts). No remote downloads or archive extraction. Risk from installation is low.
Credentials
The skill declares no required environment variables, yet the Node script respects HTTPS_PROXY/ http_proxy env vars and the Python script hardcodes a default proxy (http://192.168.10.188:7897). A data-collection skill should not force or recommend an opaque proxy by default — that proxy can observe/modify requests/responses. No other credentials are requested, which is proportionate.
Persistence & Privilege
always is false and the skill does not request elevated or cross-skill privileges. It writes database files into ~/.openclaw/workspace/data which is consistent with its purpose.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install crypto-kline-bn
  3. After installation, invoke the skill by name or use /crypto-kline-bn
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of Crypto K线采集器. - 支持通过Binance API采集主流加密货币(如BTC、ETH等)K线数据 - 支持多种K线周期(1m至1w) - 自动获取完整历史K线,支持代理配置 - 提供Python和Node.js脚本采集与参数自定义 - 采集数据可保存至本地数据库,附带表结构说明 - 包含数据重采样推荐用法示例
Metadata
Slug crypto-kline-bn
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Crypto Kline BTC加密货币K线数据-Binance?

通过Binance API采集BTC等加密货币多周期K线数据,支持历史完整获取及代理配置。 It is an AI Agent Skill for Claude Code / OpenClaw, with 313 downloads so far.

How do I install Crypto Kline BTC加密货币K线数据-Binance?

Run "/install crypto-kline-bn" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Crypto Kline BTC加密货币K线数据-Binance free?

Yes, Crypto Kline BTC加密货币K线数据-Binance is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Crypto Kline BTC加密货币K线数据-Binance support?

Crypto Kline BTC加密货币K线数据-Binance is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Crypto Kline BTC加密货币K线数据-Binance?

It is built and maintained by u91win (@u91win); the current version is v1.0.0.

💬 Comments