agentCLAWHUBUnverified

futu-trading-bot

Use Futu Trade Bot Skills to run account, quote, and trade workflows with real HK market data.

OpenClaw

Rank

62

Safety

84

Downloads

2.0k

Updated

Oct 9, 2026

Version

1.0.9

Source

CLAWHUB

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 2K downloads reported by the source. Last updated 10/9/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Public facts

Every fact links back to the source it came from.

Vendor
Clawhubvendor · observed Oct 9, 2026
Protocol compatibility
OpenClawcompatibility · observed Oct 9, 2026
Adoption signal
2K downloadsadoption · observed Oct 9, 2026
Latest release
1.0.9release · observed Aug 6, 2026
Handshake status
UNKNOWNsecurity

Install and run

Setup complexity: low.

clawhub skill install s178bcyctp44ydnda4m1apj4hx83hv3f:futu-trading-bot
  1. Install using `clawhub skill install s178bcyctp44ydnda4m1apj4hx83hv3f:futu-trading-bot` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/jeffersonling1217-png/futu-trading-bot before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-jeffersonling1217-png-futu-trading-bot/snapshot"

Documentation

CLAWHUB

152,360 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: futu-trading-bot
description: Use Futu Trade Bot Skills to run account, quote, and trade workflows with real HK market data.
license: MIT-0
metadata:
  openclaw:
    emoji: "📈"
    requires:
      bins: ["python3", "pip"]
    permissions:
      - local-network  # Futu OpenD (default 127.0.0.1:11111)
      - filesystem-read  # json/config.json and skill modules
      - filesystem-write  # optional account_info.json / strategy logs / PID files when user opts in
      - process  # optional background strategy only after explicit user confirmation
---

# Futu Trade Bot Skills 📈

## ⚠️ Security & Safety (READ FIRST)

This skill can control a **live brokerage account** via Futu OpenD. Misuse can cause **irreversible financial loss**.

**Hard rules for the agent:**
1. **Default to SIMULATE.** Never use `trd_env="REAL"` unless the user explicitly requests live trading and confirms the exact order parameters.
2. **State-changing actions require explicit user approval**, then pass `confirm=True`:
   - `unlock_trade` / `lock_trade`
   - `submit_order` when `trd_env="REAL"`
   - `modify_order` / `cancel_order` when `trd_env="REAL"`
   - `cancel_all_orders` in **any** environment
3. **Read-only actions** (quotes, `get_account_info(persist=False)`) may run without `confirm`.
4. **Do not** collect trading passwords via interactive stdin. Use config (`trade_password_md5` preferred) or an explicit parameter the user already provided out-of-band.
5. **Do not** write `json/account_info.json` unless the user asks to cache accounts (`persist=True`).
6. **Background strategies** (write script / start process / stop process) only after the user clearly asks and confirms symbol, qty, `SIMULATE`/`REAL`, and log/PID paths.
7. If a restricted sandbox blocks OpenD or `~/.com.futunn.FutuOpenD/Log`, **tell the user** before suggesting `host` / `elevated` mode — never silently escalate.

**中文硬规则:** 默认模拟盘;真金白银/解锁/全部撤单必须先复述参数并得到用户明确同意,再传 `confirm=True`;禁止 stdin 要密码;默认不把账户信息写盘。

## 🎯 Overview / 概述

**English Version:**
A trading bot skill based on Futu OpenAPI that enables natural language trading. This skill encapsulates Futu's market quote and order execution APIs, allowing agents to perform real-time trading operations through simple commands or scripts. Perfect for implementing natural language trading strategies and automated workflows.

**Important**: Always use the encapsulated functions provided in this skill (e.g., `submit_order`, `get_market_snapshot`). **Never call Futu SDK functions directly** (`ctx.place_order`, `ctx.get_market_snapshot`), as this will bypass connection management, parameter validation, and error handling, leading to unpredictable failures and resource leaks.

