Overview
- Skill Key
- gmsx000-cloud/quant-trading-backtrader
- Author
- gmsx000-cloud
- Source Repo
- openclaw/skills
- Version
- -
- Source Path
- skills/gmsx000-cloud/quant-trading-backtrader
- Latest Commit SHA
- 5ddeebe22dd1d9b16da76c579feb6e4ea92383e6
Stars
0
Installs
0
Status
ACTIVE
Visibility
PUBLIC
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 Quant Trading Backtrader 技能。 若已安装,则直接安装 Quant Trading Backtrader 技能。
# quant-trading-backtrader
A comprehensive skill for building, backtesting, and optimizing quantitative trading strategies using the Backtrader framework in Python.
## Features
- **Backtesting Engine**: Simulates trading strategies on historical data with support for multiple data feeds.
- **Strategy Development**: Provides a structured `Strategy` class to define indicators (SMA, EMA, RSI, etc.) and trading logic.
- **Risk Management**: Examples of implementing stop-loss, take-profit, and position sizing (e.g., fractional Kelly).
- **Data Handling**: Support for CSV data ingestion (customizable formats) and pandas DataFrame integration.
- **Reporting**: Generates transaction logs, trade analysis (PNL), and portfolio value tracking.
## Usage
This skill provides a foundation for creating quantitative trading bots. It includes templates and examples to get you started.
### 1. Installation
Ensure you have the required dependencies:
```bash
pip install backtrader matplotlib
```
### 2. Basic Strategy Template
Create a new strategy file (e.g., `my_strategy.py`) using the template structure:
```python
import backtrader as bt
class MyStrategy(bt.Strategy):
params = (
('period', 15),
)
def __init__(self):
self.sma = bt.indicators.SimpleMovingAverage(self.data.close, period=self.params.period)
def next(self):
if self.sma > self.data.close:
# Do something
pass
```
### 3. Running a Backtest
Use `bt.Cerebro` to orchestrate the backtest:
```python
cerebro = bt.Cerebro()
cerebro.addstrategy(MyStrategy)
# ... add data ...
cerebro.run()
```
## Examples
Check the `examples/` directory for full working examples:
- `sma_crossover.py`: A classic Trend Following strategy with Stop-Loss.
## Best Practices
- **Avoid Overfitting**: Use Walk-Forward Analysis (train on past, test on unseen future data).
- **Risk Control**: Always implement stop-loss orders. Position sizing is critical for survival.
- **Data Qu...
caoyumin97
Structured problem analysis and communication using system mapping and hierarchical logic. Use when a request involves messy, multi-factor problems, root-cause analysis, intervention design, feedback loops or delays, or when a clear top-line recommendation with logically grouped support is required.
chaimengphp
Query real-time and historical financial data across equities and crypto—prices, market moves, metrics, and trends for analysis, alerts, and reporting.
cerbug45
AI Wallet Payment System Skill Guide
bywallace
Read and manage Kubera.com portfolio data (net worth, assets, debts, allocation, holdings). Use when a user asks about their finances, net worth, portfolio, investments, holdings, asset allocation, or wants to update asset values in Kubera. Works with any AI agent or CLI that can run Python scripts.
c-goro
Expense tracking and accounting for AI agents. Log purchases, set budgets, generate spending reports, and manage multi-currency finances — all stored locally. Privacy.com card import, natural language queries, CSV/JSON export. Use when agents make purchases and need a financial audit trail.
c0rv0s
Short-form video for AI agents. Generate videos using the latest models, pay with USDC via x402.