pmwallets 0.6.5__tar.gz → 0.7.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 (29) hide show
  1. {pmwallets-0.6.5 → pmwallets-0.7.0}/PKG-INFO +26 -2
  2. {pmwallets-0.6.5 → pmwallets-0.7.0}/README.md +25 -1
  3. {pmwallets-0.6.5 → pmwallets-0.7.0}/README.zh.md +11 -0
  4. {pmwallets-0.6.5/src/pmwallets → pmwallets-0.7.0}/SKILL.md +2 -0
  5. {pmwallets-0.6.5 → pmwallets-0.7.0}/pyproject.toml +1 -1
  6. {pmwallets-0.6.5 → pmwallets-0.7.0/src/pmwallets}/SKILL.md +2 -0
  7. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/cli.py +4 -0
  8. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/client.py +67 -0
  9. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/tools.py +12 -0
  10. pmwallets-0.7.0/src/pmwallets/version.py +1 -0
  11. {pmwallets-0.6.5 → pmwallets-0.7.0}/tests/test_agent.py +3 -3
  12. {pmwallets-0.6.5 → pmwallets-0.7.0}/uv.lock +1 -1
  13. pmwallets-0.6.5/src/pmwallets/version.py +0 -1
  14. {pmwallets-0.6.5 → pmwallets-0.7.0}/.github/workflows/ci.yml +0 -0
  15. {pmwallets-0.6.5 → pmwallets-0.7.0}/.github/workflows/publish.yml +0 -0
  16. {pmwallets-0.6.5 → pmwallets-0.7.0}/.gitignore +0 -0
  17. {pmwallets-0.6.5 → pmwallets-0.7.0}/LICENSE +0 -0
  18. {pmwallets-0.6.5 → pmwallets-0.7.0}/glama.json +0 -0
  19. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/__init__.py +0 -0
  20. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/market.py +0 -0
  21. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/mcp.py +0 -0
  22. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/stream.py +0 -0
  23. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/types.py +0 -0
  24. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/watch.py +0 -0
  25. {pmwallets-0.6.5 → pmwallets-0.7.0}/src/pmwallets/webhook.py +0 -0
  26. {pmwallets-0.6.5 → pmwallets-0.7.0}/tests/test_client.py +0 -0
  27. {pmwallets-0.6.5 → pmwallets-0.7.0}/tests/test_real_socket.py +0 -0
  28. {pmwallets-0.6.5 → pmwallets-0.7.0}/tests/test_stream.py +0 -0
  29. {pmwallets-0.6.5 → pmwallets-0.7.0}/tests/test_watch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pmwallets
3
- Version: 0.6.5
3
+ Version: 0.7.0
4
4
  Summary: Official PMWallets SDK and CLI: Polymarket smart-money leaderboard, real-time wallet fills over WebSocket with gap replay, webhooks, exports — and a CLI + MCP server so AI agents (Claude Code, Codex, Cursor, …) can follow traders and act on their fills.
5
5
  Project-URL: Homepage, https://pmwallets.com/docs
6
6
  Project-URL: Repository, https://github.com/polymarketwallets/pmwallets-python
@@ -37,6 +37,17 @@ pip install pmwallets # Python ≥ 3.10
37
37
 
