---
url: "https://predictiontoolkit.com/tools/marketlens-python-sdk/"
publisher: "PredictionToolkit"
dateModified: "2026-11-03"
---

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

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

SDK

# Marketlens Python SDK: separate signal tests from execution replay

Marketlens Python SDK combines historical data access with two backtesting approaches. Strategy models tick-level execution; AlphaStrategy tests target exposure on aggregated bars. Both support repeatable Python research rather than a single black-box performance score.

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

[Read the Marketlens Python repository and guide](<https://github.com/marketlenstrade/marketlens-python>) github.com

**Pricing:** [See plans and costs ↓](<https://predictiontoolkit.com/tools/marketlens-python-sdk/#pricing>) 

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

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

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

## Screenshots and interface

Product preview1 / 2

SDK installation and Strategy example.

## What is Marketlens Python SDK?

Start broad with bar signals, then inspect representative intervals using L2 assumptions for latency, queues, limit orders, fees and settlement. Alpha does not model order queues or latency, so it answers a different question from a detailed execution simulation.

Portfolio runs let several series share capital, while structured events keep related strikes or weather buckets together. Save acquired files in data\_dir for offline iteration and use dry\_run before downloading. Always supply after and before for a bounded series run.

### Who it is for

-   Python researchers building repeatable strategies.
-   Teams comparing signals with execution behavior.
-   Researchers replaying several series with shared capital.

## Clients and supported operations

-   **Tick engine**
    
    Model latency, limits, queues, fees and settlement against recorded L2.
    
-   **Alpha engine**
    
    Set target weights or share counts on bars for faster tests.
    
-   **Portfolio runs**
    
    Replay multiple series sharing the same capital.
    
-   **Structured events**
    
    Process related strikes or weather buckets together.
    
-   **Sports subtype selection**
    
    Choose moneyline, spread, totals or another supported subtype explicitly.
    
-   **Offline iteration**
    
    Reuse cached data\_dir files across strategy changes.
    
-   **Export estimates**
    
    Use dry\_run to inspect row costs before acquiring history.
    
-   **Results as data**
    
    Inspect metrics, individual trades and DataFrames.
    

## Development workflows

### Test in two stages

Test signals across a broad period with AlphaStrategy, then narrow the question to fills and latency by replaying a shorter interval in Strategy.

### Iterate on cached data

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

### Test related markets together

Run structured events or a series portfolio with shared capital accounting.

## Pricing and total cost

The SDK is MIT-licensed. Marketlens data requires a key and row allowance; Free provides 2 million rows once and markets open in the last 7 days. Cached or previously unlocked files can be downloaded again without another row charge.

## Installation and configuration

1.  Use Python 3.10 or newer, install marketlens and set MARKETLENS\_API\_KEY.
2.  Choose Strategy for execution or AlphaStrategy for bar signals.
3.  Set after and before, quote with dry\_run and select data\_dir for reuse.
4.  Inspect reports and trades as well as summary metrics.

## Useful links

### What to check

-   Always bound series runs with after/before.
-   Alpha omits order queues and latency.
-   Mixed sports series require an explicit subtype.
-   Insufficient allowance can leave exports pending or partly downloaded.
-   Queue behavior is a simulation assumption, not a record of your hypothetical order.
-   Series runs can be unbounded without after and before.

A closer look

## Ratings & reviews

Editorial rating

**4.0**/ 5

0 user reviews

PredictionToolkit editorial

### Our take on Marketlens Python SDK

Separate bar and tick engines help select the required simulation detail. Export budgets, bounded windows and queue assumptions remain essential to setup.

**Assessment criteria:** Task usefulness, documented scope, setup clarity, and access and cost transparency.

**Assessment date:** 2026-10-01

**Documentation reviewed:** 2026-10-01

Documentation-based assessment. [How we rate](<https://predictiontoolkit.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.

## Related tools

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

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

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

Data API**4.0**Editorial

Export Polymarket history and replay Python strategies with stated latency, queue and fill assumptions.

-   Access API

The broader Marketlens data product.

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

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

Dataset**3.5**Editorial

Query historical books at 250 ms intervals or replay supported crypto strategies with depth-based fills.

-   Access Web · API · MCP

Browser-based strategy replay.

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

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

SDK**3.5**Editorial

Develop agent strategies with research, paper trading, replay and supported live integrations.

-   Language Python
-   Access CLI

Agent-oriented paper and backtesting workflows.

## Frequently asked questions about Marketlens Python SDK

### Which engine should I choose?

AlphaStrategy for bar signals; Strategy for execution details.

### Does changing strategy charge rows again?

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

### Can I estimate a download?

Use dry\_run on the export request.

### Can series share capital?

Yes, in a portfolio run.

In this profile
