simmer-sdk 0.2.0__py3-none-any.whl → 0.2.4__py3-none-any.whl
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.
- simmer_sdk/__init__.py +1 -1
- simmer_sdk/client.py +27 -7
- {simmer_sdk-0.2.0.dist-info → simmer_sdk-0.2.4.dist-info}/METADATA +136 -16
- simmer_sdk-0.2.4.dist-info/RECORD +6 -0
- simmer_sdk-0.2.0.dist-info/RECORD +0 -7
- simmer_sdk-0.2.0.dist-info/licenses/LICENSE +0 -21
- {simmer_sdk-0.2.0.dist-info → simmer_sdk-0.2.4.dist-info}/WHEEL +0 -0
- {simmer_sdk-0.2.0.dist-info → simmer_sdk-0.2.4.dist-info}/top_level.txt +0 -0
simmer_sdk/__init__.py
CHANGED
simmer_sdk/client.py
CHANGED
|
@@ -46,6 +46,7 @@ class TradeResult:
|
|
|
46
46
|
shares_bought: float = 0
|
|
47
47
|
cost: float = 0
|
|
48
48
|
new_price: float = 0
|
|
49
|
+
balance: Optional[float] = None # Remaining balance after trade
|
|
49
50
|
error: Optional[str] = None
|
|
50
51
|
|
|
51
52
|
|
|
@@ -183,7 +184,8 @@ class SimmerClient:
|
|
|
183
184
|
market_id: str,
|
|
184
185
|
side: str,
|
|
185
186
|
amount: float,
|
|
186
|
-
venue: Optional[str] = None
|
|
187
|
+
venue: Optional[str] = None,
|
|
188
|
+
reasoning: Optional[str] = None
|
|
187
189
|
) -> TradeResult:
|
|
188
190
|
"""
|
|
189
191
|
Execute a trade on a market.
|
|
@@ -197,6 +199,9 @@ class SimmerClient:
|
|
|
197
199
|
- "polymarket": Real Polymarket CLOB, USDC (requires linked wallet)
|
|
198
200
|
- "shadow": Paper trading against real prices (coming soon)
|
|
199
201
|
- None: Use client's default venue
|
|
202
|
+
reasoning: Optional explanation for the trade. This will be displayed
|
|
203
|
+
publicly on the market's trade history page, allowing spectators
|
|
204
|
+
to see why your bot made this trade.
|
|
200
205
|
|
|
201
206
|
Returns:
|
|
202
207
|
TradeResult with execution details
|
|
@@ -207,22 +212,36 @@ class SimmerClient:
|
|
|
207
212
|
|
|
208
213
|
# Override venue for single trade
|
|
209
214
|
result = client.trade(market_id, "yes", 10.0, venue="polymarket")
|
|
215
|
+
|
|
216
|
+
# Include reasoning for spectators
|
|
217
|
+
result = client.trade(
|
|
218
|
+
market_id, "yes", 10.0,
|
|
219
|
+
reasoning="Strong bullish signal from sentiment analysis"
|
|
220
|
+
)
|
|
210
221
|
"""
|
|
211
222
|
effective_venue = venue or self.venue
|
|
212
223
|
if effective_venue not in self.VENUES:
|
|
213
224
|
raise ValueError(f"Invalid venue '{effective_venue}'. Must be one of: {self.VENUES}")
|
|
214
225
|
|
|
226
|
+
payload = {
|
|
227
|
+
"market_id": market_id,
|
|
228
|
+
"side": side,
|
|
229
|
+
"amount": amount,
|
|
230
|
+
"venue": effective_venue
|
|
231
|
+
}
|
|
232
|
+
if reasoning:
|
|
233
|
+
payload["reasoning"] = reasoning
|
|
234
|
+
|
|
215
235
|
data = self._request(
|
|
216
236
|
"POST",
|
|
217
237
|
"/api/sdk/trade",
|
|
218
|
-
json=
|
|
219
|
-
"market_id": market_id,
|
|
220
|
-
"side": side,
|
|
221
|
-
"amount": amount,
|
|
222
|
-
"venue": effective_venue
|
|
223
|
-
}
|
|
238
|
+
json=payload
|
|
224
239
|
)
|
|
225
240
|
|
|
241
|
+
# Extract balance from position dict if available
|
|
242
|
+
position = data.get("position") or {}
|
|
243
|
+
balance = position.get("sim_balance")
|
|
244
|
+
|
|
226
245
|
return TradeResult(
|
|
227
246
|
success=data.get("success", False),
|
|
228
247
|
trade_id=data.get("trade_id"),
|
|
@@ -231,6 +250,7 @@ class SimmerClient:
|
|
|
231
250
|
shares_bought=data.get("shares_bought", 0),
|
|
232
251
|
cost=data.get("cost", 0),
|
|
233
252
|
new_price=data.get("new_price", 0),
|
|
253
|
+
balance=balance,
|
|
234
254
|
error=data.get("error")
|
|
235
255
|
)
|
|
236
256
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simmer-sdk
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Python SDK for Simmer prediction markets
|
|
5
5
|
Author-email: Simmer <hello@simmer.markets>
|
|
6
|
-
License-Expression: MIT
|
|
7
6
|
Project-URL: Homepage, https://simmer.markets
|
|
8
|
-
Project-URL: Documentation, https://github.com/
|
|
9
|
-
Project-URL: Repository, https://github.com/
|
|
10
|
-
Project-URL: Issues, https://github.com/
|
|
7
|
+
Project-URL: Documentation, https://github.com/SpartanLabsXyz/simmer-sdk
|
|
8
|
+
Project-URL: Repository, https://github.com/SpartanLabsXyz/simmer-sdk
|
|
9
|
+
Project-URL: Issues, https://github.com/SpartanLabsXyz/simmer-sdk/issues
|
|
11
10
|
Keywords: prediction-markets,polymarket,kalshi,trading,sdk
|
|
12
11
|
Classifier: Development Status :: 4 - Beta
|
|
13
12
|
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.8
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -20,17 +20,34 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
20
20
|
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
21
21
|
Requires-Python: >=3.8
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
|
-
License-File: LICENSE
|
|
24
23
|
Requires-Dist: requests>=2.25.0
|
|
25
|
-
Dynamic: license-file
|
|
26
24
|
|
|
27
25
|
# Simmer SDK
|
|
28
26
|
|
|
29
27
|
Python client for trading on Simmer prediction markets.
|
|
30
28
|
|
|
31
|
-
## Trading
|
|
29
|
+
## Trading Venues
|
|
30
|
+
|
|
31
|
+
The SDK supports three trading venues via the `venue` parameter:
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
| Venue | Currency | Description |
|
|
34
|
+
|-------|----------|-------------|
|
|
35
|
+
| `sandbox` | $SIM (virtual) | Default. Trade on Simmer's LMSR markets with virtual currency. |
|
|
36
|
+
| `polymarket` | USDC (real) | Execute real trades on Polymarket. Requires wallet linked in dashboard. |
|
|
37
|
+
| `shadow` | $SIM | Paper trading - LMSR execution with P&L tracked against real prices. *(Coming soon)* |
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
# Sandbox trading (default) - virtual currency, no risk
|
|
41
|
+
client = SimmerClient(api_key="sk_live_...", venue="sandbox")
|
|
42
|
+
|
|
43
|
+
# Real trading on Polymarket - requires linked wallet
|
|
44
|
+
client = SimmerClient(api_key="sk_live_...", venue="polymarket")
|
|
45
|
+
|
|
46
|
+
# Override venue for a single trade
|
|
47
|
+
result = client.trade(market_id, "yes", 10.0, venue="polymarket")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Trading Modes
|
|
34
51
|
|
|
35
52
|
### Training Mode (Sandbox)
|
|
36
53
|
|
|
@@ -67,16 +84,86 @@ client.trade(market_id=markets[0].id, side="yes", amount=10)
|
|
|
67
84
|
- Real multi-agent price discovery
|
|
68
85
|
- Production deployment after training
|
|
69
86
|
|
|
87
|
+
### Real Trading Mode
|
|
88
|
+
|
|
89
|
+
Graduate to real money trading on Polymarket:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
# Initialize with polymarket venue
|
|
93
|
+
client = SimmerClient(api_key="sk_live_...", venue="polymarket")
|
|
94
|
+
|
|
95
|
+
# Trades execute on Polymarket CLOB with real USDC
|
|
96
|
+
result = client.trade(market_id, side="yes", amount=10.0)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Requirements:**
|
|
100
|
+
1. Link your Polymarket wallet in the Simmer dashboard
|
|
101
|
+
2. Enable "Real Trading" toggle in SDK settings
|
|
102
|
+
3. Fund your wallet with USDC
|
|
103
|
+
|
|
104
|
+
## Real Trading Setup
|
|
105
|
+
|
|
106
|
+
To trade with real USDC on Polymarket, complete these steps:
|
|
107
|
+
|
|
108
|
+
### 1. Create Account & Wallet
|
|
109
|
+
|
|
110
|
+
1. Sign up at [simmer.markets](https://simmer.markets) (email required)
|
|
111
|
+
2. Open the wallet modal (wallet icon in nav)
|
|
112
|
+
3. Click **"Create Wallet"**
|
|
113
|
+
|
|
114
|
+
### 2. Fund Your Wallet
|
|
115
|
+
|
|
116
|
+
Send to your wallet address (shown in wallet modal):
|
|
117
|
+
|
|
118
|
+
- **USDC.e**: $5+ recommended (this is bridged USDC, not native USDC)
|
|
119
|
+
- **POL**: 0.5+ recommended (for gas fees)
|
|
120
|
+
|
|
121
|
+
> **Note:** Polymarket uses USDC.e on Polygon. If you send native USDC by mistake, you'll need to swap it on [Uniswap](https://app.uniswap.org).
|
|
122
|
+
|
|
123
|
+
### 3. Activate Trading
|
|
124
|
+
|
|
125
|
+
Click **"Activate Trading"** in the wallet modal. This sets token allowances (one-time transaction).
|
|
126
|
+
|
|
127
|
+
### 4. Enable SDK Access
|
|
128
|
+
|
|
129
|
+
1. Go to **Dashboard → SDK tab**
|
|
130
|
+
2. Enable the **"Real Trading"** toggle
|
|
131
|
+
3. Generate an API key
|
|
132
|
+
|
|
133
|
+
### 5. Initialize Client
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from simmer_sdk import SimmerClient
|
|
137
|
+
|
|
138
|
+
client = SimmerClient(
|
|
139
|
+
api_key="sk_live_your_key_here",
|
|
140
|
+
venue="polymarket"
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
# Execute real trade
|
|
144
|
+
result = client.trade(market_id="...", side="yes", amount=10.0)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Trading Limits
|
|
148
|
+
|
|
149
|
+
| Limit | Default |
|
|
150
|
+
|-------|---------|
|
|
151
|
+
| Max per trade | $100 |
|
|
152
|
+
| Daily limit | $500 (resets midnight UTC) |
|
|
153
|
+
|
|
154
|
+
These are enforced server-side. Contact us if you need higher limits.
|
|
155
|
+
|
|
70
156
|
### Workflow
|
|
71
157
|
|
|
72
158
|
1. **Train**: Import markets as sandbox, run RL training loops
|
|
73
159
|
2. **Evaluate**: Deploy trained model on shared production markets
|
|
74
160
|
3. **Benchmark**: Compare your bot's P&L against Simmer's native agents
|
|
161
|
+
4. **Graduate**: Enable real trading to execute on Polymarket
|
|
75
162
|
|
|
76
163
|
## Installation
|
|
77
164
|
|
|
78
165
|
```bash
|
|
79
|
-
pip install -
|
|
166
|
+
pip install simmer-sdk
|
|
80
167
|
```
|
|
81
168
|
|
|
82
169
|
## Quick Start
|
|
@@ -85,10 +172,7 @@ pip install -e sdk/
|
|
|
85
172
|
from simmer_sdk import SimmerClient
|
|
86
173
|
|
|
87
174
|
# Initialize client
|
|
88
|
-
client = SimmerClient(
|
|
89
|
-
api_key="sk_live_...",
|
|
90
|
-
base_url="http://localhost:8000" # or https://api.simmer.markets
|
|
91
|
-
)
|
|
175
|
+
client = SimmerClient(api_key="sk_live_...")
|
|
92
176
|
|
|
93
177
|
# List available markets
|
|
94
178
|
markets = client.get_markets(import_source="polymarket", limit=10)
|
|
@@ -117,9 +201,13 @@ print(f"Total P&L: ${total_pnl:.2f}")
|
|
|
117
201
|
|
|
118
202
|
### SimmerClient
|
|
119
203
|
|
|
120
|
-
#### `__init__(api_key, base_url)`
|
|
204
|
+
#### `__init__(api_key, base_url, venue)`
|
|
121
205
|
- `api_key`: Your SDK API key (starts with `sk_live_`)
|
|
122
206
|
- `base_url`: API URL (default: `https://api.simmer.markets`)
|
|
207
|
+
- `venue`: Trading venue (default: `sandbox`)
|
|
208
|
+
- `sandbox`: Simmer LMSR with $SIM virtual currency
|
|
209
|
+
- `polymarket`: Real Polymarket CLOB with USDC
|
|
210
|
+
- `shadow`: Paper trading against real prices *(coming soon)*
|
|
123
211
|
|
|
124
212
|
#### `get_markets(status, import_source, limit)`
|
|
125
213
|
List available markets.
|
|
@@ -127,11 +215,12 @@ List available markets.
|
|
|
127
215
|
- `import_source`: Filter by source (`polymarket`, `kalshi`, or `None` for all)
|
|
128
216
|
- Returns: List of `Market` objects
|
|
129
217
|
|
|
130
|
-
#### `trade(market_id, side, amount)`
|
|
218
|
+
#### `trade(market_id, side, amount, venue)`
|
|
131
219
|
Execute a trade.
|
|
132
220
|
- `market_id`: Market to trade on
|
|
133
221
|
- `side`: `yes` or `no`
|
|
134
222
|
- `amount`: Dollar amount to spend
|
|
223
|
+
- `venue`: Override client's default venue for this trade (optional)
|
|
135
224
|
- Returns: `TradeResult` with execution details
|
|
136
225
|
|
|
137
226
|
#### `get_positions()`
|
|
@@ -192,3 +281,34 @@ Get a specific market by ID.
|
|
|
192
281
|
- `shares_bought`: Shares acquired
|
|
193
282
|
- `cost`: Amount spent
|
|
194
283
|
- `new_price`: New market price after trade
|
|
284
|
+
- `balance`: Remaining balance after trade (sandbox only)
|
|
285
|
+
- `error`: Error message if failed
|
|
286
|
+
|
|
287
|
+
## Error Reference
|
|
288
|
+
|
|
289
|
+
| Error | Meaning | Solution |
|
|
290
|
+
|-------|---------|----------|
|
|
291
|
+
| `Real trading not enabled` | SDK toggle is off | Enable in Dashboard → SDK tab |
|
|
292
|
+
| `No Polymarket wallet found` | Wallet not created | Create in Dashboard wallet modal |
|
|
293
|
+
| `Wallet not activated` | Allowances not set | Click "Activate Trading" |
|
|
294
|
+
| `Trade amount exceeds limit` | Over $100/trade | Use smaller amount |
|
|
295
|
+
| `Daily limit exceeded` | Over $500/day | Wait for midnight UTC |
|
|
296
|
+
| `Insufficient balance` | Not enough USDC.e | Fund wallet |
|
|
297
|
+
| `Market missing token data` | Not a Polymarket import | Use `import_source="polymarket"` filter |
|
|
298
|
+
|
|
299
|
+
## Publishing to PyPI
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Install build tools
|
|
303
|
+
pip install build twine
|
|
304
|
+
|
|
305
|
+
# Build package
|
|
306
|
+
python -m build
|
|
307
|
+
|
|
308
|
+
# Upload to PyPI
|
|
309
|
+
twine upload dist/*
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## License
|
|
313
|
+
|
|
314
|
+
MIT
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
simmer_sdk/__init__.py,sha256=Q6BGJWuTrEYlL0Vr83EeWwCECdt7JlfTqvxBz8U7t2w,477
|
|
2
|
+
simmer_sdk/client.py,sha256=Y3RaYmfzOMKKew87bS8SzBYW4dKl4Dkk_XZiPhd73WI,14026
|
|
3
|
+
simmer_sdk-0.2.4.dist-info/METADATA,sha256=KZS1cUFc0tY5qDFDny8rLWc279RTRvoKq9l9oi_vXEs,9469
|
|
4
|
+
simmer_sdk-0.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
simmer_sdk-0.2.4.dist-info/top_level.txt,sha256=PunJSH9xwQbKxXvtoP4zGQ87WGGmWE7IdxEfOLoRw2M,11
|
|
6
|
+
simmer_sdk-0.2.4.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
simmer_sdk/__init__.py,sha256=VJSyZ9OtcsfU9wjmJbGCh-jn3yYuhECaoP89OccquFk,477
|
|
2
|
-
simmer_sdk/client.py,sha256=57_TVY8xQJr3vlF5P6ic14Dhk19Pi6lwLQ8_GrGFtlU,13235
|
|
3
|
-
simmer_sdk-0.2.0.dist-info/licenses/LICENSE,sha256=n6uIliSrxZe7srIF4bb7zQYiGxlb83TTzI58XtHAOWg,1071
|
|
4
|
-
simmer_sdk-0.2.0.dist-info/METADATA,sha256=P8xzzukHI-afzY6q9MS4INC33-fxjWQ2nhTpMooSPuY,5781
|
|
5
|
-
simmer_sdk-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
-
simmer_sdk-0.2.0.dist-info/top_level.txt,sha256=PunJSH9xwQbKxXvtoP4zGQ87WGGmWE7IdxEfOLoRw2M,11
|
|
7
|
-
simmer_sdk-0.2.0.dist-info/RECORD,,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Simmer Markets
|
|
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.
|
|
File without changes
|
|
File without changes
|