Requirements
- Python 3.7 or higher
- pip
Installation
1
Install dependencies
2
Copy the SDK files
Download
polyedge.py, parser_compact_tx.py, and sseclient.py from the PolyEdge examples repository and copy them into your project directory.sseclient.py is a lightweight, MIT-licensed Server-Sent Events client bundled with the SDK — no additional SSE library is required.Instantiation
ImportPolyEdgeClient and pass your API key. The base URL defaults to https://api.polyedge.dev/v1.
X-PolyEdge-Key header.
Methods
get_leaderboard(params)
get_leaderboard(params)
Retrieve the trader leaderboard, optionally filtered and sorted.Parameters —
params is an optional dict:Returns
dict.get_trader_profile(address)
get_trader_profile(address)
Get a trader’s detailed profile including tags, stats, and metadata.
Returns
dict.get_trader_markets(address, params)
get_trader_markets(address, params)
Retrieve a trader’s trading history aggregated by market.
Returns
dict.get_trader_market_orders(address, market_id)
get_trader_market_orders(address, market_id)
Retrieve a specific trader’s order history within a specific market.
Returns
dict.get_trader_hourly_stats(address, params)
get_trader_hourly_stats(address, params)
Get hourly aggregated performance data for a specific trader.
Returns
dict.get_market_detail(market_id)
get_market_detail(market_id)
Retrieve detailed information about a specific market.
Returns
dict.stream_orders(params) — generator
stream_orders(params) — generator
Subscribe to live mempool orders via SSE. Returns a generator that yields parsed order dicts.Break out of the loop at any time to stop consuming the stream.Parameters —
params is an optional dict:Yields
dict.When
format is omitted, each yielded value is the output of parse_compact_tx — a fully structured Python dict. See Compact format parsing below.Compact format parsing
By default,stream_orders receives events in a compact array format optimised for low bandwidth. The parser_compact_tx.py utility converts each raw list into a structured dict before yielding it.
The parsed dict has this shape:
format='json' in the params dict to stream_orders — the raw response is yielded directly without calling the parser.