longbridge-positions

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

longbridge-positions

longbridge-positions

Read-only account snapshot — what the user holds, how much cash, what they can buy/sell, and per-symbol margin ratios.
Response language: match the user's input language — Simplified Chinese / Traditional Chinese / English.
Privacy: the data here is the user's private account state. Only return detailed numbers in direct conversation; if you suspect screen-sharing or third-party observation, confirm before showing exact figures.
只读账户快照——用户持仓情况、现金金额、可买卖数量,以及各标的的保证金率。
响应语言:匹配用户输入语言——简体中文/繁体中文/英文。
隐私说明:此处数据为用户私人账户状态。仅在直接对话中返回详细数字;若怀疑存在屏幕共享或第三方观察,需先确认再显示具体数值。

Subcommands

子命令

Run
longbridge <subcommand> --help
to confirm current flags / defaults if anything below seems off.
CLI commandReturns
longbridge portfolio --format json
Combined view: total assets, P/L, intraday P/L, holdings, and cash breakdown. Single call — useful for "account snapshot" questions.
longbridge positions --format json
Stock holdings array.
longbridge fund-positions --format json
Fund holdings array.
longbridge assets [--currency USD|HKD|CNY|SGD] --format json
Net assets, cash, buy power, margins; per-currency breakdown in
cash_infos
.
longbridge margin-ratio <SYMBOL> --format json
Initial / maintenance / forced-liquidation factors for a symbol.
longbridge max-qty <SYMBOL> --side buy|sell [--price <p>] [--order-type LO|MO|ELO|ALO] --format json
Estimated max purchasable / sellable quantity (cash vs margin).
若以下内容有疑问,运行
longbridge <subcommand> --help
确认当前参数/默认值。
CLI 命令返回内容
longbridge portfolio --format json
综合视图:总资产、盈亏、日内盈亏、持仓情况及现金明细。单次调用——适用于“账户快照”类问题。
longbridge positions --format json
股票持仓数组。
longbridge fund-positions --format json
基金持仓数组。
longbridge assets [--currency USD|HKD|CNY|SGD] --format json
净资产、现金、购买力、保证金;
cash_infos
中包含分币种明细。
longbridge margin-ratio <SYMBOL> --format json
某一标的的初始/维持/强制平仓保证金系数。
longbridge max-qty <SYMBOL> --side buy|sell [--price <p>] [--order-type LO|MO|ELO|ALO] --format json
预估最大可买/可卖数量(现金 vs 保证金)。

When to use

使用场景

  • "我的持仓", "我有什么股票", "我的持倉"
    positions
  • "账户余额", "我有多少美金 / 港币", "current USD balance"
    assets --currency USD
  • "我的基金持仓"
    fund-positions
  • "NVDA 我能买多少股", "how many TSLA can I buy"
    max-qty <SYMBOL> --side buy --price <current>
    (limit) or
    --order-type MO
    (market)
  • "茅台保证金率"
    margin-ratio 600519.SH
  • "看一下我的账户全貌", "account snapshot"
    portfolio
    (one call gives total assets + P/L + holdings + cash)
  • "我的浮盈"
    portfolio
    already includes intraday P/L; otherwise
    positions
    + chain to
    longbridge-quote
    for live last price
  • "我的持仓", "我有什么股票", "我的持倉"
    positions
  • "账户余额", "我有多少美金 / 港币", "current USD balance"
    assets --currency USD
  • "我的基金持仓"
    fund-positions
  • "NVDA 我能买多少股", "how many TSLA can I buy"
    max-qty <SYMBOL> --side buy --price <current>
    (限价单)或
    --order-type MO
    (市价单)
  • "茅台保证金率"
    margin-ratio 600519.SH
  • "看一下我的账户全貌", "account snapshot"
    portfolio
    (单次调用即可获取总资产+盈亏+持仓+现金信息)
  • "我的浮盈"
    portfolio
    已包含日内盈亏;否则可通过
    positions
    结合
    longbridge-quote
    获取实时最新价格计算

max-qty workflow

max-qty 工作流程

  1. Limit order (default LO): first call
    longbridge quote <SYMBOL> --format json
    for the current last price → pass it as
    --price
    .
  2. Market order: skip price; pass
    --order-type MO
    .
  3. The response includes
    cash_max_qty
    (cash only) and
    margin_max_qty
    (with financing). Always disclose both numbers and remind the user that financing carries interest cost + forced-liquidation risk.
  1. 限价单(默认LO):先调用
    longbridge quote <SYMBOL> --format json
    获取当前最新价格 → 将其作为
    --price
    参数传入。
  2. 市价单:无需价格参数;传入
    --order-type MO
  3. 响应结果包含
    cash_max_qty
    (仅现金)和
    margin_max_qty
    (融资)。需始终告知用户这两个数值,并提醒用户融资会产生利息成本及强制平仓风险。

