polynode 0.5.5__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.
- polynode/__init__.py +41 -0
- polynode/_version.py +1 -0
- polynode/cache/__init__.py +11 -0
- polynode/client.py +635 -0
- polynode/engine.py +201 -0
- polynode/errors.py +35 -0
- polynode/orderbook.py +243 -0
- polynode/orderbook_state.py +77 -0
- polynode/redemption_watcher.py +339 -0
- polynode/short_form.py +321 -0
- polynode/subscription.py +137 -0
- polynode/testing.py +83 -0
- polynode/trading/__init__.py +19 -0
- polynode/trading/clob_api.py +158 -0
- polynode/trading/constants.py +31 -0
- polynode/trading/cosigner.py +86 -0
- polynode/trading/eip712.py +163 -0
- polynode/trading/onboarding.py +242 -0
- polynode/trading/signer.py +91 -0
- polynode/trading/sqlite_backend.py +208 -0
- polynode/trading/trader.py +506 -0
- polynode/trading/types.py +191 -0
- polynode/types/__init__.py +8 -0
- polynode/types/enums.py +51 -0
- polynode/types/events.py +270 -0
- polynode/types/orderbook.py +66 -0
- polynode/types/rest.py +376 -0
- polynode/types/short_form.py +35 -0
- polynode/types/ws.py +38 -0
- polynode/ws.py +278 -0
- polynode-0.5.5.dist-info/METADATA +133 -0
- polynode-0.5.5.dist-info/RECORD +33 -0
- polynode-0.5.5.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: polynode
|
|
3
|
+
Version: 0.5.5
|
|
4
|
+
Summary: Python SDK for the PolyNode real-time prediction market data platform
|
|
5
|
+
Project-URL: Homepage, https://polynode.dev
|
|
6
|
+
Project-URL: Documentation, https://docs.polynode.dev
|
|
7
|
+
Author-email: PolyNode <josh@quantish.live>
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: polymarket,polynode,prediction-markets,trading,websocket
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: httpx>=0.27
|
|
21
|
+
Requires-Dist: pydantic>=2.0
|
|
22
|
+
Requires-Dist: websockets>=12.0
|
|
23
|
+
Provides-Extra: all
|
|
24
|
+
Requires-Dist: aiosqlite>=0.20; extra == 'all'
|
|
25
|
+
Requires-Dist: eth-account>=0.13; extra == 'all'
|
|
26
|
+
Requires-Dist: web3>=7.0; extra == 'all'
|
|
27
|
+
Provides-Extra: cache
|
|
28
|
+
Requires-Dist: aiosqlite>=0.20; extra == 'cache'
|
|
29
|
+
Provides-Extra: trading
|
|
30
|
+
Requires-Dist: eth-account>=0.13; extra == 'trading'
|
|
31
|
+
Requires-Dist: web3>=7.0; extra == 'trading'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# polynode
|
|
35
|
+
|
|
36
|
+
Python SDK for the [PolyNode](https://polynode.dev) real-time prediction market data platform.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install polynode
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For trading support:
|
|
45
|
+
```bash
|
|
46
|
+
pip install polynode[trading]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### REST API
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from polynode import PolyNode
|
|
55
|
+
|
|
56
|
+
with PolyNode(api_key="pn_live_...") as pn:
|
|
57
|
+
status = pn.status()
|
|
58
|
+
markets = pn.markets(count=10)
|
|
59
|
+
settlements = pn.recent_settlements(count=5)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Async REST
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import asyncio
|
|
66
|
+
from polynode import AsyncPolyNode
|
|
67
|
+
|
|
68
|
+
async def main():
|
|
69
|
+
async with AsyncPolyNode(api_key="pn_live_...") as pn:
|
|
70
|
+
status = await pn.status()
|
|
71
|
+
markets = await pn.markets(count=10)
|
|
72
|
+
|
|
73
|
+
asyncio.run(main())
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### WebSocket Streaming
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import asyncio
|
|
80
|
+
from polynode import AsyncPolyNode
|
|
81
|
+
|
|
82
|
+
async def main():
|
|
83
|
+
async with AsyncPolyNode(api_key="pn_live_...") as pn:
|
|
84
|
+
sub = await pn.ws.subscribe("settlements").min_size(1000).send()
|
|
85
|
+
|
|
86
|
+
async for event in sub:
|
|
87
|
+
print(event.event_type, event.market_title, event.taker_price)
|
|
88
|
+
|
|
89
|
+
asyncio.run(main())
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Orderbook
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
import asyncio
|
|
96
|
+
from polynode import OrderbookEngine
|
|
97
|
+
|
|
98
|
+
async def main():
|
|
99
|
+
engine = OrderbookEngine(api_key="pn_live_...")
|
|
100
|
+
await engine.subscribe(["token_id_1", "token_id_2"])
|
|
101
|
+
|
|
102
|
+
engine.on("ready", lambda: print(f"Tracking {engine.size} books"))
|
|
103
|
+
engine.on("update", lambda u: print(f"{u.asset_id}: {engine.midpoint(u.asset_id)}"))
|
|
104
|
+
|
|
105
|
+
asyncio.run(main())
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Trading
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import asyncio
|
|
112
|
+
from polynode.trading import PolyNodeTrader, TraderConfig, OrderParams
|
|
113
|
+
|
|
114
|
+
async def main():
|
|
115
|
+
trader = PolyNodeTrader(TraderConfig(polynode_key="pn_live_..."))
|
|
116
|
+
status = await trader.ensure_ready("0xYourPrivateKey...")
|
|
117
|
+
|
|
118
|
+
result = await trader.order(OrderParams(
|
|
119
|
+
token_id="...",
|
|
120
|
+
side="BUY",
|
|
121
|
+
price=0.55,
|
|
122
|
+
size=100,
|
|
123
|
+
))
|
|
124
|
+
print(result)
|
|
125
|
+
|
|
126
|
+
trader.close()
|
|
127
|
+
|
|
128
|
+
asyncio.run(main())
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Documentation
|
|
132
|
+
|
|
133
|
+
Full docs at [docs.polynode.dev](https://docs.polynode.dev)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
polynode/__init__.py,sha256=ucqXzFPMdEcfGEAdbgOeJczREEiSCNBX1G3Il7y8-UI,1127
|
|
2
|
+
polynode/_version.py,sha256=78mfpLewKVki6c9UONSUdlVme_JsN9ZwIfp4Hf4jmG0,22
|
|
3
|
+
polynode/client.py,sha256=bU-v484b30bTog_t3EURt0cWGYn5cSanme5l9_LbEIc,21700
|
|
4
|
+
polynode/engine.py,sha256=DSXBmx3DXPh-PN0ihkXn7LSiyxeOoo0iY3z4YinQ3XI,6488
|
|
5
|
+
polynode/errors.py,sha256=5qUCI7K76VKbF5R5G5UYhPzcnOPlGLCA8-sJnKbrK-4,925
|
|
6
|
+
polynode/orderbook.py,sha256=F2hg1Q8trZkUyGKVAEwOxLyJ1pwp55Kc8IGf_szrvP4,8180
|
|
7
|
+
polynode/orderbook_state.py,sha256=s6FQ98NFg8FOVw7yFYA5CTzly9nFdyGLT13F0yteJkk,2608
|
|
8
|
+
polynode/redemption_watcher.py,sha256=yjFSBS2l2qa8gJ4_NgwgLOnEV37PSePV_lAGaa7eAvo,12563
|
|
9
|
+
polynode/short_form.py,sha256=V_s4bKNzX3eBpPEr9HYIR-ij3e4YMnFLMEUitltep3Q,11386
|
|
10
|
+
polynode/subscription.py,sha256=O2yKfdllI0px-1qrVK-0Qq9S4KUmIiXjjYCNC7QW0jM,4121
|
|
11
|
+
polynode/testing.py,sha256=bSSgV18ZSaRoLZPlNRCCLmRNwNIQDS35qi7NhuTg8Bg,2802
|
|
12
|
+
polynode/ws.py,sha256=gPkCEAUVQjm4ULTvlp0hHB8qtvsV2kbZ_3nklLowjXM,9464
|
|
13
|
+
polynode/cache/__init__.py,sha256=A9lXcIE3ISKKo1r0o3o-CkmQpBhLdKwdQfCR0eW5i9o,519
|
|
14
|
+
polynode/trading/__init__.py,sha256=86NK-lioiMGUCK6PLSXC-m4WdEVVacNbj1W0siQBa2U,619
|
|
15
|
+
polynode/trading/clob_api.py,sha256=U6MHsBwoI6JhIw_VJgQ6f4PsEXwOCJQqyL1TcDwcHxE,4091
|
|
16
|
+
polynode/trading/constants.py,sha256=q_QTi1w8XVw-6PRNltP9hinE4PUH0GFGgKNbkEyMdR4,1200
|
|
17
|
+
polynode/trading/cosigner.py,sha256=HuW7iHVwmMXHo5J4-gAOkjh_oWBIYySC59PujOe9geo,2557
|
|
18
|
+
polynode/trading/eip712.py,sha256=l9XVAo9abWusHp4ypTkVBHVMw04akMfaFn1yf0lRZdk,4536
|
|
19
|
+
polynode/trading/onboarding.py,sha256=kBqJi0d4YoZS13sSA9vBGsJapQFVFS4aAbljHWlMWzQ,8561
|
|
20
|
+
polynode/trading/signer.py,sha256=5KTARp6BnSorRt6n3YB11wpmivX_zOhVm-jzn098iAA,3298
|
|
21
|
+
polynode/trading/sqlite_backend.py,sha256=9ho7DnQVE_nJqmPH5yPSAYcVjVmTS1XmD3NebR-UAwA,7986
|
|
22
|
+
polynode/trading/trader.py,sha256=rKL-AugTSuObKadLL83nqLqhFrLQamQ9q4kFAu7oeKA,18505
|
|
23
|
+
polynode/trading/types.py,sha256=kNNnsNYmJ-a_7sR5o2pINPHgBgs-n5bspZs9L4Uzy7g,3667
|
|
24
|
+
polynode/types/__init__.py,sha256=0v_CByqG-zT1xucbT2So_77YDmsPj9u956at94nyrLM,280
|
|
25
|
+
polynode/types/enums.py,sha256=2cx9l10A-LUeDNBJZn7l0XBTka2YfxRQcXW0s7s3_4k,1082
|
|
26
|
+
polynode/types/events.py,sha256=ZZdS1tVg0o5vL9qyT42uXu3iX_5VTEPKFeZFnArB_h4,6861
|
|
27
|
+
polynode/types/orderbook.py,sha256=MwD6P3poo3F70bONUZ5i3ajk1sgw39hHTOw6D0fP5_8,1342
|
|
28
|
+
polynode/types/rest.py,sha256=ftJKQZH0wBrR_l199rDMqnVS8cyt8YnCvo9cKIsTcCw,7012
|
|
29
|
+
polynode/types/short_form.py,sha256=xfGklDi587u6K2aXaRWiwbxqkipW8BiEPeNIDT45v2Y,799
|
|
30
|
+
polynode/types/ws.py,sha256=EzE9Vzrb6cILemfssmnqM8fbHt4USn3latpUHKatwk4,994
|
|
31
|
+
polynode-0.5.5.dist-info/METADATA,sha256=7jm91UExQ6EETcJrNKJr9L7iG1rjcHIQJIKp8Lm7ZKU,3302
|
|
32
|
+
polynode-0.5.5.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
33
|
+
polynode-0.5.5.dist-info/RECORD,,
|