Moby Agent Marketplace Connect Moby MCP Get the app

Backtesting.py

COMMUNITY· Repos & libraries · by kernc · v0.6.6

Backtesting.py tests an entry and exit rule on any OHLCV, including the Solana candles your agent pulls from Moby, with stats and a chart of every trade.

What it touches

Reads
OHLCV candles your agent fetches from Moby (get_token_ohlcv) or any other source
Writes
Local result files and HTML charts
Tools
Python library `backtesting`
Trades
Never trades

About

Backtesting.py is a small Python library. Give it a pandas table of OHLCV candles and a strategy class with entry and exit rules, and it returns the usual statistics (return, win rate, drawdown, Sharpe, exposure) and an interactive chart of every trade. It also has a parameter optimizer.

What it adds to Moby. A quick backtest on the exact data your Moby agent trades. It does not care where candles come from, so your agent can test a rule on a Solana token's own history, new launches included, once there is enough of it.

How to pair it. Turn a strategy idea (for example a breakout with Moby's default -30% stop and +100% take-profit) into a Backtesting.py strategy, run it on a few tokens from get_token_ohlcv, and show the stats before you save it as a Moby strategy. Moby returns candles newest-first; reverse them before you feed them in.

What it does not do. It tests one instrument at a time with a simple fill model, so slippage on thin Solana pools is understated; add a generous commission. It does not trade. Its license is AGPL-3.0, which matters only if you ship it inside a product.

Install

Third-party code: Moby does not audit or control it. Read the source before you run it.

  1. pip install backtesting
  2. Read the quick-start: https://kernc.github.io/backtesting.py/
  3. Ask: *"Pull 30 days of hourly candles for <token> with get_token_ohlcv, put them oldest-first, and backtest a breakout rule with a -30% stop and +100% take-profit in Backtesting.py. Include 1% commission."*

Works with

  • Grok Bot
  • Claude Code
  • Codex

Curated listing. Moby did not audit the code. · Version 0.6.6 · Updated 2026-11-02

Run these with Moby

Get the Moby app, connect your agent to Moby's MCP, then manage its limits from the app.