polypoll-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,43 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ venv/
25
+ ENV/
26
+ env/
27
+ .venv/
28
+
29
+ # IDE
30
+ .idea/
31
+ .vscode/
32
+ *.swp
33
+ *.swo
34
+
35
+ # Testing
36
+ .pytest_cache/
37
+ .coverage
38
+ htmlcov/
39
+ .tox/
40
+
41
+ # OS
42
+ .DS_Store
43
+ Thumbs.db
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.4
2
+ Name: polypoll-sdk
3
+ Version: 0.1.0
4
+ Summary: Unified SDK for prediction market data aggregation across Polymarket, Kalshi, Manifold, Metaculus, and PredictIt
5
+ Project-URL: Homepage, https://github.com/OpenOracleWeb3/polypoll-sdk
6
+ Project-URL: Documentation, https://github.com/OpenOracleWeb3/polypoll-sdk#readme
7
+ Project-URL: Repository, https://github.com/OpenOracleWeb3/polypoll-sdk
8
+ Project-URL: Issues, https://github.com/OpenOracleWeb3/polypoll-sdk/issues
9
+ Author-email: PolyPoll Team <team@polypoll.io>
10
+ License: MIT
11
+ Keywords: forecasting,kalshi,manifold,metaculus,polymarket,prediction-markets,predictit,sdk,trading
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.9
24
+ Requires-Dist: aiohttp>=3.8.0
25
+ Requires-Dist: certifi>=2023.0.0
26
+ Requires-Dist: pydantic>=2.0.0
27
+ Requires-Dist: rapidfuzz>=3.0.0
28
+ Provides-Extra: ai
29
+ Requires-Dist: groq>=0.5.0; extra == 'ai'
30
+ Requires-Dist: openai>=1.0.0; extra == 'ai'
31
+ Provides-Extra: all
32
+ Requires-Dist: black>=23.0.0; extra == 'all'
33
+ Requires-Dist: fastapi>=0.109.0; extra == 'all'
34
+ Requires-Dist: groq>=0.5.0; extra == 'all'
35
+ Requires-Dist: openai>=1.0.0; extra == 'all'
36
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'all'
37
+ Requires-Dist: pytest>=7.0.0; extra == 'all'
38
+ Requires-Dist: ruff>=0.1.0; extra == 'all'
39
+ Requires-Dist: uvicorn[standard]>=0.27.0; extra == 'all'
40
+ Provides-Extra: dev
41
+ Requires-Dist: black>=23.0.0; extra == 'dev'
42
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
43
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
44
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
45
+ Provides-Extra: server
46
+ Requires-Dist: fastapi>=0.109.0; extra == 'server'
47
+ Requires-Dist: uvicorn[standard]>=0.27.0; extra == 'server'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # PolyPoll SDK
51
+
52
+ Unified SDK for prediction market data aggregation across multiple platforms.
53
+
54
+ ## Supported Platforms
55
+
56
+ - **Polymarket** - Crypto prediction markets on Polygon
57
+ - **Kalshi** - US regulated prediction markets
58
+ - **Manifold Markets** - Play-money forecasting
59
+ - **Metaculus** - Expert forecasting
60
+ - **PredictIt** - US political markets
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ pip install polypoll-sdk
66
+ ```
67
+
68
+ ## Quick Start
69
+
70
+ ```python
71
+ import asyncio
72
+ from polypoll_sdk import PolyPollSDK
73
+
74
+ async def main():
75
+ # Initialize SDK (no API keys needed for core features)
76
+ sdk = PolyPollSDK()
77
+
78
+ # Get markets from all platforms
79
+ markets = await sdk.get_all_markets()
80
+ print(f"Found {len(markets)} markets")
81
+
82
+ # Get markets from specific platform
83
+ polymarket = await sdk.get_markets(platform="polymarket")
84
+
85
+ # Search for markets
86
+ trump_markets = await sdk.search_markets("trump")
87
+
88
+ # Find similar markets across platforms
89
+ if markets:
90
+ similar = await sdk.get_similar_markets(
91
+ market_id=markets[0].market_id,
92
+ platform=markets[0].platform
93
+ )
94
+
95
+ # Detect arbitrage opportunities
96
+ arbitrage = await sdk.get_arbitrage_opportunities()
97
+ for opp in arbitrage[:5]:
98
+ print(f"Arbitrage: {opp.profit_pct:.1f}% profit")
99
+ print(f" {opp.strategy}")
100
+
101
+ asyncio.run(main())
102
+ ```
103
+
104
+ ## Features
105
+
106
+ ### Layer 1: Data Aggregation
107
+
108
+ ```python
109
+ # Get all markets from all platforms
110
+ markets = await sdk.get_all_markets()
111
+
112
+ # Get markets from specific platform
113
+ kalshi = await sdk.get_markets(platform="kalshi")
114
+
115
+ # Search markets by keyword
116
+ crypto = await sdk.search_markets("bitcoin", platforms=["polymarket", "kalshi"])
117
+ ```
118
+
119
+ ### Layer 2: Cross-Platform Matching
120
+
121
+ ```python
122
+ # Find markets on other platforms similar to a given market
123
+ similar = await sdk.get_similar_markets(
124
+ market_id="abc123",
125
+ platform="polymarket",
126
+ min_similarity=70
127
+ )
128
+
129
+ for match in similar:
130
+ print(f"{match.market.platform}: {match.similarity_score:.0f}%")
131
+ ```
132
+
133
+ ### Layer 3: AI Research (Coming Soon)
134
+
135
+ ```python
136
+ # Coming in future release:
137
+ # research = await sdk.deep_research("Will GPT-5 be released?")
138
+ # ai_odds = await sdk.get_ai_odds(market_id="...")
139
+ ```
140
+
141
+ ### Layer 4: Validation (Coming Soon)
142
+
143
+ ```python
144
+ # Coming in future release:
145
+ # validation = await sdk.validate(question="Will BTC hit $100k?")
146
+ # status = await sdk.check_status(market_id="...")
147
+ ```
148
+
149
+ ### Layer 5: Arbitrage Detection
150
+
151
+ ```python
152
+ # Find cross-platform arbitrage opportunities
153
+ opportunities = await sdk.get_arbitrage_opportunities(
154
+ min_profit=1.0, # Minimum 1% profit
155
+ min_similarity=80 # High similarity threshold
156
+ )
157
+
158
+ for opp in opportunities:
159
+ print(f"{opp.profit_pct:.1f}% profit: {opp.strategy}")
160
+ ```
161
+
162
+ ## UnifiedMarket Schema
163
+
164
+ All markets are normalized to a common schema:
165
+
166
+ ```python
167
+ @dataclass
168
+ class UnifiedMarket:
169
+ # Core
170
+ platform: str # polymarket, kalshi, etc.
171
+ market_id: str
172
+ title: str
173
+ url: str
174
+
175
+ # Pricing (0-1)
176
+ yes_price: float
177
+ no_price: float
178
+
179
+ # Volume
180
+ volume: float
181
+ volume_24h: float
182
+ liquidity: Optional[float]
183
+
184
+ # Status
185
+ status: MarketStatus # open, closed, resolved
186
+ is_resolved: bool
187
+ close_time: Optional[datetime]
188
+
189
+ # Metadata
190
+ category: Optional[str]
191
+ description: Optional[str]
192
+ image_url: Optional[str]
193
+ ```
194
+
195
+ ## Coming Soon: AI Features
196
+
197
+ > **Note:** AI features are planned but not yet implemented in v0.1.0.
198
+
199
+ The following features will require API keys when implemented:
200
+
201
+ ```python
202
+ # Planned for future release:
203
+ sdk = PolyPollSDK(
204
+ exa_api_key="your-exa-key",
205
+ groq_api_key="your-groq-key"
206
+ )
207
+
208
+ # Deep research (coming soon)
209
+ # research = await sdk.deep_research("Will GPT-5 be released in 2025?")
210
+
211
+ # AI odds prediction (coming soon)
212
+ # ai_odds = await sdk.get_ai_odds(market_id="...")
213
+
214
+ # Market validation (coming soon)
215
+ # validation = await sdk.validate(question="Will BTC hit $100k?")
216
+ ```
217
+
218
+ ## Development
219
+
220
+ ```bash
221
+ # Clone repository
222
+ git clone https://github.com/OpenOracleWeb3/polypoll-sdk.git
223
+ cd polypoll-sdk
224
+
225
+ # Install with dev dependencies
226
+ pip install -e ".[dev]"
227
+
228
+ # Run tests
229
+ pytest
230
+ ```
231
+
232
+ ## License
233
+
234
+ MIT
@@ -0,0 +1,185 @@
1
+ # PolyPoll SDK
2
+
3
+ Unified SDK for prediction market data aggregation across multiple platforms.
4
+
5
+ ## Supported Platforms
6
+
7
+ - **Polymarket** - Crypto prediction markets on Polygon
8
+ - **Kalshi** - US regulated prediction markets
9
+ - **Manifold Markets** - Play-money forecasting
10
+ - **Metaculus** - Expert forecasting
11
+ - **PredictIt** - US political markets
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install polypoll-sdk
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```python
22
+ import asyncio
23
+ from polypoll_sdk import PolyPollSDK
24
+
25
+ async def main():
26
+ # Initialize SDK (no API keys needed for core features)
27
+ sdk = PolyPollSDK()
28
+
29
+ # Get markets from all platforms
30
+ markets = await sdk.get_all_markets()
31
+ print(f"Found {len(markets)} markets")
32
+
33
+ # Get markets from specific platform
34
+ polymarket = await sdk.get_markets(platform="polymarket")
35
+
36
+ # Search for markets
37
+ trump_markets = await sdk.search_markets("trump")
38
+
39
+ # Find similar markets across platforms
40
+ if markets:
41
+ similar = await sdk.get_similar_markets(
42
+ market_id=markets[0].market_id,
43
+ platform=markets[0].platform
44
+ )
45
+
46
+ # Detect arbitrage opportunities
47
+ arbitrage = await sdk.get_arbitrage_opportunities()
48
+ for opp in arbitrage[:5]:
49
+ print(f"Arbitrage: {opp.profit_pct:.1f}% profit")
50
+ print(f" {opp.strategy}")
51
+
52
+ asyncio.run(main())
53
+ ```
54
+
55
+ ## Features
56
+
57
+ ### Layer 1: Data Aggregation
58
+
59
+ ```python
60
+ # Get all markets from all platforms
61
+ markets = await sdk.get_all_markets()
62
+
63
+ # Get markets from specific platform
64
+ kalshi = await sdk.get_markets(platform="kalshi")
65
+
66
+ # Search markets by keyword
67
+ crypto = await sdk.search_markets("bitcoin", platforms=["polymarket", "kalshi"])
68
+ ```
69
+
70
+ ### Layer 2: Cross-Platform Matching
71
+
72
+ ```python
73
+ # Find markets on other platforms similar to a given market
74
+ similar = await sdk.get_similar_markets(
75
+ market_id="abc123",
76
+ platform="polymarket",
77
+ min_similarity=70
78
+ )
79
+
80
+ for match in similar:
81
+ print(f"{match.market.platform}: {match.similarity_score:.0f}%")
82
+ ```
83
+
84
+ ### Layer 3: AI Research (Coming Soon)
85
+
86
+ ```python
87
+ # Coming in future release:
88
+ # research = await sdk.deep_research("Will GPT-5 be released?")
89
+ # ai_odds = await sdk.get_ai_odds(market_id="...")
90
+ ```
91
+
92
+ ### Layer 4: Validation (Coming Soon)
93
+
94
+ ```python
95
+ # Coming in future release:
96
+ # validation = await sdk.validate(question="Will BTC hit $100k?")
97
+ # status = await sdk.check_status(market_id="...")
98
+ ```
99
+
100
+ ### Layer 5: Arbitrage Detection
101
+
102
+ ```python
103
+ # Find cross-platform arbitrage opportunities
104
+ opportunities = await sdk.get_arbitrage_opportunities(
105
+ min_profit=1.0, # Minimum 1% profit
106
+ min_similarity=80 # High similarity threshold
107
+ )
108
+
109
+ for opp in opportunities:
110
+ print(f"{opp.profit_pct:.1f}% profit: {opp.strategy}")
111
+ ```
112
+
113
+ ## UnifiedMarket Schema
114
+
115
+ All markets are normalized to a common schema:
116
+
117
+ ```python
118
+ @dataclass
119
+ class UnifiedMarket:
120
+ # Core
121
+ platform: str # polymarket, kalshi, etc.
122
+ market_id: str
123
+ title: str
124
+ url: str
125
+
126
+ # Pricing (0-1)
127
+ yes_price: float
128
+ no_price: float
129
+
130
+ # Volume
131
+ volume: float
132
+ volume_24h: float
133
+ liquidity: Optional[float]
134
+
135
+ # Status
136
+ status: MarketStatus # open, closed, resolved
137
+ is_resolved: bool
138
+ close_time: Optional[datetime]
139
+
140
+ # Metadata
141
+ category: Optional[str]
142
+ description: Optional[str]
143
+ image_url: Optional[str]
144
+ ```
145
+
146
+ ## Coming Soon: AI Features
147
+
148
+ > **Note:** AI features are planned but not yet implemented in v0.1.0.
149
+
150
+ The following features will require API keys when implemented:
151
+
152
+ ```python
153
+ # Planned for future release:
154
+ sdk = PolyPollSDK(
155
+ exa_api_key="your-exa-key",
156
+ groq_api_key="your-groq-key"
157
+ )
158
+
159
+ # Deep research (coming soon)
160
+ # research = await sdk.deep_research("Will GPT-5 be released in 2025?")
161
+
162
+ # AI odds prediction (coming soon)
163
+ # ai_odds = await sdk.get_ai_odds(market_id="...")
164
+
165
+ # Market validation (coming soon)
166
+ # validation = await sdk.validate(question="Will BTC hit $100k?")
167
+ ```
168
+
169
+ ## Development
170
+
171
+ ```bash
172
+ # Clone repository
173
+ git clone https://github.com/OpenOracleWeb3/polypoll-sdk.git
174
+ cd polypoll-sdk
175
+
176
+ # Install with dev dependencies
177
+ pip install -e ".[dev]"
178
+
179
+ # Run tests
180
+ pytest
181
+ ```
182
+
183
+ ## License
184
+
185
+ MIT
@@ -0,0 +1,111 @@
1
+ """
2
+ Basic Usage Example
3
+
4
+ Demonstrates core SDK functionality:
5
+ - Fetching markets from all platforms
6
+ - Searching markets
7
+ - Finding similar markets
8
+ - Detecting arbitrage
9
+ """
10
+
11
+ import asyncio
12
+ import sys
13
+ sys.path.insert(0, '..')
14
+
15
+ from polypoll_sdk import PolyPollSDK
16
+
17
+
18
+ async def main():
19
+ print("=" * 60)
20
+ print("PolyPoll SDK - Basic Usage Example")
21
+ print("=" * 60)
22
+
23
+ # Initialize SDK (no API keys needed for core features)
24
+ sdk = PolyPollSDK()
25
+ print(f"\nSupported platforms: {sdk.supported_platforms}")
26
+ print(f"AI capabilities available: {sdk.has_ai_capabilities}")
27
+
28
+ # 1. Get all markets
29
+ print("\n" + "=" * 60)
30
+ print("1. FETCHING ALL MARKETS")
31
+ print("=" * 60)
32
+
33
+ markets = await sdk.get_all_markets(limit_per_platform=10)
34
+ print(f"\nTotal markets: {len(markets)}")
35
+
36
+ # Count by platform
37
+ by_platform = {}
38
+ for m in markets:
39
+ by_platform[m.platform] = by_platform.get(m.platform, 0) + 1
40
+
41
+ for platform, count in by_platform.items():
42
+ print(f" - {platform}: {count} markets")
43
+
44
+ # 2. Show sample markets
45
+ print("\n" + "=" * 60)
46
+ print("2. SAMPLE MARKETS")
47
+ print("=" * 60)
48
+
49
+ for market in markets[:5]:
50
+ print(f"\n[{market.platform}] {market.title[:60]}...")
51
+ print(f" YES: {market.yes_price:.1%} | NO: {market.no_price:.1%}")
52
+ print(f" Volume: ${market.volume:,.0f}")
53
+ print(f" URL: {market.url}")
54
+
55
+ # 3. Search markets
56
+ print("\n" + "=" * 60)
57
+ print("3. SEARCHING MARKETS")
58
+ print("=" * 60)
59
+
60
+ search_results = await sdk.search_markets("bitcoin", limit=5)
61
+ print(f"\nSearch 'bitcoin': {len(search_results)} results")
62
+
63
+ for market in search_results[:3]:
64
+ print(f" [{market.platform}] {market.title[:50]}...")
65
+
66
+ # 4. Find similar markets (if we have enough data)
67
+ print("\n" + "=" * 60)
68
+ print("4. SIMILAR MARKETS")
69
+ print("=" * 60)
70
+
71
+ if markets:
72
+ source = markets[0]
73
+ print(f"\nFinding markets similar to:")
74
+ print(f" [{source.platform}] {source.title[:60]}...")
75
+
76
+ similar = await sdk.get_similar_markets(
77
+ market_id=source.market_id,
78
+ platform=source.platform,
79
+ min_similarity=50
80
+ )
81
+
82
+ print(f"\nFound {len(similar)} similar markets:")
83
+ for match in similar[:5]:
84
+ print(f" {match.similarity_score:.0f}% [{match.market.platform}] "
85
+ f"{match.market.title[:40]}...")
86
+ if match.price_diff:
87
+ print(f" Price diff: {match.price_diff:.1%}")
88
+
89
+ # 5. Arbitrage opportunities
90
+ print("\n" + "=" * 60)
91
+ print("5. ARBITRAGE OPPORTUNITIES")
92
+ print("=" * 60)
93
+
94
+ arbitrage = await sdk.get_arbitrage_opportunities(
95
+ min_profit=0.1,
96
+ min_similarity=70
97
+ )
98
+
99
+ print(f"\nFound {len(arbitrage)} arbitrage opportunities:")
100
+ for opp in arbitrage[:5]:
101
+ print(f"\n {opp.profit_pct:.1f}% profit potential")
102
+ print(f" {opp.strategy}")
103
+ print(f" Similarity: {opp.similarity_score:.0f}%")
104
+
105
+ print("\n" + "=" * 60)
106
+ print("DONE!")
107
+ print("=" * 60)
108
+
109
+
110
+ if __name__ == "__main__":
111
+ asyncio.run(main())
@@ -0,0 +1,56 @@
1
+ """
2
+ PolyPoll SDK
3
+
4
+ Unified SDK for prediction market data aggregation across
5
+ Polymarket, Kalshi, Manifold, Metaculus, and PredictIt.
6
+
7
+ Example:
8
+ ```python
9
+ from polypoll_sdk import PolyPollSDK
10
+
11
+ sdk = PolyPollSDK()
12
+
13
+ # Get all markets
14
+ markets = await sdk.get_all_markets()
15
+
16
+ # Search markets
17
+ trump = await sdk.search_markets("trump")
18
+
19
+ # Find similar markets
20
+ similar = await sdk.get_similar_markets(market_id="...")
21
+
22
+ # Detect arbitrage
23
+ arb = await sdk.get_arbitrage_opportunities()
24
+ ```
25
+ """
26
+
27
+ from polypoll_sdk.client import PolyPollSDK
28
+ from polypoll_sdk.config import Platform, SDKConfig
29
+ from polypoll_sdk.models import (
30
+ ArbitrageOpportunity,
31
+ MarketOption,
32
+ MarketStatus,
33
+ MarketType,
34
+ SimilarMarket,
35
+ UnifiedMarket,
36
+ )
37
+
38
+ __version__ = "0.1.0"
39
+ __author__ = "PolyPoll Team"
40
+
41
+ __all__ = [
42
+ # Main SDK
43
+ "PolyPollSDK",
44
+ # Config
45
+ "Platform",
46
+ "SDKConfig",
47
+ # Models
48
+ "ArbitrageOpportunity",
49
+ "MarketOption",
50
+ "MarketStatus",
51
+ "MarketType",
52
+ "SimilarMarket",
53
+ "UnifiedMarket",
54
+ # Version
55
+ "__version__",
56
+ ]