Skip to content

cuwan v0.0.1: grid bots on a smaller base - #28

Merged
sgnd merged 17 commits into
mainfrom
feat/v0-0-1-rewrite
Nov 23, 2026
Merged

sgnd merged 17 commits into
mainfrom
feat/v0-0-1-rewrite

Conversation

@sgnd

@sgnd sgnd commented Nov 23, 2026

Copy link
Copy Markdown
Owner

The first release of cuwan, v0.0.1, written again from a smaller base. The old tree was 7,583 lines; this one is about 4,600. Only the Hyperliquid driver, the row seal, the output envelope and the entry point are kept from it.

What it does

  • Grid bots on Binance (spot and USD-M, live) and Hyperliquid (perps, testnet only). The bot runs in the foreground, refills each filled order, and resumes by client order ID after a restart.
  • Range exits: --on-exit pause (the default), stop or trail, plus --take-profit and --stop-loss.
  • A bot needs an explicit size: --order-size or --quote-amount.
  • The preventive close reads the mark price and fires before the liquidation price. It runs before every other rule and has no switch. The formula and a table of cases are in docs/design/guard.md.
  • Flatten closes the bot's own position. On futures it uses reduce-only orders; on spot it sells back what the bot bought.
  • One sealed store file with a chained audit log. The store key is generated and kept in the macOS keychain or the Linux Secret Service.
  • Live orders, stops and removals need a person's yes. Secrets come from stdin only. Errors never carry a key or a signed query.
  • guide install, the agent skill and AGENTS.md list exactly the binary's commands. Tests fail when they drift.
  • macOS and Linux builds only; Windows waits for a key store backend.

Checks

  • go vet, go test ./...: all packages pass.
  • govulncheck: no vulnerabilities, on Go 1.27.4.
  • gosec: 0 findings. make build and make lint pass.
  • zizmor: 0 high, 0 medium. actionlint: clean.
  • 13 deliberate breaks of the safety rules were each caught by a test.

Draft until review. Not tagged.

Closes #21

🤖 Generated with Claude Code

sgnd and others added 17 commits November 22, 2026 21:19
Kept untouched: internal/exchangex/hyperliquid, internal/sealrow,
internal/out, cmd/cuwan, and the exchangex root until its trimmed
replacement lands. The build is broken until the new code lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; keychain: generated 256-bit key, no key file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ors, clean errors, no paper mode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…quidation bound; explicit order size; spot flatten sells back

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lease workflow, macOS and Linux dist

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing, the record stays in git

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…must be finite; a person confirms at the terminal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ame each part; docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sgnd
sgnd marked this pull request as ready for review November 23, 2026 01:37
@sgnd
sgnd merged commit dc42aa2 into main Nov 23, 2026
8 checks passed
@sgnd
sgnd deleted the feat/v0-0-1-rewrite branch November 23, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CW14: CLI: M3 refill loop and range exits

1 participant