**中文版本:**
基于富途牛牛API接口的交易机器人技能,帮助用户用自然语言进行交易。本技能已将富途牛牛的行情报价、下单交易等功能做了完整封装,可供智能助手随时调用。建议通过命令行或脚本来实现自然语言的策略生成和交易执行。

**重要提示**:请始终使用本技能提供的封装函数(如 `submit_order`、`get_market_snapshot`)。**切勿直接调用富途SDK的原始函数**(例如 `ctx.place_order`),否则会绕过连接管理、参数校

README.md

# Futu Trading Bot Skills

> **⚠️ Safety first**
>
> This skill can unlock a Futu brokerage account and place, modify, or cancel **real-money** orders via local OpenD.
> - Prefer **`SIMULATE`** until you fully trust the setup.
> - `REAL` orders, unlock/lock, and **`cancel_all_orders`** require explicit human approval and API `confirm=True`.
> - Do not store plaintext passwords in git; prefer `trade_password_md5`.
> - `get_account_info()` does **not** write disk by default (`persist=False`).

这是一个为 AI Agent 打造的自然语言交易执行工具。它将富途 OpenAPI 的底层逻辑封装为语义能力,支持通过自然语言驱动账户解锁、下单及风控管理。系统支持(模拟/实盘)环境隔离,能够将“帮我买 200 股腾讯”或“清仓一半持仓”这类模糊意图,转化为符合金融规范的执行动作。

A robust trade execution tool designed for AI Agents. It abstracts Futu OpenAPI logic into high-level semantic capabilities, enabling natural language control over account unlocking, order placement, and risk management. With native support for MD5 credential handling and environment isolation (Simulated/Real), it accurately translates vague intents—such as "buy 200 shares of Tencent" or "close half of my positions"—into execution actions that comply with financial standards.

适用对象:配合 OpenClaw 使用,或任何能通过命令行调用工具并能编写 Python 脚本的 Agent/LLM。

核心代码在 `src/`,配置与运行数据在 `json/`。

## 功能
- 账户查询:`get_account_info()`
- 交易解锁:`unlock_trade(password=None, password_md5=None)`
- 交易锁定:`lock_trade(password=None, password_md5=None)`
- 预检:`run_preflight()`
- 行情拉取:`get_stock_basicinfo()`、`get_market_state()`、`get_market_snapshot()`、`get_cur_kline()`、`request_history_kline()`、`get_rt_ticker()`
- 行情统一启动:`start_quote_stream()`、`start_orderbook_stream()`
- 下单:`submit_order(...)`
- 改单/撤单:`modify_order(...)`、`cancel_order(...)`、`cancel_all_orders(...)`
- 策略运行:`run_strategy(...)`
- 策略辅助:状态、交易锁、交易时段判断、回调 payload 解析

## 当前行为说明
- `submit_order` 必须显式传入 `acc_id` 和 `trd_env`(`REAL` / `SIMULATE`)。`REAL` 还需要 `confirm=True`。
- `cancel_all_orders` 在任何环境下都需要 `confirm=True`。
- `get_account_info(persist=False)` 默认只返回内存结果;仅当 `persist=True` 时写入 `json/account_info.json`。
- `unlock_trade` / `lock_trade` 需要 `confirm=True`,支持 MD5 密码:
  - 优先使用 `password_md5` / 配置 `trade_password_md5`
  - 若仅提供明文 `password`,会在运行时自动转 MD5 后调用富途接口
  - **不提供** stdin 交互式输密码接口
- 拉取型 quote 函数会在返回后自动关闭 quote context。
- trade/account 对外函数会在返回后自动关闭各自 context。
- 订阅/回调模式不会自动关闭 quote context,调用方结束时应显式 `close_quote_service()`。
- `modify_order` / `cancel_order` / `cancel_all_orders` 会自行重新初始化交易 context,不依赖上一次调用留下的连接。

## 安装
### 方式 A:作为 ClawHub Skill 安装(推荐给 Agent 用户)
不需要手动下载整个仓库,直接安装 skill 文件夹即可:
```bash
clawhub install futu-trading-bot
```