CLI

CLI

bash
longbridge portfolio                                                  --format json
longbridge positions                                                  --format json
longbridge fund-positions                                             --format json
longbridge assets --currency USD                                      --format json
longbridge margin-ratio TSLA.US                                       --format json
longbridge max-qty TSLA.US --side buy --price 250                     --format json
bash
longbridge portfolio                                                  --format json
longbridge positions                                                  --format json
longbridge fund-positions                                             --format json
longbridge assets --currency USD                                      --format json
longbridge margin-ratio TSLA.US                                       --format json
longbridge max-qty TSLA.US --side buy --price 250                     --format json

Output

输出内容

  • portfolio
    : combined object with total assets, P/L, intraday P/L, holdings list, cash breakdown.
  • positions
    /
    fund-positions
    : array of holding rows.
  • assets
    : per-currency
    cash_infos
    array plus net-assets / buy-power / margin fields.
  • margin-ratio
    :
    {im_factor, mm_factor, fm_factor}
    .
  • max-qty
    :
    {cash_max_qty, margin_max_qty}
    .
  • portfolio
    :包含总资产、盈亏、日内盈亏、持仓列表、现金明细的综合对象。
  • positions
    /
    fund-positions
    :持仓记录数组。
  • assets
    :分币种的
    cash_infos
    数组,以及净资产/购买力/保证金字段。
  • margin-ratio
    {im_factor, mm_factor, fm_factor}
  • max-qty
    {cash_max_qty, margin_max_qty}

OAuth scope

OAuth 权限范围

Requires the trade scope on the OAuth token. If the token lacks it, both CLI and MCP fail with
unauthorized
/
not in authorized scope
. Tell the user to re-authorise:
longbridge auth logout && longbridge auth login
(and tick "Trade" in the browser).
OAuth token需要包含交易权限。若token缺少该权限,CLI和MCP都会返回
unauthorized
/
not in authorized scope
错误。告知用户重新授权:
longbridge auth logout && longbridge auth login
(并在浏览器中勾选“Trade”选项)。

Error handling

错误处理

If
longbridge
is missing, fall back to MCP. If stderr contains
unauthorized
/
not in authorized scope
, the OAuth token lacks trade scope — guide the user through re-auth (see "OAuth scope" above). Other stderr messages relay verbatim.
longbridge
未安装, fallback到MCP。若 stderr包含
unauthorized
/
not in authorized scope
,说明OAuth token缺少交易权限——引导用户按上述“OAuth权限范围”步骤重新授权。其他stderr信息直接原样反馈。

MCP fallback

MCP 备选方案

CLI subcommandMCP tool
portfolio
merge
stock_positions
+
fund_positions
+
account_balance
(no combined MCP tool)
positions
mcp__longbridge__stock_positions
fund-positions
mcp__longbridge__fund_positions
assets
mcp__longbridge__account_balance
margin-ratio
mcp__longbridge__margin_ratio
max-qty
mcp__longbridge__estimate_max_purchase_quantity
MCP-only extensions:
mcp__longbridge__profit_analysis
/
profit_analysis_detail
(P/L analysis),
mcp__longbridge__exchange_rate
(currency conversion). For "how is my P&L this month?" route to
longbridge-portfolio
.
CLI子命令MCP工具
portfolio
合并
stock_positions
+
fund_positions
+
account_balance
(无专门的综合MCP工具)
positions
mcp__longbridge__stock_positions
fund-positions
mcp__longbridge__fund_positions
assets
mcp__longbridge__account_balance
margin-ratio
mcp__longbridge__margin_ratio
max-qty
mcp__longbridge__estimate_max_purchase_quantity
仅MCP支持的扩展功能:
mcp__longbridge__profit_analysis
/
profit_analysis_detail
(盈亏分析)、
mcp__longbridge__exchange_rate
(货币兑换)。对于*"我本月盈亏如何?"*这类问题,路由到
longbridge-portfolio

Related skills

相关技能

  • Orders / executions / cash flow →
    longbridge-orders
  • Watchlist (read) →
    longbridge-watchlist
  • Account-level P&L analysis →
    longbridge-portfolio
  • 订单/成交/现金流 →
    longbridge-orders
  • 观察列表(只读) →
    longbridge-watchlist
  • 账户级盈亏分析 →
    longbridge-portfolio

File layout

文件结构

longbridge-positions/
└── SKILL.md          # prompt-only, no scripts/
longbridge-positions/
└── SKILL.md          # 仅含提示词,无scripts/目录