Futu Grid Strategy 标志

Futu Grid Strategy

社区
FutunnOpen
futu-grid-strategy

Guides an AI to implement a single-symbol base-price grid program on Futu OpenAPI: validate six parameter checks first, then write a restart-safe limit-order reconciliation loop, and accept it on a paper account. Use when the user wants a grid strategy, grid program, quantitative grid, or grid trading bot, or says 网格策略, 网格程序, 量化网格, 网格交易机器人, 实现网格, or 帮我写一个网格. Request fields follow the OpenAPI llms.md. This skill does not repeat request bodies. Paper account by default.

概览

发布者FutunnOpen
代码仓库futu-agent-hub
技能名称futu-grid-strategy
星标数
45
复刻数
3
附带文件
仅含指令
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 FutunnOpen 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Futu Grid Strategy AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/FutunnOpen/futu-agent-hub/tree/main/skills/strategy-skills/futu-grid-strategy
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/FutunnOpen/futu-agent-hub.git /tmp/futu-agent-hub
mkdir -p .claude/skills
cp -r /tmp/futu-agent-hub/skills/strategy-skills/futu-grid-strategy .claude/skills/futu-grid-strategy
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Futu Grid Strategy,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Futu Grid Strategy。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Futu Grid Strategy 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Futu grid strategy implementation

The user can already place, modify, and cancel orders and query quotes with the Futu OpenAPI llms.md. This skill adds how those actions become one grid program: whether the parameters can run, how level prices are calculated, how the base price and orders line up after a restart, and when the program must stop.

Open the user's OpenAPI llms.md for paths, field names, and enum values (public index: https://open.futunn.com/zh-cn/llm/llms.md), open the matching page, then send the request. This file does not copy request bodies. Calls go to the webapi.futunn.com product line.

1. First version scope

  • One symbol, a stock or ETF, with a market prefix: HK.00700, US.AAPL, SH.600519, SZ.000001
  • Base-price grid, percentage spacing (use a price difference only when the user explicitly asks)
  • Limit orders, valid for the day. The grid re-places orders across days through the reconciliation loop
  • Markets: Hong Kong, US, Shanghai, Shenzhen
  • Trading environment: paper trading. Switch to the live-trading pages only after the user explicitly says so in the current conversation (for example 「使用实盘」). Keep the second confirmation and trading password required by the docs. Do not write passwords, AppKeys, private keys, or tokens into the repository, and do not print them in logs

Out of scope: range grids, adding size after a break below the lower bound, options, futures, crypto, multiple symbols, market orders, and quoting profit while skipping fees.

2. Implementation order

Follow this order. Stop at the first step that fails.

  1. Collect the parameters. Read shares per lot from lot_size in the stock basic-info endpoint. If it cannot be found, ask the user. Do not guess 100.
  2. Run the six checks in section 5. On any FAIL: give the correction and the formula. Do not write trading code. Do not place orders.
  3. On WARN only: show the parameter card and the warnings first. Write code only after the user accepts them.
  4. Write the program. Use section 6 for structure and section 7 for behavior. Match the language of the user's existing project. If there is no project, ask once. If the user does not answer, use Go.
  5. Run the acceptance checks in section 9. If a test fails, do not tell the user the program is ready.
  6. When the user asks to run it, connect only to the paper account.

3. Parameters

FieldMeaningWhen omitted
SymbolWith market prefixMust ask. Do not pick a symbol for the user
Initial base priceGrid center P0Use the latest price from the quote snapshot. After it is written to the state file, restarts only read it
Move typePercentage or price differencePercentage
Buy-on-dip, sell-on-riseA user-stated 1.5% is 0.015 in the formulaWhen at least 120 daily bars exist, use average daily range × 0.67; otherwise ask
Levels per side NN levels above and below, range 3–505, and it must still pass the checks
Lots per levelPositive integer1 lot, and say so in the output
BudgetOptionalIf absent, only report the capital required and mark G3 as "budget not checked"
Drawdown stopRatio versus the grid position cost, optionalAsk once. If the user declines, leave it unset and say so in the output

Percentage: P_down[i] = P0 / (1+a)^i, P_up[i] = P0 × (1+b)^i. Price difference: P_down[i] = P0 − i×d, P_up[i] = P0 + i×d. a, b, and d are decimals. Round a buy price down to the tick and a sell price up to the tick. After rounding, the gap must be at least the gap the user asked for.

Shares per level = lots per level × lot_size. Amount per level A = shares per level × P0. Round-trip width w = min(a, b). Compute fees on w, so an asymmetric grid does not understate the cost.

4. Minimum price increment

Basic info has no tick field. Use the table below for order prices and G1, and state in the output that this is the common cash-equity tick table. Check the exchange's current tick schedule before going live.

