leapcat-trading

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LeapCat Stock Trading Skill

LeapCat 股票交易 Skill

Place, monitor, and cancel stock trading orders using the leapcat.
使用 leapcat 提交、监控和取消股票交易订单。

Prerequisites

前置要求

  • Node.js 18+ is required (commands use
    npx leapcat@latest
    which auto-downloads the CLI)
  • User must be authenticated — run
    npx leapcat@latest auth login --email <email>
    first
  • KYC must be completed and approved
  • Trade password must be set
  • 需要 Node.js 18+ 版本(命令使用
    npx leapcat@latest
    会自动下载 CLI)
  • 用户必须完成身份验证——请先运行
    npx leapcat@latest auth login --email <email>
  • 必须完成 KYC 并通过审核
  • 必须设置交易密码

Commands

命令说明

trading place-order

trading place-order

Place a new stock order (buy or sell).
bash
npx leapcat@latest trading place-order \
  --symbol <symbol> \
  --exchange <exchange> \
  --side <BUY|SELL> \
  --order-type <LIMIT|MARKET> \
  --quantity <qty> \
  [--price <price>] \
  [--source <source>] \
  [--stock-name <name>] \
  [--idempotency-key <key>] \
  --json
Parameters:
  • --symbol <symbol>
    — Stock ticker symbol (e.g.,
    AAPL
    ,
    9988.HK
    )
  • --exchange <exchange>
    — Exchange code (e.g.,
    NASDAQ
    ,
    HKEX
    )
  • --side <BUY|SELL>
    — Order direction
  • --order-type <LIMIT|MARKET>
    — Order type; use
    LIMIT
    for a specific price or
    MARKET
    for best available price
  • --quantity <qty>
    — Number of shares
  • --price <price>
    — Limit price (required for LIMIT orders, ignored for MARKET)
  • --source <source>
    — Order source identifier (default:
    CLI
    )
  • --stock-name <name>
    — Human-readable stock name (optional, for display purposes)
  • --idempotency-key <key>
    — Unique key to prevent duplicate orders (optional but recommended)
提交新的股票订单(买入或卖出)。
bash
npx leapcat@latest trading place-order \
  --symbol <symbol> \
  --exchange <exchange> \
  --side <BUY|SELL> \
  --order-type <LIMIT|MARKET> \
  --quantity <qty> \
  [--price <price>] \
  [--source <source>] \
  [--stock-name <name>] \
  [--idempotency-key <key>] \
  --json
参数说明:
  • --symbol <symbol>
    — 股票代码(例如:
    AAPL
    9988.HK
  • --exchange <exchange>
    — 交易所代码(例如:
    NASDAQ
    HKEX
  • --side <BUY|SELL>
    — 订单方向
  • --order-type <LIMIT|MARKET>
    — 订单类型;指定价格下单选择
    LIMIT
    (限价单),以当前最优价下单选择
    MARKET
    (市价单)
  • --quantity <qty>
    — 交易股数
  • --price <price>
    — 限价单价格(限价单必填,市价单会忽略该参数)
  • --source <source>
    — 订单来源标识(默认值:
    CLI
  • --stock-name <name>
    — 易读的股票名称(可选,用于展示)
  • --idempotency-key <key>
    — 用于防止重复下单的唯一密钥(可选但推荐使用)

trading list-orders

trading list-orders

List the user's orders with optional filters.
bash
npx leapcat@latest trading list-orders [--status <status>] [--symbol <symbol>] --json
Parameters:
  • --status <status>
    — Filter by order status (e.g.,
    PENDING
    ,
    FILLED
    ,
    CANCELLED
    )
  • --symbol <symbol>
    — Filter by stock symbol
列出用户的订单,支持可选筛选条件。
bash
npx leapcat@latest trading list-orders [--status <status>] [--symbol <symbol>] --json
参数说明:
  • --status <status>
    — 按订单状态筛选(例如:
    PENDING
    (待成交)、
    FILLED
    (已成交)、
    CANCELLED
    (已取消))
  • --symbol <symbol>
    — 按股票代码筛选

trading get-order

trading get-order

Get details of a specific order.
bash
npx leapcat@latest trading get-order --order-id <id> --json
Parameters:
  • --order-id <id>
    — The order identifier
获取指定订单的详情。
bash
npx leapcat@latest trading get-order --order-id <id> --json
参数说明:
  • --order-id <id>
    — 订单ID

trading cancel-order

trading cancel-order

Cancel a pending order.
bash
npx leapcat@latest trading cancel-order --order-id <id> --json
Parameters:
  • --order-id <id>
    — The order identifier to cancel
取消待成交的订单。
bash
npx leapcat@latest trading cancel-order --order-id <id> --json
参数说明:
  • --order-id <id>
    — 要取消的订单ID

Workflow

使用流程

  1. Get a market quote — Use
    npx leapcat@latest market quote --symbol <symbol> --exchange <exchange> --json
    to check the current price.
  2. Place an order — Run
    trading place-order
    with the desired parameters. For limit orders, set
    --price
    based on the quote data. Consider using
    --idempotency-key
    to avoid duplicate submissions.
  3. Monitor order status — Run
    trading get-order --order-id <id> --json
    or
    trading list-orders --json
    to track the order.
  4. Cancel if needed — Run
    trading cancel-order --order-id <id> --json
    to cancel a pending/unfilled order.
  1. 获取市场行情 — 运行
    npx leapcat@latest market quote --symbol <symbol> --exchange <exchange> --json
    查看当前价格。
  2. 提交订单 — 按需填写参数运行
    trading place-order
    。如果是限价单,请根据行情数据设置
    --price
    。推荐使用
    --idempotency-key
    避免重复提交订单。
  3. 监控订单状态 — 运行
    trading get-order --order-id <id> --json
    或者
    trading list-orders --json
    跟踪订单状态。
  4. 按需取消订单 — 运行
    trading cancel-order --order-id <id> --json
    取消待成交/未成交的订单。

Error Handling

错误处理

ErrorCauseResolution
NOT_AUTHENTICATED
Session expiredRe-authenticate with
auth login
KYC_NOT_APPROVED
KYC verification incompleteComplete the KYC flow first
TRADE_PASSWORD_NOT_SET
Trade password requiredSet via
auth trade-password set
INSUFFICIENT_BALANCE
Not enough funds for the buy orderDeposit funds via wallet
INVALID_SYMBOL
Unrecognized stock symbolVerify symbol with
market stocks --json
MARKET_CLOSED
Market is not open for tradingWait for market hours or place a limit order
ORDER_NOT_FOUND
Invalid order IDRe-check with
trading list-orders --json
CANCEL_NOT_ALLOWED
Order already filled or cancelledNo further action possible
DUPLICATE_ORDER
Idempotency key already usedUse a new idempotency key or check existing order
错误码原因解决方案
NOT_AUTHENTICATED
会话过期使用
auth login
重新登录验证
KYC_NOT_APPROVED
KYC验证未完成先完成KYC认证流程
TRADE_PASSWORD_NOT_SET
需要设置交易密码通过
auth trade-password set
设置交易密码
INSUFFICIENT_BALANCE
买入订单所需资金不足通过钱包充值
INVALID_SYMBOL
无法识别的股票代码使用
market stocks --json
验证股票代码是否正确
MARKET_CLOSED
市场未开放交易等待开盘后操作,或者提交限价单
ORDER_NOT_FOUND
订单ID无效运行
trading list-orders --json
重新核对订单ID
CANCEL_NOT_ALLOWED
订单已成交或已取消无需进一步操作
DUPLICATE_ORDER
幂等键已被使用使用新的幂等键,或者查询已存在的订单