@quantish/agent 0.1.0
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/LICENSE +22 -0
- package/README.md +262 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4042 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Quantish
|
|
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.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# @quantish/cli
|
|
2
|
+
|
|
3
|
+
AI-powered CLI agent for building trading bots on Polymarket.
|
|
4
|
+
|
|
5
|
+
Combines **coding tools** (file system, shell, git) with **trading tools** (Polymarket orders, positions, wallet) powered by Claude AI.
|
|
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
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install -g @quantish/cli
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or run directly with npx:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx @quantish/cli
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
### 1. Initialize
|
|
48
|
+
|
|
49
|
+
Set up your API keys:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
quantish init
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
You'll need:
|
|
56
|
+
- **Anthropic API Key** - Get one at https://console.anthropic.com/
|
|
57
|
+
- **Quantish API Key** - Created automatically during setup
|
|
58
|
+
|
|
59
|
+
### 2. Start Building
|
|
60
|
+
|
|
61
|
+
**Interactive mode:**
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
quantish
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Example conversations:
|
|
68
|
+
|
|
69
|
+
```
|
|
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...]
|
|
74
|
+
|
|
75
|
+
You: What's my current balance?
|
|
76
|
+
Assistant: Your Safe wallet has 0.68 USDC available for trading.
|
|
77
|
+
|
|
78
|
+
You: Place a $5 YES order on Trump winning at 55 cents
|
|
79
|
+
Assistant: Order placed! Order ID: abc123...
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**One-shot mode:**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
quantish -p "check my open orders"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Piped input:**
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
echo "show my positions" | quantish
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Commands
|
|
95
|
+
|
|
96
|
+
| Command | Description |
|
|
97
|
+
|---------|-------------|
|
|
98
|
+
| `quantish` | Start interactive chat |
|
|
99
|
+
| `quantish init` | Configure API keys |
|
|
100
|
+
| `quantish config` | View configuration |
|
|
101
|
+
| `quantish tools` | List available tools |
|
|
102
|
+
| `quantish -p "..."` | Run one-shot prompt |
|
|
103
|
+
|
|
104
|
+
## Options
|
|
105
|
+
|
|
106
|
+
| Option | Description |
|
|
107
|
+
|--------|-------------|
|
|
108
|
+
| `-p, --prompt <message>` | Run a single prompt |
|
|
109
|
+
| `-v, --verbose` | Show tool calls |
|
|
110
|
+
| `--no-mcp` | Disable trading tools |
|
|
111
|
+
| `--no-local` | Disable coding tools |
|
|
112
|
+
| `--version` | Show version |
|
|
113
|
+
| `--help` | Show help |
|
|
114
|
+
|
|
115
|
+
## Available Tools
|
|
116
|
+
|
|
117
|
+
### Local Tools (Coding)
|
|
118
|
+
|
|
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 |
|
|
138
|
+
|
|
139
|
+
### MCP Tools (Trading)
|
|
140
|
+
|
|
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 |
|
|
153
|
+
|
|
154
|
+
## Configuration
|
|
155
|
+
|
|
156
|
+
Configuration is stored in `~/.quantish/config.json`:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"anthropicApiKey": "sk-ant-...",
|
|
161
|
+
"quantishApiKey": "pk_live_...",
|
|
162
|
+
"mcpServerUrl": "https://quantish-sdk-production.up.railway.app/mcp"
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Environment variables take precedence:
|
|
167
|
+
- `ANTHROPIC_API_KEY`
|
|
168
|
+
- `QUANTISH_API_KEY`
|
|
169
|
+
|
|
170
|
+
## Examples
|
|
171
|
+
|
|
172
|
+
### Build a Trading Bot
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
quantish
|
|
176
|
+
> Create a Python script that monitors the Trump market and alerts me when price drops below 40 cents
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Manage Positions
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
quantish -p "show me my positions with unrealized P&L"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Market Making
|
|
186
|
+
|
|
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
|
+
```
|
|
191
|
+
|
|
192
|
+
### Code Review
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
quantish
|
|
196
|
+
> Read my trading bot code in bot.ts and suggest improvements
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Development
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Clone the repo
|
|
203
|
+
git clone https://github.com/quantish/cli
|
|
204
|
+
|
|
205
|
+
# Install dependencies
|
|
206
|
+
cd packages/quantish-cli
|
|
207
|
+
npm install
|
|
208
|
+
|
|
209
|
+
# Build
|
|
210
|
+
npm run build
|
|
211
|
+
|
|
212
|
+
# Run locally
|
|
213
|
+
npm start
|
|
214
|
+
|
|
215
|
+
# Development mode (watch)
|
|
216
|
+
npm run dev
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Architecture
|
|
220
|
+
|
|
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
|
+
```
|
|
231
|
+
|
|
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.
|
|
233
|
+
|
|
234
|
+
## Platform Support
|
|
235
|
+
|
|
236
|
+
| Platform | Support |
|
|
237
|
+
|----------|---------|
|
|
238
|
+
| macOS | ✅ Full support |
|
|
239
|
+
| Linux | ✅ Full support |
|
|
240
|
+
| Windows | ⚠️ Requires WSL |
|
|
241
|
+
|
|
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.
|
|
243
|
+
|
|
244
|
+
## Environment Variables
|
|
245
|
+
|
|
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 |
|
|
251
|
+
|
|
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.
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|