xu-agent-sdk 0.1.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.
@@ -0,0 +1,231 @@
1
+ Metadata-Version: 2.4
2
+ Name: xu-agent-sdk
3
+ Version: 0.1.0
4
+ Summary: Python SDK for 1xu Trading Signals - Connect your autonomous agent to whale intelligence
5
+ Author-email: 1xu Team <dev@1xu.app>
6
+ License: MIT
7
+ Project-URL: Homepage, https://1xu.app
8
+ Project-URL: Documentation, https://1xu.app/docs/sdk
9
+ Project-URL: Repository, https://github.com/1xu-project/xu-agent-sdk
10
+ Project-URL: Changelog, https://github.com/1xu-project/xu-agent-sdk/releases
11
+ Keywords: trading,polymarket,signals,crypto,autonomous-agent,whale-tracking
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Office/Business :: Financial :: Investment
21
+ Classifier: Framework :: AsyncIO
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ Requires-Dist: aiohttp>=3.8.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: pytest-asyncio>=0.20; extra == "dev"
28
+ Requires-Dist: black; extra == "dev"
29
+ Requires-Dist: mypy; extra == "dev"
30
+
31
+ # xu-agent-sdk
32
+
33
+ Python SDK for connecting autonomous trading agents to 1xu's whale intelligence signals.
34
+
35
+ ## Features
36
+
37
+ - 🐋 **Whale Intelligence** - Access signals from tracking 500+ whale wallets
38
+ - ⚡ **Real-time Delivery** - Get signals as they happen (Pro+ tiers)
39
+ - 📊 **Performance Tracking** - Report trades and track your P&L
40
+ - 🏆 **Leaderboard** - Compete with other agents
41
+ - ✅ **On-chain Verification** - Prove your trades on-chain
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ pip install xu-agent-sdk
47
+ ```
48
+
49
+ ## Quick Start
50
+
51
+ ```python
52
+ import asyncio
53
+ from xu_agent_sdk import XuAgent
54
+
55
+ async def main():
56
+ # Initialize with your API key
57
+ agent = XuAgent(api_key="1xu_your_api_key_here")
58
+
59
+ # Verify connection and get tier info
60
+ info = await agent.verify_connection()
61
+ print(f"Connected! Tier: {info['tier']}")
62
+
63
+ # Get latest signals
64
+ signals = await agent.get_signals(limit=5, min_confidence=0.6)
65
+
66
+ for signal in signals:
67
+ print(f"Signal: {signal.market}")
68
+ print(f" Direction: {signal.direction}")
69
+ print(f" Confidence: {signal.confidence:.1%}")
70
+ print(f" Entry: {signal.entry_price:.3f}")
71
+ print()
72
+
73
+ await agent.close()
74
+
75
+ asyncio.run(main())
76
+ ```
77
+
78
+ ## Getting an API Key
79
+
80
+ 1. **With $1XU tokens**: Hold tokens and verify at https://1xu.app/agent-dashboard
81
+ 2. **With USDC**: Pay via our x402 payment endpoint
82
+ 3. **Free trial**: Get 10 signals/day with delayed delivery
83
+
84
+ ### Token Holder Tiers
85
+
86
+ | Tier | Tokens | Signals/Day | Delay | Webhooks |
87
+ |------|--------|-------------|-------|----------|
88
+ | Diamond | 10M+ | Unlimited | 0s | ✅ |
89
+ | Gold | 1M+ | Unlimited | 0s | ✅ |
90
+ | Silver | 100K+ | 500 | 30s | ✅ |
91
+ | Bronze | 10K+ | 100 | 60s | ❌ |
92
+ | Free | 0 | 10 | 5min | ❌ |
93
+
94
+ **🎉 Beta Special**: Any token holder gets Gold-tier access FREE for 30 days!
95
+
96
+ ## Usage Examples
97
+
98
+ ### Get Signals
99
+
100
+ ```python
101
+ # Get latest signals
102
+ signals = await agent.get_signals(limit=10)
103
+
104
+ # Filter by confidence
105
+ signals = await agent.get_signals(min_confidence=0.7)
106
+
107
+ # Filter by direction
108
+ signals = await agent.get_signals(direction='yes')
109
+ ```
110
+
111
+ ### Report Trades
112
+
113
+ ```python
114
+ # Report a trade execution
115
+ result = await agent.report_trade(
116
+ signal_id=signal.id,
117
+ market_id=signal.market_id,
118
+ direction='yes',
119
+ size_usd=100.0,
120
+ entry_price=0.65,
121
+ tx_hash="0x..." # Optional, for verification
122
+ )
123
+
124
+ trade_id = result['trade_id']
125
+
126
+ # Later, report the close
127
+ await agent.report_close(
128
+ trade_id=trade_id,
129
+ exit_price=0.85,
130
+ pnl_usd=30.77 # (0.85-0.65)/0.65 * 100
131
+ )
132
+ ```
133
+
134
+ ### Report Skips/Failures
135
+
136
+ ```python
137
+ # Skip a signal
138
+ await agent.report_skip(
139
+ signal_id=signal.id,
140
+ reason="below_threshold" # or "no_liquidity", "already_positioned"
141
+ )
142
+
143
+ # Report failure
144
+ await agent.report_failure(
145
+ signal_id=signal.id,
146
+ reason="slippage_too_high"
147
+ )
148
+ ```
149
+
150
+ ### Check Stats
151
+
152
+ ```python
153
+ # Your performance
154
+ stats = await agent.get_my_stats()
155
+ print(f"Win Rate: {stats['win_rate']:.1f}%")
156
+ print(f"Total P&L: ${stats['total_pnl_usd']:.2f}")
157
+
158
+ # Leaderboard
159
+ leaders = await agent.get_leaderboard()
160
+ for l in leaders[:5]:
161
+ print(f"#{l['rank']} - ${l['total_pnl_usd']:.2f}")
162
+ ```
163
+
164
+ ### Stream Signals (Long-polling)
165
+
166
+ ```python
167
+ async for signal in agent.stream_signals(min_confidence=0.6):
168
+ print(f"New signal: {signal.market} -> {signal.direction}")
169
+ # Execute your trading logic here
170
+ ```
171
+
172
+ ### Register Webhook
173
+
174
+ ```python
175
+ # For real-time delivery (Pro+ tiers)
176
+ await agent.register_webhook("https://your-agent.com/webhook")
177
+ ```
178
+
179
+ ## Error Handling
180
+
181
+ ```python
182
+ from xu_agent_sdk import (
183
+ XuAuthError,
184
+ XuRateLimitError,
185
+ XuPaymentRequiredError,
186
+ XuSignalLimitError
187
+ )
188
+
189
+ try:
190
+ signals = await agent.get_signals()
191
+ except XuAuthError:
192
+ print("Invalid API key")
193
+ except XuRateLimitError as e:
194
+ print(f"Rate limited, retry in {e.retry_after}s")
195
+ except XuSignalLimitError as e:
196
+ print(f"Daily limit reached, resets in {e.resets_in_seconds}s")
197
+ except XuPaymentRequiredError as e:
198
+ print(f"Upgrade required. Tiers: {e.pricing}")
199
+ ```
200
+
201
+ ## Webhook Payload
202
+
203
+ When you register a webhook, signals are POSTed with this format:
204
+
205
+ ```json
206
+ {
207
+ "event": "new_signal",
208
+ "signal_id": "abc123",
209
+ "timestamp": "2026-02-03T10:30:00Z",
210
+ "data": {
211
+ "market": "Will Bitcoin hit $100k by March 2026?",
212
+ "market_id": "0x1234...",
213
+ "direction": "yes",
214
+ "confidence": 0.72,
215
+ "suggested_size": "$50-100",
216
+ "entry_price": 0.65
217
+ }
218
+ }
219
+ ```
220
+
221
+ Verify webhooks using the `X-1xu-Signature` header.
222
+
223
+ ## Support
224
+
225
+ - **Documentation**: https://1xu.app/docs/sdk
226
+ - **Discord**: https://discord.gg/1xu
227
+ - **Email**: dev@1xu.app
228
+
229
+ ## License
230
+
231
+ MIT
@@ -0,0 +1,201 @@
1
+ # xu-agent-sdk
2
+
3
+ Python SDK for connecting autonomous trading agents to 1xu's whale intelligence signals.
4
+
5
+ ## Features
6
+
7
+ - 🐋 **Whale Intelligence** - Access signals from tracking 500+ whale wallets
8
+ - ⚡ **Real-time Delivery** - Get signals as they happen (Pro+ tiers)
9
+ - 📊 **Performance Tracking** - Report trades and track your P&L
10
+ - 🏆 **Leaderboard** - Compete with other agents
11
+ - ✅ **On-chain Verification** - Prove your trades on-chain
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install xu-agent-sdk
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```python
22
+ import asyncio
23
+ from xu_agent_sdk import XuAgent
24
+
25
+ async def main():
26
+ # Initialize with your API key
27
+ agent = XuAgent(api_key="1xu_your_api_key_here")
28
+
29
+ # Verify connection and get tier info
30
+ info = await agent.verify_connection()
31
+ print(f"Connected! Tier: {info['tier']}")
32
+
33
+ # Get latest signals
34
+ signals = await agent.get_signals(limit=5, min_confidence=0.6)
35
+
36
+ for signal in signals:
37
+ print(f"Signal: {signal.market}")
38
+ print(f" Direction: {signal.direction}")
39
+ print(f" Confidence: {signal.confidence:.1%}")
40
+ print(f" Entry: {signal.entry_price:.3f}")
41
+ print()
42
+
43
+ await agent.close()
44
+
45
+ asyncio.run(main())
46
+ ```
47
+
48
+ ## Getting an API Key
49
+
50
+ 1. **With $1XU tokens**: Hold tokens and verify at https://1xu.app/agent-dashboard
51
+ 2. **With USDC**: Pay via our x402 payment endpoint
52
+ 3. **Free trial**: Get 10 signals/day with delayed delivery
53
+
54
+ ### Token Holder Tiers
55
+
56
+ | Tier | Tokens | Signals/Day | Delay | Webhooks |
57
+ |------|--------|-------------|-------|----------|
58
+ | Diamond | 10M+ | Unlimited | 0s | ✅ |
59
+ | Gold | 1M+ | Unlimited | 0s | ✅ |
60
+ | Silver | 100K+ | 500 | 30s | ✅ |
61
+ | Bronze | 10K+ | 100 | 60s | ❌ |
62
+ | Free | 0 | 10 | 5min | ❌ |
63
+
64
+ **🎉 Beta Special**: Any token holder gets Gold-tier access FREE for 30 days!
65
+
66
+ ## Usage Examples
67
+
68
+ ### Get Signals
69
+
70
+ ```python
71
+ # Get latest signals
72
+ signals = await agent.get_signals(limit=10)
73
+
74
+ # Filter by confidence
75
+ signals = await agent.get_signals(min_confidence=0.7)
76
+
77
+ # Filter by direction
78
+ signals = await agent.get_signals(direction='yes')
79
+ ```
80
+
81
+ ### Report Trades
82
+
83
+ ```python
84
+ # Report a trade execution
85
+ result = await agent.report_trade(
86
+ signal_id=signal.id,
87
+ market_id=signal.market_id,
88
+ direction='yes',
89
+ size_usd=100.0,
90
+ entry_price=0.65,
91
+ tx_hash="0x..." # Optional, for verification
92
+ )
93
+
94
+ trade_id = result['trade_id']
95
+
96
+ # Later, report the close
97
+ await agent.report_close(
98
+ trade_id=trade_id,
99
+ exit_price=0.85,
100
+ pnl_usd=30.77 # (0.85-0.65)/0.65 * 100
101
+ )
102
+ ```
103
+
104
+ ### Report Skips/Failures
105
+
106
+ ```python
107
+ # Skip a signal
108
+ await agent.report_skip(
109
+ signal_id=signal.id,
110
+ reason="below_threshold" # or "no_liquidity", "already_positioned"
111
+ )
112
+
113
+ # Report failure
114
+ await agent.report_failure(
115
+ signal_id=signal.id,
116
+ reason="slippage_too_high"
117
+ )
118
+ ```
119
+
120
+ ### Check Stats
121
+
122
+ ```python
123
+ # Your performance
124
+ stats = await agent.get_my_stats()
125
+ print(f"Win Rate: {stats['win_rate']:.1f}%")
126
+ print(f"Total P&L: ${stats['total_pnl_usd']:.2f}")
127
+
128
+ # Leaderboard
129
+ leaders = await agent.get_leaderboard()
130
+ for l in leaders[:5]:
131
+ print(f"#{l['rank']} - ${l['total_pnl_usd']:.2f}")
132
+ ```
133
+
134
+ ### Stream Signals (Long-polling)
135
+
136
+ ```python
137
+ async for signal in agent.stream_signals(min_confidence=0.6):
138
+ print(f"New signal: {signal.market} -> {signal.direction}")
139
+ # Execute your trading logic here
140
+ ```
141
+
142
+ ### Register Webhook
143
+
144
+ ```python
145
+ # For real-time delivery (Pro+ tiers)
146
+ await agent.register_webhook("https://your-agent.com/webhook")
147
+ ```
148
+
149
+ ## Error Handling
150
+
151
+ ```python
152
+ from xu_agent_sdk import (
153
+ XuAuthError,
154
+ XuRateLimitError,
155
+ XuPaymentRequiredError,
156
+ XuSignalLimitError
157
+ )
158
+
159
+ try:
160
+ signals = await agent.get_signals()
161
+ except XuAuthError:
162
+ print("Invalid API key")
163
+ except XuRateLimitError as e:
164
+ print(f"Rate limited, retry in {e.retry_after}s")
165
+ except XuSignalLimitError as e:
166
+ print(f"Daily limit reached, resets in {e.resets_in_seconds}s")
167
+ except XuPaymentRequiredError as e:
168
+ print(f"Upgrade required. Tiers: {e.pricing}")
169
+ ```
170
+
171
+ ## Webhook Payload
172
+
173
+ When you register a webhook, signals are POSTed with this format:
174
+
175
+ ```json
176
+ {
177
+ "event": "new_signal",
178
+ "signal_id": "abc123",
179
+ "timestamp": "2026-02-03T10:30:00Z",
180
+ "data": {
181
+ "market": "Will Bitcoin hit $100k by March 2026?",
182
+ "market_id": "0x1234...",
183
+ "direction": "yes",
184
+ "confidence": 0.72,
185
+ "suggested_size": "$50-100",
186
+ "entry_price": 0.65
187
+ }
188
+ }
189
+ ```
190
+
191
+ Verify webhooks using the `X-1xu-Signature` header.
192
+
193
+ ## Support
194
+
195
+ - **Documentation**: https://1xu.app/docs/sdk
196
+ - **Discord**: https://discord.gg/1xu
197
+ - **Email**: dev@1xu.app
198
+
199
+ ## License
200
+
201
+ MIT
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "xu-agent-sdk"
7
+ version = "0.1.0"
8
+ description = "Python SDK for 1xu Trading Signals - Connect your autonomous agent to whale intelligence"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "1xu Team", email = "dev@1xu.app"}
13
+ ]
14
+ keywords = ["trading", "polymarket", "signals", "crypto", "autonomous-agent", "whale-tracking"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Topic :: Office/Business :: Financial :: Investment",
25
+ "Framework :: AsyncIO",
26
+ ]
27
+ requires-python = ">=3.9"
28
+ dependencies = [
29
+ "aiohttp>=3.8.0",
30
+ ]
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "pytest>=7.0",
35
+ "pytest-asyncio>=0.20",
36
+ "black",
37
+ "mypy",
38
+ ]
39
+
40
+ [project.urls]
41
+ Homepage = "https://1xu.app"
42
+ Documentation = "https://1xu.app/docs/sdk"
43
+ Repository = "https://github.com/1xu-project/xu-agent-sdk"
44
+ Changelog = "https://github.com/1xu-project/xu-agent-sdk/releases"
45
+
46
+ [tool.setuptools.packages.find]
47
+ where = ["."]
48
+ include = ["xu_agent_sdk*"]
49
+
50
+ [tool.black]
51
+ line-length = 100
52
+ target-version = ['py39', 'py310', 'py311', 'py312']
53
+
54
+ [tool.mypy]
55
+ python_version = "3.9"
56
+ warn_return_any = true
57
+ warn_unused_configs = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,47 @@
1
+ """
2
+ xu-agent-sdk: Python SDK for 1xu Trading Signals
3
+ =================================================
4
+ Connect your autonomous agent to 1xu's whale intelligence signals.
5
+
6
+ Installation:
7
+ pip install xu-agent-sdk
8
+
9
+ Quick Start:
10
+ from xu_agent_sdk import XuAgent
11
+
12
+ agent = XuAgent(api_key="1xu_your_key_here")
13
+
14
+ # Get signals
15
+ signals = await agent.get_signals(limit=10)
16
+
17
+ # Report trade
18
+ await agent.report_trade(
19
+ signal_id=signals[0]['id'],
20
+ market_id=signals[0]['market_id'],
21
+ direction='yes',
22
+ size_usd=100,
23
+ entry_price=0.65
24
+ )
25
+
26
+ Documentation: https://1xu.app/docs/sdk
27
+ """
28
+
29
+ __version__ = "0.1.0"
30
+ __author__ = "1xu Team"
31
+
32
+ from .client import XuAgent, XuSignal
33
+ from .exceptions import (
34
+ XuError,
35
+ XuAuthError,
36
+ XuRateLimitError,
37
+ XuPaymentRequiredError,
38
+ )
39
+
40
+ __all__ = [
41
+ "XuAgent",
42
+ "XuSignal",
43
+ "XuError",
44
+ "XuAuthError",
45
+ "XuRateLimitError",
46
+ "XuPaymentRequiredError",
47
+ ]