Most AI trading projects give you one thing: a chatbot that talks about markets, or a backtester that crunches numbers. Vibe-Trading tries to be the whole desk. It is an open-source agent from the University of Hong Kong's Data Science lab (HKUDS) that takes a plain-English request — "backtest a 20/50 moving-average crossover on BTC for 2024" — and runs it: fetches the data, writes the strategy, runs the backtest, and reports the numbers. It also ships a 478-alpha factor library you can benchmark without any model at all, a paper-trading engine, and an MCP server so other agents can drive it.

It is trending for a reason. The repository — HKUDS/Vibe-Trading — sits at 39,393 stars and 6,403 forks under the MIT license, with 4,295 commits since April 2026 and a pip package, vibe-trading-ai 0.1.19, released November 5, 2026. The README logged new entries on November 28, 29, and 30 — the project is shipping weekly. A companion paper, arXiv 2611.24845, documents the design. I installed it, pointed it at a local Ollama model, and ran the full loop: alpha benchmark, agent backtest, deterministic backtest, paper account, MCP server, API server. Every command below ran exactly as written, including the two that failed.

Why this is blowing up now#

AI trading agents are not new — this blog covered a multi-agent trading desk running on Ollama in October — but Vibe-Trading is the first one at this scale to package the whole quant workflow behind one CLI. The agent is the headline, but the unglamorous parts are what make it usable: a fallback chain of free data sources (Yahoo's public endpoint first for US equities, then Stooq, Sina, and others; OKX first for crypto), a factor registry with 478 named alphas and their formulas, and a backtest engine with a written contract for strategy code. The project also ships 19 broker connectors, so the same agent that backtests can, with authentication, trade live — and a paper-trading mode so you never have to.

The numbers: 39,393 stars, 6,403 forks, 4,295 commits, MIT license, created April 1, 2026, pip package 0.1.19 (November 5, 2026). The agent supports Ollama as a first-class provider, which is the whole point of this tutorial: the documented default is qwen2.5:7b served locally, no API key, no account, no per-token bill. That is the promise being tested here — and the honest result is that the model you choose matters more than the install.

What you'll need#

  • Python 3.12 and pip. The install below pulls roughly 1.1 GB of dependencies into a virtual environment — leave 2 GB free.
  • Ollama running locally (ollama serve, default port 11434) with a model pulled. The documented default is qwen2.5:7b (about 4.7 GB). I tested with the much smaller qwen3:0.6b (523 MB) that was already on the machine — and the agent path failed with it, twice. Read step 3 before choosing your model.
  • No API keys, no accounts, no paid data for everything in this tutorial. Market data comes from free public endpoints.
  • A terminal and about an hour. The install takes minutes; the S&P 500 alpha benchmark takes about 14 minutes on a 2-core machine; the agent turns take several minutes each on a small local model.
  • Cost: $0. Paper trading is simulated money; nothing here places a real order or touches a broker.

1. Install it#

Install the package into a virtual environment and confirm the version. Pin it — the CLI surface changes between releases, and everything below was verified against 0.1.19:

python3 -m venv .venv
.venv/bin/pip install vibe-trading-ai==0.1.19
.venv/bin/vibe-trading --version

Expected output:

vibe-trading 0.1.19

Check the full command list while you are here — vibe-trading --help shows the subcommands you will use: run, serve, provider, alpha, paper, portfolio, connector, memory, and more. The deterministic paths in this tutorial — alpha bench, the MCP backtest tool, paper — need no model at all; only run does.

2. Point it at a local model#

Vibe-Trading reads its provider configuration from ~/.vibe-trading/.env (created by the interactive vibe-trading init wizard) or from a .env in the directory you run it from. For Ollama, three lines are the whole configuration:

LANGCHAIN_PROVIDER=ollama
LANGCHAIN_MODEL_NAME=qwen3:0.6b
OLLAMA_BASE_URL=http://127.0.0.1:11434

Verify the provider with the built-in diagnostics command, which prints the resolved provider without leaking keys:

vibe-trading provider doctor

Expected output (abridged):

{
  "provider": "ollama",
  "model": "qwen3:0.6b",
  "base_url": "http://127.0.0.1:11434",
  "api_key": {}
}

Before running anything, the CLI runs a preflight check. Mine reported 5 of 7 services ready: the LLM (Ollama, qwen3:0.6b) and the OKX API were reachable, akshare and ccxt were installed, and two items were not — Tushare, which needs a token you do not need for this tutorial, and yfinance, which failed with a connection timeout in this sandbox and was flagged as "US/HK equity backtest unavailable." That last line is worth understanding: the preflight probes yfinance specifically, but the equity data path does not depend on it — the Yahoo public endpoint, which the loaders try first, served the S&P 500 benchmark in step 4 without yfinance working at all.

3. Ask the agent to backtest — and what the small model could not do#

The agent's headline move is a one-line backtest. This is the exact prompt from the project's own quick example:

vibe-trading run -p "Backtest a BTC-USDT 20/50 moving-average crossover for 2024. Compare it with buy-and-hold and report maximum drawdown."

With the 0.6B model, it did not work. The run finished in 5 minutes 26 seconds after two model calls and reported: "The symbol BTC/USDT is not available or not handled by the tool. The market is set to 'multi,' but no results were returned from the symbol search." The model had converted the symbol to slash form (BTC/USDT) when calling the symbol-search tool, and the search returned nothing for that spelling. The tooling handles the dash form (BTC-USDT) — the model chose the wrong one and gave up instead of retrying.

I ran it a second time with the format spelled out:

vibe-trading run -p "Backtest a 20/50 moving-average crossover on BTC-USDT for 2024. Use the exact symbol BTC-USDT (with a dash) from OKX. Compare it with buy-and-hold and report maximum drawdown."

This time the agent locked the symbol correctly — its own grounding record shows BTC-USDT authorized — but the model then hallucinated a price of 12345.67 with no tool evidence behind it (its grounding system flagged the claim), went through seven model calls, and failed after 11 minutes 21 seconds: "empty_model_response: provider=ollama model=qwen3:0.6b iteration 6 returned no content and no tool calls." The model simply ran out of steam mid-task.

Two failures, one lesson: a 0.6B model is below what this agent needs. The 0.6B model generates at roughly 7 tokens per second on this machine, and each agent turn burns minutes on reasoning before it ever calls a tool. Do not judge the agent by this model. For the agent path, use the documented default — qwen2.5:7b via Ollama — or a frontier API key. I did not verify the 7B model in this run, so treat that as the project's recommendation, not a tested claim. What I did verify is the deterministic path that needs no model at all, which is the next two steps.

4. Rank 101 alphas on the S&P 500 — no model needed#

The alpha zoo is the part of Vibe-Trading that works with zero AI. List the registry first:

vibe-trading alpha list        # 50 of 478 alphas shown
vibe-trading alpha show academic_hml   # formula, source, and references for one factor

Then benchmark a whole zoo against a universe. This is the command I ran — the classic 101 formulaic alphas, S&P 500, calendar 2024, top 3 kept:

vibe-trading alpha bench --zoo alpha101 --universe sp500 --period 2024-2024 --top 3
Editorial illustration of a ranked factor leaderboard and a magnifying glass over a candlestick chart
AI-generated illustration: ranking 101 alphas against the S&P 500.

It ran 101 of 101 alphas in 13 minutes 47 seconds of wall time (827.71 seconds reported), testing 96 and skipping 5, fetching 498 of 503 requested names. The five missing names — FDXF, HONA, Q, SNDK, VYLR — are artifacts of the Wikipedia constituent list, not real S&P 500 tickers; the loader tried Yahoo, then Stooq, then the rest of the chain, and dropped them. The top three by information ratio:

AlphaThemeMean rank ICInformation ratioPositive IC daysStatus
alpha101_007momentum / volume0.01740.240161.1% (185 days)dead
alpha101_008reversal0.03170.233359.3% (236 days)alive
alpha101_051momentum0.02540.217858.4% (231 days)alive

Read the table carefully: the highest information ratio belongs to 007, but its category is "dead" — the registry's own verdict — while 008 has the highest mean rank IC (0.0317) and is alive. A bench that ranks factors and then tells you which ones it has already retired is more useful than a bench that only ranks. The run also writes an HTML report; mine landed at reports/alpha_bench_20261201T070130Z.html under the runtime home.

5. Backtest the crossover deterministically#

The agent writes strategy code and calls the same backtest tool you can call yourself over MCP. A backtest run is a directory with two files: config.json and code/signal_engine.py. Here is the exact pair I ran, following the project's strategy-generate skill contract — a signal engine returns a series in [-1, 1] per symbol, 1.0 fully long, 0.0 flat, indexed exactly like the input bars, with no look-ahead shifting (the engine fills a signal at the next bar's open):