38
38
  Create an API key on [pmwallets.com/keys](https://pmwallets.com/keys).
39
39
 
40
+
41
+ ## Signals and radar (Pro and Max)
42
+
43
+ ```python
44
+ entries = client.signals(category="sports")["entries"]
45
+ big = client.radar(minUsd=25000, smart=True)
46
+ client.save_signal_rule("signal", {"enabled": True, "scope": "official", "minWallets": 3, "windowMin": 30, "minUsd": 5000, "channels": ["ws", "webhook"]})
47
+ ```
48
+
49
+ Live alerts arrive on `wss://api.pmwallets.com/v1/signals/ws` as `{type: 'signal' | 'radar', data}`. Amounts keep two significant figures, times the minute, and traders are named by handle.
50
+
40
51
  ## Usage
41
52
 
42
53
  ```python
@@ -105,9 +116,22 @@ pmwallets skill # the guide to give your agent (SKILL.md)
105
116
  placed an order. Restarts resume from where the stream stopped.
106
117
  - To trade, give the agent [pmwallets-copytrade](https://github.com/polymarketwallets/polymarket-copy-trading-bot-python):
107
118
  `order buy <tokenId> --usdc 5 --key <eventId>` (the same key never orders twice), `market`, `balance`, `positions`.
108
- - MCP config (Claude Desktop, Cursor, …): `{"command": "uvx", "args": ["pmwallets", "mcp"], "env": {"PMW_API_KEY": "pmw_…"}}`.
109
119
  - Platforms without a shell (Dify, Coze, n8n, GPT Actions): import [openapi.json](https://pmwallets.com/openapi.json).
110
120
  - `HTTPS_PROXY` / `NO_PROXY` are honoured by the command line.
121
+
122
+ MCP config (Claude Desktop, Cursor, Windsurf, WorkBuddy, …):
123
+
124
+ ```json
125
+ {
126
+ "mcpServers": {
127
+ "pmwallets": {
128
+ "command": "uvx",
129
+ "args": ["pmwallets", "mcp"],
130
+ "env": { "PMW_API_KEY": "pmw_..." }
131
+ }
132
+ }
133
+ }
134
+ ```
111
135
  - The same pieces are importable: `Watcher`, `MarketLookup`, `serve_mcp` / `McpTool`, `pmwallets_tools`.
112
136
 
113
137
  ## Trade-history exports
@@ -19,6 +19,17 @@ pip install pmwallets # Python ≥ 3.10
19
19
 
20
20
  Create an API key on [pmwallets.com/keys](https://pmwallets.com/keys).
21
21
 
22
+
23
+ ## Signals and radar (Pro and Max)
24
+
25
+ ```python
26
+ entries = client.signals(category="sports")["entries"]
27
+ big = client.radar(minUsd=25000, smart=True)
28
+ client.save_signal_rule("signal", {"enabled": True, "scope": "official", "minWallets": 3, "windowMin": 30, "minUsd": 5000, "channels": ["ws", "webhook"]})
29
+ ```
30
+
31
+ Live alerts arrive on `wss://api.pmwallets.com/v1/signals/ws` as `{type: 'signal' | 'radar', data}`. Amounts keep two significant figures, times the minute, and traders are named by handle.
32
+
22
33
  ## Usage
23
34
 
24
35
  ```python
@@ -87,9 +98,22 @@ pmwallets skill # the guide to give your agent (SKILL.md)
87
98
  placed an order. Restarts resume from where the stream stopped.
88
99
  - To trade, give the agent [pmwallets-copytrade](https://github.com/polymarketwallets/polymarket-copy-trading-bot-python):
89
100
  `order buy <tokenId> --usdc 5 --key <eventId>` (the same key never orders twice), `market`, `balance`, `positions`.
90
- - MCP config (Claude Desktop, Cursor, …): `{"command": "uvx", "args": ["pmwallets", "mcp"], "env": {"PMW_API_KEY": "pmw_…"}}`.
91
101
  - Platforms without a shell (Dify, Coze, n8n, GPT Actions): import [openapi.json](https://pmwallets.com/openapi.json).
92
102
  - `HTTPS_PROXY` / `NO_PROXY` are honoured by the command line.
103
+
104
+ MCP config (Claude Desktop, Cursor, Windsurf, WorkBuddy, …):
105
+
106
+ ```json
107
+ {
108
+ "mcpServers": {
109
+ "pmwallets": {
110
+ "command": "uvx",
111
+ "args": ["pmwallets", "mcp"],
112
+ "env": { "PMW_API_KEY": "pmw_..." }
113
+ }
114
+ }
115
+ }
116
+ ```
93
117
  - The same pieces are importable: `Watcher`, `MarketLookup`, `serve_mcp` / `McpTool`, `pmwallets_tools`.
94
118
 
95
119
  ## Trade-history exports
@@ -16,6 +16,17 @@ pip install pmwallets # Python ≥ 3.10
16
16
 
17
17
  在 [pmwallets.com/keys](https://pmwallets.com/keys) 创建 API key。用法示例见 [README.md](README.md#usage)。
18
18
 
19
+
20
+ ## 信号与雷达(Pro 和 Max)
21
+
22
+ ```python
23
+ entries = client.signals(category="sports")["entries"]
24
+ big = client.radar(minUsd=25000, smart=True)
25
+ client.save_signal_rule("signal", {"enabled": True, "scope": "official", "minWallets": 3, "windowMin": 30, "minUsd": 5000, "channels": ["ws", "webhook"]})
26
+ ```
27
+
28
+ 实时告警走 `wss://api.pmwallets.com/v1/signals/ws`,帧为 `{type: 'signal' | 'radar', data}`。金额保留两位有效数字,时间到分钟,交易者只给代号。
29
+
19
30
  ## 包含什么
20
31
 
21
32
  | | |
@@ -21,6 +21,8 @@ Both also run as MCP servers (`pmwallets mcp`, `pmwallets-copytrade mcp --config
21
21
 
22
22
  ```bash
23
23
  pmwallets leaderboard --period 30d --minWinLo 0.55 --category politics --limit 20
24
+ pmwallets signals --category sports # Pro and Max: several smart wallets buying one side
25
+ pmwallets radar --minUsd 25000 --smart # Pro and Max: large fills across the market
24
26
  pmwallets entity <handle> # one trader's stats; a handle is 12 characters, e.g. 7KQ2MF9X4B1C
25
27
  pmwallets subscribe <handle> # BILLS the account per hour (or uses the plan); 402 = balance too low
26
28
  pmwallets subscriptions
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pmwallets"
7
- version = "0.6.5"
7
+ version = "0.7.0"
8
8
  description = "Official PMWallets SDK and CLI: Polymarket smart-money leaderboard, real-time wallet fills over WebSocket with gap replay, webhooks, exports — and a CLI + MCP server so AI agents (Claude Code, Codex, Cursor, …) can follow traders and act on their fills."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -21,6 +21,8 @@ Both also run as MCP servers (`pmwallets mcp`, `pmwallets-copytrade mcp --config
21
21
 
22
22
  ```bash
23
23
  pmwallets leaderboard --period 30d --minWinLo 0.55 --category politics --limit 20
24
+ pmwallets signals --category sports # Pro and Max: several smart wallets buying one side
25
+ pmwallets radar --minUsd 25000 --smart # Pro and Max: large fills across the market
24
26
  pmwallets entity <handle> # one trader's stats; a handle is 12 characters, e.g. 7KQ2MF9X4B1C
25
27
  pmwallets subscribe <handle> # BILLS the account per hour (or uses the plan); 402 = balance too low
26
28
  pmwallets subscriptions
@@ -47,6 +47,8 @@ Set PMW_API_KEY (create one on https://pmwallets.com/keys). Every command prints
47
47
  pmwallets fills --since-block <n> [--since-log-index <n>] [--limit 100]
48
48
  pmwallets market <tokenId> the Polymarket question and outcome of a token
49
49
  pmwallets account plan and balance
50
+ pmwallets signals [--source mine] [--category sports] [--q fed] smart-money signals (Pro and Max)
51
+ pmwallets radar [--minUsd 25000] [--side BUY] [--smart] large fills, whole market (Pro and Max)
50
52
  pmwallets mcp MCP server on stdio (tools: leaderboard, entity, subscribe, new_fills, …)
51
53
  pmwallets skill print the guide for AI agents (SKILL.md)
52
54
 
@@ -159,6 +161,8 @@ async def _main(argv: list[str]) -> int:
159
161
 
160
162
  if cmd == "leaderboard":
161
163
  return await call("leaderboard", {k: v for k, v in flags.items() if v is not True})
164
+ if cmd in ("signals", "radar"):
165
+ return await call(cmd, {k: (float(v) if k == "minUsd" else v) for k, v in flags.items()})
162
166
  if cmd == "entity":
163
167
  p = flags.get("period")
164
168
  return await call("entity", {"id": pos[0] if pos else None, **({"period": p} if isinstance(p, str) else {})})
@@ -37,6 +37,11 @@ class _Base:
37
37
  """The WebSocket URL derived from the base URL (https → wss)."""
38
38
  return ("ws" + self.base_url[4:] if self.base_url.startswith("http") else self.base_url) + "/v1/ws"
39
39
 
40
+ @property
41
+ def signals_ws_url(self) -> str:
42
+ """Where the alerts of your signal and radar rules arrive, as {type: "signal" | "radar", data}."""
43
+ return self.ws_url.removesuffix("/v1/ws") + "/v1/signals/ws"
44
+
40
45
  @property
41
46
  def _headers(self) -> dict[str, str]:
42
47
  return {"x-api-key": self.api_key, "accept": "application/json"}
@@ -174,6 +179,37 @@ class Client(_Base):
174
179
  return self.request("GET", "/v1/account/reveals")
175
180
 
176
181
  # ── subscriptions
182
+ def signals(self, **query: Any) -> dict[str, Any]:
183
+ """Markets where several smart-money wallets bought one side (Pro and Max). source="mine" lists your own rule's."""
184
+ return self.request("GET", "/v1/signals", query=query)
185
+
186
+ def radar(self, smart: bool = False, **query: Any) -> dict[str, Any]:
187
+ """Large taker fills across the whole market (Pro and Max). minUsd is 5000, 10000, 25000, 50000, 100000, 250000 or 1000000."""
188
+ return self.request("GET", "/v1/radar", query={**query, **({"smart": "1"} if smart else {})})
189
+
190
+ def signal_rules(self) -> dict[str, Any]:
191
+ return self.request("GET", "/v1/account/signal-rules")
192
+
193
+ def save_signal_rule(self, kind: str, rule: dict[str, Any]) -> dict[str, Any]:
194
+ return self.request("PUT", f"/v1/account/signal-rules/{_q(kind)}", body=rule)
195
+
196
+ def wallet_groups(self) -> list[dict[str, Any]]:
197
+ return self.request("GET", "/v1/account/wallet-groups")
198
+
199
+ def create_wallet_group(self, name: str) -> dict[str, Any]:
200
+ return self.request("POST", "/v1/account/wallet-groups", body={"name": name})
201
+
202
+ def edit_wallet_group(self, group_id: str, **change: Any) -> dict[str, Any]:
203
+ """name, add, remove: wallets are handles, or addresses you paid to unlock."""
204
+ return self.request("PATCH", f"/v1/account/wallet-groups/{_q(group_id)}", body=change)
205
+
206
+ def quick_add_wallets(self, group_id: str, count: int, **filters: Any) -> dict[str, Any]:
207
+ """Fill a group with the board's best traders matching the filters; count is 10, 20, 50 or 100."""
208
+ return self.request("POST", f"/v1/account/wallet-groups/{_q(group_id)}/quick-add", body={"count": count, **filters})
209
+
210
+ def delete_wallet_group(self, group_id: str) -> Any:
211
+ return self.request("DELETE", f"/v1/account/wallet-groups/{_q(group_id)}")
212
+
177
213
  def subscriptions(self) -> list[Subscription]:
178
214
  """Active and paused subscriptions, newest first."""
179
215
  return self.request("GET", "/v1/account/subscriptions")
@@ -331,6 +367,37 @@ class AsyncClient(_Base):
331
367
  async def reveals(self) -> list[dict[str, Any]]:
332
368
  return await self.request("GET", "/v1/account/reveals")
333
369
 
370
+ async def signals(self, **query: Any) -> dict[str, Any]:
371
+ """Markets where several smart-money wallets bought one side (Pro and Max). source="mine" lists your own rule's."""
372
+ return await self.request("GET", "/v1/signals", query=query)
373
+
374
+ async def radar(self, smart: bool = False, **query: Any) -> dict[str, Any]:
375
+ """Large taker fills across the whole market (Pro and Max). minUsd is 5000, 10000, 25000, 50000, 100000, 250000 or 1000000."""
376
+ return await self.request("GET", "/v1/radar", query={**query, **({"smart": "1"} if smart else {})})
377
+
378
+ async def signal_rules(self) -> dict[str, Any]:
379
+ return await self.request("GET", "/v1/account/signal-rules")
380
+
381
+ async def save_signal_rule(self, kind: str, rule: dict[str, Any]) -> dict[str, Any]:
382
+ return await self.request("PUT", f"/v1/account/signal-rules/{_q(kind)}", body=rule)
383
+
384
+ async def wallet_groups(self) -> list[dict[str, Any]]:
385
+ return await self.request("GET", "/v1/account/wallet-groups")
386
+
387
+ async def create_wallet_group(self, name: str) -> dict[str, Any]:
388
+ return await self.request("POST", "/v1/account/wallet-groups", body={"name": name})
389
+
390
+ async def edit_wallet_group(self, group_id: str, **change: Any) -> dict[str, Any]:
391
+ """name, add, remove: wallets are handles, or addresses you paid to unlock."""
392
+ return await self.request("PATCH", f"/v1/account/wallet-groups/{_q(group_id)}", body=change)
393
+
394
+ async def quick_add_wallets(self, group_id: str, count: int, **filters: Any) -> dict[str, Any]:
395
+ """Fill a group with the board's best traders matching the filters; count is 10, 20, 50 or 100."""
396
+ return await self.request("POST", f"/v1/account/wallet-groups/{_q(group_id)}/quick-add", body={"count": count, **filters})
397
+
398
+ async def delete_wallet_group(self, group_id: str) -> Any:
399
+ return await self.request("DELETE", f"/v1/account/wallet-groups/{_q(group_id)}")
400
+
334
401
  async def subscriptions(self) -> list[Subscription]:
335
402
  return await self.request("GET", "/v1/account/subscriptions")
336
403
 
@@ -203,6 +203,12 @@ def pmwallets_tools(client: Optional[AsyncClient], *, markets: Optional[MarketLo
203
203
  async def market(a: dict) -> Any:
204
204
  return (await (mk or MarketLookup()).by_token(ident(a.get("tokenId"), "tokenId"))) or {"error": "not found"}
205
205
 
206
+ async def signals(a: dict) -> Any:
207
+ return await need().signals(**a)
208
+
209
+ async def radar(a: dict) -> Any:
210
+ return await need().radar(**a)
211
+
206
212
  async def account(a: dict) -> Any:
207
213
  c = need()
208
214
  plan, billing = await asyncio.gather(c.plan(), c.billing())
@@ -212,6 +218,12 @@ def pmwallets_tools(client: Optional[AsyncClient], *, markets: Optional[MarketLo
212
218
  McpTool("leaderboard",
213
219
  "Polymarket traders ranked by realized PnL and other stats over a window, with filters. Each row is an entity (one trader, possibly several wallets).",
214
220
  _obj(BOARD_FILTERS), leaderboard),
221
+ McpTool("signals",
222
+ "Markets where several smart-money wallets bought one side in a short time (Pro and Max plans). Amounts are rounded, wallets are named by handle.",
223
+ _obj({"source": _str('"official" (default) or "mine"'), "category": _str("market category"), "q": _str("words in the market title")}), signals),
224
+ McpTool("radar",
225
+ "Large taker fills across the whole market (Pro and Max plans). Amounts are rounded, the trader is a handle and a PnL band.",
226
+ _obj({"minUsd": {"type": "number", "description": "5000, 10000, 25000, 50000, 100000, 250000 or 1000000"}, "side": _str('"BUY" or "SELL"'), "smart": {"type": "boolean", "description": "official smart money only"}, "category": _str("market category"), "q": _str("words in the market title")}), radar),
215
227
  McpTool("entity", "One trader's statistics by handle or address (full address only once unlocked).",
216
228
  _obj({"id": _str("12-character handle or 0x address"), "period": _str('"30d" or "7d"')}, ["id"]), entity),
217
229
  McpTool("subscriptions", "The traders this account follows (active and paused subscriptions).", _obj({}), subscriptions),
@@ -0,0 +1 @@
1
+ VERSION = "0.7.0"
@@ -142,7 +142,7 @@ async def test_mcp_offers_the_latest_protocol_to_an_unknown_version():
142
142
  assert m["result"]["protocolVersion"] == "2025-06-18"
143
143
 
144
144
 
145
- def test_mcp_over_real_stdio_lists_the_nine_tools(tmp_path):
145
+ def test_mcp_over_real_stdio_lists_the_tools(tmp_path):
146
146
  msgs = "\n".join(json.dumps(m) for m in [
147
147
  {"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05"}},
148
148
  {"jsonrpc": "2.0", "id": 2, "method": "tools/list"},
@@ -154,7 +154,7 @@ def test_mcp_over_real_stdio_lists_the_nine_tools(tmp_path):
154
154
  assert out[0]["result"]["instructions"] == MCP_INSTRUCTIONS
155
155
  assert out[0]["result"]["serverInfo"] == {"name": "pmwallets", "version": pmwallets.VERSION}
156
156
  assert [t["name"] for t in out[1]["result"]["tools"]] == [
157
- "leaderboard", "entity", "subscriptions", "subscribe", "cancel_subscription", "new_fills", "fills", "market", "account"]
157
+ "leaderboard", "signals", "radar", "entity", "subscriptions", "subscribe", "cancel_subscription", "new_fills", "fills", "market", "account"]
158
158
 
159
159
 
160
160
  def row(block, log_index):
@@ -231,7 +231,7 @@ async def test_every_tool_tells_an_agent_how_to_fix_a_missing_api_key(tmp_path):
231
231
  sub = next(t for t in tools if t.name == "subscriptions")
232
232
  with pytest.raises(RuntimeError, match="PMW_API_KEY"):
233
233
  await sub.handler({})
234
- assert len(tools) == 9
234
+ assert len(tools) == 11
235
235
 
236
236
 
237
237
  def test_version_matches_pyproject():
@@ -134,7 +134,7 @@ wheels = [
134
134
 
135
135
  [[package]]
136
136
  name = "pmwallets"
137
- version = "0.6.5"
137
+ version = "0.7.0"
138
138
  source = { editable = "." }
139
139
  dependencies = [
140
140
  { name = "httpx" },
@@ -1 +0,0 @@
1
- VERSION = "0.6.5"
File without changes
File without changes
File without changes
File without changes