From b7302f525377f9b75059b17a3cf5e8ed80140bce Mon Sep 17 00:00:00 2001 From: David Lau Date: Fri, 27 Mar 2026 18:25:08 +0800 Subject: [PATCH] fix: move wallet_holdings filter defaults to CLI, remove no-op flags Portfolio holdings to return empty results for wallets that only have closed positions (issue #21). Changes: - Convert --hide-closed, --hide-airdrop, --hide-abnormal to value options with explicit defaults (hide_closed=true, hide_airdrop=true, hide_abnormal=false), so defaults are enforced by the CLI and users can override with e.g. --hide-closed false - Remove --sell-out and --show-small which are hard-coded in the service and were never forwarded to the upstream API - Update SKILL.md to reflect new option signatures and defaults Fixes #21 Co-Authored-By: Claude Sonnet 4.6 --- skills/gmgn-portfolio/SKILL.md | 8 +++----- src/commands/portfolio.ts | 16 ++++++---------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/skills/gmgn-portfolio/SKILL.md b/skills/gmgn-portfolio/SKILL.md index 5f71689..68a05b6 100644 --- a/skills/gmgn-portfolio/SKILL.md +++ b/skills/gmgn-portfolio/SKILL.md @@ -81,11 +81,9 @@ gmgn-cli portfolio token-balance \ | `--cursor ` | Pagination cursor | | `--order-by ` | Sort field: `usd_value` / `last_active_timestamp` / `realized_profit` / `unrealized_profit` / `total_profit` / `history_bought_cost` / `history_sold_income` (default `usd_value`) | | `--direction ` | 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-abnormal ` | Hide abnormal positions: `true` / `false` (default: `false`) | +| `--hide-airdrop ` | Hide airdrop positions: `true` / `false` (default: `true`) | +| `--hide-closed ` | Hide closed positions: `true` / `false` (default: `true`) | | `--hide-open` | Hide open positions | ## `portfolio activity` Options diff --git a/src/commands/portfolio.ts b/src/commands/portfolio.ts index f975e02..f273757 100644 --- a/src/commands/portfolio.ts +++ b/src/commands/portfolio.ts @@ -17,11 +17,9 @@ export function registerPortfolioCommands(program: Command): void { .option("--order-by ", "Sort field: usd_value / last_active_timestamp / realized_profit / unrealized_profit / total_profit / history_bought_cost / history_sold_income", "usd_value") .option("--direction ", "Sort direction: asc / desc", "desc") .option("--interval ", "Stats interval (default 24h)") - .option("--sell-out", "Include sold-out positions") - .option("--show-small", "Include small-value positions") - .option("--hide-abnormal", "Hide abnormal positions") - .option("--hide-airdrop", "Hide airdrop positions") - .option("--hide-closed", "Hide closed positions") + .option("--hide-abnormal ", "Hide abnormal positions (default: false)", "false") + .option("--hide-airdrop ", "Hide airdrop positions (default: true)", "true") + .option("--hide-closed ", "Hide closed positions (default: true)", "true") .option("--hide-open", "Hide open positions") .option("--tx30d", "Only show positions with trades in last 30 days") .option("--raw", "Output raw JSON") @@ -34,11 +32,9 @@ export function registerPortfolioCommands(program: Command): void { if (opts.orderBy) extra["order_by"] = opts.orderBy; if (opts.direction) extra["direction"] = opts.direction; if (opts.interval) extra["interval"] = opts.interval; - if (opts.sellOut) extra["sell_out"] = "true"; - if (opts.showSmall) extra["show_small"] = "true"; - if (opts.hideAbnormal) extra["hide_abnormal"] = "true"; - if (opts.hideAirdrop) extra["hide_airdrop"] = "true"; - if (opts.hideClosed) extra["hide_closed"] = "true"; + extra["hide_abnormal"] = opts.hideAbnormal; + extra["hide_airdrop"] = opts.hideAirdrop; + extra["hide_closed"] = opts.hideClosed; if (opts.hideOpen) extra["hide_open"] = "true"; if (opts.tx30d) extra["tx30d"] = "true";