33 Commits

Author SHA1 Message Date
3855477155 refactor: flatten account command to a single balances view
Remove overview/balances/positions subcommands in favor of one
`account` command that returns all balances with an `is_dust` flag.
Add descriptions to every parser and expose -a/--agent and --doc
on all leaf commands for better help discoverability.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 18:19:19 +08:00
d629c25232 fix: resolve merge conflicts and lint issues
- Merge origin/main changes (flattened buy/sell commands, --doc flag, aliases)
- Fix spinner placement for buy/sell commands
- Fix duplicate alias key 'p' in canonical subcommands
- Remove unused mypy ignore comments in spot_client.py
- Fix nested with statements in tests

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 16:59:53 +08:00
4602583760 Merge remote-tracking branch 'origin/main' into main 2026-04-17 16:57:40 +08:00
ca0625b199 chore: bump version to 2.1.1
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 16:51:55 +08:00
a0e01ca56f chore: bump version to 2.1.0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 16:44:58 +08:00
f528575aa8 feat: add catlog command, agent flag reorder, and TUI polish
- Add `coinhunter catlog` with limit/offset pagination for audit logs
- Optimize audit log reading with deque to avoid loading all history
- Allow `-a/--agent` flag after subcommands
- Fix upgrade spinner artifact and empty line issues
- Render audit log TUI as timeline with low-saturation event colors
- Convert audit timestamps to local timezone in TUI
- Remove futures-related capabilities
- Add conda environment.yml for development
- Bump version to 2.0.9 and update README

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 16:42:47 +08:00
9224621d7e feat: add CLI aliases, flatten trade commands, and introduce --doc
- Add `coin` entry-point alias alongside `coinhunter`
- Add short aliases for all commands (e.g., a/acc, m, opp/o, b, s)
- Flatten `buy` and `sell` to top-level commands; remove `trade` parent
- Add `--doc` flag to print output schema and field descriptions per command
- Update README and tests
- Bump version to 2.1.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 00:40:24 +08:00
6923013694 fix: remove recvWindow from exchange_info wrapper
Binance exchangeInfo endpoint does not accept recvWindow, causing
RuntimeError when calling opportunity scan or any command that hits
exchange_info().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 20:21:45 +08:00
0f862957b0 refactor: remove all futures-related capabilities
Delete USDT-M futures support since the user's Binance API key does not
support futures trading. This simplifies the CLI to spot-only:

- Remove futures client wrapper (um_futures_client.py)
- Remove futures trade commands and close position logic
- Simplify account service to spot-only (no market_type field)
- Remove futures references from opportunity service
- Update README and tests to reflect spot-only architecture
- Bump version to 2.0.7

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 20:10:15 +08:00
680bd3d33c fix: allow -a/--agent flag after subcommands
- Preprocess argv to reorder agent flag before subcommand parsing.
- Enables usage like `coinhunter account overview -s -f -a`.
- Bump version to 2.0.6.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 19:19:12 +08:00
f06a1a34f1 feat: Braille spinner, shell completions, TUI polish
- Add with_spinner context manager with cyan Braille animation for human mode.
- Wrap all query/execution commands in cli.py with loading spinners.
- Integrate shtab: auto-install shell completions during init for zsh/bash.
- Add `completion` subcommand for manual script generation.
- Fix stale output_format default in DEFAULT_CONFIG.
- Add help descriptions to all second-level subcommands.
- Bump version to 2.0.5.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 19:12:23 +08:00
536425e8ea feat: add Braille spinner, shell completions, and TUI polish
- Add with_spinner context manager with cyan Braille animation for human mode.
- Wrap all query/execution commands in cli.py with loading spinners.
- Integrate shtab: auto-install shell completions during init for zsh/bash.
- Add `completion` subcommand for manual script generation.
- Fix stale output_format default in DEFAULT_CONFIG (json → tui).
- Add help descriptions to all second-level subcommands.
- Version 2.0.4.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 19:11:40 +08:00
b857ea33f3 refactor: rename update command to upgrade
- Align CLI verb with pipx/pip terminology (`pipx upgrade`).
- Rename internal `self_update` to `self_upgrade` for consistency.
- Update README and tests accordingly.
- Bump version to 2.0.4.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 18:50:14 +08:00
cdc90a9be1 fix: clean up update TUI output and suppress noisy stderr
- Add dedicated render branch for self_update results.
- Hide progress-only stderr on success to eliminate pipx noise.
- Remove generic "RESULT" heading from fallback key-value output.
- Bump version to 2.0.3.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 18:47:08 +08:00
9395978440 feat: human-friendly TUI output with --agent flag for JSON/compact
- Replace default JSON output with styled TUI tables and ANSI colors.
- Add -a/--agent global flag: small payloads → JSON, large → pipe-delimited compact.
- Update README to reflect new output behavior and remove JSON-first references.
- Bump version to 2.0.2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 18:36:23 +08:00
b78845eb43 feat: add self-update command and bump to 2.0.1
- Add `coinhunter update` CLI command for pipx/pip upgrade
- README: document update behavior and recommend pipx install
- Dynamic version badge with cacheSeconds=60
- Version bump: 2.0.0 → 2.0.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 18:00:43 +08:00
52cd76a750 refactor: rewrite to CoinHunter V2 flat architecture
Replace the V1 commands/services split with a flat, direct architecture:
- cli.py dispatches directly to service functions
- New services: account, market, trade, opportunity
- Thin Binance wrappers: spot_client, um_futures_client
- Add audit logging, runtime paths, and TOML config
- Remove legacy V1 code: commands/, precheck, review engine, smart executor
- Add ruff + mypy toolchain and fix edge cases in trade params

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 17:22:29 +08:00
3819e35a7b docs: recommend pipx for end-user installation to avoid externally-managed-environment errors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 01:37:31 +08:00
72f5bbcbb7 docs: swap header emoji to coin
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v1.0.0
2026-04-16 01:26:06 +08:00
da93f727e8 docs: refresh README with current architecture and beautified title
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 01:24:43 +08:00
62c40a9776 refactor: address high-priority debt and publish to PyPI
- Fix TOCTOU race conditions by wrapping read-modify-write cycles
  under single-file locks in execution_state, portfolio_service,
  precheck_state, state_manager, and precheck_service.
