---
url: "https://polytoolhub.com/tools/marketlens-python-sdk/"
publisher: "Polytoolhub"
dateModified: "2026-10-05"
---

[← Backtesting](<https://polytoolhub.com/polymarket-backtesting-tools/>) 

![Marketlens Python SDK logo](<https://polytoolhub.com/assets/icon-logo-tool-marketlens-55ffc19ca97b-32-44bd5560969403da.webp>)

SDK

# Marketlens Python SDK

Retrieve historical Polymarket books and run either tick-level execution simulations or faster bar-based signal backtests in Python.

[**4.0**/ 5Editorial rating](<https://polytoolhub.com/tools/marketlens-python-sdk/#reviews>) [0 user reviews](<https://polytoolhub.com/tools/marketlens-python-sdk/#reviews>) 

[View repository](<https://github.com/marketlenstrade/marketlens-python>) github.com

**Available on:** Python, Parquet, Jupyter

**Pricing:** The SDK is MIT-licensed

[Screenshots](<https://polytoolhub.com/tools/marketlens-python-sdk/#screenshots>) [Explore alternatives](<https://polytoolhub.com/tools/marketlens-python-sdk/#alternatives>) 

[Backtesting](<https://polytoolhub.com/polymarket-backtesting-tools/>) [SDKs & libraries](<https://polytoolhub.com/polymarket-sdks/>) +1 more

[Historical data](<https://polytoolhub.com/polymarket-historical-data/>) 

## Screenshots and interface

Product preview1 / 2

Python installation and Strategy quickstart.

## What is Marketlens Python SDK?

The Marketlens Python SDK combines data access with two distinct backtesting engines. Strategy replays L2 events with execution assumptions; AlphaStrategy tests target exposure on aggregated bars. This lets researchers first test a signal over a broad window, then examine whether execution details change the result.

### Who it is for

-   Python researchers implementing repeatable strategies
-   Teams comparing signal quality with execution behavior
-   Users replaying several market series with shared capital

## Features and coverage

**Available on:** Python, Parquet, Jupyter

**Markets & venues:** Polymarket

-   **Tick engine**
    
    Model latency, limit orders, queue assumptions, fees and settlement against recorded L2.
    
-   **Alpha engine**
    
    Set target weights or share counts on bar data for faster experiments.
    
-   **Portfolio runs**
    
    Replay multiple series with shared capital.
    
-   **Structured events**
    
    Process related strikes or weather buckets together.
    
-   **Sports subtype selection**
    
    Choose moneyline, spread, totals or another supported type rather than mixing them.
    
-   **Offline iteration**
    
    Cache data\_dir files and reuse them across strategy changes.
    
-   **Export estimates**
    
    Use dry\_run to inspect row costs before acquiring a window.
    
-   **Results as data**
    
    Inspect metrics, trades and DataFrames for further analysis.
    

## Workflows with Marketlens Python SDK

### Evaluate a signal in two stages

Run an AlphaStrategy over a broad period, then replay a short representative interval through Strategy to inspect fill and latency sensitivity.

### Iterate without repeated downloads

Acquire a bounded series window into data\_dir, change the strategy and reuse the local files.

### Test related markets together

Run a structured event or a portfolio of series so all legs share the same capital accounting.

## Pricing and total cost

The SDK is MIT-licensed. Data access uses a Marketlens API key and row allowance; the free key includes a one-time 2M-row allowance and markets open in the last 7 days. Previously unlocked files can be downloaded again without another row charge.

## Getting started

1.  Use Python 3.10 or newer and install marketlens.
2.  Create a key and set MARKETLENS\_API\_KEY.
3.  Choose Strategy for execution or AlphaStrategy for bar signals.
4.  Always bound series runs with after and before.
5.  Quote downloads with dry\_run and choose data\_dir for reuse.
6.  Inspect reports and individual trades, not only the summary metric.

## Useful links

### What to check

-   A series run without after/before can be unbounded.
-   Alpha simulations leave order queues and latency outside the model.
-   Sports league series require an explicit subtype when they contain several bet types.
-   An export can be pending or partially downloaded if the allowance is insufficient.
-   Historical queue behavior is a simulation assumption, not a record of your hypothetical order.

A closer look

## Ratings & reviews

[Write a review](<https://polytoolhub.com/tools/marketlens-python-sdk/#write-review>) 

Editorial rating

**4.0**/ 5

0 user reviews

Polytoolhub editorial

### Our take on Marketlens Python SDK

Separate tick and bar engines help researchers choose the appropriate simulation detail. Export allowances, bounded queries and queue assumptions remain important parts of setup.

Based on documented features, setup and access terms. [How we rate](<https://polytoolhub.com/methodology/>) 

### User reviews 0

The main score switches to user ratings after 5 published reviews.

**Be the first to share your experience**

A specific example helps the next person choose the right tool.

Write a review

### How was your experience with Marketlens Python SDK?

Share what you used, what worked and what could be better. We confirm your email and review the submission before publishing.

To submit a review, email [info@polytoolhub.com](<mailto:info@polytoolhub.com>)  with the tool name, your rating and your experience. Enable JavaScript to prepare a draft here.

## Related tools

[Browse category](<https://polytoolhub.com/polymarket-backtesting-tools/>) 

![Marketlens: SDK example and research modules.](<https://polytoolhub.com/assets/cover-marketlens-f5dc0e42bdef2af9-400.webp>)

![Marketlens logo](<https://polytoolhub.com/assets/icon-logo-tool-marketlens-55ffc19ca97b-32-44bd5560969403da.webp>)[Marketlens](<https://polytoolhub.com/tools/marketlens/>) 

Data API**4.0**Editorial

Replay your trading strategy against historical order books, with explicit fill and latency assumptions.

-   Data coverage Order books · Trades · Prices
-   Access API

The provider’s broader data and research product.

![PolyOrderbooks: Historical L2 product overview and provider book example.](<https://polytoolhub.com/assets/cover-polyorderbooks-dcc290fb8f86ca82-400.webp>)

![PolyOrderbooks logo](<https://polytoolhub.com/assets/logo-tool-polyorderbooks-31c38b1b9d88.svg>)[PolyOrderbooks](<https://polytoolhub.com/tools/polyorderbooks/>) 

Dataset**3.5**Editorial

Query historical Polymarket crypto and sports order books at 250 ms resolution, or replay a crypto strategy against recorded depth.

-   Access Web · API · MCP

A browser-oriented strategy replay option.

![Simmer SDK: SDK introduction and available integration paths.](<https://polytoolhub.com/assets/cover-simmer-sdk-18fff77b13e8c7d9-400.webp>)

![Simmer SDK logo](<https://polytoolhub.com/assets/logo-simmer-markets-005e86752b04.webp>)[Simmer SDK](<https://polytoolhub.com/tools/simmer-sdk/>) 

SDK**3.5**Editorial

Build prediction-market agents with market research, multiple paper modes, historical replay and supported live-venue integrations.

-   Language Python
-   Access CLI

Agent-focused paper and backtesting workflows.

## Frequently asked questions about Marketlens Python SDK

### Which engine should I choose?

Use AlphaStrategy for bar-level signal tests and Strategy when execution details matter.

### Will changing my strategy charge for data again?

Reusing cached or already unlocked files does not consume another row allowance.

### Can I estimate a download first?

Use dry\_run on the export request.

### Can multiple series share one bankroll?

Yes. Portfolio runs share capital across the selected series.

In this profile
