-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_poly_structure.py
More file actions
30 lines (28 loc) · 1.02 KB
/
Copy pathdebug_poly_structure.py
File metadata and controls
30 lines (28 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import aiohttp
import asyncio
import json
async def fetch_one():
url = 'https://gamma-api.polymarket.com/events'
params = {
'closed': 'false',
'limit': 1,
'tag_slug': 'sports'
}
async with aiohttp.ClientSession() as session:
async with session.get(url, params=params) as resp:
data = await resp.json()
if data:
event = data[0]
print(f"Event Title: {event.get('title')}")
markets = event.get('markets', [])
if markets:
m = markets[0]
print(f"Market Question: {m.get('question')}")
print(f"clobTokenIds: {m.get('clobTokenIds')}")
print(f"outcomes: {m.get('outcomes')}")
print(f"outcomePrices: {m.get('outcomePrices')}")
else:
print('No markets in event')
else:
print('No data returned')
asyncio.run(fetch_one())