安装完成后,在该 skill 目录中创建虚拟环境并安装依赖(否则无法 `import` / 调用):
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
```

### 方式 B:从 GitHub 源码安装(推荐给开发者)
如果你是要开发/改代码,直接 clone 本仓库后:
```bash
pip install -r requirements.txt
```

推荐(开发环境):
```bash
pip install -e .
```
安装后可直接 `import quote_service/trade_service/account_manager/config_manager`,
无需再手动设置 `PYTHONPATH` 或在脚本

_meta.json

{
  "ownerId": "kn79d46ahs4v5syfeh8jjzqf7d81y7rr",
  "slug": "futu-trading-bot",
  "version": "1.0.9",
  "publishedAt": 1786009435466
}

docs/account.md

# Account Manager 文档

所属项目:**Futu Trade Bot Skills**

## 模块位置
`src/account_manager.py`

## 安全提示
- `unlock_trade` / `lock_trade` 会改变真实券商账户的交易锁定状态,**必须** `confirm=True`,且仅在用户明确授权后调用。
- 不要通过 agent stdin 收集交易密码;优先使用配置中的 `trade_password_md5`。
- `get_account_info` 默认**不写盘**。仅当用户要求缓存账户列表时使用 `persist=True`(写入 `json/account_info.json`,含账户 ID / 环境 / 券商等元数据,请限制文件权限且勿提交仓库)。

## 对外接口

### `get_account_info(persist=False)`
```python
get_account_info(persist: bool = False) -> Dict[str, Any]
```

行为:
- 调用富途 `get_acc_list()`。
- 返回账户列表结构:`accounts`。
- 仅当 `persist=True` 时覆盖写 `json/account_info.json`,并在结果中设置 `persisted=True/False`。

### `unlock_trade(password=None, password_md5=None, confirm=False)`
```python
unlock_trade(
    password: Optional[str] = None,
    password_md5: Optional[str] = None,
    confirm: bool = False,
) -> Dict[str, Any]
```

- `confirm` 必须为 `True`,否则直接失败。
- 密码优先级:显式 `password_md5` → 显式 `password` → 配置 `trade_password_md5` → 配置 `trade_password`。

### `lock_trade(password=None, password_md5=None, confirm=False)`
同样需要 `confirm=True`。内部调用富途 `unlock_trade(..., is_unlock=False)`。

## 使用示例
```python
from account_manager import get_account_info, unlock_trade, lock_trade

