gmgn-portfolio

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Use the
gmgn-cli
tool to query wallet portfolio data based on the user's request.
使用
gmgn-cli
工具根据用户请求查询钱包投资组合数据。

Sub-commands

子命令

Sub-commandDescription
portfolio info
Wallets and main currency balances bound to the API Key
portfolio holdings
Wallet token holdings with P&L
portfolio activity
Transaction history
portfolio stats
Trading statistics (supports batch)
portfolio token-balance
Token balance for a specific token
子命令描述
portfolio info
API Key绑定的钱包及主币余额
portfolio holdings
包含盈亏的钱包代币持仓
portfolio activity
交易历史记录
portfolio stats
交易统计(支持批量查询)
portfolio token-balance
特定代币的余额

Supported Chains

支持的链

sol
/
bsc
/
base
sol
/
bsc
/
base

Prerequisites

前置条件

  • .env
    file with
    GMGN_API_KEY
    set
  • Run from the directory where your
    .env
    file is located, or set
    GMGN_HOST
    in your environment
  • 已配置
    GMGN_API_KEY
    .env
    文件
  • .env
    文件所在目录运行,或在环境变量中配置
    GMGN_HOST

Usage Examples

使用示例

bash
undefined
bash
undefined

API Key wallet info (no --chain or --wallet needed)

API Key对应的钱包信息(无需指定--chain或--wallet参数)

npx gmgn-cli portfolio info
npx gmgn-cli portfolio info

Wallet holdings (default sort)

钱包持仓(默认排序)

npx gmgn-cli portfolio holdings --chain sol --wallet <wallet_address>
npx gmgn-cli portfolio holdings --chain sol --wallet <wallet_address>

Holdings sorted by USD value, descending

按美元价值降序排列的持仓

npx gmgn-cli portfolio holdings
--chain sol --wallet <wallet_address>
--order-by usd_value --direction desc --limit 20
npx gmgn-cli portfolio holdings
--chain sol --wallet <wallet_address>
--order-by usd_value --direction desc --limit 20

Include sold-out positions

包含已清仓的持仓

npx gmgn-cli portfolio holdings --chain sol --wallet <wallet_address> --sell-out
npx gmgn-cli portfolio holdings --chain sol --wallet <wallet_address> --sell-out

Transaction activity

交易活动记录

npx gmgn-cli portfolio activity --chain sol --wallet <wallet_address>
npx gmgn-cli portfolio activity --chain sol --wallet <wallet_address>

Activity filtered by type

按类型筛选的交易活动

npx gmgn-cli portfolio activity --chain sol --wallet <wallet_address>
--type buy --type sell
npx gmgn-cli portfolio activity --chain sol --wallet <wallet_address>
--type buy --type sell

Activity for a specific token

特定代币的交易活动

npx gmgn-cli portfolio activity --chain sol --wallet <wallet_address>
--token <token_address>
npx gmgn-cli portfolio activity --chain sol --wallet <wallet_address>
--token <token_address>

Trading stats (default 7d)

交易统计(默认7天周期)

npx gmgn-cli portfolio stats --chain sol --wallet <wallet_address>
npx gmgn-cli portfolio stats --chain sol --wallet <wallet_address>

Trading stats for 30 days

30天周期的交易统计

npx gmgn-cli portfolio stats --chain sol --wallet <wallet_address> --period 30d
npx gmgn-cli portfolio stats --chain sol --wallet <wallet_address> --period 30d

Batch stats for multiple wallets

多个钱包的批量统计

npx gmgn-cli portfolio stats --chain sol
--wallet <wallet_1> --wallet <wallet_2>
npx gmgn-cli portfolio stats --chain sol
--wallet <wallet_1> --wallet <wallet_2>

Token balance

代币余额

npx gmgn-cli portfolio token-balance
--chain sol --wallet <wallet_address> --token <token_address>
undefined
npx gmgn-cli portfolio token-balance
--chain sol --wallet <wallet_address> --token <token_address>
undefined

Holdings Options

持仓查询选项

OptionDescription
--limit <n>
Page size (default
20
, max 50)
--cursor <cursor>
Pagination cursor
--order-by <field>
Sort field:
usd_value
/
price
/
unrealized_profit
/
realized_profit
/
total_profit
/
history_bought_cost
/
history_sold_income
(default
usd_value
)
--direction <asc|desc>
Sort direction (default
desc
)
--sell-out
Include sold-out positions
--show-small
Include small-value positions
--hide-abnormal
Hide abnormal positions
--hide-airdrop
Hide airdrop positions
--hide-closed
Hide closed positions
--hide-open
Hide open positions
选项描述
--limit <n>
每页数量(默认
20
,最大50)
--cursor <cursor>
分页游标
--order-by <field>
排序字段:
usd_value
/
price
/
unrealized_profit
/
realized_profit
/
total_profit
/
history_bought_cost
/
history_sold_income
(默认
usd_value
--direction <asc|desc>
排序方向(默认
desc
--sell-out
包含已清仓的持仓
--show-small
包含小额持仓
--hide-abnormal
隐藏异常持仓
--hide-airdrop
隐藏空投持仓
--hide-closed
隐藏已平仓持仓
--hide-open
隐藏未平仓持仓

Activity Options

交易活动查询选项

OptionDescription
--token <address>
Filter by token
--limit <n>
Page size
--cursor <cursor>
Pagination cursor
--type <type>
Repeatable:
buy
/
sell
/
add
/
remove
/
transfer
选项描述
--token <address>
按代币筛选
--limit <n>
每页数量
--cursor <cursor>
分页游标
--type <type>
可重复指定:
buy
/
sell
/
add
/
remove
/
transfer

Stats Options

交易统计选项

OptionDescription
--period <period>
Stats period:
7d
/
30d
(default
7d
)
选项描述
--period <period>
统计周期:
7d
/
30d
(默认
7d

Notes

注意事项

  • All portfolio commands use normal auth (API Key only, no signature required)
  • portfolio stats
    supports multiple
    --wallet
    flags for batch queries
  • Use
    --raw
    to get single-line JSON for further processing
  • 所有投资组合命令使用普通认证(仅需API Key,无需签名)
  • portfolio stats
    支持多个
    --wallet
    参数以进行批量查询
  • 使用
    --raw
    参数可获取单行JSON格式结果,以便后续处理