trading-cli 0.3.0__tar.gz

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.
Files changed (71) hide show
  1. trading_cli-0.3.0/EXCHANGES.md +398 -0
  2. trading_cli-0.3.0/LICENSE +21 -0
  3. trading_cli-0.3.0/MANIFEST.in +8 -0
  4. trading_cli-0.3.0/PKG-INFO +309 -0
  5. trading_cli-0.3.0/README.md +273 -0
  6. trading_cli-0.3.0/SKILL.md +295 -0
  7. trading_cli-0.3.0/examples/bots_alpaca.sh +113 -0
  8. trading_cli-0.3.0/examples/bots_binance.sh +137 -0
  9. trading_cli-0.3.0/examples/bots_bybit.sh +75 -0
  10. trading_cli-0.3.0/examples/bots_coinbase.sh +46 -0
  11. trading_cli-0.3.0/examples/bots_dex_perps.sh +131 -0
  12. trading_cli-0.3.0/examples/bots_hyperliquid.sh +97 -0
  13. trading_cli-0.3.0/examples/bots_ibkr.sh +113 -0
  14. trading_cli-0.3.0/examples/bots_kraken.sh +45 -0
  15. trading_cli-0.3.0/examples/bots_kucoin.sh +44 -0
  16. trading_cli-0.3.0/examples/bots_okx.sh +59 -0
  17. trading_cli-0.3.0/examples/forward_test_all.sh +40 -0
  18. trading_cli-0.3.0/examples/paper_quickstart.sh +75 -0
  19. trading_cli-0.3.0/examples/polymarket.sh +121 -0
  20. trading_cli-0.3.0/examples/repl_session.sh +149 -0
  21. trading_cli-0.3.0/examples/swaps_and_wallets.sh +130 -0
  22. trading_cli-0.3.0/fastbooks_cli/__init__.py +3 -0
  23. trading_cli-0.3.0/fastbooks_cli/__main__.py +6 -0
  24. trading_cli-0.3.0/fastbooks_cli/client.py +1169 -0
  25. trading_cli-0.3.0/fastbooks_cli/commands/__init__.py +0 -0
  26. trading_cli-0.3.0/fastbooks_cli/commands/apikey.py +144 -0
  27. trading_cli-0.3.0/fastbooks_cli/commands/backtest.py +450 -0
  28. trading_cli-0.3.0/fastbooks_cli/commands/bots.py +479 -0
  29. trading_cli-0.3.0/fastbooks_cli/commands/config.py +294 -0
  30. trading_cli-0.3.0/fastbooks_cli/commands/dex.py +507 -0
  31. trading_cli-0.3.0/fastbooks_cli/commands/direct.py +150 -0
  32. trading_cli-0.3.0/fastbooks_cli/commands/execution.py +298 -0
  33. trading_cli-0.3.0/fastbooks_cli/commands/init_cmd.py +149 -0
  34. trading_cli-0.3.0/fastbooks_cli/commands/markets.py +270 -0
  35. trading_cli-0.3.0/fastbooks_cli/commands/mcp_cmd.py +27 -0
  36. trading_cli-0.3.0/fastbooks_cli/commands/onchain.py +123 -0
  37. trading_cli-0.3.0/fastbooks_cli/commands/polymarket.py +2215 -0
  38. trading_cli-0.3.0/fastbooks_cli/commands/repl.py +385 -0
  39. trading_cli-0.3.0/fastbooks_cli/commands/strategy.py +259 -0
  40. trading_cli-0.3.0/fastbooks_cli/commands/swap.py +320 -0
  41. trading_cli-0.3.0/fastbooks_cli/commands/wallet.py +447 -0
  42. trading_cli-0.3.0/fastbooks_cli/config_store.py +112 -0
  43. trading_cli-0.3.0/fastbooks_cli/direct.py +209 -0
  44. trading_cli-0.3.0/fastbooks_cli/main.py +88 -0
  45. trading_cli-0.3.0/fastbooks_cli/mcp_server.py +171 -0
  46. trading_cli-0.3.0/fastbooks_cli/output.py +86 -0
  47. trading_cli-0.3.0/fastbooks_cli/strategies/__init__.py +87 -0
  48. trading_cli-0.3.0/pyproject.toml +54 -0
  49. trading_cli-0.3.0/setup.cfg +4 -0
  50. trading_cli-0.3.0/tests/README.md +41 -0
  51. trading_cli-0.3.0/tests/__init__.py +0 -0
  52. trading_cli-0.3.0/tests/conftest.py +149 -0
  53. trading_cli-0.3.0/tests/test_backtest.py +298 -0
  54. trading_cli-0.3.0/tests/test_bots_per_exchange.py +604 -0
  55. trading_cli-0.3.0/tests/test_cli.py +249 -0
  56. trading_cli-0.3.0/tests/test_dex.py +147 -0
  57. trading_cli-0.3.0/tests/test_e2e_flows.py +364 -0
  58. trading_cli-0.3.0/tests/test_execution_per_venue.py +598 -0
  59. trading_cli-0.3.0/tests/test_paper_flows_per_exchange.py +67 -0
  60. trading_cli-0.3.0/tests/test_polymarket.py +443 -0
  61. trading_cli-0.3.0/tests/test_repl.py +143 -0
  62. trading_cli-0.3.0/tests/test_strategy.py +119 -0
  63. trading_cli-0.3.0/tests/test_stress.py +72 -0
  64. trading_cli-0.3.0/tests/test_swap.py +115 -0
  65. trading_cli-0.3.0/tests/test_wallet_creation.py +142 -0
  66. trading_cli-0.3.0/trading_cli.egg-info/PKG-INFO +309 -0
  67. trading_cli-0.3.0/trading_cli.egg-info/SOURCES.txt +69 -0
  68. trading_cli-0.3.0/trading_cli.egg-info/dependency_links.txt +1 -0
  69. trading_cli-0.3.0/trading_cli.egg-info/entry_points.txt +4 -0
  70. trading_cli-0.3.0/trading_cli.egg-info/requires.txt +20 -0
  71. trading_cli-0.3.0/trading_cli.egg-info/top_level.txt +1 -0
