Skip to content

Commit 83d1b8b

Browse files
Michael YuanMichael Yuan
authored andcommitted
docs: comprehensive three-exchange architecture documentation
- Add Coinbase as third exchange alongside Hyperliquid and Binance - Document exchange capability matrix (spot/perps/options support) - Explain auto-routing priority: HL > Coinbase > Binance for spot - Add cancel order formats for all three exchanges - Document Coinbase product ID format (BTC-USD vs BTCUSDT) - Update config template showing all three exchange credentials - Add coinbase.rs to architecture section - Clarify options are Binance-only (HL and Coinbase don't support)
1 parent 13d7932 commit 83d1b8b

1 file changed

Lines changed: 102 additions & 43 deletions

File tree

README.md

Lines changed: 102 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# fintool
22

3-
A Rust CLI for financial trading and market intelligence — spot and perpetual futures on **Hyperliquid** and **Binance**, stock quotes, LLM-enriched analysis, prediction markets, SEC filings, and news.
3+
A Rust CLI for financial trading and market intelligence — spot and perpetual futures on **Hyperliquid**, **Binance**, and **Coinbase**, stock quotes, LLM-enriched analysis, prediction markets, SEC filings, and news.
44

55
## Installation
66

@@ -44,10 +44,14 @@ fintool report list TSLA
4444
fintool predict list
4545
fintool predict search "election"
4646

47-
# Spot trading (Hyperliquid or Binance)
47+
# Spot trading (auto-selects exchange)
4848
fintool order buy TSLA 100 410
4949
fintool order sell TSLA 1 420
5050

51+
# Force specific exchange
52+
fintool order buy BTC 100 65000 --exchange coinbase
53+
fintool order buy BTC 100 65000 --exchange binance
54+
5155
# Perp trading
5256
fintool perp buy BTC 100 65000
5357
fintool perp sell BTC 0.01 70000
@@ -78,7 +82,17 @@ The `--human` flag is global and works with any subcommand.
7882

7983
## Exchange Support
8084

81-
`fintool` supports multiple exchanges with automatic routing:
85+
`fintool` supports three exchanges with automatic routing: **Hyperliquid**, **Binance**, and **Coinbase**.
86+
87+
### Exchange Capability Matrix
88+
89+
| Feature | Hyperliquid | Binance | Coinbase |
90+
|---------|-------------|---------|----------|
91+
| Spot Trading ||||
92+
| Perpetual Futures ||||
93+
| Options ||||
94+
| Balance/Positions ||||
95+
| Orders/Cancellation ||||
8296

8397
### Global Exchange Flag
8498

@@ -89,19 +103,31 @@ All trading commands support `--exchange <EXCHANGE>`:
89103
| `auto` (default) | Auto-select based on configured exchanges and command type |
90104
| `hyperliquid` | Force Hyperliquid (requires wallet config) |
91105
| `binance` | Force Binance (requires API keys) |
106+
| `coinbase` | Force Coinbase (requires API keys) |
92107

93108
### Auto Mode Routing
94109

95110
When `--exchange auto` (default):
96111

97-
1. **Options commands** → Always Binance (Hyperliquid doesn't support options)
98-
2. **If only one exchange configured** → Use that one
99-
3. **If both configured** → Hyperliquid for spot/perp, Binance for options
112+
1. **Options commands** → Always Binance (only exchange that supports options)
113+
2. **Perpetual futures** → Hyperliquid > Binance (Coinbase doesn't support perps)
114+
3. **Spot trading** → Hyperliquid > Coinbase > Binance (priority order)
115+
4. **If only one exchange configured** → Use that one
116+
117+
### Symbol Formats by Exchange
118+
119+
| Exchange | Spot Format | Perp Format | Notes |
120+
|----------|-------------|-------------|-------|
121+
| Hyperliquid | `BTC`, `TSLA` | `BTC`, `ETH` | Symbol only, no pair suffix |
122+
| Binance | `BTCUSDT` | `BTCUSDT` | Auto-appends USDT in code |
123+
| Coinbase | `BTC-USD` | N/A | Dash-separated, USD quote |
124+
125+
**Note:** `fintool` handles format conversion automatically. Just use the base symbol (e.g., `BTC`) and it will convert to the right format for each exchange.
100126

101127
### Examples
102128

103129
```bash
104-
# Auto routing (uses configured exchange)
130+
# Auto routing (uses configured exchange with priority)
105131
fintool order buy BTC 100 65000
106132

107133
# Force Hyperliquid
@@ -110,8 +136,11 @@ fintool order buy BTC 100 65000 --exchange hyperliquid
110136
# Force Binance
111137
fintool order buy BTC 100 65000 --exchange binance
112138

139+
# Force Coinbase (uses BTC-USD internally)
140+
fintool order buy BTC 100 65000 --exchange coinbase
141+
113142
# Options require Binance
114-
fintool options buy BTC call 70000 260328 0.1
143+
fintool options buy BTC call 70000 260328 0.1 --exchange binance
115144
```
116145

117146
---
@@ -122,6 +151,8 @@ Config file: `~/.fintool/config.toml`
122151

123152
Run `fintool init` to generate a template, or copy `config.toml.default` from the release zip.
124153

154+
### Example Configuration (All Three Exchanges)
155+
125156
```toml
126157
[wallet]
127158
# Hyperliquid private key (hex, with or without 0x prefix)
@@ -143,6 +174,10 @@ openai_model = "gpt-4.1-mini"
143174
binance_api_key = "..."
144175
binance_api_secret = "..."
145176

177+
# Coinbase Advanced Trade — enables spot trading
178+
coinbase_api_key = "..."
179+
coinbase_api_secret = "..."
180+
146181
# Kalshi — prediction market trading
147182
# kalshi_api_key = "..."
148183
# kalshi_api_secret = "..."
@@ -160,26 +195,28 @@ binance_api_secret = "..."
160195
| `api_keys` | `openai_model` | string | `gpt-4.1-mini` | OpenAI model for quote analysis. Any chat completions model works. |
161196
| `api_keys` | `binance_api_key` | string || Binance API key for spot/futures/options trading. |
162197
| `api_keys` | `binance_api_secret` | string || Binance API secret (HMAC-SHA256 signing). |
198+
| `api_keys` | `coinbase_api_key` | string || Coinbase Advanced Trade API key. |
199+
| `api_keys` | `coinbase_api_secret` | string || Coinbase Advanced Trade API secret (HMAC-SHA256 signing). |
163200
| `api_keys` | `kalshi_api_key` | string || Kalshi API key (for prediction market trading). |
164201
| `api_keys` | `kalshi_api_secret` | string || Kalshi API secret. |
165202

166203
### What Needs Configuration
167204

168-
| Command | Hyperliquid Wallet | Binance Keys | OpenAI Key | Exchange Support |
169-
|---------|-------------------|--------------|------------|------------------|
170-
| `quote` | No | No | Optional (enriches) | N/A (read-only) |
171-
| `perp quote` | No | No | No | N/A (read-only) |
172-
| `news`, `init` | No | No | No | N/A |
173-
| `report` | No | No | No | N/A |
174-
| `predict list/search/quote` | No | No | No | N/A |
175-
| `order buy/sell` | Yes (HL) | Yes (Binance) | No | Both |
176-
| `perp buy/sell` | Yes (HL) | Yes (Binance) | No | Both |
177-
| `orders` | Yes (HL) | Yes (Binance) | No | Both |
178-
| `cancel` | Yes (HL) | Yes (Binance) | No | Both |
179-
| `balance` | Yes (HL) | Yes (Binance) | No | Both |
180-
| `positions` | Yes (HL) | Yes (Binance) | No | Both |
181-
| `options buy/sell` | No | Yes (Binance) | No | Binance only |
182-
| `predict buy/sell` | Yes (HL) | No | No | Polymarket/Kalshi |
205+
| Command | Hyperliquid Wallet | Binance Keys | Coinbase Keys | OpenAI Key | Exchange Support |
206+
|---------|-------------------|--------------|---------------|------------|------------------|
207+
| `quote` | No | No | No | Optional (enriches) | N/A (read-only) |
208+
| `perp quote` | No | No | No | No | N/A (read-only) |
209+
| `news`, `init` | No | No | No | No | N/A |
210+
| `report` | No | No | No | No | N/A |
211+
| `predict list/search/quote` | No | No | No | No | N/A |
212+
| `order buy/sell` | Yes (HL) | Yes (Binance) | Yes (Coinbase) | No | All three |
213+
| `perp buy/sell` | Yes (HL) | Yes (Binance) | No | No | HL + Binance |
214+
| `orders` | Yes (HL) | Yes (Binance) | Yes (Coinbase) | No | All three |
215+
| `cancel` | Yes (HL) | Yes (Binance) | Yes (Coinbase) | No | All three |
216+
| `balance` | Yes (HL) | Yes (Binance) | Yes (Coinbase) | No | All three |
217+
| `positions` | Yes (HL) | Yes (Binance) | Yes (Coinbase) | No | All three |
218+
| `options buy/sell` | No | Yes (Binance) | No | No | Binance only |
219+
| `predict buy/sell` | Yes (HL) | No | No | No | Polymarket/Kalshi |
183220

184221
---
185222

@@ -436,11 +473,12 @@ fintool report get AAPL 0000320193-24-000123
436473

437474
Place a **spot** limit buy order. The price is the **maximum price** you're willing to pay per unit. Size is calculated as `AMOUNT_USDC / MAX_PRICE`.
438475

439-
**Exchanges:** Hyperliquid (native), Binance (via `/api/v3/order`)
476+
**Exchanges:** Hyperliquid, Binance, Coinbase (auto-routed based on config and `--exchange` flag)
440477

441478
The symbol is auto-resolved:
442479
- **Hyperliquid:** `TSLA``TSLA/USDC` spot pair
443480
- **Binance:** `TSLA``TSLAUSDT` spot pair
481+
- **Coinbase:** `BTC``BTC-USD` product ID
444482

445483
#### Examples
446484

@@ -449,8 +487,9 @@ fintool order buy TSLA 1 410 # buy $1 of TSLA at max $410
449487
fintool order buy HYPE 100 25 # buy $100 of HYPE at max $25
450488
fintool order buy BTC 50 66000 # buy $50 of BTC spot at max $66,000
451489

452-
# Force Binance
490+
# Force specific exchange
453491
fintool order buy BTC 100 65000 --exchange binance
492+
fintool order buy BTC 100 65000 --exchange coinbase
454493
```
455494

456495
#### JSON Schema
@@ -473,16 +512,17 @@ fintool order buy BTC 100 65000 --exchange binance
473512

474513
Place a **spot** limit sell order. The price is the **minimum price** you'll accept per unit.
475514

476-
**Exchanges:** Hyperliquid (native), Binance (via `/api/v3/order`)
515+
**Exchanges:** Hyperliquid, Binance, Coinbase (auto-routed based on config and `--exchange` flag)
477516

478517
#### Examples
479518

480519
```bash
481520
fintool order sell TSLA 1 420 # sell 1 TSLA at minimum $420
482521
fintool order sell HYPE 10 30 # sell 10 HYPE at minimum $30
483522

484-
# Force Binance
523+
# Force specific exchange
485524
fintool order sell BTC 0.01 67000 --exchange binance
525+
fintool order sell BTC 0.01 67000 --exchange coinbase
486526
```
487527

488528
#### JSON Schema
@@ -504,7 +544,7 @@ fintool order sell BTC 0.01 67000 --exchange binance
504544

505545
Place a **perpetual futures** limit buy (long) order.
506546

507-
**Exchanges:** Hyperliquid (native), Binance (via `/fapi/v1/order`)
547+
**Exchanges:** Hyperliquid, Binance (Coinbase doesn't support perps)
508548

509549
#### Examples
510550

@@ -522,7 +562,7 @@ fintool perp buy BTC 100 65000 --exchange binance
522562

523563
Place a **perpetual futures** limit sell (short) order.
524564

525-
**Exchanges:** Hyperliquid (native), Binance (via `/fapi/v1/order`)
565+
**Exchanges:** Hyperliquid, Binance (Coinbase doesn't support perps)
526566

527567
#### Examples
528568

@@ -540,13 +580,14 @@ fintool perp sell BTC 0.01 70000 --exchange binance
540580

541581
List open orders (both spot and perp). Optionally filter by symbol.
542582

543-
**Exchanges:** Both Hyperliquid and Binance supported
583+
**Exchanges:** All three supported (Hyperliquid, Binance, Coinbase)
544584

545585
```bash
546586
fintool orders
547587
fintool orders BTC
548588
fintool orders --human
549589
fintool orders --exchange binance
590+
fintool orders --exchange coinbase
550591
```
551592

552593
---
@@ -562,6 +603,9 @@ Cancel an open order.
562603
| Hyperliquid | `SYMBOL:OID` | `BTC:91490942` |
563604
| Binance spot | `binance_spot:SYMBOL:ORDERID` | `binance_spot:BTCUSDT:12345678` |
564605
| Binance futures | `binance_futures:SYMBOL:ORDERID` | `binance_futures:BTCUSDT:87654321` |
606+
| Coinbase | `coinbase:UUID` | `coinbase:abc123-def456-...` |
607+
608+
**Note:** Use `fintool orders` to get the correct order ID format for each exchange.
565609

566610
#### Examples
567611

@@ -574,6 +618,9 @@ fintool cancel binance_spot:BTCUSDT:12345678
574618

575619
# Binance futures
576620
fintool cancel binance_futures:BTCUSDT:87654321
621+
622+
# Coinbase
623+
fintool cancel coinbase:abc123-def456-ghi789
577624
```
578625

579626
---
@@ -582,12 +629,13 @@ fintool cancel binance_futures:BTCUSDT:87654321
582629

583630
Show account balances and margin summary.
584631

585-
**Exchanges:** Both Hyperliquid and Binance supported
632+
**Exchanges:** All three supported (Hyperliquid, Binance, Coinbase)
586633

587634
```bash
588635
fintool balance
589636
fintool balance --human
590637
fintool balance --exchange binance
638+
fintool balance --exchange coinbase
591639
```
592640

593641
---
@@ -596,19 +644,20 @@ fintool balance --exchange binance
596644

597645
Show open positions with PnL.
598646

599-
**Exchanges:** Both Hyperliquid and Binance supported
647+
**Exchanges:** All three supported (Hyperliquid, Binance, Coinbase)
600648

601649
```bash
602650
fintool positions
603651
fintool positions --human
604652
fintool positions --exchange binance
653+
fintool positions --exchange coinbase
605654
```
606655

607656
---
608657

609658
### `fintool options buy/sell <SYMBOL> <TYPE> <STRIKE> <EXPIRY> <SIZE>`
610659

611-
Place an options order. **Binance only** — Hyperliquid doesn't support options yet (pending HIP-4).
660+
Place an options order. **Binance only** — Hyperliquid and Coinbase don't support options.
612661

613662
**Binance options symbol format:** `BTC-260328-80000-C`
614663
- Format: `BASE-YYMMDD-STRIKE-C/P`
@@ -627,7 +676,7 @@ fintool options sell BTC put 60000 260328 0.1
627676
fintool options buy BTC call 70000 260328 0.1 --exchange binance
628677
```
629678

630-
**Note:** Hyperliquid will return an error: *"Options trading requires Binance"*
679+
**Note:** Hyperliquid and Coinbase will return an error: *"Options trading requires Binance"*
631680

632681
---
633682

@@ -687,14 +736,14 @@ fintool predict sell polymarket:some-market no 50 --min-price 90
687736
| `fintool report annual/quarterly <SYM>` | SEC 10-K/10-Q filings | N/A |
688737
| `fintool report list <SYM>` | List recent SEC filings | N/A |
689738
| `fintool report get <SYM> <ACC>` | Fetch specific filing | N/A |
690-
| `fintool order buy <SYM> <USDC> <MAX>` | Spot limit buy | Hyperliquid, Binance |
691-
| `fintool order sell <SYM> <AMT> <MIN>` | Spot limit sell | Hyperliquid, Binance |
739+
| `fintool order buy <SYM> <USDC> <MAX>` | Spot limit buy | Hyperliquid, Binance, Coinbase |
740+
| `fintool order sell <SYM> <AMT> <MIN>` | Spot limit sell | Hyperliquid, Binance, Coinbase |
692741
| `fintool perp buy <SYM> <USDC> <PX>` | Perp limit long | Hyperliquid, Binance |
693742
| `fintool perp sell <SYM> <AMT> <PX>` | Perp limit short | Hyperliquid, Binance |
694-
| `fintool orders [SYM]` | List open orders | Hyperliquid, Binance |
695-
| `fintool cancel <ORDER_ID>` | Cancel an order | Hyperliquid, Binance |
696-
| `fintool balance` | Account balances | Hyperliquid, Binance |
697-
| `fintool positions` | Open positions + PnL | Hyperliquid, Binance |
743+
| `fintool orders [SYM]` | List open orders | Hyperliquid, Binance, Coinbase |
744+
| `fintool cancel <ORDER_ID>` | Cancel an order | Hyperliquid, Binance, Coinbase |
745+
| `fintool balance` | Account balances | Hyperliquid, Binance, Coinbase |
746+
| `fintool positions` | Open positions + PnL | Hyperliquid, Binance, Coinbase |
698747
| `fintool options buy/sell ...` | Options trading | Binance only |
699748
| `fintool predict list` | List prediction markets | Polymarket, Kalshi |
700749
| `fintool predict search <Q>` | Search prediction markets | Polymarket, Kalshi |
@@ -717,6 +766,7 @@ fintool predict sell polymarket:some-market no 50 --min-price 90
717766
| Trading — Binance spot | Binance Spot API `/api/v3/order` | API key + secret | HMAC-SHA256 signing |
718767
| Trading — Binance futures | Binance Futures API `/fapi/v1/order` | API key + secret | HMAC-SHA256 signing |
719768
| Trading — Binance options | Binance Options API `/eapi/v1/order` | API key + secret | HMAC-SHA256 signing |
769+
| Trading — Coinbase spot | Coinbase Advanced Trade API `/api/v3/brokerage/orders` | API key + secret | HMAC-SHA256 signing |
720770
| Prediction markets (quotes) | Polymarket Gamma API | No | |
721771
| Prediction markets (quotes) | Kalshi REST API | No | |
722772
| Prediction markets (trading) | Polymarket CLOB | Wallet private key | |
@@ -732,6 +782,7 @@ fintool/
732782
│ ├── config.rs # Config loading (~/.fintool/config.toml)
733783
│ ├── signing.rs # Hyperliquid wallet signing, asset resolution, order execution
734784
│ ├── binance.rs # Binance API client (spot/futures/options, HMAC-SHA256 signing)
785+
│ ├── coinbase.rs # Coinbase Advanced Trade API client (spot, HMAC-SHA256 signing)
735786
│ ├── format.rs # Color formatting helpers
736787
│ └── commands/
737788
│ ├── quote.rs # Multi-source quotes + LLM enrichment
@@ -740,7 +791,7 @@ fintool/
740791
│ ├── order.rs # Spot limit buy/sell with exchange routing
741792
│ ├── perp.rs # Perp limit buy/sell with exchange routing
742793
│ ├── orders.rs # List open orders
743-
│ ├── cancel.rs # Cancel orders (supports Binance format)
794+
│ ├── cancel.rs # Cancel orders (supports all three exchange formats)
744795
│ ├── balance.rs # Account balance
745796
│ ├── positions.rs # Open positions
746797
│ ├── options.rs # Options trading (Binance only, real implementation)
@@ -759,9 +810,17 @@ fintool/
759810
- Options orders: `/eapi/v1/order`
760811
- Account balances, positions, open orders, cancellation
761812

813+
**`coinbase.rs`** — Coinbase Advanced Trade integration:
814+
- HMAC-SHA256 request signing (timestamp + method + path + body)
815+
- Spot orders: `/api/v3/brokerage/orders`
816+
- Product ID format: `BTC-USD` (not `BTCUSDT`)
817+
- Account balances, open orders, cancellation
818+
- **No perp or options support** (Coinbase doesn't offer these products)
819+
762820
**Exchange Routing** — Commands with `--exchange` flag:
763821
- `resolve_exchange()` in each command module
764-
- Auto mode logic: check configured exchanges, default to Hyperliquid for spot/perp
822+
- Auto mode logic: check configured exchanges, priority = Hyperliquid > Coinbase > Binance for spot
823+
- Perps: Hyperliquid > Binance (Coinbase excluded)
765824
- Options always require Binance
766825

767826
## Key Dependencies
@@ -771,7 +830,7 @@ fintool/
771830
| `hyperliquid_rust_sdk` | Hyperliquid exchange client with EIP-712 signing |
772831
| `ethers` | Ethereum wallet and signing primitives |
773832
| `reqwest` | HTTP client (rustls TLS — no OpenSSL) |
774-
| `hmac`, `sha2`, `hex` | HMAC-SHA256 signing for Binance API |
833+
| `hmac`, `sha2`, `hex` | HMAC-SHA256 signing for Binance and Coinbase APIs |
775834
| `clap` | CLI argument parsing |
776835
| `serde` / `serde_json` | JSON serialization |
777836
| `colored` | Terminal colors (`--human` mode) |

0 commit comments

Comments
 (0)