print(get_account_info())
print(unlock_trade(confirm=True))
print(lock_trade(confirm=True))
```

## 注意事项
- 依赖 OpenD 连接可用。
- 明文密码和 MD5 都属于敏感信息。
- 对外函数返回后会关闭账户相关 context。

docs/config.md

# Config Manager 文档

所属项目:**Futu Trade Bot Skills**

## 模块位置
`src/config_manager.py`

## 作用
统一加载并提供项目配置(富途连接参数、交易密码、日志参数)。

## 配置文件读取规则
1. 优先读取:`json/config.json`
2. 回退读取:`json/config_example.json`(存在时)
3. 兼容读取:`json/config.example.json`(旧命名存在时)
4. 若都不存在,抛出 `FileNotFoundError`

## 配置示例
```json
{
  "futu_api": {
    "host": "127.0.0.1",
    "port": 11111,
    "security_firm": "FUTUSECURITIES",
    "trade_password": "",
    "trade_password_md5": "",
    "default_env": "SIMULATE"
  },
  "logging": {
    "level": "INFO",
    "format": "%(asctime)s - %(levelname)s - %(message)s"
  }
}
```

## 默认值(缺省字段自动补全)
- `host`: `127.0.0.1`
- `port`: `11111`
- `security_firm`: `FUTUSECURITIES`
- `trade_password`: `""`
- `trade_password_md5`: `""`
- `default_env`: `SIMULATE`

## 主要接口
- `get_futu_config()`
- `get_host()`
- `get_port()`
- `get_security_firm()`
- `get_trade_password()`
- `get_trade_password_md5()`
- `get_default_env()`
- `get_default_env_str()`

## 与其他模块关系
- `account_manager` 使用本模块读取主机、端口、券商、交易密码。
- `trade_service` 使用本模块读取主机、端口、券商。

## 安全建议
- `json/config.json` 不应入库,需加入 `.gitignore`。
- 使用最小权限:`chmod 600 json/config.json`。
- 不在日志中输出真实密码或 MD5 值。
Github ReposUpdated 11h agoRank 70

AionUi

Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!

MCPOPENCLAW
Github ReposUpdated 6mo agoRank 70

activepieces

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

OPENCLAW
Github ReposUpdated 6mo agoRank 70

cherry-studio

AI productivity studio with smart chat, autonomous agents, and 300+ assistants.

MCPOPENCLAW
Github ReposUpdated 7mo agoRank 70

CopilotKit

The Frontend for Agents & Generative UI. React + Angular

OPENCLAW

Machine-readable data

The same record, as JSON, for agents and crawlers.

{
  "facts": [
    {
      "factKey": "vendor",
      "category": "vendor",
      "label": "Vendor",
      "value": "Clawhub",
      "href": "https://clawhub.ai/jeffersonling1217-png/skills/futu-trading-bot",
      "sourceUrl": "https://clawhub.ai/jeffersonling1217-png/skills/futu-trading-bot",
      "sourceType": "profile",
      "confidence": "medium",
      "observedAt": "2026-10-09T21:51:03.969Z",
      "isPublic": true
    },
    {
      "factKey": "protocols",
      "category": "compatibility",
      "label": "Protocol compatibility",
      "value": "OpenClaw",
      "href": "https://www.xpersona.co/api/v1/agents/clawhub-jeffersonling1217-png-futu-trading-bot/contract",
      "sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-jeffersonling1217-png-futu-trading-bot/contract",
      "sourceType": "contract",
      "confidence": "medium",
      "observedAt": "2026-10-09T21:51:03.969Z",
      "isPublic": true
    },
    {
      "factKey": "traction",
      "category": "adoption",
      "label": "Adoption signal",
      "value": "2K downloads",
      "href": "https://clawhub.ai/jeffersonling1217-png/futu-trading-bot",
      "sourceUrl": "https://clawhub.ai/jeffersonling1217-png/futu-trading-bot",
      "sourceType": "profile",
      "confidence": "medium",
      "observedAt": "2026-10-09T21:51:03.969Z",
      "isPublic": true
    },
    {
      "factKey": "latest_release",
      "category": "release",
      "label": "Latest release",
      "value": "1.0.9",
      "href": "https://clawhub.ai/jeffersonling1217-png/futu-trading-bot",
      "sourceUrl": "https://clawhub.ai/jeffersonling1217-png/futu-trading-bot",
      "sourceType": "release",
      "confidence": "medium",
      "observedAt": "2026-08-06T09:43:55.466Z",
      "isPublic": true
    },
    {
      "factKey": "handshake_status",
      "category": "security",
      "label": "Handshake status",
      "value": "UNKNOWN",
      "href": "https://www.xpersona.co/api/v1/agents/clawhub-jeffersonling1217-png-futu-trading-bot/trust",
      "sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-jeffersonling1217-png-futu-trading-bot/trust",
      "sourceType": "trust",
      "confidence": "medium",
      "observedAt": null,
      "isPublic": true
    }
  ],
  "events": [
    {
      "eventType": "release",
      "title": "Release 1.0.9",
      "description": "Pin pydantic==2.12.5 to satisfy supply-chain scanner (SC4); keep 1.0.8 security confirm gates",
      "href": "https://clawhub.ai/jeffersonling1217-png/futu-trading-bot",
      "sourceUrl": "https://clawhub.ai/jeffersonling1217-png/futu-trading-bot",
      "sourceType": "release",
      "confidence": "medium",
      "observedAt": "2026-08-06T09:43:55.466Z",
      "isPublic": true
    }
  ]
}

Record generated Oct 10, 2026.

Sponsored

Ads related to futu-trading-bot and adjacent AI workflows.