@quantish/agent 0.1.15 → 0.1.18

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 (4) hide show
  1. package/LICENSE +2 -0
  2. package/README.md +140 -152
  3. package/dist/index.js +1305 -403
  4. package/package.json +2 -1
package/LICENSE CHANGED
@@ -20,3 +20,5 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
22
 
23
+
24
+
package/README.md CHANGED
@@ -1,19 +1,45 @@
1
- # @quantish/agent
1
+ # @quantish/cli
2
2
 
3
- AI-powered CLI agent for building trading bots and applications on Polymarket.
3
+ AI-powered CLI agent for building trading bots on Polymarket.
4
4
 
5
5
  Combines **coding tools** (file system, shell, git) with **trading tools** (Polymarket orders, positions, wallet) powered by Claude AI.
6
6
 
7
+ ## How It Works
8
+
9
+ Quantish CLI connects to the **Quantish Signing Server** to execute trades on Polymarket. Here's why:
10
+
11
+ ### Why We Use a Signing Server
12
+
13
+ Polymarket uses a **gasless relayer system** - this means:
14
+ - ✅ **Free wallet creation** - No MATIC needed to set up
15
+ - ✅ **Free trading** - Polymarket covers gas fees on all transactions
16
+ - ✅ **Simplified signing** - Our server handles the complex signature formats
17
+
18
+ To make this work reliably, the Quantish Signing Server:
19
+ 1. **Handles wallet creation** - Your wallet is created and managed through our server
20
+ 2. **Signs transactions** - Orders are signed using Polymarket's required format
21
+ 3. **Relays to Polymarket** - Transactions go through Polymarket's official relayer
22
+ 4. **Bypasses geo-restrictions** - Our server is hosted in a compatible region
23
+
24
+ ### What This Means for You
25
+
26
+ - **Your funds are secure** - Only you can authorize transactions via your API key
27
+ - **Wallets are non-custodial** - You can export your private key anytime with `export_private_key`
28
+ - **Trading is free** - No gas fees, ever
29
+ - **It just works** - No VPN or complex setup needed
30
+
31
+ > 🔒 **Security Note**: Your private keys are stored encrypted. You can export them and migrate to a self-hosted solution in the future if needed.
32
+
7
33
  ## Installation
8
34
 
9
35
  ```bash
10
- npm install -g @quantish/agent
36
+ npm install -g @quantish/cli
11
37
  ```
12
38
 
13
39
  Or run directly with npx:
14
40
 
15
41
  ```bash
16
- npx @quantish/agent
42
+ npx @quantish/cli
17
43
  ```
18
44
 
19
45
  ## Quick Start
@@ -41,15 +67,15 @@ quantish
41
67
  Example conversations:
42
68
 
43
69
  ```
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...]
70
+ You: Create a trading bot that monitors my positions and sells when profit > 20%
71
+ Assistant: I'll create that for you. Let me first check your current positions...
72
+ [Calling get_positions...]
73
+ [Writing bot.ts...]
48
74
 
49
75
  You: What's my current balance?
50
- Assistant: Your Safe wallet has 125.50 USDC available for trading.
76
+ Assistant: Your Safe wallet has 0.68 USDC available for trading.
51
77
 
52
- You: Place a $10 YES order on Trump winning at 55 cents
78
+ You: Place a $5 YES order on Trump winning at 55 cents
53
79
  Assistant: Order placed! Order ID: abc123...
54
80
  ```
55
81
 
@@ -59,6 +85,12 @@ Assistant: Order placed! Order ID: abc123...
59
85
  quantish -p "check my open orders"
