cb is a Node.js CLI for Coinbase account, product, and order workflows.
- Node.js
>=20 - npm
- From source (recommended while developing):
npm installnpm run buildnpm link
- Or install globally from this repository:
npm install -g .
After either method, run with:
cb <command> [options]
Note:
- This project depends on
cb-libfrom GitHub (git+https://github.com/benjaminjnoack/cb-lib.git#v3.0.0). - Installing dependencies requires GitHub access for that dependency (local and CI).
- Create
.envfrom the example:cp .env.example .env
- Set:
HELPER_COINBASE_CREDENTIALS_PATH=/absolute/path/to/coinbase-credentials.json- This is currently the only required env var in
.env. - See cb-lib README for more information.
- Keep secrets local:
.envis ignored and should never be committed.
Run in development without building:
npm run dev -- <command> [options]
Run built CLI directly:
npm run buildnode dist/cli.js <command> [options]
Get help:
cb --helpcb <command> --help
cb accounts [product] [--crypto] [--cash](alias:account)cb balance(alias:usd)cb cashcb fees
cb product [product]cb price [product]
cb buy [product] [--baseSize <baseSize>] [--value <value>]cb sell [product] [--baseSize <baseSize>] [--value <value>]cb market <product> (--buy | --sell) [--baseSize <baseSize>] [--value <value>]
cb bid [product] [--baseSize <baseSize>] [--value <value>] [--no-postOnly]cb ask [product] [--baseSize <baseSize>] [--value <value>] [--no-postOnly]cb limit [product] (--buy | --sell) [--baseSize <baseSize>] [--value <value>] --limitPrice <limitPrice> [--no-postOnly]cb stop [product] --baseSize <baseSize> --limitPrice <limitPrice> --stopPrice <stopPrice>cb bracket [product] --baseSize <baseSize> --limitPrice <limitPrice> --stopPrice <stopPrice>cb max [product]
cb plan [product] --buyPrice <price> --stopPrice <stopPrice> --takeProfitPrice <takeProfitPrice> [--riskPercent <riskPercent>] [--bufferPercent <bufferPercent>] [--all-in] [--dryRunFlag] [--no-postOnly]
Notes:
--all-insizes to max affordable position and overrides risk-based sizing.--riskPercentand--bufferPercenthave defaults.--dryRunFlagdoes not place orders and sizes using USDtotal(notavailable).
cb orders [product](alias:open)cb order <order_id>cb cancel <order_id>
npm run lintnpm run typechecknpm run testnpm run buildnpm run release:check
- Tests block all outbound network calls by default through
test/setup/no-network.ts. - Any real
http,https, orfetchusage in tests must be mocked explicitly.
Project development workflow, tooling, and CI details are in CONTRIBUTING.md.