Hong Kong, by the price band the quote falls in:

Price upper bound (exclusive)tick
0.250.001
0.500.005
100.01
200.02
1000.05
2000.10
5000.20
10000.50
20001
50002
99955
above5

US: use 0.0001 when the price is below 1, otherwise 0.01. Shanghai and Shenzhen: 0.01. If the market is not in this table, stop and explain why.

5. Six checks

The fee rates are order-of-magnitude figures. Say in the output "check the broker's current fee schedule before going live". Do not use them for reconciliation.

MarketOne-side rateFixed fee per orderIntraday round trip
Hong Kong0.14%15 HKDAllowed
US0.005%1 USDAllowed
Shanghai / Shenzhen0.026%, plus 0.05% stamp duty on sells5 CNYNot allowed. Sell quantity is limited by the sellable quantity

G1 tick share = tick / (P0 × w). ≤ 10% PASS, 10%–20% WARN, > 20% FAIL. On FAIL, raise the grid width above tick / (P0 × 0.1), or change the symbol.

G2 fees as a share of gross profit = (2 × one-side rate × A + stamp-duty rate × A + 2 × fixed fee) / (A × w). ≤ 25% PASS, 25%–40% WARN, > 40% FAIL.

G3 capital required = the sum of price × shares per level across every buy level × 1.15. PASS when a budget exists and the requirement is ≤ the budget. Otherwise FAIL and write the shortfall. With no budget, only report the requirement and mark the result "not checked".

G4 uses the P10 and P90 of the closing prices over the last 120 trading days. The lower bound is the lowest buy level. The upper bound is the highest sell level. PASS when both sides are covered, WARN when only one side is covered, FAIL when neither is covered. If there are fewer than 120 daily bars, mark "not checked". Also report N × w: when it is below 10%, state that a one-sided breakout within half a year is likely.

G5 = w / average daily range. Average daily range is the median of (high − low) / close over the last 120 trading days. 0.5–0.7 PASS; 0.4–0.5 or 0.7–0.8 WARN; < 0.4 or ≥ 0.8 FAIL. If there are not 120 daily bars, mark "not checked".

G6: FAIL when N < 3 or N > 50; WARN when N > 10; otherwise PASS.

Use daily bars from the historical K-line endpoint, and keep the adjustment basis consistent. When the data is insufficient, G4 and G5 may be skipped. The result must say "not checked". Do not fill in an estimate and mark it PASS.

Math self-check (approximate Hong Kong fees, lot_size = 100): HK.00700, base price 410.40, 1% spacing, 5 levels, 1 lot. tick = 0.20. G1 = 4.9% PASS, G2 = 35.3% WARN, notional of the five buy levels is about 199,000 HKD, capital required is about 229,000 HKD. The pure functions in the program must match this set of numbers before the trading loop is written.

6. Split the program into four parts

  • Grid: level prices, the six checks, and capital required. No network access.
  • State file: local JSON. Fields must include at least the symbol, move type, down spacing, up spacing, level count, lot count, shares per lot, base price, whether it is stopped, the stop reason, the share quantity already in the account at startup, whether that quantity has been recorded, and the save time.
  • Broker adapter: wrap only the llms.md pages for account, funds, positions, place order, cancel order, open orders, order detail, quote snapshot, quote push, and trade push. Fields follow those pages.
  • Loop: reconcile on startup, then wake on pushes and a timer and reconcile again.

Base-price rules:

  • On the first start with a given parameter set, write the base price to the state file.
  • On a later start, if the symbol, move type, spacing, level count, and lot count are unchanged, keep using the base price in the file.
  • If the parameters changed, stop placing orders. Tell the user the old base price does not match the new parameters, and wait for the user to decide. Do not quietly recompute from the latest price.
  • If the state is stopped and the user has not explicitly said to continue, only query orders. Do not place new ones.

Order marks use short ASCII: g1b, g1s. The number is the level, b is buy, s is sell. Before placing an order, check the remark length limit on the order page. Cancel only open orders for the same symbol whose mark belongs to this strategy. Leave other orders in the account alone.

Read positions at startup. Record the shares already held then in the state file. Do not place sell orders for them, and do not use their cost for the drawdown check. Grid position = current position − this starting quantity, floored at 0.

7. Reconciliation loop

Quote pushes and trade pushes only wake the loop. After a disconnect, a duplicate push, or a partial fill, the next order query and position query decide which orders to place. Also reconcile on a timer of about 20 seconds. On a rate-limit error, back off and do not place replacement orders in that round.

If the price is below the lowest buy level or above the highest sell level: record the stop reason, cancel this strategy's open orders, leave the position in place, and save the state. Do not add levels downward or upward.

