fubon-cli Skill
Use this skill to execute fubon commands safely and return parseable results for downstream automation.
What This Skill Does
- - Executes
fubon-cli command groups end to end. - Keeps command usage aligned with actual CLI behavior.
- Returns standardized JSON output and error handling guidance.
- Supports order lifecycle workflows: login -> query -> place order -> verify -> adjust/cancel.
When To Use
Use this skill if the user asks for any of these intents:
- - Login/logout/session status for Fubon Neo.
- Place or manage stock/futures/options orders.
- Query inventory, unrealized PnL, settlement, balances, margin quota.
- Read market quotes, candles, trade details, movers, actives, snapshots, history.
- Subscribe to realtime market or callback streams.
- Manage conditional orders.
- Use natural language to produce trading commands (
fubon ask, fubon chat).
Preconditions
- 1. Install platform wheel for
fubon_neo. - Install
fubon-cli. - Ensure certificate files and account credentials are available.
Example:
CODEBLOCK0
Core Workflow
- 1. Authenticate first.
- Run requested query or order action.
- Inspect
success and error keys. - If placing an order, run follow-up query to confirm state.
CODEBLOCK1
Command Map
Auth
CODEBLOCK2
Command Surface
The Command Surface below lists the primary CLI entrypoints and example usages. These map 1:1 to the fubon-cli commands and are safe to invoke from automation when preconditions are met.
See the examples in the Command Map section for concrete invocations.
Stock
CODEBLOCK3
Account
CODEBLOCK4
Market
CODEBLOCK5
Realtime
CODEBLOCK6
Futures and Options
CODEBLOCK7
Conditional Orders
CODEBLOCK8
AI
CODEBLOCK9
Output Contract
Non-streaming commands:
CODEBLOCK10
Failure example:
CODEBLOCK11
Streaming commands output JSONL (one JSON object per line).
Execution Rules
- 1. Never assume login state; check status or handle not-logged-in errors.
- For orders, always confirm with
fubon stock orders or equivalent query command. - For retriable failures (network/transient), retry conservatively once.
- For parameter or auth failures, stop and surface exact
error text.
Safety Boundaries
- - Do not expose raw credentials in logs or chat output.
- Encourage verification of symbol, quantity, price, and account index before order placement.
- Prefer non-production or low-risk validation paths for first-time automation.
Release Binding
This skill is version-bound with fubon-cli.
- -
scripts/validate_skill_doc.py validates coverage. - INLINECODE15 builds skill artifact.
- INLINECODE16 publishes to clawhub endpoint.
- CI/CD should publish skill after package release to keep tool and skill synchronized.
Version Binding
This skill's version must be kept in sync with the fubon-cli package version. The CI/CD pipeline is configured to build and publish the skill bundle immediately after a successful package release so the skill metadata (skill.manifest.json) and SKILL.md match the released package.
- - Use
scripts/build_skill_bundle.py to create dist/skill artifacts tied to the current git tag or package version. - Use
scripts/publish_skill.py (requires CLAWHUB_API_TOKEN) to publish the bundle to the skill registry.
fubon-cli 技能
使用此技能安全地执行 fubon 命令,并为下游自动化返回可解析的结果。
该技能的功能
- - 端到端执行 fubon-cli 命令组。
- 确保命令用法与实际 CLI 行为保持一致。
- 返回标准化的 JSON 输出和错误处理指南。
- 支持订单生命周期工作流:登录 -> 查询 -> 下单 -> 验证 -> 调整/取消。
使用时机
当用户提出以下任一意图时,使用此技能:
- - 富邦 Neo 的登录/登出/会话状态。
- 下达或管理股票/期货/期权订单。
- 查询库存、未实现损益、结算、余额、融资额度。
- 读取市场报价、K线、成交明细、涨跌幅排行、活跃股、快照、历史数据。
- 订阅实时行情或回调流。
- 管理条件单。
- 使用自然语言生成交易指令(fubon ask、fubon chat)。
前置条件
- 1. 安装 fubon_neo 平台 wheel 包。
- 安装 fubon-cli。
- 确保证书文件和账户凭证可用。
示例:
bash
pip install ./wheels/fubonneo-2.2.8-cp37-abi3-winamd64.whl
pip install fubon-cli
核心工作流
- 1. 首先进行身份验证。
- 执行请求的查询或下单操作。
- 检查 success 和 error 字段。
- 如果下单,执行后续查询以确认状态。
bash
fubon login --id --password --cert-path --cert-password
fubon login --id --api-key KEY> --cert-path --cert-password PW>
fubon market quote 2330
fubon stock buy 2330 1000 --price 580
fubon stock orders
命令映射
认证
bash
fubon login --id --password --cert-path [--cert-password ]
fubon login status
fubon login logout
命令界面
下面的命令界面列出了主要的 CLI 入口点和示例用法。这些与 fubon-cli 命令一一对应,在满足前置条件时,可安全地从自动化流程中调用。
具体调用示例请参见命令映射部分。
股票
bash
fubon stock buy --price
fubon stock sell --price
fubon stock orders
fubon stock cancel
fubon stock modify-price NO> PRICE>
fubon stock modify-quantity NO> QTY>
账户
bash
fubon account inventory
fubon account unrealized
fubon account settlement
fubon account margin-quota
行情
bash
fubon market quote
fubon market ticker
fubon market candles --timeframe 5
fubon market trades --limit 50
fubon market snapshot TSE
fubon market movers TSE --direction up
fubon market actives TSE --trade volume
fubon market history --from 2024-01-01 --to 2024-06-30
实时行情
bash
fubon realtime subscribe
fubon realtime callbacks
期货与期权
bash
fubon futopt buy TXF202406 1 --price 20000
fubon futopt sell TXF202406 1 --price 20100
fubon futopt orders
条件单
bash
fubon condition create --payload {symbol:2330,trigger:{}}
fubon condition list
fubon condition cancel
AI
bash
fubon ask 台積電現在的價格是多少?
fubon chat
fubon config set openai-key
fubon config show
输出契约
非流式命令:
json
{
success: true,
data: {}
}
失败示例:
json
{
success: false,
error: Error message
}
流式命令输出 JSONL(每行一个 JSON 对象)。
执行规则
- 1. 切勿假设登录状态;检查状态或处理未登录错误。
- 对于订单,始终使用 fubon stock orders 或等效查询命令进行确认。
- 对于可重试的失败(网络/瞬时错误),保守重试一次。
- 对于参数或认证失败,停止执行并返回确切的 error 文本。
安全边界
- - 不要在日志或聊天输出中暴露原始凭证。
- 在下单前鼓励验证股票代码、数量、价格和账户索引。
- 首次自动化时,优先使用非生产环境或低风险的验证路径。
版本绑定
此技能与 fubon-cli 版本绑定。
- - scripts/validateskilldoc.py 验证覆盖率。
- scripts/buildskillbundle.py 构建技能产物。
- scripts/publish_skill.py 发布到 clawhub 端点。
- CI/CD 应在包发布后发布技能,以保持工具和技能的同步。
版本绑定
此技能的版本必须与 fubon-cli 包版本保持同步。CI/CD 管道配置为在成功发布包后立即构建和发布技能包,以便技能元数据(skill.manifest.json)和 SKILL.md 与发布的包匹配。
- - 使用 scripts/buildskillbundle.py 创建与当前 git 标签或包版本关联的 dist/skill 产物。
- 使用 scripts/publishskill.py(需要 CLAWHUBAPI_TOKEN)将包发布到技能注册表。