← 返回 Skills 市场
xdl2003

Futu Client

作者 xdl2003 · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
523
总下载
1
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install futu-client
功能描述
Provides a Python client to query stock positions, account info, place orders, and retrieve market data using the Futu OpenAPI.
使用说明 (SKILL.md)

Futu API Skill

Overview

The futu-client skill provides a convenient client for querying stock positions, account info, placing orders, and more using Futu OpenAPI. It wraps the futu (futu-api) library to offer a simplified interface for trading and querying.

Features

Requirements

  • FutuOpenD must be running on 127.0.0.1:11111
  • Install dependencies: pip install futu-api

Supported Markets

  • HK Stocks: Codes like "HK.00700" (Tencent), "HK.01810" (Xiaomi)
  • US Stocks: Codes like "US.AAPL", "US.QQQ"
  • CN Stocks: Codes like "SH.600000", "SZ.000001"

Data Types

Category Methods
Positions get_positions - Get current positions
Account get_account_info - Get account balance, buying power
Trading place_order, modify_order, unlock_trade
Orders get_orders - Today's orders
Deals get_today_deals - Today's executed trades
History get_history_orders, get_history_deals
Watchlists get_watchlist, get_all_watchlists - Get self-selected stocks
Quotes get_quote, get_market_snapshot
Trading Info get_max_tradable_qty

Usage

Installation

pip install futu-api pandas

Note: FutuOpenD must be running on your machine before using this skill.

Basic Usage

from futu_client import FutuClient
from futu import TrdSide, OrderType, TrdEnv

# Create client
client = FutuClient()

# Get positions
positions = client.get_positions(trd_env=TrdEnv.REAL)
print(positions)

# Get account info
account = client.get_account_info()
print(f"Total assets: {account['total_assets']}")
print(f"Buying power: {account['power']}")

# Get today's deals
deals = client.get_today_deals()
print(deals)

# Place an order (for real trading, use TrdEnv.REAL)
# result = client.place_order(
#     price=100.0,
#     qty=100,
#     code="HK.00700",
#     trd_side=TrdSide.BUY,
#     trd_env=TrdEnv.SIMULATE  # Use SIMULATE for testing
# )

# Get quote
quote = client.get_quote("US.AAPL")
print(f"AAPL price: {quote['last_price']}")

client.close()

Key Methods

get_positions(trd_env=TrdEnv.REAL)

Returns current positions as a DataFrame with columns:

  • code: Stock code
  • stock_name: Stock name
  • qty: Position quantity
  • can_sell_qty: Available to sell
  • cost_price: Cost price
  • nominal_price: Current market price
  • pl_ratio: Profit/loss ratio (%)
  • currency: Currency (HKD, USD, etc.)

get_account_info(trd_env=TrdEnv.REAL)

Returns account information as a dictionary:

  • total_assets: Total assets
  • cash: Available cash
  • power: Buying power
  • market_val: Position market value
  • currency: Account currency

place_order(price, qty, code, trd_side, order_type, trd_env)

Place an order. Returns order result.

Parameters:

  • price: Order price (float)
  • qty: Order quantity (int)
  • code: Stock code (e.g., "HK.00700", "US.AAPL")
  • trd_side: TrdSide.BUY or TrdSide.SELL
  • order_type: OrderType.NORMAL (default)
  • trd_env: TrdEnv.REAL (real) or TrdEnv.SIMULATE (paper trading)

get_quote(code)

Get real-time quote for a stock.

get_market_snapshot(codes)

Get market snapshot for multiple stocks.

get_watchlist(group_name="全部")

Get user's watchlist (self-selected stocks).

Parameters:

  • group_name: Watchlist group name. Common values:
    • "全部" (All) - default
    • "港股" (HK stocks)
    • "美股" (US stocks)
    • "沪深" (CN stocks)

Returns DataFrame with columns:

  • code: Stock code
  • name: Stock name
  • lot_size: Lot size

get_all_watchlists()

Get all watchlist groups at once.

Returns dictionary mapping group names to DataFrames.