- Add missing test coverage (96 tests total):
  - test_review_service.py (15 tests)
  - test_check_api.py (6 tests)
  - test_external_gate.py main branches (+10 tests)
  - test_trade_execution.py new commands (+8 tests)
- Unify all agent-consumed JSON messages to English.
- Config-ize hardcoded values (volume filter, schema_version) via
  get_user_config with sensible defaults.
- Add 1-hour TTL to exchange cache with force_new override.
- Add ruff and mypy to dev dependencies; fix all type errors.
- Add __all__ declarations to 11 service modules.
- Sync README with new commands, config tuning docs, and PyPI badge.
- Publish package as coinhunter==1.0.0 on PyPI with MIT license.
- Deprecate coinhunter-cli==1.0.1 with runtime warning.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 01:21:27 +08:00
01bb54dee5 chore: migrate gstack from vendored to team mode 2026-04-15 22:49:40 +08:00
759086ebd7 chore: add gstack skill routing rules to CLAUDE.md 2026-04-15 22:47:31 +08:00
5fcdd015e1 chore: remove auto-trader command and aliases from CLI 2026-04-15 22:21:36 +08:00
f59388f69a docs: refresh README with current architecture and beautified title 2026-04-15 21:31:08 +08:00
a61c329496 refactor: split precheck_core and migrate commands to commands/
- Split 900-line precheck_core.py into 9 focused modules:
  precheck_constants, time_utils, data_utils, state_manager,
  market_data, candidate_scoring, snapshot_builder,
  adaptive_profile, trigger_analyzer
- Remove dead auto_trader command and module
- Migrate 7 root-level command modules into commands/:
  check_api, doctor, external_gate, init_user_state,
  market_probe, paths, rotate_external_gate_log
- Keep thin backward-compatible facades in root package
- Update cli.py MODULE_MAP to route through commands/
- Verified compileall and smoke tests for all key commands
2026-04-15 21:29:18 +08:00
db981e8e5f refactor: finish facade migration for precheck and executor 2026-04-15 20:50:38 +08:00
e6274d3a00 feat: polish exec cli ergonomics and output 2026-04-15 20:28:24 +08:00
f69facde0c refactor(smart_executor): split monolithic executor into clean service modules
- Extract 7 focused services from smart_executor.py:
  - trade_common: constants, timezone, logging, dry-run state
  - file_utils: file locking + atomic JSON helpers
  - smart_executor_parser: argparse + legacy argument compatibility
  - execution_state: decision deduplication (executions.json)
  - portfolio_service: positions.json + exchange reconciliation
  - exchange_service: ccxt wrapper, balances, order prep
  - trade_execution: buy/sell/rebalance/hold actions
- Turn smart_executor.py into a thin backward-compatible facade
- Fix critical dry-run bug: module-level DRY_RUN copy caused real orders
  in dry-run mode; replace with mutable dict + is_dry_run() function
- Fix dry-run polluting positions.json: skip save_positions() when dry-run
- Fix rebalance dry-run budget: use sell_order cost instead of real balance
- Add full legacy CLI compatibility for old --decision HOLD --dry-run style
v0.1.1
2026-04-15 18:39:08 +08:00
893f0fb077 refactor: split precheck state snapshot and analysis 2026-04-15 17:17:00 +08:00
965b53b598 refactor: split precheck and smart executor entrypoints 2026-04-15 17:03:16 +08:00
6eefabb9ff feat: add runtime diagnostics and path management 2026-04-15 16:55:45 +08:00
7586685d5f feat: bootstrap coinhunter cli package 2026-04-15 16:40:56 +08:00