Agent-first trading framework: describe strategies in natural language, generate executable code, backtest and deploy across exchanges.
Project description
VibeTrading
Agent-first trading framework for cryptocurrency. Describe strategies in natural language, generate executable Python code, backtest on historical data, and iteratively improve with LLM-powered analysis.
Installation
pip install vibetrading
Quick Start
Setup
Set your LLM API key (at least one) and optional proxy:
export OPENAI_API_KEY=sk-... # or ANTHROPIC_API_KEY, GEMINI_API_KEY, DEEPSEEK_API_KEY
export HTTPS_PROXY=http://127.0.0.1:7890 # optional
Or put them in a .env file — the package loads it automatically.
Generate a Strategy
import vibetrading.strategy
code = vibetrading.strategy.generate(
"BTC momentum strategy: RSI(14) oversold entry, SMA crossover confirmation, "
"3x leverage, 10% position size, 8% take-profit, 4% stop-loss",
model="gpt-4o",
)
Backtest
import vibetrading.backtest
import vibetrading.tools
data = vibetrading.tools.download_data(["BTC"], exchange="binance", interval="1h")
results = vibetrading.backtest.run(code, interval="1h", data=data)
metrics = results["metrics"]
print(f"Return: {metrics['total_return']:.2%}")
print(f"Sharpe: {metrics['sharpe_ratio']:.2f}")
print(f"Max Drawdown: {metrics['max_drawdown']:.2%}")
print(f"Win Rate: {metrics['win_rate']:.2%}")
Analyze Results
Use an LLM to score performance and get actionable improvement suggestions:
report = vibetrading.strategy.analyze(results, strategy_code=code, model="gpt-4o")
print(f"Score: {report.score}/10")
print(report.summary)
for s in report.suggestions:
print(f" → {s}")
Evolve
One call to iteratively improve a strategy through generate → backtest → analyze feedback loops:
import vibetrading
result = vibetrading.evolve(
"BTC momentum strategy with RSI and SMA crossover, 3x leverage",
iterations=3,
model="gpt-4o",
interval="1h",
)
print(f"Best score: {result.best_score}/10")
print(f"Improved: {result.improved}")
print(result.best_code)
How It Works
Describe ──▶ Generate ──▶ Backtest ──▶ Analyze ──▶ Evolve
(prompt) (LLM) (engine) (LLM) (loop)
▲ │
└──────────── feedback ──────────────────────┘
- Describe — Write what you want in plain English.
- Generate — An LLM produces framework-compatible strategy code with risk management.
- Backtest — Run against historical data from any CCXT-supported exchange.
- Analyze — An LLM evaluates backtest results: scores performance, finds weaknesses, suggests fixes.
- Evolve — Repeat the loop. Each iteration feeds analysis back to the generator.
Features
- Any LLM — Works with OpenAI, Anthropic, Google, DeepSeek, or any OpenAI-compatible API via litellm.
- Built-in validator — Static analysis catches common errors before execution.
- LLM backtest analysis — Structured scoring (1-10), strengths/weaknesses, and actionable suggestions.
- Strategy evolution —
vibetrading.evolve()runs the full generate → backtest → analyze → regenerate loop. - CCXT data — Download and cache OHLCV data from Binance, Bybit, OKX, and 100+ exchanges.
- Realistic simulation — Limit/market orders, margin, leverage, funding rates, fees, and liquidation detection.
Modules
| Module | Purpose |
|---|---|
vibetrading |
vibe decorator, evolve() |
vibetrading.strategy |
generate(), validate(), analyze(), prompt templates |
vibetrading.backtest |
BacktestEngine, run() |
vibetrading.evolution |
StrategyEvolver, evolve() |
vibetrading.tools |
download_data(), load_csv() |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vibetrading-0.1.5.tar.gz.
File metadata
- Download URL: vibetrading-0.1.5.tar.gz
- Upload date:
- Size: 66.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1994ade9ec1b28c722e417971428682b8fd7dad1f465631a4ea562da27e8c64
|
|
| MD5 |
8758c4ca63b6c7ef3863410612bc0507
|
|
| BLAKE2b-256 |
dec7d1200ef30d218fb435e28d11c8d61421bb0447fede766f987a2b3018e1a5
|
File details
Details for the file vibetrading-0.1.5-py3-none-any.whl.
File metadata
- Download URL: vibetrading-0.1.5-py3-none-any.whl
- Upload date:
- Size: 81.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d07801b1802f796cc0fc6cc4dedc980b803ac3d2218fbe61de67367553e85b79
|
|
| MD5 |
5c5c55a018aaea4660970b2c6e95c8e5
|
|
| BLAKE2b-256 |
00144bcf161e6c5d83da8d927f313121b53fa3b466b81150e6449acb34b1e183
|