Overview
Getting Started
Marketlens provides historical order book data, trades, and derived signals for prediction markets. Access via the Python SDK or the REST API.
Installation
bash
$ pip install marketlensAuthentication
Create an API key from the Console. Pass it via environment variable or Authorization header. All requests go to https://api.marketlens.trade/v1.
bash
$ export MARKETLENS_API_KEY=mk_...First Request
Search for markets and print their current prices.
from marketlens import MarketLens
client = MarketLens()
markets = client.markets.list(q="bitcoin")
for m in markets:
print(m.question, m.outcomes["last_price"])Output
Bitcoin between $82,000 and $84,000 on March 14? 0.3150
Bitcoin Up or Down — Mar 14, 2:15–2:20PM ET 0.5840
Will the price of Bitcoin be above $90,000 on March 14? 0.0430What's Next
Data
- Markets · discover and filter prediction markets
- Events & Series · navigate the market hierarchy
- Order Book · reconstruct and replay L2 depth
- Trades & Candles · executed trades and OHLCV aggregations
- Signals & Surfaces · fitted implied probability surfaces
- Exports · download raw data as Parquet files
- Reference Prices · spot candles for underlying assets
Backtesting
- Strategy Guide · define and run strategies against historical state
- Examples · complete strategy implementations
Reference
- Pagination · cursor-based pagination and auto-pagination
- Errors & Rate Limits · error handling and retry behavior