@@ -0,0 +1,398 @@
1
+ # FastBooks Exchange API Reference
2
+
3
+ Detailed per-exchange documentation for the FastBooks CLI. Each exchange has specific requirements, supported features, and configuration notes.
4
+
5
+ ---
6
+
7
+ ## Binance
8
+
9
+ **Type:** Centralized Exchange (CEX)
10
+ **Markets:** Spot, Perpetual Futures (USDT-M, COIN-M)
11
+
12
+ ### Authentication
13
+ - **API Key:** Required
14
+ - **API Secret:** Required
15
+ - **Testnet:** Available (`--testnet` flag)
16
+
17
+ ### Setup
18
+ ```bash
19
+ fastbooks wallet add binance --api-key YOUR_KEY --api-secret YOUR_SECRET
20
+ fastbooks wallet add binance --api-key YOUR_KEY --api-secret YOUR_SECRET --testnet # testnet
21
+ fastbooks wallet test binance
22
+ ```
23
+
24
+ ### Supported Operations
25
+ | Operation | Spot | Perpetual |
26
+ |-----------|------|-----------|
27
+ | Place order (market/limit/stop) | Yes | Yes |
28
+ | Cancel order | Yes | Yes |
29
+ | List orders | Yes | Yes |
30
+ | Get balance | Yes | Yes |
31
+ | Get positions | N/A | Yes |
32
+ | Set leverage | N/A | Yes |
33
+
34
+ ### Symbol Format
35
+ - Spot: `BTC/USDT`, `ETH/USDT`, `SOL/USDT`
36
+ - Perpetual: `BTC/USDT`, `ETH/USDT` (same, auto-detected)
37
+
38
+ ### Notes
39
+ - Rate limits: 1200 requests/minute (order weight varies)
40
+ - Minimum order sizes vary by symbol
41
+ - Leverage range: 1x-125x depending on symbol
42
+
43
+ ---
44
+
45
+ ## Bybit
46
+
47
+ **Type:** Centralized Exchange (CEX)
48
+ **Markets:** Spot, USDT Perpetual, Inverse Perpetual
49
+
50
+ ### Authentication
51
+ - **API Key:** Required
52
+ - **API Secret:** Required
53
+
54
+ ### Setup
55
+ ```bash
56
+ fastbooks wallet add bybit --api-key YOUR_KEY --api-secret YOUR_SECRET
57
+ ```
58
+
59
+ ### Supported Operations
60
+ | Operation | Spot | Perpetual |
61
+ |-----------|------|-----------|
62
+ | Place order | Yes | Yes |
63
+ | Cancel order | Yes | Yes |
64
+ | List orders | Yes | Yes |
65
+ | Get balance | Yes | Yes |
66
+ | Get positions | N/A | Yes |
67
+ | Set leverage | N/A | Yes |
68
+
69
+ ### Symbol Format
70
+ - Spot: `BTC/USDT`, `ETH/USDT`
71
+ - Perpetual: `BTC/USDT`, `ETH/USDT`
72
+
73
+ ### Notes
74
+ - Unified Trading Account (UTA) supported
75
+ - Leverage range: 1x-100x
76
+
77
+ ---
78
+
79
+ ## OKX
80
+
81
+ **Type:** Centralized Exchange (CEX)
82
+ **Markets:** Spot, Perpetual Swap, Futures, Options
83
+
84
+ ### Authentication
85
+ - **API Key:** Required
86
+ - **API Secret:** Required
87
+ - **Passphrase:** Required (set during API key creation on OKX)
88
+
89
+ ### Setup
90
+ ```bash
91
+ fastbooks wallet add okx --api-key YOUR_KEY --api-secret YOUR_SECRET --passphrase YOUR_PASSPHRASE
92
+ ```
93
+
94
+ ### Symbol Format
95
+ - Spot: `BTC/USDT`, `ETH/USDT`
96
+ - Swap: `BTC/USDT`, `ETH/USDT`
97
+
98
+ ### Notes
99
+ - Passphrase is **mandatory** — OKX rejects requests without it
100
+ - Supports unified margin mode
101
+
102
+ ---
103
+
104
+ ## Kraken
105
+
106
+ **Type:** Centralized Exchange (CEX)
107
+ **Markets:** Spot, Perpetual (via Kraken Pro)
108
+
109
+ ### Authentication
110
+ - **API Key:** Required
111
+ - **API Secret:** Required
112
+
113
+ ### Setup
114
+ ```bash
115
+ fastbooks wallet add kraken --api-key YOUR_KEY --api-secret YOUR_SECRET
116
+ ```
117
+
118
+ ### Notes
119
+ - Kraken uses non-standard symbol formats internally (XBT instead of BTC)
120
+ - The CLI normalizes symbols automatically
121
+
122
+ ---
123
+
124
+ ## Coinbase
125
+
126
+ **Type:** Centralized Exchange (CEX)
127
+ **Markets:** Spot only
128
+
129
+ ### Authentication
130
+ - **API Key:** Required (Advanced Trade API)
131
+ - **API Secret:** Required
132
+
133
+ ### Setup
134
+ ```bash
135
+ fastbooks wallet add coinbase --api-key YOUR_KEY --api-secret YOUR_SECRET
136
+ ```
137
+
138
+ ### Notes
139
+ - Only spot trading supported
140
+ - Uses Advanced Trade API (not legacy Pro API)
141
+ - No perpetual/futures support
142
+
143
+ ---
144
+
145
+ ## KuCoin
146
+
147
+ **Type:** Centralized Exchange (CEX)
148
+ **Markets:** Spot only
149
+
150
+ ### Authentication
151
+ - **API Key:** Required
152
+ - **API Secret:** Required
153
+ - **Passphrase:** Required
154
+
155
+ ### Setup
156
+ ```bash
157
+ fastbooks wallet add kucoin --api-key YOUR_KEY --api-secret YOUR_SECRET --passphrase YOUR_PASSPHRASE
158
+ ```
159
+
160
+ ### Notes
161
+ - Passphrase **mandatory** (like OKX)
162
+ - Spot trading only through CLI currently
163
+
164
+ ---
165
+
166
+ ## Hyperliquid
167
+
168
+ **Type:** On-chain Perpetual DEX (Arbitrum)
169
+ **Markets:** Perpetual only
170
+
171
+ ### Authentication
172
+ - **Private Key:** EVM private key, 64 hex characters (with or without `0x` prefix)
173
+ - No API key/secret needed — transactions are signed with wallet
174
+
175
+ ### Setup
176
+ ```bash
177
+ fastbooks wallet add hyperliquid --api-key 0xYOUR_64_CHAR_HEX_PRIVATE_KEY
178
+ # The --api-key flag is used for the private key
179
+ ```
180
+
181
+ ### Supported Operations
182
+ | Operation | Status |
183
+ |-----------|--------|
184
+ | Place order (market/limit) | Yes |
185
+ | Cancel order | Limited |
186
+ | Get balance | Limited |
187
+ | Get positions | Limited |
188
+ | Set leverage | Yes |
189
+
190
+ ### Symbol Format
191
+ - Perpetual: `ETH/USDC`, `BTC/USDC`, `SOL/USDC`
192
+ - Uses USDC as quote currency (not USDT)
193
+
194
+ ### Notes
195
+ - **On-chain execution** — all orders are settled on Arbitrum
196
+ - Order prices formatted to 5 significant figures
197
+ - Wallet address derived from private key
198
+ - Supports `Ioc` (immediate-or-cancel for market) and `Gtc` (good-till-cancel for limit)
199
+ - No API rate limits (blockchain throughput limits apply)
200
+
201
+ ---
202
+
203
+ ## Interactive Brokers (IBKR)
204
+
205
+ **Type:** Traditional Broker
206
+ **Markets:** Stocks, Options, Forex, Futures, Bonds
207
+
208
+ ### Authentication
209
+ - **Gateway:** IB Gateway must be running (ports 4001 paper / 4002 live)
210
+ - **Credentials:** Encrypted with AES-256-GCM via `IBKR_ENCRYPTION_KEY`
211
+
212
+ ### Setup
213
+ ```bash
214
+ # 1. Start IB Gateway (via Docker or native)
215
+ # 2. Set encryption key
216
+ export IBKR_ENCRYPTION_KEY=your_base64_encoded_key
217
+
218
+ # 3. Configure via API (credentials stored encrypted)
219
+ ```
220
+
221
+ ### Supported Operations
222
+ | Operation | Status |
223
+ |-----------|--------|
224
+ | Place order (market/limit) | Yes |
225
+ | Cancel order | Limited |
226
+ | Get order | Yes |
227
+ | List orders | Yes |
228
+ | Order history | Yes |
229
+ | Get balance | Yes |
230
+ | Get positions | Yes |
231
+
232
+ ### Symbol Format
233
+ - Stocks: `AAPL`, `MSFT`, `GOOGL`
234
+ - Options: Exchange-specific contract IDs
235
+ - Forex: `EUR/USD`, `GBP/USD`
236
+
237
+ ### Notes
238
+ - Paper trading on port 4001, live on port 4002
239
+ - Requires running IB Gateway or TWS
240
+ - Market hours constraints apply
241
+ - 2FA may be required (handled via IBeam)
242
+
243
+ ---
244
+
245
+ ## Alpaca
246
+
247
+ **Type:** Traditional Broker (Commission-Free)
248
+ **Markets:** US Stocks, Crypto
249
+
250
+ ### Authentication
251
+ - **API Key:** Required
252
+ - **API Secret:** Required
253
+ - **Paper mode:** Use `--sandbox` flag
254
+
255
+ ### Setup
256
+ ```bash
257
+ # Paper trading (recommended for testing)
258
+ fastbooks wallet add alpaca --api-key YOUR_KEY --api-secret YOUR_SECRET --sandbox
259
+
260
+ # Live trading
261
+ fastbooks wallet add alpaca --api-key YOUR_KEY --api-secret YOUR_SECRET
262
+ ```
263
+
264
+ ### Supported Operations
265
+ | Operation | Status |
266
+ |-----------|--------|
267
+ | Place order | Yes |
268
+ | Cancel order | Yes |
269
+ | Get order | Yes |
270
+ | List orders | Yes |
271
+ | Get balance | Yes |
272
+ | Get positions | Yes (via balance) |
273
+
274
+ ### Symbol Format
275
+ - Stocks: `AAPL`, `MSFT`, `TSLA`
276
+ - Crypto: `BTC/USD`, `ETH/USD`
277
+
278
+ ### Notes
279
+ - Commission-free stock trading
280
+ - Paper and live API endpoints are different
281
+ - Extended hours trading supported
282
+ - Fractional shares supported
283
+
284
+ ---
285
+
286
+ ## Deribit
287
+
288
+ **Type:** Centralized Exchange (Derivatives)
289
+ **Markets:** Options, Perpetual
290
+
291
+ ### Authentication
292
+ - **API Key:** Required
293
+ - **API Secret:** Required
294
+ - **Testnet:** Available
295
+
296
+ ### Setup
297
+ ```bash
298
+ fastbooks wallet add deribit --api-key YOUR_KEY --api-secret YOUR_SECRET
299
+ fastbooks wallet add deribit --api-key YOUR_KEY --api-secret YOUR_SECRET --testnet
300
+ ```
301
+
302
+ ### Current Support
303
+ - Options chain data (`fastbooks markets options BTC`)
304
+ - Options orderbook data
305
+ - Read-only (execution coming soon)
306
+
307
+ ---
308
+
309
+ ## Jupiter (Solana DEX)
310
+
311
+ **Type:** DEX Aggregator on Solana
312
+ **Markets:** 5000+ Solana tokens
313
+
314
+ ### Authentication
315
+ - Solana wallet required for swaps (read-only data is public)
316
+
317
+ ### Current Support
318
+ - Ticker data via `fastbooks markets tickers --category dex`
319
+ - Token pricing and liquidity data
320
+ - 5000+ tokens with live prices
321
+
322
+ ### Notes
323
+ - Best price routing across Solana DEXs
324
+ - On-chain swap execution planned (requires wallet integration)
325
+ - Uses Jupiter V6 API
326
+
327
+ ---
328
+
329
+ ## Uniswap (Ethereum DEX)
330
+
331
+ **Type:** Decentralized Exchange (Ethereum)
332
+ **Markets:** 1000+ ERC-20 tokens
333
+
334
+ ### Authentication
335
+ - EVM wallet required for swaps (read-only data is public)
336
+
337
+ ### Current Support
338
+ - Ticker data via `fastbooks markets tickers --category dex`
339
+ - Pool and liquidity data
340
+
341
+ ### Notes
342
+ - Uniswap V3 concentrated liquidity
343
+ - Gas fees apply for on-chain execution
344
+ - Multi-chain support planned (Polygon, Arbitrum, Base)
345
+
346
+ ---
347
+
348
+ ## Polymarket
349
+
350
+ **Type:** Prediction Market
351
+ **Markets:** Binary prediction events
352
+
353
+ ### Authentication
354
+ - Read-only (no auth needed for market data)
355
+
356
+ ### Current Support
357
+ - Market search and orderbook data
358
+ - YES/NO token pricing
359
+
360
+ ### Usage
361
+ ```bash
362
+ fastbooks markets orderbook polymarket "presidential election"
363
+ ```
364
+
365
+ ---
366
+
367
+ ## Limitless
368
+
369
+ **Type:** Prediction Market
370
+ **Markets:** Binary prediction events
371
+
372
+ ### Authentication
373
+ - Read-only
374
+
375
+ ### Usage
376
+ ```bash
377
+ fastbooks markets orderbook limitless "some-market-slug"
378
+ ```
379
+
380
+ ---
381
+
382
+ ## DEX Aggregation (Additional)
383
+
384
+ The following DEXs provide ticker data through the aggregated tickers endpoint:
385
+
386
+ | DEX | Chain | Approx Tokens |
387
+ |-----|-------|---------------|
388
+ | Raydium | Solana | 2000+ |
389
+ | Orca | Solana | 1500+ |
390
+ | SushiSwap | Multi-chain | 2000+ |
391
+ | Curve | Multi-chain | 600+ |
392
+ | GeckoTerminal | Multi-chain | 800+ |
393
+
394
+ Access via:
395
+ ```bash
396
+ fastbooks markets tickers --category dex
397
+ fastbooks --json markets tickers --category dex --limit 100
398
+ ```
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FastBooks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ include README.md
2
+ include SKILL.md
3
+ include EXCHANGES.md
4
+ include LICENSE
5
+ recursive-include examples *.sh
6
+ recursive-include tests *.py *.md
7
+ global-exclude __pycache__/*
8
+ global-exclude *.py[cod]