Binance Exchange Skill
Query Binance spot exchange data via API. Requires proxy for network access.
Prerequisites
Proxy Configuration:
CODEBLOCK0
Note: Binance API may be restricted in certain regions. Use a proxy node in allowed regions (HK/SG/JP/UK/DE).
API Endpoints
| Endpoint | Use Case |
|---|
| INLINECODE0 | Real-time prices |
| INLINECODE1 |
24h statistics |
|
/api/v3/klines | K-line/candlestick data |
|
/api/v3/exchangeInfo | Trading rules & symbols |
Scripts
1. Price Query
CODEBLOCK1
2. 24h Change (via K-lines)
CODEBLOCK2
3. K-Line Data
CODEBLOCK3
4. Token Info (New!)
CODEBLOCK4
Returns:
- - Symbol, price, 24h change, change %, 24h high/low, volume, quote volume
5. Search Symbols
CODEBLOCK5
Quick Reference
| Data | Command |
|---|
| BTC price | INLINECODE4 |
| 24h stats |
./scripts/token-info.sh BTCUSDT stats |
| K-line |
./scripts/kline.sh BTCUSDT 1h 100 |
Rate Limits
- - 1200 requests/minute (public endpoints)
- Use caching for frequent queries
Binance Exchange 技能
通过API查询币安现货交易数据。需要代理才能访问网络。
前置条件
代理配置:
bash
使用系统代理
export HTTP_PROXY=http://127.0.0.1:1082
export HTTPS_PROXY=http://127.0.0.1:1082
注意: 币安API在某些地区可能受限。请使用允许地区(香港/新加坡/日本/英国/德国)的代理节点。
API端点
| 端点 | 用途 |
|---|
| /api/v3/ticker/price | 实时价格 |
| /api/v3/ticker/24hr |
24小时统计 |
| /api/v3/klines | K线/蜡烛图数据 |
| /api/v3/exchangeInfo | 交易规则与交易对 |
脚本
1. 价格查询
bash
单个交易对
./scripts/price.sh BTCUSDT
多个交易对
./scripts/price.sh BTCUSDT ETHUSDT BNBUSDT
2. 24小时涨跌(通过K线)
bash
单个交易对
./scripts/change.sh BTCUSDT
涨幅榜(需自定义处理)
./scripts/gainers.sh
3. K线数据
bash
BTC 1小时K线(100根蜡烛)
./scripts/kline.sh BTCUSDT 1h 100
ETH 4小时K线
./scripts/kline.sh ETHUSDT 4h 50
4. 代币信息(新增!)
bash
获取基础价格
./scripts/token-info.sh BTCUSDT
获取24小时统计
./scripts/token-info.sh BTCUSDT stats
返回内容:
- - 交易对、价格、24小时涨跌、涨跌幅、24小时最高/最低价、成交量、成交额
5. 搜索交易对
bash
搜索USDT交易对
./scripts/search.sh USDT
快速参考
| 数据 | 命令 |
|---|
| BTC价格 | ./scripts/price.sh BTCUSDT |
| 24小时统计 |
./scripts/token-info.sh BTCUSDT stats |
| K线 | ./scripts/kline.sh BTCUSDT 1h 100 |
频率限制
- - 每分钟1200次请求(公共端点)
- 频繁查询请使用缓存