{
  "source": "okx",
  "codes": ["BTC-USDT"],
  "start_date": "2023-11-12",
  "end_date": "2024-12-31",
  "warmup_bars": 50,
  "interval": "1D",
  "initial_cash": 100000,
  "commission": 0.001,
  "engine": "daily",
  "position_adjustment": "hold"
}
import numpy as np
import pandas as pd


class SignalEngine:
    def generate(self, data_map):
        signals = {}
        for code, df in data_map.items():
            close = df["close"]
            ma20 = close.rolling(20).mean()
            ma50 = close.rolling(50).mean()
            sig = pd.Series(0.0, index=df.index)
            sig[ma20 > ma50] = 1.0
            signals[code] = sig
        return signals

The start date is 50 bars before 2024 on purpose: the 50-day average needs 50 bars of history, so warmup_bars: 50 primes the indicators and the graded window is exactly calendar 2024. The backtest ran through the MCP backtest tool with this run directory, on real OKX daily bars — 416 of them, BTC opening 2023 at $37,154 and closing 2024 at $94,443. The engine's metrics.csv:

Metric20/50 crossoverBuy-and-hold
Final value ($100,000 start)$134,693.79$220,749.69
Total return+34.69%+120.75%
Annual return+22.76%—
Maximum drawdown−36.87%—
Sharpe / Sortino / Calmar0.77 / 1.19 / 0.62—
Trades / win rate / profit factor5 / 40% / 2.16—
Average holding period47.2 days—
Editorial illustration of two rising equity curves, one steep and one gentler, with a shaded drawdown dip
AI-generated illustration: the crossover's equity curve against buy-and-hold.

