{"repo":"marketlenstrade/marketlens-python","free":true,"listed":false,"github":"https://github.com/marketlenstrade/marketlens-python","clone":"git clone https://github.com/marketlenstrade/marketlens-python.git","description":"Python SDK for Polymarket order book data and backtesting. Tick-level L2 snapshots, billions of deltas, full book reconstruction, and a strategy backtesting engine with realistic execution.","language":"Python","stars":23,"topics":["algorithmic-trading","backtesting","market-data","order-book","polymarket","prediction-markets","python","quantitative-finance","sdk","tick-data"],"license":"MIT","category":"trading","readme_excerpt":"Marketlens Backtest prediction market strategies on tick-level L2 order book data from Polymarket. Marketlens records every book update, replays it through an execution-realistic engine, and hands you the results as metrics and DataFrames. Write a Strategy , point it at a market or series, and know whether it makes money. PyPI · Documentation · Changelog Python 3.10+. Get a free API key at marketlens.trade and export it as MARKETLENS API KEY . Order book history starts 2026-03-01. Quickstart Two engines client.backtest() runs one of two engines, chosen by your strategy's base class: - Execution ( Strategy ): replays the full L2 book tick by tick and simulates how your orders actually fill: latency, limit orders, CLOB queue position, fees, settlement. Use it when the edge lives in how you trade. - Alpha ( AlphaStrategy ): one bar per market per resolution , built from order book metrics or trade candles. You declare a target exposure and the engine trades the delta to it. Orders, queues, and latency are out of the model, so multi-week and multi-month windows stay fast. Use it to test whether a signal predicts price at all. A common loop: prove the signal on the alpha engine over a long window, then confirm the execution on the tick engine over a short one. Docs: Execution · Alpha · Runs · Examples Execution backtests The target is a market UUID, a series slug, or a list of either. Always pass after / before on series runs, they are otherwise unbounded. One market, full lifetim","default_branch":null,"files":null,"tree":[],"storefront":"/r/marketlenstrade","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/marketlenstrade/marketlens-python/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}