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 marketlens

Authentication

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", status="active", sort="-liquidity", take=5, ) for m in markets: print(m.question, m.outcomes[0].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.0430

What's Next

Data

Backtesting

  • Strategy Guide · define and run strategies against historical state
  • Examples · complete strategy implementations

Reference