@coinbase/coinbase-cli 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +94 -94
- package/dist/version.txt +1 -1
- package/package.json +1 -1
- package/skills/coinbase/SKILL.md +3 -2
- package/skills/coinbase-equities/SKILL.md +49 -0
- package/skills/coinbase-market-data/SKILL.md +2 -1
- package/skills/coinbase-portfolios/SKILL.md +2 -0
- package/skills/coinbase-x402/SKILL.md +62 -0
package/dist/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.7
|
package/package.json
CHANGED
package/skills/coinbase/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: coinbase
|
|
3
|
-
description: Umbrella skill for the coinbase CLI — the agent-first interface to the Coinbase Advanced Trade brokerage. Use when the user mentions Coinbase trading, spot orders, crypto prices, balances, portfolios,
|
|
3
|
+
description: Umbrella skill for the coinbase CLI — the agent-first interface to the Coinbase Advanced Trade brokerage and curated x402 resources. Use when the user mentions Coinbase trading, spot orders, crypto prices, balances, portfolios, conversions, x402 payments, or wants to know which coinbase tool/lane to use. Indexes the granular journey skills and explains auth, env, and MCP-vs-CLI selection.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# coinbase CLI
|
|
@@ -53,7 +53,7 @@ Add MCP with: `claude mcp add --scope user --transport stdio coinbase -- coinbas
|
|
|
53
53
|
|
|
54
54
|
## Install agent skills
|
|
55
55
|
|
|
56
|
-
Skills give your agent step-by-step guidance for common Coinbase workflows (trading, market data, watch, convert, portfolios).
|
|
56
|
+
Skills give your agent step-by-step guidance for common Coinbase workflows (trading, market data, watch, convert, portfolios, x402).
|
|
57
57
|
|
|
58
58
|
```sh
|
|
59
59
|
coinbase skills add
|
|
@@ -105,3 +105,4 @@ Output: `stdout` = raw JSON (parseable), `stderr` = human status/errors. Exit `0
|
|
|
105
105
|
| `coinbase-watch` | trigger an action on a live condition (`--until` watchers) |
|
|
106
106
|
| `coinbase-convert` | convert between currencies (USDC ↔ USD, etc.) |
|
|
107
107
|
| `coinbase-portfolios` | list / create / manage portfolios, move funds between them |
|
|
108
|
+
| `coinbase-x402` | discover curated x402 resources, pay and fetch them, attach the correct v1/v2 payment header |
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coinbase-equities
|
|
3
|
+
description: Places and manages equity (stock) orders on Coinbase Advanced Trade — market/limit orders, trading sessions (pre-market, regular, after-hours, overnight, multi-session), and halted-symbol handling. Use when the user wants to buy or sell a stock/ETF, or asks about equity trading sessions, market hours, or halts. Uses the same `coinbase orders`/`coinbase products` commands as crypto (see `coinbase-trading`), plus equity-only fields covered here. These are real orders.
|
|
4
|
+
requires: coinbase env configured with Trade permission (see `coinbase` skill)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# coinbase-equities
|
|
8
|
+
|
|
9
|
+
Equity (stock) orders use the same `coinbase orders create` command as crypto (see `coinbase-trading` for the shared market/limit/stop_limit mechanics, sizing, and order-management commands). This skill covers what's different for equities: **product IDs use the TICKER-QUOTE form** (e.g. `AAPL-USD` or `AAPL-USDC`, same shape as crypto pairs) — many tickers have separate USD and USDC listings, so a bare ticker like `AAPL` is rejected; you must pick the exact listing. Orders are also subject to **trading sessions** and **halts** — concepts that don't exist for 24/7 crypto.
|
|
10
|
+
|
|
11
|
+
**`orders preview` is not available for equities** — it's rejected upstream regardless of product or session. Go straight to `orders create` for equities (still preview first for crypto/futures).
|
|
12
|
+
|
|
13
|
+
## Trading sessions
|
|
14
|
+
|
|
15
|
+
`equity_trading_session` is required on every equity order:
|
|
16
|
+
|
|
17
|
+
- `NORMAL` — standard market hours. Only session that accepts market orders. Rejected (`untradable product`) if the market is currently closed.
|
|
18
|
+
- `PRE_MARKET` — pre-market hours. Whole-share limit orders only.
|
|
19
|
+
- `AFTER_HOURS` — after-hours session. Whole-share limit orders only.
|
|
20
|
+
- `OVERNIGHT` — overnight session. Whole-share limit orders only.
|
|
21
|
+
- `MULTI_SESSION` — spans pre-market + regular + after-hours in one order. Whole-share limit orders only.
|
|
22
|
+
|
|
23
|
+
"Whole-share limit orders only" means: `type=limit`, no `quote_size`, no fractional `base_size` — no market orders.
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
# Regular-hours market buy of $500 of AAPL
|
|
27
|
+
coinbase orders create product_id=AAPL-USD side=BUY type=market quote_size=500 \
|
|
28
|
+
equity_trading_session=NORMAL
|
|
29
|
+
|
|
30
|
+
# Pre-market limit buy — must be a whole-share limit order
|
|
31
|
+
coinbase orders create product_id=AAPL-USD side=BUY type=limit base_size=2 limit_price=195.00 \
|
|
32
|
+
equity_trading_session=PRE_MARKET
|
|
33
|
+
|
|
34
|
+
# Multi-session (pre-market + regular + after-hours) — must be a whole-share limit order
|
|
35
|
+
coinbase orders create product_id=AAPL-USD side=BUY type=limit base_size=2 limit_price=195.00 \
|
|
36
|
+
equity_trading_session=MULTI_SESSION
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`equity_order_date` (format `YYYY-MM-DD`) is optional and only needed if the user is scheduling an order for a specific trading day rather than today.
|
|
40
|
+
|
|
41
|
+
## Halts and closed markets
|
|
42
|
+
|
|
43
|
+
An order against a halted symbol or submitted when the requested session isn't open is rejected — market orders are also prohibited outside the core session for a symbol. If `coinbase orders create` fails, **report the rejection reason to the user rather than silently retrying** (e.g. with a different session or order type) — a different session may not be what they intended.
|
|
44
|
+
|
|
45
|
+
If the user wants to know whether a symbol is currently tradable, check `coinbase products get <TICKER-QUOTE>` before placing a market order during a session that might not be open.
|
|
46
|
+
|
|
47
|
+
## Everything else
|
|
48
|
+
|
|
49
|
+
Sizing (`quote_size`/`base_size`), preview, edit, cancel, fills, and portfolio scope work exactly as for crypto — see `coinbase-trading`. Equity positions and cash balance appear in `coinbase portfolios get` alongside crypto positions (`equity_positions`, `total_equities_balance`).
|
|
@@ -48,4 +48,5 @@ coinbase products list --jq '.products[].product_id' --paginate
|
|
|
48
48
|
## Notes
|
|
49
49
|
|
|
50
50
|
- For streaming/conditional reads ("tell me when BTC > 65k"), use `coinbase-watch` (`--until`), not polling loops.
|
|
51
|
-
- Market data is read-only and does not place orders. To act on a price, hand off to `coinbase-trading` (spot)
|
|
51
|
+
- Market data is read-only and does not place orders. To act on a price, hand off to `coinbase-trading` (spot), `coinbase-futures` (CFM dated futures), or `coinbase-equities` (stocks).
|
|
52
|
+
- Unlike crypto (always open), an equity quote can be stale outside its trading session, and a halted symbol won't move at all — check `coinbase products get <TICKER-QUOTE>` before treating an equity price as tradable now.
|
|
@@ -27,6 +27,8 @@ coinbase portfolios delete <portfolio_uuid>
|
|
|
27
27
|
|
|
28
28
|
`portfolios get` includes `futures_positions` alongside spot for any portfolio holding CFM dated-futures positions — see `coinbase-futures` for placing futures orders and reading liquidation risk.
|
|
29
29
|
|
|
30
|
+
`portfolios get` includes equity positions and cash alongside crypto (`equity_positions`, `portfolio_balances.total_equities_balance`) for any account holding stocks — see `coinbase-equities` for placing equity orders.
|
|
31
|
+
|
|
30
32
|
## The per-key scoping model
|
|
31
33
|
|
|
32
34
|
Each CDP API key is scoped to ONE portfolio — the key can only trade within it. To operate across portfolios, register one env per portfolio using the `live-<portfolio>` convention:
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coinbase-x402
|
|
3
|
+
description: Discovers curated x402 resources and pays for them with Coinbase custodial USDC. Use when the user wants to find, call, or pay an x402 resource, handle a 402 Payment Required challenge, or needs to know whether to send X-PAYMENT or PAYMENT-SIGNATURE.
|
|
4
|
+
requires: coinbase env configured with the required x402 payment scopes (see `coinbase` skill)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# coinbase-x402
|
|
8
|
+
|
|
9
|
+
Discover and call curated x402 resources through the Coinbase Agent API. Discovery is free, but `pay` and `fetch` can place a real USDC hold. Confirm the resource and maximum spend with the user before paying.
|
|
10
|
+
|
|
11
|
+
## Choose the flow
|
|
12
|
+
|
|
13
|
+
- Use `x402 resources` to search the curated catalog without spending funds.
|
|
14
|
+
- Prefer `x402 fetch` for a catalog resource. It handles the v2 challenge, payment, and retry in one call.
|
|
15
|
+
- Use `x402 pay` only when the caller must attach a payment header to its own HTTP request.
|
|
16
|
+
|
|
17
|
+
## Discover and fetch
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
coinbase x402 resources q==wallet
|
|
21
|
+
|
|
22
|
+
coinbase x402 fetch \
|
|
23
|
+
resource=https://example.com/paid-resource \
|
|
24
|
+
input:='{"address":"0x..."}' \
|
|
25
|
+
max_amount=1000000
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Use the exact URL and only the input fields returned by discovery. Inspect the advertised payment requirement before fetching. Set `max_amount` when the user wants a cap below the catalog ceiling. It is denominated in the payment asset's atomic units.
|
|
29
|
+
|
|
30
|
+
`x402 fetch` supports protocol v2 resources and automatically uses the correct payment header.
|
|
31
|
+
|
|
32
|
+
## Create a payment header
|
|
33
|
+
|
|
34
|
+
Copy the resource's 402 challenge fields exactly. In particular, copy `x402Version` into `x402_version`; do not assume the version from the resource URL or the encoded header.
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
coinbase x402 pay \
|
|
38
|
+
scheme=exact \
|
|
39
|
+
network=eip155:8453 \
|
|
40
|
+
asset=0x... \
|
|
41
|
+
pay_to=0x... \
|
|
42
|
+
amount=10000 \
|
|
43
|
+
max_amount=10000 \
|
|
44
|
+
max_timeout_seconds:=300 \
|
|
45
|
+
x402_version:=2 \
|
|
46
|
+
extra:='{"name":"USD Coin","version":"2"}'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The result contains `payment_header`. Attach it according to the challenge version:
|
|
50
|
+
|
|
51
|
+
| `x402_version` | HTTP header |
|
|
52
|
+
| :--- | :--- |
|
|
53
|
+
| `1` | `X-PAYMENT` |
|
|
54
|
+
| `2` | `PAYMENT-SIGNATURE` |
|
|
55
|
+
|
|
56
|
+
The header names are not interchangeable. Never send `X-PAYMENT` to a v2 resource or `PAYMENT-SIGNATURE` to a v1 resource.
|
|
57
|
+
|
|
58
|
+
If the resource rejects the header, first verify that the challenge's `x402Version`, the `x402_version` passed to `pay`, and the HTTP header name agree. Do not create another payment merely to try the other header name.
|
|
59
|
+
|
|
60
|
+
## Retry safety
|
|
61
|
+
|
|
62
|
+
Use the smallest `amount` and `max_amount` that satisfy the requirement. Reuse the returned `idempotency_key` only when retrying the same logical payment after an outcome-unknown failure. Starting a retry without it can create another hold.
|