Open-source trading framework
VibeTrading
Open-source trading framework for generating, backtesting, analyzing, and evolving strategies with LLM-powered feedback.
import vibetrading
# One call: generate → backtest → analyze → improve
result = vibetrading.evolve(
"BTC momentum with RSI and SMA crossover, "
"3x leverage, 8% TP, 4% SL",
iterations=3,
model="gpt-4o",
interval="1h",
)
print(f"Best score: {result.best_score}/10")
print(f"Improved: {result.improved}")
print(result.best_code)Core Capabilities
Strategy Generation
Generate structured strategies from prompts or templates. Output is framework-compatible and validated.
Backtest Analysis
LLM evaluates backtest results: scores performance (1-10), identifies weaknesses, and suggests actionable improvements.
Built-in Backtesting
Backtest using the same strategy logic used for live trading. No duplicate implementation.
Strategy Evolution
One call to iteratively improve strategies. Generate → backtest → analyze → regenerate with feedback, automatically.
Quickstart
Install
pip install vibetradingExample
import vibetrading
import vibetrading.strategy
import vibetrading.backtest
import vibetrading.tools
# 1. Generate strategy from a prompt
code = vibetrading.strategy.generate(
"BTC momentum: RSI(14) oversold entry, SMA crossover, "
"3x leverage, 8% TP, 4% SL",
model="gpt-4o",
)
# 2. Backtest on historical data
data = vibetrading.tools.download_data(["BTC"], interval="1h")
results = vibetrading.backtest.run(code, data=data)
# 3. Analyze with LLM
report = vibetrading.strategy.analyze(results, strategy_code=code)
print(f"Score: {report.score}/10")
print(report.suggestions)
# 4. Or evolve in one call (generate → backtest → analyze loop)
result = vibetrading.evolve("BTC momentum with RSI", iterations=3)
print(result.best_code)Architecture
Modular Pipeline
Strategies flow through a modular pipeline — from generation to backtesting, LLM-powered analysis, and iterative evolution. Each iteration feeds analysis back to the generator.
Define trading logic
Simulate on historical data
LLM scores & suggests fixes
Feedback → regenerate → repeat