Market LabDocs

Market Lab v0.0.8

Python Scripting V2, Docker deployment, and outcome market-making bots.

v0.0.8 adds Python strategies, a Docker option for mlabd, and outcome-market support for the existing market-making bots.

Python Scripting V2

Write a normal Python file and use Market Lab for data, backtesting, execution, jobs, and artifacts:

mlab script backtest strategy.py \
  --python .venv/bin/python \
  --source btc@candles@binancef:timeframe=60

mlab script run strategy.py \
  --python .venv/bin/python \
  --source btc@candles@binancef:timeframe=60

Python V2 includes:

  • on_data(ctx, history), on_execution(ctx), and on_finish(ctx, history);
  • pandas, NumPy, matplotlib, statsmodels, and other packages from the selected environment;
  • all existing ctx.study helpers;
  • ctx.trade, ctx.order, and ctx.cancel with an exchange selected per request;
  • multi-symbol and multi-exchange execution without --venue;
  • ctx.pnl() and job-owned artifact paths;
  • automatic execution keys when key is omitted; and
  • time, memory, subprocess, protocol, and log limits.

Sources come from --source or marketlab.toml, not the Python manifest. Hyperliquid uses mainnet by default; --testnet applies to every Hyperliquid request in that job.

Live logs now show when Python initializes and when market data is connected:

[23:57:52] initializing strategy (Python 3.11.2, managed 394af2a3f753, 80 packages)
[23:57:54] script running; market data connected providers=mmt exchanges=binancef,hyperliquidf symbols=btc

See Python Scripting V2.

Native or Docker daemon

The host CLI can supervise mlabd natively or in Docker:

mlab daemon backend native
mlab daemon backend docker

The Docker container runs as a non-root user with a read-only root filesystem, dropped capabilities, no Docker socket, and an authenticated loopback-only connection to the CLI.

Python packages require no Dockerfile. For a Docker live job, Market Lab snapshots the selected local environment, creates an isolated runtime with the same pinned packages, and reuses it on later deployments.

Backtests remain local and do not require the daemon.

See Market Lab Daemon and Python V2 with Docker.

Outcome market making

Mid-Price, Volume-Mid, and Grid now run on Hyperliquid outcome markets:

mlab bot run mid-price 1009 \
  --venue hyperliquid-outcomes \
  --margin 100 \
  --duration 3600

Pass the outcome ID only. Outcome bots do not use leverage.

Market Lab resolves the Yes/No pair, splits quote collateral into both shares, places complementary maker quotes, and merges balanced shares during cleanup. Grid keeps its fixed paired-cell behavior.

Advanced manual utilities remain available through mlab outcome split, merge, merge-question, and negate.

See Hyperliquid outcomes.

On this page