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.
Features and coverage
- 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.
Workflows with Marketlens Python SDK
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.
Getting started
Before you start: Always bound series runs with after/before.
- Use Python 3.10 or newer, install marketlens and set MARKETLENS_API_KEY.
- Choose Strategy for execution or AlphaStrategy for bar signals.
- Set after and before, quote with dry_run and select data_dir for reuse.
- Inspect reports and trades as well as summary metrics.
Series runs can be unbounded without after and before.
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.
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?
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.


