binance-futures-trading — automated USDT-M contract trading binance-futures-trading, trader, community, automated USDT-M contract trading, ide skills, install binance-futures-trading skill, binance-futures-trading API documentation, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Trading Agents needing automated Binance USDT-M perpetual contract management. binance-futures-trading is a skill that offers automated trading functionality for Binance USDT-M perpetual contracts, supporting features like account balance queries and order management via the MCP tool.

Features

Account balance queries using BINANCE_API_KEY and BINANCE_API_SECRET
Position information queries and leverage/margin mode setting
Automated opening and closing of positions with stop-loss and take-profit settings
Order management capabilities, including query and cancellation of orders
Support for simulated trading mode (TRADING_SIMULATION) and testnet (BINANCE_USE_TESTNET)
Environment configuration using bash variables for API keys and simulation mode

# Core Topics

phpmac phpmac
[0]
[0]
Updated: 3/8/2026

Agent Capability Analysis

The binance-futures-trading skill by phpmac is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for automated USDT-M contract trading, install binance-futures-trading skill, binance-futures-trading API documentation.

Ideal Agent Persona

Perfect for Trading Agents needing automated Binance USDT-M perpetual contract management.

Core Value

Empowers agents to automate account balance queries, position information, and order management using the Binance API, with features like leverage and margin mode setting, and stop-loss and take-profit orders, all while utilizing the MCP tool for streamlined trading.

Capabilities Granted for binance-futures-trading

Automating Binance USDT-M perpetual contract trading strategies
Managing account balances and position information in real-time
Executing orders with precision using stop-loss and take-profit settings

! Prerequisites & Limits

  • Requires Binance API key and secret
  • Default simulation mode must be disabled for live trading
  • Compatibility with Binance testnet is optional
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

binance-futures-trading

Install binance-futures-trading, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

币安 USDT 合约交易技能

概述

本技能提供币安 USDT-M 永续合约的完整交易功能, 通过 MCP 工具实现:

  • 账户余额查询
  • 持仓信息查询
  • 杠杆/保证金模式设置
  • 开仓/平仓操作
  • 止损止盈设置
  • 订单管理 (查询/撤销)

环境配置

必需的环境变量

bash
1# API 密钥 (必需) 2BINANCE_API_KEY=your_api_key 3BINANCE_API_SECRET=your_api_secret 4 5# 模拟交易模式 (默认 true, 不执行真实订单) 6TRADING_SIMULATION=true 7 8# 使用测试网 (可选, 默认 false) 9BINANCE_USE_TESTNET=false

安全提醒

  • 禁止在代码中硬编码 API 密钥
  • 建议先使用测试网验证策略
  • 默认启用模拟模式, 防止误操作

可用工具

查询类 (只读)

工具名称功能参数
binance_get_balance查询账户余额asset (可选)
binance_get_positions查询持仓信息symbol (可选)
binance_get_open_orders查询普通挂单 (限价单等)symbol (可选)
binance_get_open_algo_orders查询条件单 (止盈止损)symbol (可选)

注意: 止盈止损订单使用 Algo Order API, 需要用 binance_get_open_algo_orders 查询, 不会出现在 binance_get_open_orders 中.

设置类

工具名称功能参数
binance_change_leverage设置杠杆倍数symbol, leverage (1-125)
binance_change_margin_type设置保证金模式symbol, margin_type (ISOLATED/CROSSED)

交易类

工具名称功能关键参数
binance_place_order下单symbol, side, type, quantity
binance_close_position平仓symbol, quantity (可选)
binance_set_stop_loss_take_profit设置止损止盈symbol, stopLossPrice, takeProfitPrice
binance_cancel_order撤销普通订单symbol, orderId
binance_cancel_all_orders撤销所有普通订单symbol
binance_cancel_algo_order撤销单个条件单symbol, algoId
binance_cancel_all_algo_orders撤销所有条件单symbol

使用示例

1. 查询账户状态

python
1# 查询 USDT 余额 2binance_get_balance(asset="USDT") 3 4# 查询所有持仓 5binance_get_positions() 6 7# 查询指定交易对持仓 8binance_get_positions(symbol="BTCUSDT")

2. 设置杠杆和保证金模式

python
1# 设置 BTCUSDT 杠杆为 10 倍 2binance_change_leverage(symbol="BTCUSDT", leverage=10) 3 4# 切换为逐仓模式 (有持仓时无法切换) 5binance_change_margin_type(symbol="BTCUSDT", margin_type="ISOLATED")

3. 开仓

python
1# 市价做多 0.01 BTC 2binance_place_order( 3 symbol="BTCUSDT", 4 side="BUY", 5 type="MARKET", 6 quantity=0.01, 7 confirm_real_order=True # 实盘必须 8) 9 10# 限价做空 11binance_place_order( 12 symbol="BTCUSDT", 13 side="SELL", 14 type="LIMIT", 15 quantity=0.01, 16 price=100000, 17 timeInForce="GTC", 18 confirm_real_order=True 19)

4. 平仓

python
1# 全部平仓 2binance_close_position( 3 symbol="BTCUSDT", 4 confirm_real_order=True 5) 6 7# 部分平仓 8binance_close_position( 9 symbol="BTCUSDT", 10 quantity=0.005, 11 confirm_real_order=True 12)

5. 设置止损止盈