60
86
  ```
61
87
 
88
+ **Piped input:**
89
+
90
+ ```bash
91
+ echo "show my positions" | quantish
92
+ ```
93
+
62
94
  ## Commands
63
95
 
64
96
  | Command | Description |
@@ -66,8 +98,6 @@ quantish -p "check my open orders"
66
98
  | `quantish` | Start interactive chat |
67
99
  | `quantish init` | Configure API keys |
68
100
  | `quantish config` | View configuration |
69
- | `quantish config --server <url>` | Set custom MCP server URL |
70
- | `quantish config --export` | Export keys for standalone apps |
71
101
  | `quantish tools` | List available tools |
72
102
  | `quantish -p "..."` | Run one-shot prompt |
73
103
 
@@ -82,173 +112,124 @@ quantish -p "check my open orders"
82
112
  | `--version` | Show version |
83
113
  | `--help` | Show help |
84
114
 
85
- ## Building Standalone Applications
115
+ ## Available Tools
86
116
 
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.
117
+ ### Local Tools (Coding)
88
118
 
89
- ### MCP API Overview
119
+ | Tool | Description |
120
+ |------|-------------|
121
+ | `read_file` | Read file contents |
122
+ | `write_file` | Write/create files |
123
+ | `list_dir` | List directory contents |
124
+ | `delete_file` | Delete files |
125
+ | `file_exists` | Check if file exists |
126
+ | `run_command` | Execute shell commands |
127
+ | `grep` | Search file contents |
128
+ | `find_files` | Find files by pattern |
129
+ | `git_status` | Get git status |
130
+ | `git_diff` | Show git diff |
131
+ | `git_add` | Stage files |
132
+ | `git_commit` | Create commits |
133
+ | `git_log` | Show commit history |
134
+ | `git_checkout` | Switch branches |
135
+ | `web_search` | Search the web (Exa/DuckDuckGo) |
136
+ | `web_answer` | AI-powered Q&A (Exa) |
137
+ | `fetch_url` | Fetch URL content |
90
138
 
91
- There are two MCP endpoints:
139
+ ### MCP Tools (Trading)
92
140
 
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) |
141
+ | Tool | Description |
142
+ |------|-------------|
143
+ | `get_balances` | Check wallet balances |
144
+ | `get_positions` | View current positions |
145
+ | `place_order` | Place buy/sell orders |
146
+ | `cancel_order` | Cancel open orders |
147
+ | `get_orders` | List orders |
148
+ | `get_orderbook` | Get market orderbook |
149
+ | `get_price` | Get current price |
150
+ | `transfer_usdc` | Transfer USDC |
151
+ | `swap_tokens` | Swap tokens |
152
+ | `claim_winnings` | Claim from resolved markets |
97
153
 
98
- ### Trading API (Requires Your API Key)
154
+ ## Configuration
99
155
 
100
- ```javascript
101
- const response = await fetch('https://quantish-sdk-production.up.railway.app/mcp/execute', {
102
- method: 'POST',
103
- headers: {
104
- 'Content-Type': 'application/json',
105
- 'x-api-key': process.env.QUANTISH_API_KEY
106
- },
107
- body: JSON.stringify({
108
- jsonrpc: '2.0',
109
- method: 'tools/call',
110
- params: { name: 'get_balances', arguments: {} },
111
- id: Date.now()
112
- })
113
- });
156
+ Configuration is stored in `~/.quantish/config.json`:
114
157
 
115
- const data = await response.json();
116
- const result = JSON.parse(data.result.content[0].text);
158
+ ```json
159
+ {
160
+ "anthropicApiKey": "sk-ant-...",
161
+ "quantishApiKey": "pk_live_...",
162
+ "mcpServerUrl": "https://quantish-sdk-production.up.railway.app/mcp"
163
+ }
117
164
  ```
118
165
 
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', {
125
- method: 'POST',
126
- headers: {
127
- 'Content-Type': 'application/json',
128
- 'X-API-Key': 'qm_ueQeqrmvZyHtR1zuVbLYkhx0fKyVAuV8' // Public key
129
- },
130
- body: JSON.stringify({
131
- name: 'search_markets', // Simple format for Discovery
132
- arguments: { query: 'bitcoin', limit: 5 }
133
- })
134
- });
135
-
136
- const data = await response.json();
137
- const result = JSON.parse(data.result.content[0].text);
138
- ```
166
+ Environment variables take precedence:
167
+ - `ANTHROPIC_API_KEY`
168
+ - `QUANTISH_API_KEY`
139
169
 
140
- **Discovery Tools:** `search_markets`, `get_market_details`, `get_trending_markets`, `find_arbitrage`
170
+ ## Examples
141
171
 
142
- ### Example: Ask the Agent to Build an App
172
+ ### Build a Trading Bot
143
173
 
144
174
  ```bash
145
175
  quantish
