# Welcome

Describe trading strategies in natural language. Generate executable Python. Backtest, analyze, and deploy with LLM-powered feedback.

```
pip install vibetrading
```

***

## What is VibeTrading?

VibeTrading is an open-source trading framework where users describe strategies in natural language and AI agents generate, backtest, and analyze executable code.

### How It Works

**1. Describe** — Tell the agent what you want in plain English.

**2. Generate** — AI produces framework-compatible strategy code with proper risk management.

**3. Backtest** — Run against historical data from any CCXT-supported exchange.

**4. Analyze** — An LLM evaluates backtest results: scores performance (1-10), finds weaknesses, suggests fixes.

**5. Iterate** — Refine based on analysis and repeat.

```
Describe ──▶ Generate ──▶ Backtest ──▶ Analyze ──▶ Iterate
(prompt)      (LLM)        (engine)     (LLM)       (refine)
                ▲                                      │
                └──────────── feedback ────────────────┘
```

***

## Quick Example

```python
import vibetrading
import vibetrading.strategy
import vibetrading.backtest
import vibetrading.tools

# 1. Generate strategy from natural language
code = vibetrading.strategy.generate(
    "ETH mean reversion with Bollinger Bands, short when price hits upper band, "
    "long when price hits lower band, 5x leverage",
    model="gpt-4o",
)

# 2. Backtest
data = vibetrading.tools.download_data(["ETH"], exchange="binance", interval="1h")
results = vibetrading.backtest.run(code, interval="1h", data=data)

if results:
    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%}")

# 3. Analyze with LLM
report = vibetrading.strategy.analyze(results, strategy_code=code)
print(f"Score: {report.score}/10")
print(report.suggestions)
```

***

## Package Modules

```
import vibetrading                # vibe decorator
import vibetrading.strategy       # generate, validate & analyze strategies
import vibetrading.backtest       # backtest engine (BacktestEngine, run())
import vibetrading.tools          # data download & CSV loading
```

***

## Links

* [GitHub](https://github.com/VibeTradingLabs/vibetrading)
* [PyPI](https://pypi.org/project/vibetrading/)
* [Community](https://docs.vibetrading.dev/resources/community)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vibetrading.dev/getting-started/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