Example:

client = FutuClient()
all_watchlists = client.get_all_watchlists()
for name, df in all_watchlists.items():
    print(f"{name}: {len(df)} stocks")
client.close()

Trading Environment

  • TrdEnv.REAL: Real trading (requires account and unlock)
  • TrdEnv.SIMULATE: Paper trading (for testing)

Error Handling

Always handle exceptions appropriately:

from futu_client import FutuClient

client = FutuClient()

try:
    positions = client.get_positions()
except Exception as e:
    print(f"Error: {e}")

client.close()

Notes

  • FutuOpenD must be running before using this skill
  • For real trading, you need to unlock with trading password
  • Some features may require specific account permissions
  • Paper trading (SIMULATE) is available for testing without real money
安全使用建议
This package appears coherent and implements a local futu-api wrapper. Before installing, verify you trust the source and that you intend to run FutuOpenD locally (127.0.0.1:11111). Installing futu-api from PyPI is normal, but confirm the package/version you install is official. Be careful when using TrdEnv.REAL: placing orders and calling unlock_trade will perform real trades if your account is unlocked. Review the full client.py locally (the provided content was partially truncated in the prompt) to ensure there are no unexpected network calls or hidden behavior before granting it access to your environment.
功能分析
Type: OpenClaw Skill Name: futu-client Version: 1.0.1 The skill is a legitimate wrapper for the Futu OpenAPI (futu-api), providing a simplified interface for stock trading, account queries, and market data retrieval. It communicates exclusively with a local FutuOpenD gateway on 127.0.0.1:11111 and contains no evidence of malicious behavior, data exfiltration, or prompt injection. All methods in client.py align with the documented purpose of interfacing with the Futu trading platform.
能力评估
Purpose & Capability
The name/description, SKILL.md, and client.py all describe a wrapper around the futu (futu-api) Python library talking to FutuOpenD on localhost:11111. Required functionality (positions, quotes, orders) matches methods implemented in client.py.
Instruction Scope
SKILL.md limits runtime actions to using the futu-api library and connecting to FutuOpenD on 127.0.0.1:11111. It does not instruct the agent to read unrelated files, environment variables, or post data to unexpected external endpoints.
Install Mechanism
This is instruction-only (no install spec). The README suggests installing futu-api and pandas via pip, which is appropriate and proportional for a Python client wrapper.
Credentials
The skill declares no required environment variables or credentials. The only sensitive action is trading/unlocking, but the skill does not automatically request or store credentials — unlocking must be called explicitly by the user (unlock_trade) which takes a password parameter.
Persistence & Privilege
The skill is not always-enabled, does not request persistent elevated privileges, and does not modify other skill/system configurations. Autonomous invocation remains enabled (platform default) but is not combined with other red flags.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install futu-client
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /futu-client 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Updated internal metadata in _meta.json for versioning. - No functional or API changes to python code or documentation. - SKILL.md content remains unchanged. - Maintenance release; no user-facing updates.
v1.0.0
futu-client 1.0.0 – Initial release - Provides a simplified client for interacting with Futu OpenAPI for HK, US, and CN stock trading and data. - Supports querying positions, account info, placing and modifying orders, retrieving orders and deals, and viewing watchlists and quotes. - Includes comprehensive method documentation and usage examples for both real and simulated (paper) trading. - Requires running FutuOpenD locally and dependency on futu-api Python library. - Offers error handling guidance and covers both trading and data retrieval scenarios.
元数据
Slug futu-client
版本 1.0.1
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 2
常见问题

Futu Client 是什么?

Provides a Python client to query stock positions, account info, place orders, and retrieve market data using the Futu OpenAPI. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 523 次。

如何安装 Futu Client?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install futu-client」即可一键安装,无需额外配置。

Futu Client 是免费的吗?

是的,Futu Client 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Futu Client 支持哪些平台?

Futu Client 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Futu Client?

由 xdl2003(@xdl2003)开发并维护,当前版本 v1.0.1。

💬 留言讨论