146
- > Create a Node.js script that monitors Bitcoin markets and sends a Discord notification when prices move more than 10%
176
+ > Create a Python script that monitors the Trump market and alerts me when price drops below 40 cents
147
177
  ```
148
178
 
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
154
-
155
- ## Architecture
179
+ ### Manage Positions
156
180
 
157
- ```
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
181
+ ```bash
182
+ quantish -p "show me my positions with unrealized P&L"
169
183
  ```
170
184
 
171
- ## Self-Hosting
185
+ ### Market Making
172
186
 
173
- You can run your own Trading MCP server for full control over your wallet keys.
187
+ ```bash
188
+ quantish
189
+ > Help me set up a basic market making strategy. I want to place both bid and ask orders around the current mid price.
190
+ ```
174
191
 
175
- ### Configure Custom Server
192
+ ### Code Review
176
193
 
177
194
  ```bash
178
- # Set via CLI
179
- quantish config --server https://your-server.com/mcp
180
-
181
- # Or via environment variable
182
- export MCP_SERVER_URL=https://your-server.com/mcp
195
+ quantish
196
+ > Read my trading bot code in bot.ts and suggest improvements
183
197
  ```
184
198
 
185
- ### What You Need
199
+ ## Development
186
200
 
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
201
+ ```bash
202
+ # Clone the repo
203
+ git clone https://github.com/quantish/cli
190
204
 
191
- See [Self-Hosting Guide](https://quantish.live/docs/self-hosting.html) for full instructions.
205
+ # Install dependencies
206
+ cd packages/quantish-cli
207
+ npm install
192
208
 
193
- ## Configuration
209
+ # Build
210
+ npm run build
194
211
 
195
- Configuration is stored in `~/.quantish/config.json`:
212
+ # Run locally
213
+ npm start
196
214
 
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
- }
215
+ # Development mode (watch)
216
+ npm run dev
204
217
  ```
205
218
 
206
- Environment variables take precedence:
207
- - `ANTHROPIC_API_KEY`
208
- - `QUANTISH_API_KEY`
209
- - `MCP_SERVER_URL`
210
-
211
- ## Available Tools
212
-
213
- ### Local Tools (Coding)
214
-
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 |
230
-
231
- ### MCP Tools (Trading)
232
-
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 |
219
+ ## Architecture
243
220
 
244
- ### MCP Tools (Discovery)
221
+ ```
222
+ quantish (CLI)
223
+
224
+ ├── Local Tools (filesystem, shell, git)
225
+ │ └── Runs directly on your machine
226
+
227
+ └── MCP Tools (trading)
228
+ └── Calls Quantish MCP Server
229
+ └── Executes on Polymarket
230
+ ```
245
231
 
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 |
232
+ The agent uses Claude to understand your requests and decide which tools to use. It can combine coding and trading tools in a single conversation.
252
233
 
253
234
  ## Platform Support
254
235
 
@@ -258,16 +239,23 @@ Environment variables take precedence:
258
239
  | Linux | ✅ Full support |
259
240
  | Windows | ⚠️ Requires WSL |
260
241
 
261
- **Windows users:** Install [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) and run Quantish from within WSL.
242
+ **Windows users:** Install [WSL (Windows Subsystem for Linux)](https://learn.microsoft.com/en-us/windows/wsl/install) and run Quantish from within WSL. Native Windows (PowerShell/cmd.exe) is not supported.
262
243
 
263
- ## How It Works
244
+ ## Environment Variables
264
245
 
265
- Quantish CLI connects to the **Quantish Signing Server** to execute trades on Polymarket:
246
+ | Variable | Description |
247
+ |----------|-------------|
248
+ | `ANTHROPIC_API_KEY` | Your Anthropic API key (required) |
249
+ | `QUANTISH_API_KEY` | Your Quantish trading API key |
250
+ | `EXA_API_KEY` | Optional: Exa AI search key for powerful web search |
266
251
 
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
252
+ ### Web Search
253
+
254
+ Web search works without API keys (using DuckDuckGo fallback), but **Exa is strongly recommended** for AI-quality search results.
255
+
256
+ Get your Exa API key at: https://dashboard.exa.ai
257
+
258
+ Exa is the same search engine used by Cursor, Notion, Vercel, and other leading AI products.
271
259
 
272
260
  ## License
273
261