The trade log tells the story. The strategy bought on January 1 at $42,805 and sold January 25 at $39,781 (−7.1%), bought February 12 at $49,942 and sold April 18 at $63,466 (+27.1%), bought May 24 at $68,366 and sold June 25 at $61,790 (−9.6%), then bought July 28 at $67,684 and held to year end. Five trades, two winners, and a 40% win rate — but the winners were bigger than the losers (profit factor 2.16), so the year still ended up 34.7%.

And yet it lost to doing nothing by 86 percentage points. 2024 was a relentless BTC uptrend, and every exit was a whipsaw: the crossover sold into dips that recovered. That is the correct conclusion from this backtest, not a failure of the tool — the engine measured the strategy honestly, including a −36.9% maximum drawdown that buy-and-hold never had to explain. A backtester that only ever flatters your strategy is useless; this one reported the underperformance in its own summary (excess return −86.06%, information ratio −1.66).

One sandbox note, because it will bite you behind a proxy: the OKX loader fetches history page by page on one shared HTTP session, and on this machine the second page stalled — the first request returned in under a second, the reused connection then hung until the 20-second read timeout, four attempts in a row. Single requests to the same endpoint work fine; it is the paginated walk-back that stalls when the proxy closes keep-alive connections. The workaround I verified is to fetch the bars once (five plain requests, 416 rows) into a CSV and point the backtest at it with the documented local-data config (~/.vibe-trading/data-bridge/config.yaml) and "source": "local" in config.json. Same bars, same engine, same numbers — only the transport differs. On a normal network, "source": "okx" works directly.

6. Paper-trade without risking money#

Backtests are history; paper trading is the present tense. Create a simulated account from a JSON state file — cash and positions — and list it:

printf '{"cash": 100000, "positions": []}' > paper_state.json
vibe-trading paper create --label tutorial-demo --market us --state paper_state.json
vibe-trading paper list

Expected output (abridged):

{
  "id": "93d67b6e7da94dfe95504a0a00d0dd68",
  "label": "tutorial-demo",
  "market": "us",
  "currency": "USD",
  "created_at": "2026-12-01T07:26:19.434106+00:00",
  "start": "today",
  "account_state": {"cash": 100000.0, "positions": []}
}

Paper accounts cover the US, Hong Kong, and China A-share markets (us, hk, cn_a) under frozen matching rules — T+1 settlement, price limits, board lots, fees — and the matching engine never places a real order. Advance the account day by day with paper step and paper advance; the account id above is the handle for all of it.

7. Drive it from other agents — and the API#

Vibe-Trading also ships as an MCP server, so Claude Code or any MCP client can call it as tools. Start it with vibe-trading-mcp (stdio transport by default; --transport http serves Streamable HTTP on port 8900). I verified the handshake over stdio: initialize returned server Vibe-Trading 0.1.19, and tools/list returned 81 tools — including backtest, get_market_data, alpha_bench, paper_trade_step, technical_indicators, and the trading_* family for quotes, positions, orders, and history. The get_market_data call I ran returned real OKX bars for BTC-USDT, January 1–10, 2024 (open $42,783.90, close $45,183.90 on day one), with provenance recording source okx and no fallback used.

One environment note if you run the MCP server on a machine with a proxy: fastmcp's startup version check crashes on some NO_PROXY values (IPv6 literals), with httpx.InvalidURL: Invalid port: ':1]'. Set FASTMCP_CHECK_FOR_UPDATES=off in the server's environment and it starts cleanly.

The API server is the same app over HTTP:

vibe-trading serve --port 8899
curl -s http://127.0.0.1:8899/runs
curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8899/docs

/runs returned both of my agent runs as JSON (including the failed one, with its prompt and status), and /docs returned 200 with the OpenAPI spec for "Vibe-Trading API" 0.1.19. Startup takes about a minute — the preflight yfinance probe alone burns 30 seconds timing out on a restricted network — so wait for "Application startup complete" before curling. The root path returns 404 until you build the frontend bundle with vibe-trading setup; the API is the point of serve.

When to use this vs alternatives#

OptionUse it whenWatch out for
Vibe-TradingYou want one CLI for agent research, factor benchmarking, backtests, paper trading, and an MCP server — free data, local modelThe agent needs a capable model; the 0.6B model failed twice. Live trading needs broker auth.
Claude Trading SkillsYou want a disciplined investing process inside Claude Code — regime checks, sizing, journaling — starting freeA process pack, not a backtester; most screeners need a paid FMP key
TradingAgents on OllamaYou want a multi-agent debate (bull vs bear, analyst vs trader) on your own machineHeavier multi-agent orchestration; Vibe-Trading's factor library and paper engine are broader
Daily stock analysis scriptsYou want a scheduled daily report, not an interactive agentReporting only — no backtests, no alphas, no paper trading
Your own backtester (pandas + yfinance)You want total control over every line of the engineYou rebuild the data fallback chain, the factor registry, and the paper engine yourself

The honest boundary is the model. The deterministic half of Vibe-Trading — alpha bench, backtest tool, paper trading, MCP tools, API — ran end to end on a 2-core sandbox with no API key and no model at all. The agent half is real too, but it is only as good as the model driving it, and a 0.6B model is not good enough. Budget for the documented 7B default (or a frontier key) before you judge the agent.

The takeaway#

Vibe-Trading earns its trending spot by being a complete quant desk in one pip install: an agent that takes English and returns backtests, a 478-alpha library you can rank without any model, a backtest engine that reports underperformance as plainly as outperformance, and paper trading that costs nothing. Install it, point it at Ollama, run the alpha bench, and backtest one strategy before you believe any of it — the numbers in this tutorial are reproducible from the commands above, and the two failures are part of the record. The crossover made 34.7% and still lost to buy-and-hold by 86 points; that is exactly the kind of uncomfortable, checkable fact a good trading tool should hand you. Use a capable model for the agent, keep the deterministic tools for the numbers, and never let either one place a real order without you.

Sources#