@coinbase/coinbase-cli 0.0.4 → 0.0.6
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/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.6
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coinbase-futures
|
|
3
|
+
description: Places and manages CFM dated futures orders on Coinbase Advanced Trade — liquidation risk. Use when the user wants to open a dated futures position, or asks about liquidation risk. Uses the same `coinbase orders`/`coinbase portfolios` commands as spot (see `coinbase-trading`). These are real orders — losses can occur.
|
|
4
|
+
requires: coinbase env configured with Trade permission (see `coinbase` skill)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# coinbase-futures
|
|
8
|
+
|
|
9
|
+
CFM dated futures orders use the same `coinbase orders create` / `orders preview` commands as spot (see `coinbase-trading` for the shared market/limit/stop_limit mechanics and order-management commands). This skill covers what's different for CFM.
|
|
10
|
+
|
|
11
|
+
**Portfolio scope**: CFM dated futures are documented as available only in the caller's default portfolio for now. Pass the default portfolio_uuid (equal to the user's UUID — see `coinbase-trading`) rather than a named sub-portfolio for any futures order.
|
|
12
|
+
|
|
13
|
+
**Product IDs**: `<BASE>-<DDMMMYY>-CDE`, e.g. `BIT-28AUG26-CDE` (Bitcoin) or `BIP-20DEC30-CDE` (a separate Bitcoin-linked contract series — note the ticker root is `BIP`, not `BTC`). These roll to a new contract code every cycle — don't hardcode a date-coded ticker long-term; discover the live one with `coinbase products list product_type=FUTURE` and filter by the `-CDE` suffix.
|
|
14
|
+
|
|
15
|
+
## Market orders: `base_size` only, and can fail after acceptance
|
|
16
|
+
|
|
17
|
+
Futures market orders **must use `base_size`** (number of contracts) — `quote_size` is rejected with `"Futures market orders must be parameterized in base (number of contracts)"`. A market order can also be accepted (an `order_id` is returned) and then transition to `FAILED` asynchronously — not something the CLI can detect at submission time. For a reliable, immediate-fill order, prefer an IOC limit at/above the ask (buy) or at/below the bid (sell) instead of a plain market order:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
coinbase orders create product_id=BIT-28AUG26-CDE side=BUY type=limit base_size=1 limit_price=65000 \
|
|
21
|
+
time_in_force=IOC
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
CFM's margin/leverage is fixed by the exchange per contract, not user-selectable per order — there's no `leverage`/`margin_type` param for orders.
|
|
25
|
+
|
|
26
|
+
**Before placing an order, preview it and read back `predicted_liquidation_price`** — check current position risk from `portfolios get` alongside it, and confirm with the user if margin looks tight:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
coinbase orders preview product_id=BIT-28AUG26-CDE side=BUY type=limit base_size=1 limit_price=65000
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Checking liquidation risk
|
|
33
|
+
|
|
34
|
+
`coinbase portfolios get <portfolio_uuid>` includes `futures_positions` alongside spot.
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
coinbase portfolios get <portfolio_uuid> --jq '.futures_positions'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Everything else
|
|
41
|
+
|
|
42
|
+
Sizing (`quote_size`/`base_size`), order types, preview, edit, cancel, and fills work exactly as for spot — see `coinbase-trading`. `reduce_only` is not yet supported for CFM orders through this tool.
|
|
@@ -48,4 +48,4 @@ 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
|
|
51
|
+
- Market data is read-only and does not place orders. To act on a price, hand off to `coinbase-trading` (spot) or `coinbase-futures` (CFM dated futures).
|
|
@@ -25,6 +25,8 @@ coinbase portfolios edit <portfolio_uuid> name="Renamed"
|
|
|
25
25
|
coinbase portfolios delete <portfolio_uuid>
|
|
26
26
|
```
|
|
27
27
|
|
|
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
|
+
|
|
28
30
|
## The per-key scoping model
|
|
29
31
|
|
|
30
32
|
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:
|
|
@@ -8,6 +8,12 @@ requires: coinbase env configured with Trade permission (see `coinbase` skill)
|
|
|
8
8
|
|
|
9
9
|
Place and manage spot orders. **These are REAL orders.** Confirm the full plan (product, side, size) with the user before placing.
|
|
10
10
|
|
|
11
|
+
## Choosing the quote currency (USD vs USDC)
|
|
12
|
+
|
|
13
|
+
The examples below use USD or USDC arbitrarily for illustration — always apply the rule below for real trades.
|
|
14
|
+
|
|
15
|
+
Don't default to USD. If the user names a quote currency ("use my USDC"), use that pair. If they don't, check `coinbase balance` first and use whichever of USD/USDC they actually hold; if both, prefer USDC. If the pair you land on doesn't exist for that asset, say so instead of silently trying another one.
|
|
16
|
+
|
|
11
17
|
## Market orders
|
|
12
18
|
|
|
13
19
|
Side determines which size field you use:
|
|
@@ -23,7 +29,7 @@ coinbase orders create product_id=BTC-USD side=BUY type=market quote_size=100
|
|
|
23
29
|
# "Buy N USDC worth of <ASSET>" → BUY on <ASSET>-USDC with quote_size=N
|
|
24
30
|
coinbase orders create product_id=BTC-USDC side=BUY type=market quote_size=1
|
|
25
31
|
|
|
26
|
-
# Sell 0.5 ETH at market
|
|
32
|
+
# Sell 0.5 ETH at market (USD used here for illustration only — apply the rule above)
|
|
27
33
|
coinbase orders create product_id=ETH-USD side=SELL type=market base_size=0.5
|
|
28
34
|
```
|
|
29
35
|
|