When the user set a drawdown stop: estimate the grid position cost from the buy-level prices of the shares still held. Do not use the account's blended cost. Stop and keep the position when (cost − latest price) / cost reaches the threshold.

Each level may change an order at most once per reconciliation. If that side already has one identical open order (same side, price, quantity, and mark), keep it. If the same level and side has two, cancel the extra one and decide whether to replace it on the next round.

For level i (i from 1 to N):

  • The buy price is the i-th lower level. The sell price is the i-th upper level. The quantity is the shares per level.
  • Net position at this level = filled buy shares at this level − filled sell shares. Partial fills use the filled quantity. A cancelled remainder is not a position.
  • Net position > 0: cancel this level's buy order and place a sell order for the sellable quantity. Round the sell quantity down to a whole lot. Do not exceed the shares per level or the sellable quantity. If the sellable quantity is not enough, wait for the next round.
  • When the net position returns to 0 and this level has had a sell fill: do not place a buy order again until the latest price rises through that level's sell price.
  • When the net position is 0 and a new buy is allowed: the buy price must be below the latest price. If it is not, cancel a resting buy and do not place a new one.
  • Check the sellable quantity before selling. Shares bought the same day in Shanghai or Shenzhen cannot be treated as sellable yet.

On process exit, cancel this strategy's open orders, keep the position, and write the state file.

8. Show this before handing it to the user

Before writing code or placing an order, show the four blocks below. If any check is FAIL, do not write "start implementing" in the first block.

  1. Parameter card: symbol, base price, move type, both spacings, level count, shares per lot, lots per level, budget, drawdown stop, paper or live. Print every defaulted value.
  2. Check table: the G1–G6 numbers and PASS / WARN / FAIL / not checked.
  3. Calculation basis: one formula line for every number that did not come from the user's own words.
  4. Risk: how this parameter set is most likely to lose money (at a drop to the lower bound, the price gap of each buy level versus the lower bound, times the shares per level); which items were not checked; whether the next step is to change the parameters, run the tests first, or connect to the paper account.

This skill generates and constrains a program. It does not forecast returns, and it does not replace the user's trading decision.

9. Acceptance

Make these checks into tests that do not access the network. Only after all of them pass may you say the program is written.

  • The HK.00700 self-check in section 5: G1, G2, and capital required match.
  • Buy prices round down and sell prices round up. After rounding, the price is farther from the base price than the raw price.
  • A second read of the state file with the same parameters leaves the base price unchanged.
  • A parameter change does not generate a new base price.
  • Two open orders with the same mark on the same level and side leave only one after reconciliation.
  • After a level's buy order is fully filled, the next round places a sell at that level's sell price. It does not move the order to somewhere near the fill price.
  • After the latest price breaks below the lowest buy level, the state is stopped and no new buy order is produced.
  • Shares already held at startup do not generate a sell order.
  • When the Shanghai or Shenzhen sellable quantity is 0, no sell order is placed.

When the user explicitly asks to run it, use the paper account's account, funds, positions, and orders pages. A live order happens only after the user has said to use the live account (for example 「使用实盘」).

10. Refuse outright

When the request is one of these, explain why and stop:

  • Level count below 3 or above 50
  • A check is still FAIL, but the user asks to place the orders anyway
  • Increase the lot size or add levels downward after a break below the lower bound
  • Design the grid as same-day buy and same-day sell for Shanghai or Shenzhen
  • Skip the fee calculation, or subtract one estimated fee from total profit only at the end
  • Remove the out-of-range stop because one look-back showed the stop missed some profit
  • Cancel or modify an order that does not carry this strategy's mark
  • Ask for, echo, or write a trading password or key in the conversation

常见问题

Futu Grid Strategy AI 技能有什么作用?

Guides an AI to implement a single-symbol base-price grid program on Futu OpenAPI: validate six parameter checks first, then write a restart-safe limit-order reconciliation loop, and accept it on a paper account. Use when the user wants a grid strategy, grid program, quantitative grid, or grid trading bot, or says 网格策略, 网格程序, 量化网格, 网格交易机器人, 实现网格, or 帮我写一个网格. Request fields follow the OpenAPI llms.md. This skill does not repeat request bodies. Paper account by default.

为什么在 TypingMind 中使用 Futu Grid Strategy?

因为您只需安装一次,就能搭配任何模型使用。Futu Grid Strategy 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Futu Grid Strategy?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/FutunnOpen/futu-agent-hub/tree/main/skills/strategy-skills/futu-grid-strategy。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Futu Grid Strategy?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Futu Grid Strategy 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Futu Grid Strategy 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Futu Grid Strategy AI 技能免费吗?

FutunnOpen 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