← Backtesting

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.

Screenshots and interface

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.

  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.

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

Editorial rating
4.0/ 5
0 user reviews

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.

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.

Related tools

Browse category

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.