← 返回 Skills 市场
99
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install binance-trader
功能描述
Provide Binance spot and futures trading with account info, price quotes, order placement, position tracking, and historical data retrieval.
使用说明 (SKILL.md)
Binance Trader Skill
币安交易技能 - 支持现货和合约交易
安装
# 安装 Binance Python SDK
/usr/bin/python3.12 -m pip install python-binance ccxt
# 配置 API Key
export BINANCE_API_KEY="your_api_key"
export BINANCE_API_SECRET="your_api_secret"
使用方法
1. 查看账户余额
from binance.client import Client
import os
client = Client(os.getenv('BINANCE_API_KEY'), os.getenv('BINANCE_API_SECRET'))
account = client.get_account()
for balance in account['balances']:
if float(balance['free']) > 0 or float(balance['locked']) > 0:
print(f"{balance['asset']}: 可用={balance['free']}, 冻结={balance['locked']}")
2. 查看当前价格
# 获取单个币种价格
price = client.get_symbol_ticker(symbol="BTCUSDT")
print(f"BTC 价格:{price['price']} USDT")
# 获取多个币种价格
prices = client.get_symbol_ticker()
for p in prices[:10]: # 前 10 个
print(f"{p['symbol']}: {p['price']}")
3. 下单交易
# 现货买入 (市价单)
order = client.order_market_buy(
symbol='BTCUSDT',
quoteOrderQty=100 # 用 100 USDT 买入
)
# 现货卖出
order = client.order_market_sell(
symbol='BTCUSDT',
quantity=0.001 # 卖出 0.001 BTC
)
# 限价单
order = client.order_limit_buy(
symbol='BTCUSDT',
quantity=0.001,
price=50000 # 在 50000 USDT 时买入
)
4. 合约交易
from binance.um_futures import UMFutures
um_client = UMFutures(key=os.getenv('BINANCE_API_KEY'), secret=os.getenv('BINANCE_API_SECRET'))
# 查看合约持仓
positions = um_client.position_risk()
for pos in positions:
if float(pos['positionAmt']) != 0:
print(f"{pos['symbol']}: 持仓={pos['positionAmt']}, 入场价={pos['entryPrice']}, 未实现盈亏={pos['unRealizedProfit']}")
# 开多 (买入)
order = um_client.new_order(
symbol="BTCUSDT",
side="BUY",
type="MARKET",
quantity=0.001
)
# 开空 (卖出)
order = um_client.new_order(
symbol="BTCUSDT",
side="SELL",
type="MARKET",
quantity=0.001
)
# 设置止损止盈
order = um_client.new_order(
symbol="BTCUSDT",
side="SELL",
type="STOP_MARKET",
quantity=0.001,
stopPrice=48000, # 跌到 48000 止损
closePosition=True
)
5. 查看 K 线数据
# 获取 BTC 1 小时 K 线 (最近 100 根)
klines = client.get_klines(symbol="BTCUSDT", interval=Client.KLINE_INTERVAL_1HOUR, limit=100)
for k in klines[-5:]: # 最后 5 根
timestamp = k[0]
open_price = k[1]
high = k[2]
low = k[3]
close = k[4]
volume = k[5]
print(f"时间:{timestamp}, 开:{open_price}, 高:{high}, 低:{low}, 收:{close}, 量:{volume}")
6. 查看订单历史
# 现货订单历史
orders = client.get_all_orders(symbol='BTCUSDT', limit=10)
for order in orders:
print(f"{order['symbol']}: {order['side']} {order['type']} @ {order['price']} - 状态:{order['status']}")
# 合约订单历史
orders = um_client.get_all_orders(symbol='BTCUSDT', limit=10)
安全注意事项
- 永远不要分享 API Key
- 设置 IP 白名单 - 在币安后台限制 API Key 只能从特定 IP 访问
- 限制权限 - 只开启必要的权限(交易/读取),不要开启提现权限
- 使用子账户 - 建议创建子账户专门用于交易
- 设置提现白名单 - 防止资金被盗转
常用交易对
- 现货:
BTCUSDT,ETHUSDT,BNBUSDT,SOLUSDT - 合约:
BTCUSDT,ETHUSDT,BNBUSDT(永续合约)
错误处理
from binance.exceptions import BinanceAPIException
try:
order = client.order_market_buy(symbol='BTCUSDT', quoteOrderQty=100)
except BinanceAPIException as e:
print(f"币安 API 错误:{e.status_code}, {e.message}")
except Exception as e:
print(f"其他错误:{e}")
安全使用建议
This skill appears to implement real Binance operations and legitimately needs your BINANCE_API_KEY and BINANCE_API_SECRET, but the registry metadata did not declare those env vars and the install instructions ask you to pip-install unpinned packages from PyPI. Before installing or running it: (1) Verify the skill's source/author — prefer official or well-known authors; (2) use a dedicated Binance API key with minimal permissions (enable Trade/Read, disable Withdraw) and enable IP whitelist or use a sub-account with limited funds; (3) run pip installs in an isolated virtualenv or sandbox and consider pinning package versions or verifying package checksums; (4) treat the skill as capable of placing real trades — test with tiny amounts or a sandbox/testnet account first; (5) if you require stronger assurance, ask the publisher to update registry metadata to declare required env vars and provide an install spec with pinned versions or a vetted release URL. If you do not trust the unknown source, do not provide your real API keys or run the install on a production system.
功能分析
Type: OpenClaw Skill
Name: binance-trader
Version: 1.0.0
The skill bundle provides standard documentation and Python code snippets for interacting with the Binance API using the 'python-binance' and 'ccxt' libraries. It includes clear instructions for account management, spot/futures trading, and market data retrieval, along with appropriate security warnings regarding API key management and permission limiting in SKILL.md.
能力评估
Purpose & Capability
The SKILL.md implements spot and futures trading via the official python-binance SDK and ccxt which matches the described purpose. However the registry metadata declares no required credentials or env vars even though the instructions clearly require BINANCE_API_KEY and BINANCE_API_SECRET.
Instruction Scope
The runtime instructions are narrowly scoped to Binance operations (account, prices, orders, k-lines, error handling) and do not instruct reading unrelated system files or exfiltrating data to external endpoints. The instructions do tell the agent to import environment variables for API keys (expected for this functionality).
Install Mechanism
There is no declared install spec in the registry (instruction-only), but the SKILL.md tells the user to run pip install python-binance ccxt. That is expected for a Python skill, but packages are unpinned and fetched from PyPI with no hashes — this increases risk (supply-chain or trojaned package) and there is no guidance to run installs in an isolated environment.
Credentials
The skill requires Binance API credentials (used throughout examples) but the registry metadata lists no required env vars or primary credential. Asking for API keys is reasonable for trading, but the metadata omission is an inconsistency that prevents automated permission checks and user awareness. No mention of withdrawal permissions in required settings — instructions correctly advise to avoid enabling withdrawals, but there is no enforcement.
Persistence & Privilege
The skill is not always-enabled and does not request elevated/persistent platform privileges. It doesn't instruct modifying other skills or system-wide agent config. Autonomous invocation is allowed by default (normal) but not itself flagged.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install binance-trader - 安装完成后,直接呼叫该 Skill 的名称或使用
/binance-trader触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of the Binance Trader skill:
- Supports spot and futures trading on Binance
- Includes examples for viewing account balance, placing orders, checking prices, retrieving K-line data, and viewing order history
- Provides setup instructions for installing dependencies and configuring API keys
- Contains security suggestions and error handling tips
- Usage documentation is provided in Chinese
元数据
常见问题
Binance Trader 是什么?
Provide Binance spot and futures trading with account info, price quotes, order placement, position tracking, and historical data retrieval. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 99 次。
如何安装 Binance Trader?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install binance-trader」即可一键安装,无需额外配置。
Binance Trader 是免费的吗?
是的,Binance Trader 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Binance Trader 支持哪些平台?
Binance Trader 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Binance Trader?
由 Henry Sun(@shenry07)开发并维护,当前版本 v1.0.0。
推荐 Skills