Paper lab

Langbot runs its own reference strategies on paper, around the clock, against the live order books it records for every open market. The same strategies and the same fill model are yours to run in the simulator.

On this page

The paper lab is Langbot running its own strategies against its own record. It reads the order books Langbot records for every open market on Kalshi and Polymarket, the phrase hits from live events, the calendar and the settlements, and trades on paper only: no venue client is created, no credential is read and no order ever leaves it.

It exists so the product is used the way you would use it: the strategies are ordinary langbot.lab classes in the SDK, and the engine that runs them around the clock is the same one that replays history. Every result is labelled paper, and a paper result is not a forecast of what real orders would get.

Run a lab strategy yourself

The lab's strategies run through the plain simulator under a lab: prefix:

Terminal
langbot sim run -e <event_id> -s lab:fade_longshots
langbot sim run -e <event_id> -s lab:favorite_maker --params '{"qty": 5}'
StrategyWhat it does
fade_longshotsbuys NO on markets whose YES trades at 10¢ or less with a tight spread, once per market, and holds to settlement
maker_calm_marketsquotes both sides of quiet two-sided markets away from their events, and steps aside around events, phrase hits and the close
favorite_makerrests a small YES bid at the best bid on markets priced 50–90¢, and pulls it while the market's event is live
cross_venue_divergenceon question pairs marked equivalent, buys YES on the venue whose ask sits below the other venue's mid by more than both venues' fees plus a margin
pm_payrolls_t1ha pre-registered forward test on Polymarket's payrolls brackets, one hour before the release; it failed its research bar and runs to measure, not to recommend

Each one starts with $10,000 of paper cash and its own limits (total exposure, per market, a daily loss stop). The rules and defaults are on the classes in langbot.lab.strategies.

In code

Python
from langbot.lab import LabEngine, StrategySpec, book_item, lab_strategy

eng = LabEngine([StrategySpec("fade", lab_strategy("fade_longshots"))])
rows: list[dict] = []  # order-book snapshot rows, oldest first
for row in rows:
    eng.step(book_item(row))
print(eng.summary())

Fill model and fees

The lab uses the simulator's engine:

  • an order arrives 250 ms after it is placed (plus a venue speed bump for taking orders) and walks the depth of the first recorded book at or after that time;
  • a limit order rests; with queue position on, it waits behind the size recorded at its price, and a move through its price fills it;
  • Kalshi fees are ceil(rate × multiplier × C × P × (1 − P) × 100) / 100 per execution: takers at 0.07 times the series' fee multiplier, makers at 0.0175 times it only on series that charge makers;
  • Polymarket fees are rate × C × p × (1 − p) on takers at the market's own rate, and makers pay nothing (and may be credited the market's rebate).

The fee terms are read from the venues' public endpoints and cached for a day. The same engine and fees are what langbot sim run uses: see Simulator and backtesting.