← Back to Skills Marketplace
xdl2003

Futu Client

by xdl2003 · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ Security Clean
523
Downloads
1
Stars
1
Active Installs
2
Versions
Install in OpenClaw
/install futu-client
Description
Provides a Python client to query stock positions, account info, place orders, and retrieve market data using the Futu OpenAPI.
README (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
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install futu-client
  3. After installation, invoke the skill by name or use /futu-client
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug futu-client
Version 1.0.1
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 2
Frequently Asked Questions

What is Futu Client?

Provides a Python client to query stock positions, account info, place orders, and retrieve market data using the Futu OpenAPI. It is an AI Agent Skill for Claude Code / OpenClaw, with 523 downloads so far.

How do I install Futu Client?

Run "/install futu-client" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Futu Client free?

Yes, Futu Client is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Futu Client support?

Futu Client is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Futu Client?

It is built and maintained by xdl2003 (@xdl2003); the current version is v1.0.1.

💬 Comments