python
1# 同时设置止损和止盈 2binance_set_stop_loss_take_profit( 3 symbol="BTCUSDT", 4 stopLossPrice=95000, 5 takeProfitPrice=110000, 6 confirm_real_order=True 7) 8 9# 只设置止损 10binance_set_stop_loss_take_profit( 11 symbol="BTCUSDT", 12 stopLossPrice=95000, 13 confirm_real_order=True 14)

6. 订单管理

python
1# 查询普通挂单 (限价单等) 2binance_get_open_orders(symbol="BTCUSDT") 3 4# 查询条件单 (止盈止损订单) 5binance_get_open_algo_orders(symbol="BTCUSDT") 6 7# 撤销指定订单 8binance_cancel_order(symbol="BTCUSDT", orderId=123456789) 9 10# 撤销所有普通挂单 11binance_cancel_all_orders(symbol="BTCUSDT") 12 13# 撤销单个条件单 (止盈止损) 14binance_cancel_algo_order(symbol="BTCUSDT", algoId=123456789) 15 16# 撤销所有条件单 (止盈止损) 17binance_cancel_all_algo_orders(symbol="BTCUSDT")

重要:

  • 止盈止损订单使用 Algo Order API (2025-12-09 迁移后)
  • 查询条件单: binance_get_open_algo_orders
  • 撤销条件单: binance_cancel_algo_orderbinance_cancel_all_algo_orders
  • 普通的 binance_cancel_all_orders 无法撤销条件单

订单类型说明

类型说明必需参数
MARKET市价单, 立即成交quantity
LIMIT限价单quantity, price, timeInForce
STOP_MARKET止损市价单stopPrice
TAKE_PROFIT_MARKET止盈市价单stopPrice
STOP止损限价单price, stopPrice
TAKE_PROFIT止盈限价单price, stopPrice

交易方向

账户使用对冲模式 (Hedge Mode), 所有交易操作必须指定 positionSide 参数:

  • 开多: side=BUY + positionSide=LONG
  • 平多: side=SELL + positionSide=LONG
  • 开空: side=SELL + positionSide=SHORT
  • 平空: side=BUY + positionSide=SHORT

注意: 不要使用 positionSide=BOTH, 会报错 -4061


模拟交易模式

默认情况下, 所有交易类工具运行在模拟模式:

  1. 不会执行真实订单
  2. 返回模拟订单信息
  3. 用于验证参数和策略逻辑

启用实盘交易

  1. 设置环境变量: TRADING_SIMULATION=false
  2. 调用时传入: confirm_real_order=True
python
1# 两个条件都满足才会执行真实订单 2binance_place_order( 3 symbol="BTCUSDT", 4 side="BUY", 5 type="MARKET", 6 quantity=0.01, 7 confirm_real_order=True # 必须显式确认 8)

风险提示

  1. 资金安全: 合约交易有爆仓风险, 请谨慎操作
  2. 杠杆风险: 高杠杆放大盈亏, 建议使用低杠杆
  3. 止损保护: 开仓后应立即设置止损
  4. 测试优先: 新策略先在测试网验证
  5. 单笔风险: 建议单笔亏损不超过账户 1-2%

常见错误码

错误码说明解决方案
-1000未知错误检查网络, 重试
-1021时间戳超出范围检查系统时间同步
-1022签名无效检查 API Secret
-2010余额不足检查可用余额
-2019保证金不足降低仓位或增加保证金
-4003数量小于最小值检查交易对最小交易量
-4014价格不符合精度调整价格精度

技术实现

本 MCP 工具使用 binance-futures-connector-python 官方 SDK, 无需手动处理签名等底层细节.

API 端点说明

普通订单 API:

  • GET /fapi/v1/openOrders - 查询普通挂单
  • DELETE /fapi/v1/order - 撤销单个普通订单
  • DELETE /fapi/v1/allOpenOrders - 撤销所有普通订单

条件单 Algo Order API (2025-12-09 迁移后):

  • POST /fapi/v1/algoOrder - 创建条件单 (止盈止损)
  • GET /fapi/v1/openAlgoOrders - 查询条件单
  • DELETE /fapi/v1/algoOrder - 撤销单个条件单
  • 注意: 币安没有提供批量撤销条件单的 API, binance_cancel_all_algo_orders 工具通过先查询再逐个撤销实现

开发注意事项

修改本 MCP 服务前, 应使用 Context7 查询最新 API 文档:

# 查询币安合约 API 文档
resolve-library-id: "binance futures connector python"
get-library-docs: context7CompatibleLibraryID="/binance/binance-futures-connector-python", topic="具体功能"

参考资料

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is binance-futures-trading?

Perfect for Trading Agents needing automated Binance USDT-M perpetual contract management. binance-futures-trading is a skill that offers automated trading functionality for Binance USDT-M perpetual contracts, supporting features like account balance queries and order management via the MCP tool.

How do I install binance-futures-trading?

Run the command: npx killer-skills add phpmac/trader. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for binance-futures-trading?

Key use cases include: Automating Binance USDT-M perpetual contract trading strategies, Managing account balances and position information in real-time, Executing orders with precision using stop-loss and take-profit settings.

Which IDEs are compatible with binance-futures-trading?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for binance-futures-trading?

Requires Binance API key and secret. Default simulation mode must be disabled for live trading. Compatibility with Binance testnet is optional.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add phpmac/trader. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use binance-futures-trading immediately in the current project.

Related Skills

Looking for an alternative to binance-futures-trading or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI