Vibe-Trading: The Trading Agent That Compiles Prompts Into Strategies

HKUDS built a multi-agent finance workspace that turns natural language into backtests, market-specific code, and cross-platform exports for global trading workflows.

10 min read • View on GitHub • More from HKUDS

A drafting table in a white room where a handwritten trading idea is fed into a mechanical compiler device. The machine splits the idea into three output trays: strategy code, a backtest report, and export sheets for different trading platforms. It explains that the project turns one prompt into executable trading artifacts.
Vibe-Trading is built around translation. One idea in, three kinds of trading output out.
Key Takeaways

Most AI trading demos stop at summaries, signals, or a chatbot that sounds confident about candles. Vibe-Trading goes after a harder job: turn a plain-language trading idea into artifacts you can actually inspect, backtest, and export. That is why the repo reads less like a trading assistant and more like a compiler for market workflows.

AI-powered multi-agent finance workspace that turns natural language requests into executable trading strategies, research insights, and portfolio analysis across global markets.

HKUDS/Vibe-Trading, Project Description · Vibe-Trading: Your Personal Trading Agent

Why Vibe-Trading Feels More Like a Compiler Than an Assistant

The core trick is translation. A user describes a strategy in natural language, the system converts that idea into a structured plan, then generates a runnable signal_engine.py, a config.json, and a run directory for the backtest. From there, the workflow can branch into Pine Script v6, MQL5, and TDX exports.

That matters because it narrows where the LLM is allowed to improvise. The model helps shape the strategy, but the math, evaluation, and export layers are handled as artifacts. In other words, the repo tries to make the model useful without asking it to be a calculator.

LayerWhat the user getsWhy it matters
PromptA plain trading ideaLow friction entry for non-quant users
Generated code<code>signal_engine.py</code>Turns intent into an executable strategy
BacktestPerformance evidenceSeparates ideas from results
ExportPine Script, MQL5, TDXMakes the same strategy portable across platforms
A close-up of a stacked filing cabinet with three drawers labeled as different memory layers. Loose scraps are pruned from the top drawer, a compact summary sheet sits in the middle, and a hand reaches for a lower drawer that is opened deliberately. It explains how the agent keeps long research sessions coherent without overflowing context.
The hard problem is not just trading. It is remembering enough of the investigation to keep going.

The Pipeline: Prompt, Code, Backtest, Export

The workflow is staged on purpose. Prompt in. Skill selection. Strategy code generation. Backtest execution. Then platform-specific export. That sequence is the repo’s main argument: execution is a pipeline, not a conversation.

This pipeline is the project’s key move. It separates generation, verification, and export into distinct stages.

run_dir/
  config.json
  signal_engine.py
  backtest_report.json
  exports/
    strategy.pine
    strategy.mq5
    strategy.tdx
StepLLM's roleDeterministic role
Strategy designPropose and refineNone
Code generationDraft the strategy engineValidate file structure
BacktestInterpret resultsCompute the results
ExportMap strategy logicRender target syntax

The Real Brain Is the ReAct Loop

The engine behind the repo is AgentLoop, and its job is to keep the research thread alive. It uses three context layers. Microcompact trims old tool results, auto-compact summarizes when the token budget gets tight, and manual compact lets the model ask for a cleanup when the transcript gets messy.

That is a practical answer to a real problem. Trading research sessions can be long, noisy, and full of dead ends. The loop is designed so the agent can explore, revise, and keep going without losing the plot.

Skills Are Loaded, Not Stuffed

The skill system follows progressive disclosure. The system prompt only sees short skill descriptions, while the full methodology files are loaded on demand. That is a cleaner design than dumping dozens of research playbooks into the prompt and hoping the model ignores what it does not need.

ApproachWhat goes into contextTrade-off
Stuff everything inAll skills up frontFast to start, slow to scale
Progressive disclosureOnly descriptions first, full docs on demandMore control, less token waste
Manual library browsingHuman picks docs outside the agentPrecise, but less fluid
skills = loader.get_descriptions()
if need_more_detail:
    skill_doc = loader.load_skill("chanlun")
    context.append(skill_doc)

Why the Swarm Matters

Vibe-Trading is not one monolithic trader. It is a swarm of specialized teams, from a geopolitical war room to an ML quant lab. That choice changes the product from a single assistant into a research desk with distinct functions, which is closer to how real trading teams work.

ModelStrengthWeakness
Single generic agentSimple to explainEasy to overload
Specialized swarmRole clarity and narrower promptsMore orchestration overhead
Human research deskStrong judgment and reviewSlower and less scalable

Global Markets, Local Heuristics

The repo is broad on purpose. It covers A-shares, crypto, forex, futures, and global equities, and it pulls from loaders like akshare, tushare, ccxt, yfinance, and okx. That mix matters because a trading system only feels universal if its data plumbing understands local market realities.

Market familyTypical plumbing needWhy the repo’s approach helps
A-sharesLocal data and platform syntaxSupports China-specific workflows
CryptoExchange APIs and fast iterationPairs well with ccxt and exportable signals
Forex and futuresPlatform-specific execution formatsMakes MQL5 and related targets useful
Global equitiesPortable research stackKeeps cross-market comparisons consistent

Where Vibe-Trading Fits in the Market

Compared with a generic chat-based trading assistant, Vibe-Trading goes further into executable artifacts. Compared with a narrower autonomous executor like VibeTrade, it is less about one broker or one approval flow and more about research, code generation, backtesting, and export. It sits closer to a multilingual quant workshop than to a single-purpose bot.

Project typePrimary focusWhat it optimizes for
Generic chat assistantAnswers and summariesConvenience
Autonomous executorBroker-connected actionControlled execution
Vibe-TradingPrompt to strategy pipelinePortable research artifacts
Traditional quant stackManual coding and validationFull control

The project is strongest when you treat it as a research-to-code system. It is less convincing as a fully autonomous trader, and that is fine. The real value is that it makes strategy generation portable, inspectable, and fast to iterate.