trading-strategy-backtester
/trading-strategy-backtester
Testuje wstecznie strategię handlową na sygnałach: wykonuje symulowane transakcje i liczy zwrot, wskaźnik Sharpe, skuteczność oraz maksymalne obsunięcie.
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 05.07.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Testuje wstecznie strategię handlową na sygnałach: wykonuje symulowane transakcje i liczy zwrot, wskaźnik Sharpe, skuteczność oraz maksymalne obsunięcie.
Oryginalny opis (EN)
When the user wants to backtest a quantitative trading strategy based on specific signals, this skill implements strategy logic, executes simulated trades, calculates performance metrics, and generates comprehensive reports. It handles position sizing, transaction costs, holding periods, and computes key metrics like total return, annualized return, Sharpe ratio, win rate, and maximum drawdown. Triggers include backtesting requests, strategy evaluation, or trading performance analysis.
Jak działa
- 1. Understand the Request
- 2. Fetch Required Data
- 3. Calculate Indicators & Generate Signals
- 4. Execute Strategy Backtest
- 5. Calculate Performance Metrics
- 6. Prepare Output for Notion (or specified destination)
- 7. Generate Summary Report
- 8. Use Bundled Scripts for Complex Calculations
- Key Principles
Podgląd SKILL.md
---
name: trading-strategy-backtester
description: When the user wants to backtest a quantitative trading strategy based on specific signals, this skill implements strategy logic, executes simulated trades, calculates performance metrics, and generates comprehensive reports. It handles position sizing, transaction costs, holding periods, and computes key metrics like total return, annualized return, Sharpe ratio, win rate, and maximum drawdown. Triggers include backtesting requests, strategy evaluation, or trading performance analysis.
---
# Instructions
## 1. Understand the Request
- Identify the assets, signal logic, holding period, position sizing, and transaction costs from the user request or referenced documentation.
- If a `detail.md` or similar spec file is mentioned, read it first.
- Clarify any ambiguous parameters (e.g., "last 12 months" means 12 complete calendar months).
## 2. Fetch Required Data
- Use `yahoo-finance-get_historical_stock_prices` or equivalent data source to fetch historical price data for all specified assets/tickers.
- Ensure data covers the required backtest period plus any lookback needed for indicator calculation (e.g., 6-month rolling Z-score).
- Align data frequencies (e.g., monthly closes) and handle missing months if necessary.
## 3. Calculate Indicators & Generate Signals
- Implement the specified signal logic (e.g., Z-score thresholding).
- Calculate all required indicators (e.g., spreads, MoM%, Z-scores) as defined.
- Generate a clear signal for each period (e.g., Long Spread, Short Spread, Flat).
## 4. Execute Strategy Backtest
- Simulate trades based on signals:
- Entry: At period end when signal is generated (non-Flat).
- Exit: After the specified holding period (e.g., 1 month later).
- Position Sizing: Apply specified weights (e.g., equal weight on legs).
- Transaction Costs: Deduct specified round-trip cost from each trade's net PnL.
- Only one position at a time; close existing position before opening new one if strategy rules require.
- For spread trades (e.g., Long Spread = Long Asset A + Short Asset B), calculate leg returns and combine them according to position sizing.
## 5. Calculate Performance Metrics
Compute and report:
- **Total Return %** (compounded across all trades)
- **Annualized Return %** (based on actual backtest period length)
- **Sharpe Ratio (annualized)** (using monthly returns, annualized with √12)
- **Win Rate %** (percentage of profitable trades)
- **Maximum Drawdown %** (peak-to-trough decline in cumulative returns)
- **Number of Trades**
- **Backtest Period** (Start and End dates)
## 6. Prepare Output for Notion (or specified destination)
- If the target is Notion databases:
1. Identify the correct database IDs using `notion-API-post-search` or similar.
2. Check existing entries; delete placeholder/empty rows if necessary.
3. Create new pages for each record (e.g., monthly summary rows, trade rows, metric row).
4. **Important**: The available `notion-API-post-page` and `notion-API-patch-page` functions have limited schemas and may only allow updating the `title` property. If database properties (number, select, rich_text) cannot be updated via these functions, append the data as content blocks using `notion-API-patch-block-children` as a workaround. Each block should present the data clearly in a human-readable format.
- Structure output according to the database schemas described in the request (e.g., "Oil Market Summary" and "Spread Strategy Backtest").
## 7. Generate Summary Report
- Create a comprehensive markdown report summarizing:
- Executive Summary
- Data Overview & Key Observations
- Methodology (indicator calculations, strategy rules)
- Trade Details & Analysis
- Performance Metrics
- Conclusions & Recommendations
- Save the report to a file in the workspace (e.g., `summary_report.md`).
- Optionally, add a high-level summary to a main Notion page using content blocks.
## 8. Use Bundled Scripts for Complex Calculations
- For repetitive, complex, or error-prone calculations (e.g., Z-score rolling window, trade simulation, metric computation), use the bundled Python script `backtest_engine.py`.
- Adapt the script's parameters (tickers, signal thresholds, costs, etc.) to match the current request.
## Key Principles
- **Data Validation**: Check for missing periods or data inconsistencies; inform the user if gaps exist.
- **Transparency**: Document any assumptions or workarounds (e.g., Notion API limitations).
- **Reproducibility**: Ensure the backtest logic is clear and deterministic.
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · zjunlp/skills | 90 | MIT |
| joogy06/agent-foundry | 100 | MIT |
Migawka bazy z 28.10.2026 · wersja paczki 23d54a95439b (skrót SHA-256 całej paczki)
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100backtest-strategy
Wykonuje backtesty strategii inwestycyjnych na danych historycznych: liczy Sharpe ratio, maksymalny drawdown, win rate i zwrot całkowity oraz generuje krzywe kapitału. - 100backtesting-trading-strategies
Testuje strategie handlowe na kryptowalutach i rynkach tradycyjnych na danych historycznych: Sharpe, Sortino, max drawdown, krzywe kapitału i optymalizacja parametrów. - 100pine-backtester
Dodaje do wskaźników i strategii Pine Script backtesting: metryki wyników, analiza transakcji, krzywe kapitału, współczynnik wygranych, drawdown i walidacja statystyczna. - 100backtesting-trading-strategies
Testuje strategie handlowe na kryptowalutach na danych historycznych z metrykami wydajności. - 100fund-risk-compare
Porównuje ETF-y na podstawie CSV z NAV: roczna stopa zwrotu, maksymalny drawdown, wskaźnik Sharpe'a i macierz korelacji. - 100quant-strategy-quick-backtest
Szybko testuje strategię handlową: zwrot, maksymalne obsunięcie, Sharpe i ryzyko przeuczenia w krótkim raporcie.