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
- Use Python 3.10 or newer and install marketlens.
- Create a key and set MARKETLENS_API_KEY.
- Choose Strategy for execution or AlphaStrategy for bar signals.
- Always bound series runs with after and before.
- Quote downloads with dry_run and choose data_dir for reuse.
- 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
User reviews 0
The main score switches to user ratings after 5 published reviews.
A specific example helps the next person choose the right tool.
Related tools
Browse categoryFrequently 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.


