← Backtesting

SDK

Marketlens Python SDK

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

View repositorygithub.com
Available on
Python, Parquet, Jupyter
Pricing
The SDK is MIT-licensed

Screenshots and interface

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

Before you start: A series run without after/before can be unbounded.

  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
Editorial rating
4.0/ 5
0 user reviews

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

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@polytradingbot.com with the tool name, your rating and your experience. Enable JavaScript to prepare a draft here.

Related tools

Browse category

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.