@quantish/agent 0.1.26 → 0.1.27
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/README.md +172 -335
- package/dist/index.js +32 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
# @quantish/agent
|
|
2
2
|
|
|
3
|
-
AI-powered
|
|
3
|
+
AI-powered CLI agent for building trading bots and applications on Polymarket.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- **🤖 Multi-Provider AI** - Use Anthropic Claude or 100+ OpenRouter models (GLM-4.7, MiniMax, DeepSeek, etc.)
|
|
8
|
-
- **💹 Live Trading** - Trade on Polymarket (Polygon) and Kalshi (Solana via DFlow)
|
|
9
|
-
- **🔧 Full Coding Tools** - Read/write files, run commands, git operations
|
|
10
|
-
- **🌐 Web Search** - Search the web with Exa AI or DuckDuckGo fallback
|
|
11
|
-
- **💾 Session Persistence** - Save and resume conversations across sessions
|
|
12
|
-
- **⚡ Queued Input** - Type while the agent is working, queue messages
|
|
13
|
-
- **📊 Cost Tracking** - Real-time token usage and cost display
|
|
5
|
+
Combines **coding tools** (file system, shell, git) with **trading tools** (Polymarket orders, positions, wallet) powered by Claude AI.
|
|
14
6
|
|
|
15
7
|
## Installation
|
|
16
8
|
|
|
@@ -18,420 +10,265 @@ AI-powered coding & trading agent for Polymarket and Kalshi. Build trading bots,
|
|
|
18
10
|
npm install -g @quantish/agent
|
|
19
11
|
```
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
Or run directly with npx:
|
|
22
14
|
|
|
23
15
|
```bash
|
|
24
|
-
|
|
25
|
-
quantish init
|
|
26
|
-
|
|
27
|
-
# Start interactive chat
|
|
28
|
-
quantish
|
|
16
|
+
npx @quantish/agent
|
|
29
17
|
```
|
|
30
18
|
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
The agent connects to three MCP (Model Context Protocol) servers:
|
|
34
|
-
|
|
35
|
-
| MCP | URL | Auth | Purpose |
|
|
36
|
-
|-----|-----|------|---------|
|
|
37
|
-
| Discovery | `quantish.live/mcp` | Public (embedded key) | Search markets across all platforms |
|
|
38
|
-
| Polymarket | `quantish-sdk-production.up.railway.app/mcp` | `QUANTISH_API_KEY` | Trade on Polymarket (Polygon) |
|
|
39
|
-
| Kalshi | `kalshi-mcp-production-7c2c.up.railway.app/mcp` | `KALSHI_API_KEY` | Trade on Kalshi (Solana via DFlow) |
|
|
40
|
-
|
|
41
|
-
**Polymarket** - Managed Polygon wallet:
|
|
42
|
-
- ✅ Gasless transactions (Polymarket covers fees)
|
|
43
|
-
- ✅ Signs orders using Polymarket's required format
|
|
44
|
-
- ✅ Works globally (no geo-restrictions)
|
|
45
|
-
- 🔒 Non-custodial - export your private key anytime
|
|
46
|
-
|
|
47
|
-
**Kalshi** - Managed Solana wallet via DFlow:
|
|
48
|
-
- ✅ Trade on CFTC-regulated Kalshi markets
|
|
49
|
-
- ✅ Uses DFlow protocol for on-chain settlement
|
|
50
|
-
- ⚡ Small SOL fees (~0.01 SOL per trade)
|
|
51
|
-
- 🔒 Non-custodial - export your private key anytime
|
|
52
|
-
|
|
53
|
-
## Interactive Commands
|
|
54
|
-
|
|
55
|
-
### Chat Commands
|
|
56
|
-
|
|
57
|
-
| Command | Description |
|
|
58
|
-
|---------|-------------|
|
|
59
|
-
| `/help` | Show all commands |
|
|
60
|
-
| `/clear` | Clear conversation history |
|
|
61
|
-
| `/compact` | Summarize conversation to save tokens |
|
|
62
|
-
| `/model <name>` | Switch model (opus, sonnet, haiku, glm, minimax, etc.) |
|
|
63
|
-
| `/provider <name>` | Switch LLM provider (anthropic, openrouter) |
|
|
64
|
-
| `/cost` | Show session cost breakdown |
|
|
65
|
-
| `/tools` | List available tools |
|
|
66
|
-
| `/config` | Show configuration info |
|
|
67
|
-
|
|
68
|
-
### Session Commands
|
|
69
|
-
|
|
70
|
-
| Command | Description |
|
|
71
|
-
|---------|-------------|
|
|
72
|
-
| `/save [name]` | Save current session |
|
|
73
|
-
| `/resume` | Resume last session |
|
|
74
|
-
| `/sessions` | List all saved sessions |
|
|
75
|
-
| `/load <id>` | Load a session by ID |
|
|
76
|
-
| `/forget` | Delete all saved sessions |
|
|
77
|
-
|
|
78
|
-
### Process Commands
|
|
79
|
-
|
|
80
|
-
| Command | Description |
|
|
81
|
-
|---------|-------------|
|
|
82
|
-
| `/processes` | List running background processes |
|
|
83
|
-
| `/stop <id>` | Stop a background process |
|
|
84
|
-
| `/stopall` | Stop all background processes |
|
|
85
|
-
|
|
86
|
-
### Keyboard Shortcuts
|
|
19
|
+
## Quick Start
|
|
87
20
|
|
|
88
|
-
|
|
89
|
-
|-----|--------|
|
|
90
|
-
| `Enter` | Send message (or queue if agent is working) |
|
|
91
|
-
| `Esc` | Interrupt current generation |
|
|
92
|
-
| `Ctrl+C` | Exit CLI |
|
|
21
|
+
### 1. Initialize
|
|
93
22
|
|
|
94
|
-
|
|
23
|
+
Set up your API keys:
|
|
95
24
|
|
|
96
25
|
```bash
|
|
97
|
-
quantish
|
|
98
|
-
quantish init # First-time setup wizard
|
|
99
|
-
quantish config # View configuration
|
|
100
|
-
quantish config --export # Export as .env format
|
|
101
|
-
quantish tools # List all available tools
|
|
102
|
-
quantish -p "message" # One-shot mode
|
|
103
|
-
quantish --version # Show version
|
|
26
|
+
quantish init
|
|
104
27
|
```
|
|
105
28
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
| `-v, --verbose` | Show detailed tool calls |
|
|
110
|
-
| `--no-mcp` | Disable trading tools |
|
|
111
|
-
| `--no-local` | Disable coding tools |
|
|
112
|
-
|
|
113
|
-
## Available Tools
|
|
114
|
-
|
|
115
|
-
### Local Tools (Coding)
|
|
29
|
+
You'll need:
|
|
30
|
+
- **Anthropic API Key** - Get one at https://console.anthropic.com/
|
|
31
|
+
- **Quantish API Key** - Created automatically during setup
|
|
116
32
|
|
|
117
|
-
|
|
118
|
-
|------|-------------|
|
|
119
|
-
| `read_file` | Read file contents with line numbers |
|
|
120
|
-
| `write_file` | Create or overwrite files |
|
|
121
|
-
| `edit_file` | Search and replace in files |
|
|
122
|
-
| `edit_lines` | Edit specific line ranges (efficient) |
|
|
123
|
-
| `list_dir` | List directory contents |
|
|
124
|
-
| `delete_file` | Delete files |
|
|
125
|
-
| `file_exists` | Check if file exists |
|
|
126
|
-
| `run_command` | Execute shell commands (blocking) |
|
|
127
|
-
| `start_background_process` | Run long-running processes |
|
|
128
|
-
| `get_process_output` | Get output from background process |
|
|
129
|
-
| `stop_process` | Stop a background process |
|
|
130
|
-
| `grep` | Search file contents |
|
|
131
|
-
| `find_files` | Find files by pattern |
|
|
132
|
-
| `setup_env` | Create/update .env files |
|
|
33
|
+
### 2. Start Building
|
|
133
34
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
| Tool | Description |
|
|
137
|
-
|------|-------------|
|
|
138
|
-
| `git_status` | Get repository status |
|
|
139
|
-
| `git_diff` | Show changes |
|
|
140
|
-
| `git_add` | Stage files |
|
|
141
|
-
| `git_commit` | Create commits |
|
|
142
|
-
| `git_log` | Show commit history |
|
|
143
|
-
| `git_checkout` | Switch branches |
|
|
144
|
-
|
|
145
|
-
### Web Tools
|
|
146
|
-
|
|
147
|
-
| Tool | Description |
|
|
148
|
-
|------|-------------|
|
|
149
|
-
| `web_search` | Search the web (Exa/DuckDuckGo) |
|
|
150
|
-
| `web_answer` | AI-powered Q&A (requires Exa API key) |
|
|
151
|
-
| `fetch_url` | Fetch URL content |
|
|
152
|
-
|
|
153
|
-
### MCP Tools - Discovery
|
|
154
|
-
|
|
155
|
-
| Tool | Description |
|
|
156
|
-
|------|-------------|
|
|
157
|
-
| `search_markets` | Search markets across Polymarket, Kalshi, Limitless |
|
|
158
|
-
| `get_trending_markets` | Get trending/popular markets |
|
|
159
|
-
| `get_market_details` | Get market info and prices |
|
|
160
|
-
| `get_categories` | List available categories |
|
|
161
|
-
| `get_market_stats` | Get platform statistics |
|
|
162
|
-
|
|
163
|
-
### MCP Tools - Polymarket Trading
|
|
164
|
-
|
|
165
|
-
| Tool | Description |
|
|
166
|
-
|------|-------------|
|
|
167
|
-
| `get_balances` | Check USDC and position balances |
|
|
168
|
-
| `get_positions` | View current positions |
|
|
169
|
-
| `place_order` | Place buy/sell orders |
|
|
170
|
-
| `cancel_order` | Cancel open orders |
|
|
171
|
-
| `get_orders` | List orders |
|
|
172
|
-
| `get_orderbook` | Get market orderbook |
|
|
173
|
-
| `get_price` | Get current price |
|
|
174
|
-
| `transfer_usdc` | Transfer USDC |
|
|
175
|
-
| `claim_winnings` | Claim from resolved markets |
|
|
176
|
-
| `export_private_key` | Export wallet private key |
|
|
177
|
-
|
|
178
|
-
### MCP Tools - Kalshi Trading
|
|
179
|
-
|
|
180
|
-
| Tool | Description |
|
|
181
|
-
|------|-------------|
|
|
182
|
-
| `kalshi_signup` | Create new account with Solana wallet |
|
|
183
|
-
| `kalshi_search_markets` | Search Kalshi markets |
|
|
184
|
-
| `kalshi_get_market` | Get market details by ticker |
|
|
185
|
-
| `kalshi_get_events` | Browse market categories |
|
|
186
|
-
| `kalshi_get_live_data` | Get live market data |
|
|
187
|
-
| `kalshi_get_quote` | Get quote for buy/sell order |
|
|
188
|
-
| `kalshi_place_order` | Execute a trade on Solana |
|
|
189
|
-
| `kalshi_get_wallet_info` | Get wallet address and balances |
|
|
190
|
-
| `kalshi_get_positions` | View Kalshi positions |
|
|
191
|
-
| `kalshi_check_market_initialization` | Check if market is tokenized |
|
|
192
|
-
| `kalshi_initialize_market` | Initialize market on-chain |
|
|
193
|
-
| `kalshi_check_redemption_status` | Check if market can be redeemed |
|
|
194
|
-
| `kalshi_export_private_key` | Export Solana private key |
|
|
195
|
-
|
|
196
|
-
## LLM Providers
|
|
197
|
-
|
|
198
|
-
### Anthropic (Default for new installs)
|
|
199
|
-
|
|
200
|
-
Uses Claude models directly via Anthropic API.
|
|
35
|
+
**Interactive mode:**
|
|
201
36
|
|
|
202
37
|
```bash
|
|
203
|
-
|
|
204
|
-
/model sonnet # Claude Sonnet 4.5 - Balanced (default)
|
|
205
|
-
/model haiku # Claude Haiku 4.5 - Fastest/cheapest
|
|
38
|
+
quantish
|
|
206
39
|
```
|
|
207
40
|
|
|
208
|
-
|
|
41
|
+
Example conversations:
|
|
209
42
|
|
|
210
|
-
|
|
43
|
+
```
|
|
44
|
+
You: Create a trading bot that monitors Bitcoin markets and alerts on price changes
|
|
45
|
+
Assistant: I'll create that for you. Let me first search for Bitcoin markets...
|
|
46
|
+
[Calling search_markets...]
|
|
47
|
+
[Writing bitcoin-monitor.js...]
|
|
211
48
|
|
|
212
|
-
|
|
213
|
-
|
|
49
|
+
You: What's my current balance?
|
|
50
|
+
Assistant: Your Safe wallet has 125.50 USDC available for trading.
|
|
214
51
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
/model deepseek # DeepSeek V3.2 - Great reasoning
|
|
218
|
-
/model gemini # Gemini 2.0 Flash - Google's latest
|
|
219
|
-
/model grok # Grok 3 Mini Beta - xAI
|
|
52
|
+
You: Place a $10 YES order on Trump winning at 55 cents
|
|
53
|
+
Assistant: Order placed! Order ID: abc123...
|
|
220
54
|
```
|
|
221
55
|
|
|
222
|
-
|
|
56
|
+
**One-shot mode:**
|
|
57
|
+
|
|
223
58
|
```bash
|
|
224
|
-
|
|
225
|
-
/model meta-llama/llama-3.3-70b-instruct
|
|
59
|
+
quantish -p "check my open orders"
|
|
226
60
|
```
|
|
227
61
|
|
|
228
|
-
##
|
|
62
|
+
## Commands
|
|
229
63
|
|
|
230
|
-
|
|
64
|
+
| Command | Description |
|
|
65
|
+
|---------|-------------|
|
|
66
|
+
| `quantish` | Start interactive chat |
|
|
67
|
+
| `quantish init` | Configure API keys |
|
|
68
|
+
| `quantish config` | View configuration |
|
|
69
|
+
| `quantish config --server <url>` | Set custom MCP server URL |
|
|
70
|
+
| `quantish config --export` | Export keys for standalone apps |
|
|
71
|
+
| `quantish tools` | List available tools |
|
|
72
|
+
| `quantish -p "..."` | Run one-shot prompt |
|
|
231
73
|
|
|
232
|
-
|
|
74
|
+
## Options
|
|
233
75
|
|
|
234
|
-
|
|
|
235
|
-
|
|
236
|
-
|
|
|
237
|
-
| `
|
|
238
|
-
| `
|
|
239
|
-
| `
|
|
240
|
-
| `
|
|
241
|
-
| `
|
|
242
|
-
| `KALSHI_MCP_URL` | Custom Kalshi MCP server URL |
|
|
76
|
+
| Option | Description |
|
|
77
|
+
|--------|-------------|
|
|
78
|
+
| `-p, --prompt <message>` | Run a single prompt |
|
|
79
|
+
| `-v, --verbose` | Show tool calls |
|
|
80
|
+
| `--no-mcp` | Disable trading tools |
|
|
81
|
+
| `--no-local` | Disable coding tools |
|
|
82
|
+
| `--version` | Show version |
|
|
83
|
+
| `--help` | Show help |
|
|
243
84
|
|
|
244
|
-
|
|
85
|
+
## Building Standalone Applications
|
|
245
86
|
|
|
246
|
-
|
|
247
|
-
quantish config --export > .env
|
|
248
|
-
```
|
|
87
|
+
The real power of Quantish is building standalone applications that interact with prediction markets. The agent can create trading bots, web dashboards, notification systems, and more.
|
|
249
88
|
|
|
250
|
-
|
|
89
|
+
### MCP API Overview
|
|
251
90
|
|
|
252
|
-
|
|
91
|
+
There are two MCP endpoints:
|
|
253
92
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
- Polymarket: `https://quantish-sdk-production.up.railway.app/mcp/execute` (requires `QUANTISH_API_KEY`)
|
|
259
|
-
- Kalshi: `https://kalshi-mcp-production-7c2c.up.railway.app/mcp` (requires `KALSHI_API_KEY`)
|
|
93
|
+
| Endpoint | Purpose | Auth Required |
|
|
94
|
+
|----------|---------|---------------|
|
|
95
|
+
| Trading API | Wallet, orders, positions | Yes (QUANTISH_API_KEY) |
|
|
96
|
+
| Discovery API | Search markets, prices | No (public key) |
|
|
260
97
|
|
|
261
|
-
|
|
98
|
+
### Trading API (Requires Your API Key)
|
|
262
99
|
|
|
263
100
|
```javascript
|
|
264
|
-
// Discovery MCP (simple format)
|
|
265
|
-
const response = await fetch('https://quantish.live/mcp/execute', {
|
|
266
|
-
method: 'POST',
|
|
267
|
-
headers: {
|
|
268
|
-
'Content-Type': 'application/json',
|
|
269
|
-
'X-API-Key': 'qm_ueQeqrmvZyHtR1zuVbLYkhx0fKyVAuV8'
|
|
270
|
-
},
|
|
271
|
-
body: JSON.stringify({
|
|
272
|
-
name: 'search_markets',
|
|
273
|
-
arguments: { query: 'bitcoin', limit: 5 }
|
|
274
|
-
})
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
// Polymarket Trading MCP (JSON-RPC format)
|
|
278
101
|
const response = await fetch('https://quantish-sdk-production.up.railway.app/mcp/execute', {
|
|
279
102
|
method: 'POST',
|
|
280
103
|
headers: {
|
|
281
104
|
'Content-Type': 'application/json',
|
|
282
|
-
'
|
|
105
|
+
'x-api-key': process.env.QUANTISH_API_KEY
|
|
283
106
|
},
|
|
284
107
|
body: JSON.stringify({
|
|
285
108
|
jsonrpc: '2.0',
|
|
286
|
-
id: 1,
|
|
287
109
|
method: 'tools/call',
|
|
288
|
-
params: { name: '
|
|
110
|
+
params: { name: 'get_balances', arguments: {} },
|
|
111
|
+
id: Date.now()
|
|
289
112
|
})
|
|
290
113
|
});
|
|
291
114
|
|
|
292
|
-
|
|
293
|
-
const
|
|
115
|
+
const data = await response.json();
|
|
116
|
+
const result = JSON.parse(data.result.content[0].text);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Trading Tools:** `get_balances`, `get_positions`, `place_order`, `cancel_order`, `get_orders`, `get_orderbook`, `get_price`, `transfer_usdc`
|
|
120
|
+
|
|
121
|
+
### Discovery API (Free, No Auth)
|
|
122
|
+
|
|
123
|
+
```javascript
|
|
124
|
+
const response = await fetch('https://quantish.live/mcp/execute', {
|
|
294
125
|
method: 'POST',
|
|
295
126
|
headers: {
|
|
296
127
|
'Content-Type': 'application/json',
|
|
297
|
-
'X-API-Key':
|
|
128
|
+
'X-API-Key': 'qm_ueQeqrmvZyHtR1zuVbLYkhx0fKyVAuV8' // Public key
|
|
298
129
|
},
|
|
299
130
|
body: JSON.stringify({
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
method: 'tools/call',
|
|
303
|
-
params: { name: 'kalshi_get_positions', arguments: {} }
|
|
131
|
+
name: 'search_markets', // Simple format for Discovery
|
|
132
|
+
arguments: { query: 'bitcoin', limit: 5 }
|
|
304
133
|
})
|
|
305
134
|
});
|
|
306
|
-
```
|
|
307
135
|
|
|
308
|
-
|
|
136
|
+
const data = await response.json();
|
|
137
|
+
const result = JSON.parse(data.result.content[0].text);
|
|
138
|
+
```
|
|
309
139
|
|
|
310
|
-
|
|
140
|
+
**Discovery Tools:** `search_markets`, `get_market_details`, `get_trending_markets`, `find_arbitrage`
|
|
311
141
|
|
|
312
|
-
###
|
|
142
|
+
### Example: Ask the Agent to Build an App
|
|
313
143
|
|
|
314
144
|
```bash
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
```bash
|
|
319
|
-
# Configure CLI to use your server
|
|
320
|
-
export MCP_SERVER_URL=https://your-server.com/mcp
|
|
145
|
+
quantish
|
|
146
|
+
> Create a Node.js script that monitors Bitcoin markets and sends a Discord notification when prices move more than 10%
|
|
321
147
|
```
|
|
322
148
|
|
|
323
|
-
|
|
324
|
-
-
|
|
325
|
-
-
|
|
326
|
-
-
|
|
149
|
+
The agent will create all necessary files:
|
|
150
|
+
- Main application code with MCP helper functions
|
|
151
|
+
- `package.json` with dependencies
|
|
152
|
+
- `.env.example` with required environment variables
|
|
153
|
+
- `README.md` with setup instructions
|
|
327
154
|
|
|
328
|
-
|
|
155
|
+
## Architecture
|
|
329
156
|
|
|
330
|
-
```bash
|
|
331
|
-
npm install @quantish/kalshi-server
|
|
332
157
|
```
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
158
|
+
quantish (CLI)
|
|
159
|
+
│
|
|
160
|
+
├── Local Tools (filesystem, shell, git)
|
|
161
|
+
│ └── Runs directly on your machine
|
|
162
|
+
│
|
|
163
|
+
└── MCP Tools (trading + discovery)
|
|
164
|
+
├── Trading MCP (your wallet, orders)
|
|
165
|
+
│ └── https://quantish-sdk-production.up.railway.app/mcp
|
|
166
|
+
│
|
|
167
|
+
└── Discovery MCP (public market data)
|
|
168
|
+
└── https://quantish.live/mcp
|
|
337
169
|
```
|
|
338
170
|
|
|
339
|
-
|
|
340
|
-
- `DATABASE_URL` - PostgreSQL connection string
|
|
341
|
-
- `ENCRYPTION_KEY` - 64-char hex string for wallet encryption
|
|
342
|
-
- `DFLOW_API_KEY` - DFlow API key
|
|
343
|
-
- `SOLANA_RPC_URL` - Solana RPC endpoint
|
|
344
|
-
|
|
345
|
-
Resources:
|
|
346
|
-
- **NPM**: [@quantish/kalshi-server](https://www.npmjs.com/package/@quantish/kalshi-server)
|
|
347
|
-
- **GitHub**: [joinQuantish/kalshi-mcp](https://github.com/joinQuantish/kalshi-mcp)
|
|
348
|
-
- **DFlow Docs**: [docs.dflow.net](https://docs.dflow.net)
|
|
171
|
+
## Self-Hosting
|
|
349
172
|
|
|
350
|
-
|
|
173
|
+
You can run your own Trading MCP server for full control over your wallet keys.
|
|
351
174
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
| Platform | Support |
|
|
355
|
-
|----------|---------|
|
|
356
|
-
| macOS | ✅ Full support |
|
|
357
|
-
| Linux | ✅ Full support |
|
|
358
|
-
| Windows | ⚠️ Requires WSL |
|
|
359
|
-
|
|
360
|
-
## Examples
|
|
175
|
+
### Configure Custom Server
|
|
361
176
|
|
|
362
177
|
```bash
|
|
363
|
-
#
|
|
364
|
-
quantish
|
|
178
|
+
# Set via CLI
|
|
179
|
+
quantish config --server https://your-server.com/mcp
|
|
365
180
|
|
|
366
|
-
#
|
|
367
|
-
|
|
181
|
+
# Or via environment variable
|
|
182
|
+
export MCP_SERVER_URL=https://your-server.com/mcp
|
|
183
|
+
```
|
|
368
184
|
|
|
369
|
-
|
|
370
|
-
quantish -p "show my Kalshi positions"
|
|
185
|
+
### What You Need
|
|
371
186
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
187
|
+
1. **Server**: Deploy the `quantish-server` to Railway, Render, or your own VPS
|
|
188
|
+
2. **Database**: PostgreSQL for user data and encrypted keys
|
|
189
|
+
3. **Polymarket Builder Credentials**: Apply at https://polymarket.com/builder
|
|
375
190
|
|
|
376
|
-
|
|
377
|
-
quantish
|
|
378
|
-
> Buy $10 of YES on the next Fed rate decision market on Kalshi
|
|
191
|
+
See [Self-Hosting Guide](https://quantish.live/docs/self-hosting.html) for full instructions.
|
|
379
192
|
|
|
380
|
-
|
|
381
|
-
quantish
|
|
382
|
-
> Create a bot that monitors Trump markets and alerts me when prices change more than 5%
|
|
193
|
+
## Configuration
|
|
383
194
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
195
|
+
Configuration is stored in `~/.quantish/config.json`:
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"anthropicApiKey": "sk-ant-...",
|
|
200
|
+
"quantishApiKey": "qtsh_...",
|
|
201
|
+
"mcpServerUrl": "https://quantish-sdk-production.up.railway.app/mcp",
|
|
202
|
+
"model": "claude-sonnet-4-5-20250929"
|
|
203
|
+
}
|
|
387
204
|
```
|
|
388
205
|
|
|
389
|
-
|
|
206
|
+
Environment variables take precedence:
|
|
207
|
+
- `ANTHROPIC_API_KEY`
|
|
208
|
+
- `QUANTISH_API_KEY`
|
|
209
|
+
- `MCP_SERVER_URL`
|
|
390
210
|
|
|
391
|
-
|
|
211
|
+
## Available Tools
|
|
392
212
|
|
|
393
|
-
|
|
213
|
+
### Local Tools (Coding)
|
|
394
214
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
215
|
+
| Tool | Description |
|
|
216
|
+
|------|-------------|
|
|
217
|
+
| `read_file` | Read file contents |
|
|
218
|
+
| `write_file` | Write/create files |
|
|
219
|
+
| `edit_file` | Search and replace in files |
|
|
220
|
+
| `list_dir` | List directory contents |
|
|
221
|
+
| `delete_file` | Delete files |
|
|
222
|
+
| `setup_env` | Create/update .env files |
|
|
223
|
+
| `run_command` | Execute shell commands |
|
|
224
|
+
| `grep` | Search file contents |
|
|
225
|
+
| `find_files` | Find files by pattern |
|
|
226
|
+
| `git_status` | Get git status |
|
|
227
|
+
| `git_diff` | Show git diff |
|
|
228
|
+
| `git_add` | Stage files |
|
|
229
|
+
| `git_commit` | Create commits |
|
|
398
230
|
|
|
399
|
-
###
|
|
231
|
+
### MCP Tools (Trading)
|
|
400
232
|
|
|
401
|
-
|
|
233
|
+
| Tool | Description |
|
|
234
|
+
|------|-------------|
|
|
235
|
+
| `get_balances` | Check wallet balances |
|
|
236
|
+
| `get_positions` | View current positions |
|
|
237
|
+
| `place_order` | Place buy/sell orders |
|
|
238
|
+
| `cancel_order` | Cancel open orders |
|
|
239
|
+
| `get_orders` | List orders |
|
|
240
|
+
| `get_orderbook` | Get market orderbook |
|
|
241
|
+
| `get_price` | Get current price |
|
|
242
|
+
| `transfer_usdc` | Transfer USDC |
|
|
402
243
|
|
|
403
|
-
|
|
404
|
-
rm -rf ~/.quantish/sessions
|
|
405
|
-
```
|
|
244
|
+
### MCP Tools (Discovery)
|
|
406
245
|
|
|
407
|
-
|
|
246
|
+
| Tool | Description |
|
|
247
|
+
|------|-------------|
|
|
248
|
+
| `search_markets` | Search markets by keyword |
|
|
249
|
+
| `get_market_details` | Get full market info |
|
|
250
|
+
| `get_trending_markets` | Popular markets |
|
|
251
|
+
| `find_arbitrage` | Find price discrepancies |
|
|
408
252
|
|
|
409
|
-
|
|
410
|
-
/compact # Summarize conversation
|
|
411
|
-
/model haiku # Switch to cheaper model
|
|
412
|
-
/clear # Start fresh
|
|
413
|
-
```
|
|
253
|
+
## Platform Support
|
|
414
254
|
|
|
415
|
-
|
|
255
|
+
| Platform | Support |
|
|
256
|
+
|----------|---------|
|
|
257
|
+
| macOS | ✅ Full support |
|
|
258
|
+
| Linux | ✅ Full support |
|
|
259
|
+
| Windows | ⚠️ Requires WSL |
|
|
416
260
|
|
|
417
|
-
|
|
418
|
-
git clone https://github.com/joinQuantish/quantish-agent
|
|
419
|
-
cd quantish-agent
|
|
420
|
-
npm install
|
|
421
|
-
npm run build
|
|
422
|
-
npm link # Install locally
|
|
423
|
-
```
|
|
261
|
+
**Windows users:** Install [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) and run Quantish from within WSL.
|
|
424
262
|
|
|
425
|
-
##
|
|
263
|
+
## How It Works
|
|
426
264
|
|
|
427
|
-
|
|
265
|
+
Quantish CLI connects to the **Quantish Signing Server** to execute trades on Polymarket:
|
|
428
266
|
|
|
429
|
-
**
|
|
267
|
+
- **Your funds are secure** - Only you can authorize transactions via your API key
|
|
268
|
+
- **Wallets are non-custodial** - Export your private key anytime with `export_private_key`
|
|
269
|
+
- **Trading is free** - No gas fees (Polymarket covers them)
|
|
270
|
+
- **Self-hosting available** - Run your own server for full control
|
|
430
271
|
|
|
431
|
-
##
|
|
272
|
+
## License
|
|
432
273
|
|
|
433
|
-
|
|
434
|
-
- [GitHub](https://github.com/joinQuantish/quantish-agent)
|
|
435
|
-
- [NPM](https://www.npmjs.com/package/@quantish/agent)
|
|
436
|
-
- [Documentation](https://docs.quantish.live)
|
|
437
|
-
- [Quantish Platform](https://quantish.live)
|
|
274
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -765,17 +765,42 @@ async function runSetup() {
|
|
|
765
765
|
}
|
|
766
766
|
} else {
|
|
767
767
|
console.log("Options:");
|
|
768
|
-
console.log(chalk.dim(" 1. Create a new Kalshi
|
|
768
|
+
console.log(chalk.dim(" 1. Create a new Kalshi wallet (recommended for new users)"));
|
|
769
769
|
console.log(chalk.dim(" 2. Enter an existing Kalshi API key"));
|
|
770
770
|
console.log(chalk.dim(" 3. Skip Kalshi for now\n"));
|
|
771
771
|
const choice = await prompt("Choose (1/2/3): ");
|
|
772
772
|
if (choice === "1") {
|
|
773
|
-
console.log();
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
773
|
+
console.log(chalk.dim("\nCreating a new Solana wallet on Kalshi MCP..."));
|
|
774
|
+
const externalId = await prompt("Enter a unique identifier (e.g., email or username): ");
|
|
775
|
+
if (!externalId) {
|
|
776
|
+
console.log(chalk.red("Identifier is required to create an account."));
|
|
777
|
+
skipKalshi = true;
|
|
778
|
+
} else {
|
|
779
|
+
try {
|
|
780
|
+
const kalshiClient = createMCPClient(KALSHI_MCP_URL, "", "kalshi");
|
|
781
|
+
const result = await kalshiClient.callTool("kalshi_signup", { externalId });
|
|
782
|
+
if (result.success && typeof result.data === "object" && result.data !== null) {
|
|
783
|
+
const data = result.data;
|
|
784
|
+
kalshiKey = data.apiKey;
|
|
785
|
+
console.log(chalk.green("\n\u2713 Kalshi wallet created!"));
|
|
786
|
+
console.log(chalk.dim(` Solana Address: ${data.walletAddress}`));
|
|
787
|
+
if (data.apiSecret) {
|
|
788
|
+
console.log(chalk.yellow("\n\u26A0\uFE0F Save your API secret (shown only once):"));
|
|
789
|
+
console.log(chalk.bold.yellow(` ${String(data.apiSecret)}`));
|
|
790
|
+
console.log();
|
|
791
|
+
}
|
|
792
|
+
} else {
|
|
793
|
+
console.log(chalk.red("Failed to create Kalshi account: " + (result.error || "Unknown error")));
|
|
794
|
+
console.log(chalk.dim("You can try again later via the agent."));
|
|
795
|
+
skipKalshi = true;
|
|
796
|
+
}
|
|
797
|
+
} catch (error2) {
|
|
798
|
+
console.log(chalk.red("Failed to connect to Kalshi MCP."));
|
|
799
|
+
console.log(chalk.dim(String(error2)));
|
|
800
|
+
console.log(chalk.dim("You can try again later via the agent."));
|
|
801
|
+
skipKalshi = true;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
779
804
|
} else if (choice === "2") {
|
|
780
805
|
kalshiKey = await prompt("Enter your Kalshi API key: ", true);
|
|
781
806
|
} else {
|