yfinance-ta-patterns
A technical-analysis MCP server that scans market symbols for candlestick patterns, scores them with an AI confluence engine, and adds trade setups, backtests, macro events, and news.
Scan a symbol (
ta_scan_symbol): detect active candlestick patterns across stocks, crypto, forex, indices, and commodities, compute AI confluence scores (trend, RSI, volume, ATR), and generate trade setups (entry, stop-loss, TP1/TP2), with optional markdown brief.Scan a watchlist (
ta_scan_watchlist): batch-scan up to 25 tickers and rank all opportunities by confluence score descending, with per-symbol error isolation.Backtest patterns (
ta_backtest_patterns): run next-open historical backtests to rank the top-performing patterns by composite score or win rate, with holding-period, min-signal, and news-event filters.List patterns (
ta_list_patterns): enumerate all supported candlestick patterns along with TA-Lib availability and No-GIL runtime status.Get economic calendar (
ta_get_economic_calendar): retrieve live macro events auto-filtered to the asset's currencies, by date range and importance, with a cleanunavailablefallback.Get market news (
ta_get_news): fetch recent headlines, publishers, and timestamps for a ticker, with resilient fallback handling.
Provides LLM-ready market briefs, JSON payloads, and engineered reasoning prompts tailored for local Ollama models, enabling AI-driven analysis of candlestick patterns, confluence scores, and trade setups.
Provides LLM-ready market briefs, JSON payloads, and engineered reasoning prompts tailored for OpenAI reasoning models such as o3-mini, o1, and GPT-4.5, enabling AI-driven analysis of candlestick patterns, confluence scores, and trade setups.
Market Candlestick & AI Pattern Scanner (yfinance-ta-patterns)
High-performance Python library, CLI, and Native MCP Server (yfinance-ta-mcp) that downloads multi-asset market data via yfinance, detects TA-Lib candlestick patterns, and enriches raw signals using an AI/Quant Confluence Engine to generate multi-factor confluence scores (deterministic quantitative confluence heuristic, not uncalibrated win-rate probability), trade setups, and LLM-ready market briefs.
Verified on CPython 3.8 through 3.15 and free-threaded No-GIL CPython 3.14t. Linux x86_64 is the primary target (full test suite); the CI matrix also runs Windows and macOS. On these CPython versions the package installs from PyPI with zero compilation. PyPy 3.8-3.12 and CPython 3.16 (development) get only the dependency-free subset from PyPI (yfinance, pandas and numpy are excluded there by environment markers); see the compatibility matrix below for the exact scope.
🤝 Community, Issues & Support
🎬 Featured on Video: In-depth walkthrough by Context Unfiltered (Tech & Science): "New Python Library Combines Candlestick Patterns With AI" — Watch on Instagram Reels
🐛 Found a bug or calculation issue? Please Open an Issue — reports are tracked and resolved quickly!
💬 Questions, strategies, or feature requests? Join the conversation in GitHub Discussions.
⭐ Find this project useful? Give it a star on GitHub — it helps more traders and quants discover the tool!
☕ Support development (USDT TRC-20):
TDVbEdnpgNgoAhNcn1EwXxWHiR3RKLit5P(Verify on TronScan)
Key Features
Multi-Asset Data Loader: Universal fetching and candle normalization for stocks (
AAPL,NVDA), crypto (BTC-USD), commodities (GC=F), indices (^GSPC), and forex pairs (EURUSD). Supports custom date ranges (start,end), timezone conversion, UTC-anchored 4h resampling, and raw OHLC integrity validation.TA-Lib Pattern Detection: Full recognition engine across all 61 canonical TA-Lib candlestick patterns via native C TA-Lib OR built-in pure-Python / NumPy fallback engine (all 61 patterns supported in both modes!).
AI Pattern Confluence Scorer: Multi-factor confluence score ($0.0 - 1.0$) evaluating quantitative confluence (deterministic heuristic, not win-rate probability):
Multi-EMA trend alignment (20, 50, 200 EMA) with safe warm-up handling
Zero-lookahead Relative Volume surge (RVOL)
Canonical Wilder's RSI (14) momentum exhaustion & divergence
Canonical Wilder's ATR (14) volatility expansion & candle body dominance
Automated Trade Setups: Computes entry price, ATR-based invalidation stop-loss, and multi-tier take-profit targets (1.5x / 3.0x risk/reward).
AI Market Analyst & LLM Integration: Generates executive markdown briefs, JSON payloads, and engineered reasoning prompts tailored for frontier AI agents and reasoning models (Claude 3.7 Sonnet, OpenAI o3-mini / o1, DeepSeek-R1 / V3, Gemini 2.5 Flash / Pro, GPT-4.5, Ollama).
Quantitative Pattern Ranking & Backtesting: Unbiased next-open execution (
Open[i+1]), symmetric Long/Short trading, universal FX quote-currency conversion, transaction cost modeling (commissions & slippage), overfitting filters (min_signals), and periodic Sharpe ratio accounting for non-trading hold periods.
Related MCP server: crypto-powerdata-mcp
🧩 Compatibility & Runtime Verification Matrix
Runtime / Implementation | Versions | Execution Mode | Status | Notes & Verification Scope |
CPython (Standard) | 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.14, 3.15 | Standard bytecode + GIL | ✅ Verified | Direct PyPI install ( |
CPython (Free-Threaded) | 3.14t | Multi-core No-GIL (PEP 703) | ✅ Verified |
|
CPython (Free-Threaded) | 3.13t | Multi-core No-GIL (PEP 703) | ⚠️ Wheels-only install | Plain |
PyPy (JIT Accelerated) | 3.8, 3.9, 3.10, 3.11, 3.12 | High-speed JIT tracing | ⚠️ Manual setup | On PyPy, PyPI installs only the pure-Python dependencies; |
Operating Systems | Linux x86_64, Windows, macOS | Native wheels & source | ✅ Verified | Primary target: Linux x86_64 (full suite). CI also runs GitHub's |
Quick start
1. Installation
yfinance-ta-patterns installs in seconds with zero C build requirements by default, using an internal vectorized pure-Python/NumPy engine for candlestick pattern recognition.
🚀 Quick Installation by Platform
Platform / Tool | Command | Description |
Conda / Mamba |
| Recommended for Quant, Finance & Data Science |
Conda + Native TA-Lib |
| Full C-accelerated TA-Lib with zero compilation |
Pixi |
| Modern high-speed reproducible Conda workflow |
Ubuntu / Debian (APT PPA) |
| Official PPA repository (pure apt, zero URLs) |
Ubuntu / Debian (.deb) |
| Native |
Ubuntu / Debian (pipx) |
| Isolated global CLI tool install (PEP 668 compliant) |
uv (Python) |
| Sub-second pure Python installation |
pip (Python) |
| Universal PyPI installation |
Option A: Using uv (Fastest & Recommended)
# 1. Standard install (100% Autonomous AI + Pattern Engine, zero C compiler or Scikit-Learn required):
uv add yfinance-ta-patterns
# 2. Optional: bare-metal AVX2+FMA SIMD matrix acceleration (pre-compiled binary wheels on Windows x64; source build via --no-binary or NumPy fallback on Linux/macOS):
uv add "yfinance-ta-patterns[gemm]"
# 3. Optional: with C TA-Lib extension if you already have local C headers:
uv add "yfinance-ta-patterns[talib]"
# 4. Instant execution without installing into environment:
uvx --from yfinance-ta-patterns yftp --all-patterns --symbol AAPL --timeframe 1h --aiWhy --no-config? Passing --no-config tells uv to ignore any local or parent uv.toml settings (such as local wheel registries or find-links overrides), ensuring a clean, isolated, and reproducible installation directly from PyPI in any project directory.
⚡ Free-Threaded Python / No-GIL Guide (PEP 703: 3.14t verified, 3.13t wheels-only)
Python 3.13+ introduces experimental free-threaded (No-GIL) builds. yfinance-ta-patterns is verified under free-threaded CPython 3.14t (full suite on Linux x86_64, smoke test on Windows in CI). Here is what you need to know for a smooth No-GIL setup on Windows:
1. Python Version Selection & Wheel Availability
Python 3.14t (Recommended): Verified in No-GIL execution.
yfinance-ta-patterns, NumPy, and pandas run with the GIL disabled. Note:yfinanceis imported lazily when market data is first loaded, and it pulls inlxml, which has not declared free-threading support, so CPython re-enables the GIL (with aRuntimeWarning) at that point. Start Python withPYTHON_GIL=0/-X gil=0to keep it disabled at your own risk, or skipyfinanceand pass your own OHLCV DataFrames.Python 3.13t (wheels-only install): plain
pip/uvinstalls fail, because the latestyfinancepulls incurl-cffi->cffi, which refuses to build on free-threaded 3.13 (CFFI does not support the free-threaded build of CPython 3.13). A wheels-only install (uv ... --no-build) resolves toyfinance0.2.57, which predatescurl-cffi, and works: the full suite (602 tests) passes with the GIL disabled. Live downloads with that oldyfinanceare not verified, so prefer 3.14t for currentyfinance.
2. Understanding Automatic GIL Re-Enablement
In free-threaded interpreters, sys._is_gil_enabled() may return True for two common reasons:
Global Environment Variable: A Windows user/system variable
PYTHON_GIL=1forces the GIL on at startup. Check in PowerShell:[System.Environment]::GetEnvironmentVariable('PYTHON_GIL', 'User')PEP 703 C-Extension Protection: When loading C extensions (such as
talib._ta_libor third-party network libraries) that have not yet declaredPy_MOD_GIL_NOT_USED, CPython automatically re-enables the GIL to protect thread safety and emits aRuntimeWarning.
3. Running in True No-GIL Mode
To run at full multi-core performance with the GIL disabled:
Command Line Flag:
python -X gil=0 my_scanner.pyPowerShell:
$env:PYTHON_GIL = "0" python my_scanner.pyCMD:
set PYTHON_GIL=0 python my_scanner.pyPure-Python Engine: When native TA-Lib is not installed, the built-in NumPy fallback engine keeps the GIL disabled out-of-the-box without extra flags.
4. Verification
Run yftp --check-talib to inspect the runtime environment:
yftp --check-talibOr verify programmatically:
from yfinance_ta_patterns import is_freethreaded, is_gil_enabled
print("Free-Threaded build:", is_freethreaded())
print("GIL active:", is_gil_enabled())Option B: Using Standard pip
# Standard install (pure-Python fallback by default):
pip install yfinance-ta-patterns
# Optional: With native C TA-Lib acceleration (requires ta-lib C headers):
pip install "yfinance-ta-patterns[talib]"Option C: Native C TA-Lib on Linux & macOS (Optional)
Native C TA-Lib is 100% OPTIONAL: yfinance-ta-patterns already includes a built-in high-speed vectorized NumPy pattern recognition engine that works immediately with zero compilation.
If you want the full C-accelerated TA-Lib engine without any manual compilation:
Via Conda (Recommended — Zero C builds):
conda install -c conda-forge yfinance-ta-patterns ta-libOr manual C compiler build from source:
macOS (Homebrew):
brew install ta-lib export TA_INCLUDE_PATH="$(brew --prefix)/include" export TA_LIBRARY_PATH="$(brew --prefix)/lib" uv pip install ta-libLinux (Ubuntu / Debian / Arch):
# Ubuntu / Debian: sudo apt-get update && sudo apt-get install -y libta-lib0 libta-lib-dev # Arch Linux: yay -S ta-lib # Then install the python wrapper: uv pip install ta-lib
🐍 Python Version Compatibility Matrix
Python Version | Execution Mode | Verification Status | Scope & Recommendation |
Python 3.15 | Standard (GIL) | ✅ Verified | Full suite verified on Linux x86_64 (3.15.1); Windows smoke test in CI; not yet covered on macOS. |
Python 3.14t | Free-Threaded (No-GIL) | ✅ Verified | Core library, NumPy, and pandas run with the GIL disabled; |
Python 3.14 | Standard (GIL) | ✅ Verified | Full verified installation; instant universal PyPI install. |
Python 3.13t | Free-Threaded (No-GIL) | ⚠️ Wheels-only | Plain |
Python 3.13 | Standard (GIL) | ✅ Verified | Full verified installation. |
Python 3.8–3.12 | Standard (GIL) | ✅ Verified | Verified on Linux, Windows and macOS in CI (3.8, 3.9 and 3.10 are at or past upstream end-of-life as of October 2026). Includes dedicated pandas 2.3.x index concurrency tests. |
PyPy 3.8–3.12 | JIT Accelerated | ⚠️ Manual setup | PyPI installs only the pure-Python dependencies on PyPy and has no PyPy wheels for |
🤖 Native MCP (Model Context Protocol) Server
Connect yfinance-ta-patterns directly to Claude Code, Antigravity, Claude Desktop, Cursor, or Windsurf via the built-in yfinance-ta-mcp JSON-RPC 2.0 server (ta_scan_symbol, ta_scan_watchlist, ta_backtest_patterns, ta_list_patterns, ta_get_economic_calendar, ta_get_news):
Latest Protocol Spec (
2025-11-25): Full MCP lifecycle version negotiation supporting2024-11-05,2025-03-26,2025-06-18, and2025-11-25.Institutional Tool Metadata: Includes human-readable
title,annotations(readOnlyHint: true,openWorldHint), and detailed JSONoutputSchemafor every tool.Token-Optimized Output: Emits raw UTF-8 without token-wasting
\uXXXXescaping for Cyrillic and currency symbols (€,£,¥).ta_scan_watchlistfeaturescompact: trueby default to comfortably remain below Claude Code's 10,000-token tool output threshold.Verified Macro Calendar:
ta_get_economic_calendarretrieves live macroeconomic events mapped to asset currencies with explicitUTCtimestamps, returning cleansource: "unavailable"when feeds are offline (zero mock/hallucinated macroeconomic data).Market News Headlines:
ta_get_newsretrieves recent financial market headlines, publisher attribution, and publication timestamps directly for the selected ticker symbol with resilient fallback handling.
Option 1: Claude Code CLI
# Recommended: install once as a global tool (~0.4s instant startup, avoids uvx cold timeouts)
uv tool install yfinance-ta-patterns
claude mcp add yfinance-ta -- yfinance-ta-mcp
# Or zero-install execution via uvx (pinned version recommended for reproducibility):
claude mcp add yfinance-ta -- uvx --from "yfinance-ta-patterns>=0.3.49" yfinance-ta-mcpOption 2: Antigravity / Claude Desktop / Cursor / Windsurf (mcp_config.json)
{
"mcpServers": {
"yfinance-ta": {
"command": "yfinance-ta-mcp"
}
}
}Or zero-install via uvx:
{
"mcpServers": {
"yfinance-ta": {
"command": "uvx",
"args": ["--from", "yfinance-ta-patterns", "yfinance-ta-mcp"]
}
}
}🚀 Ready-to-Use Examples (examples/)
The repository includes production-ready backtesting and real-time scanning scripts in the examples/ directory:
1. Multi-Pair Historical Backtesting (examples/multi_pair_backtest.py)
A rigorous multi-pair portfolio backtest across 6 major and cross Forex pairs (EURUSD, GBPUSD, USDJPY, AUDUSD, EURGBP, EURJPY) over 2 years on hourly (1h) candles.
Key capabilities demonstrated:
Unbiased Execution: Fills trades at
Open[i+1](next candle open) to eliminate lookahead bias.Fixed Holding Period (
holding_period=5): Automatically closes trades after 5 bars. Essential for single-direction candlestick patterns (Hammer, Inverted Hammer, 3 White Soldiers) which otherwise hold positions indefinitely without reverse exit signals.Universal Forex PnL & Position Sizing: Automatic base-currency normalization for USD-base pairs (
USDJPY) and cross-rates (EURGBP), applying commissions in account currency ($0.05 ECN micro-lot).Composite Scoring: Ranks combinations by combining Win Rate, Profit Factor, Sharpe Ratio, and logarithmic trade volume.
# Run with Python:
python examples/multi_pair_backtest.py
# Or run with uv:
uv run examples/multi_pair_backtest.pySample Output:
==================================================================================================
TOP-10 BEST COMBINATIONS (PAIR + PATTERN) OVER 2y:
==================================================================================================
Pair Pattern Signals WinRate TotalPnL ProfitFactor Sharpe MaxDD MaxDD_%
EURJPY INVERTEDHAMMER 82 63.0% $+55.34 2.55 0.38 $7.11 0.07%
EURJPY MORNINGSTAR 46 63.0% $+21.49 2.66 0.34 $2.87 0.03%
EURUSD INNECK 12 75.0% $+6.31 3.81 0.25 $1.14 0.01%
EURUSD STALLEDPATTERN 26 65.4% $+23.44 3.09 0.29 $5.17 0.05%
EURUSD STICKSANDWICH 8 62.5% $+8.13 5.01 0.22 $1.00 0.01%
EURUSD ONNECK 11 63.6% $+11.53 4.44 0.17 $1.97 0.02%
USDJPY MATCHINGLOW 195 55.6% $+50.36 1.40 0.24 $15.09 0.15%
EURJPY GRAVESTONEDOJI 226 52.4% $+58.74 1.44 0.24 $20.81 0.21%
EURJPY HIKKAKE 1604 52.7% $+50.97 1.06 0.09 $75.80 0.76%
USDJPY BELTHOLD 1596 47.7% $+78.87 1.09 0.13 $83.89 0.84%
Full ranked report saved to: all_pairs_ranked.csv2. Live Multi-Asset Signal Scanner (examples/live_signals_scanner.py)
Scans a 12-asset watchlist across Forex and Cryptocurrencies (BTC-USD, ETH-USD) for active candlestick patterns over recent candles, scoring each opportunity with the AI Confluence Engine.
Key capabilities demonstrated:
AI Confluence Scoring: Quantifies trend alignment (EMA 20/50/200), volume expansion, and Wilder RSI (14) momentum into a 0–100% confidence score.
Automated Trade Setups: Calculates exact Entry Price, ATR-based Stop Loss, and Take Profit targets (1:1.5 Risk/Reward ratio).
Automated Opportunity Ranking: Sorts all live setups and highlights the TOP-1 Highest Confidence Trade Setup.
# Run with Python:
python examples/live_signals_scanner.py
# Or run with uv:
uv run examples/live_signals_scanner.pySample Output:
=========================================================================================================
SIGNALS FOUND: 26 (Ranked by AI Confluence / Quality)
=========================================================================================================
Time Symbol Direction Pattern Confluence Grade Entry StopLoss TakeProfit_1 Risk_Reward Trend
08.09 19:00 ETH-USD BUY 3WHITESOLDIERS 80.0/100 EXCELLENT 2499.389893 2483.227621 2523.633300 1:1.5 BULLISH
08.09 17:00 EURUSD BUY 3WHITESOLDIERS 70.0/100 STRONG 1.163332 1.162101 1.165178 1:1.5 STRONG_BULLISH
08.09 17:00 USDCAD SELL HANGINGMAN 70.0/100 STRONG 1.377840 1.378940 1.376190 1:1.5 STRONG_BEARISH
**********************************************************
TOP-1 SIGNAL: ETH-USD — BUY (3WHITESOLDIERS)
Candle Time: 08.09 19:00 | Confluence: 80.0/100 [EXCELLENT] (deterministic heuristic, not win probability)
Market Trend: BULLISH | RSI: 56.3
Entry Price: 2499.39
Stop Loss: 2483.23
Take Profit: 2523.63 (R:R 1:1.5)
**********************************************************2. Run CLI
# 1. Multi-Currency Portfolio Scanner (automatically scans all 56 Forex pairs without specifying --symbol):
yftp --timeframe 5m --period 30d --all-patterns --ai-analyst
# 2. Or explicitly scan all 56 pairs with custom confluence threshold:
yftp --all-pairs --timeframe 1h --period 60d --ai --min-confidence 0.60
# 3. Scan a custom comma-separated portfolio of symbols:
yftp --symbol EURUSD,GBPUSD,USDJPY --timeframe 15m --ai
# 4. Single symbol AI-scored analysis with Executive Brief:
yftp --symbol GBPUSD --timeframe 5m --period 30d --all-patterns --ai-analyst
# 5. Detect a single pattern with classic output:
yftp --pattern HAMMER --symbol AAPL --timeframe 1h --period 60d
# 6. Generate an LLM-ready prompt template for Frontier Reasoning Models (Claude 3.7 Sonnet / o3-mini / DeepSeek-R1):
yftp --all-patterns --symbol EURUSD --timeframe 1h --period 60d --promptCLI Reference
yfinance-ta-patterns [-h] [-v] (--pattern PATTERN | --all-patterns | --mcp | --calendar | --news | --backtest)
[--symbol SYMBOL] [--all-pairs] [--period PERIOD] [--timeframe TIMEFRAME]
[--lookback-bars LOOKBACK_BARS] [--date YYYY-MM-DD] [--start-date YYYY-MM-DD] [--end-date YYYY-MM-DD]
[--execution {next_open,close}] [--min-signals MIN_SIGNALS]
[--commission COMMISSION] [--slippage SLIPPAGE] [--auto-adjust]
[--ai] [--min-confidence MIN_CONFIDENCE]
[--ai-analyst] [--prompt] [--format {text,json,markdown}]Options
Flag | Description |
| Show package version. |
| Launch the native JSON-RPC 2.0 Model Context Protocol (MCP) server over stdio. |
| Single candlestick pattern (e.g. |
| Scan and display signals for all available candlestick patterns. |
| Ticker symbol(s) (e.g. |
| Scan all 56 major, minor, and exotic Forex currency pairs. |
| History period ( |
| Interval alias ( |
| Number of recent historical bars to inspect for signals (default: |
| Filter signals for a specific date ( |
| Date range filter ( |
| Fetch and display high/medium impact macro economic calendar releases. |
| Fetch and display real-time market news for the symbol. |
| Run institutional quantitative pattern ranking backtest. |
| Execution timing: |
| Minimum signal count required for ranking (reduces overfitting from 1-trade samples). |
| Fixed transaction cost per round-trip trade in backtester. |
| Slippage in price units applied adversely to entries and exits. |
| Enable dividend and split adjustments (recommended for long multi-year stock backtests). |
| Enrich detected patterns with AI confidence scoring, signal grade, and trade setups. |
| Minimum confidence threshold for AI scoring ($0.0$ to $1.0$, default: $0.0$ in single mode, $0.55$ in multi-symbol mode). |
| Run executive AI market analysis with synthesis and trade setups. |
| Generate an LLM prompt ready to pass to ChatGPT, Claude, or local LLMs. |
| Output format: |
Python API
1. Universal Multi-Asset Data Loader (MarketDataLoader)
Fetches and normalizes OHLC data across equities, crypto, forex, and commodities:
from yfinance_ta_patterns import MarketDataLoader
# Stocks
loader = MarketDataLoader(symbol="NVDA", period="60d", interval="1h")
df = loader.get_data()
# Crypto
crypto_loader = MarketDataLoader(symbol="BTC-USD", period="30d", interval="15m")
crypto_df = crypto_loader.get_data()
# Forex (ForexDataLoader is fully compatible alias)
from yfinance_ta_patterns import ForexDataLoader
forex_loader = ForexDataLoader(symbol="EURUSD", period="60d", interval="1h")
forex_df = forex_loader.get_data()2. AI Pattern Confidence Scorer (AIPatternScorer)
Evaluates technical confluence (trend, momentum, volume, volatility) and builds complete risk-managed trade setups:
from yfinance_ta_patterns import MarketDataLoader, AIPatternScorer
# Use period="2y" (or >= 200 daily candles) to ensure complete EMA200 indicator warm-up
data = MarketDataLoader("AAPL", period="2y", interval="1d").get_data()
scorer = AIPatternScorer(data)
scored_signals = scorer.score_all_active(min_confidence=0.60)
for sig in scored_signals:
print(f"Pattern: {sig.pattern_name}")
print(f"Confidence: {sig.confidence * 100:.1f}% ({sig.grade.value})")
print(f"Action: {sig.action}")
if sig.setup:
print(f"Entry: {sig.setup.entry_price:.2f}")
print(f"Stop Loss: {sig.setup.stop_loss:.2f}")
print(f"Target 1: {sig.setup.take_profit_1:.2f} (R:R {sig.setup.risk_reward_ratio:.1f})")
print("Confluences:", ", ".join(sig.confluences))
print("-" * 40)3. AI Market Analyst & LLM Prompting (AIMarketAnalyst)
Generates structured briefs and prompt templates for external LLM reasoning agents:
from yfinance_ta_patterns import MarketDataLoader, AIMarketAnalyst
data = MarketDataLoader("BTC-USD", period="30d", interval="4h").get_data()
analyst = AIMarketAnalyst(data, symbol="BTC-USD")
results = analyst.analyze(min_confidence=0.65)
# 1. Executive Markdown Brief
brief = analyst.generate_brief(results)
print(brief)
# 2. Prompt for Frontier Reasoning Models (Claude 3.7 Sonnet / o3-mini / DeepSeek-R1 / Gemini 2.5)
llm_prompt = analyst.to_llm_prompt(results)
# 3. JSON Payload for APIs / Microservices
json_data = analyst.to_json(results)4. Quantitative Backtesting & Pattern Ranking (PatternRankingTester)
Tests all candlestick patterns and ranks them by quantitative performance metrics:
from yfinance_ta_patterns import MarketDataLoader, PatternRankingTester
data = MarketDataLoader("EURUSD", period="60d", interval="1h").get_data()
tester = PatternRankingTester(
data,
symbol="EURUSD",
initial_capital=10000.0,
position_size=1000.0,
execution="next_open", # Unbiased: enters on Open of bar i+1
allow_short=True, # Full symmetric short trades on bearish signals
commission=1.50, # Transaction fee per trade
slippage=0.0001, # Execution slippage in price units
min_signals=5, # Exclude patterns with < 5 signals (reduces overfitting)
sharpe_mode="periodic", # Accounts for 0% returns during idle hold periods
)
results = tester.test_all_patterns(min_signals=5)
top_patterns = tester.get_top_patterns(5)
for r in top_patterns:
print(
f"{r.pattern_name}: Win Rate={r.win_rate:.1f}%, PnL=${r.total_pnl:.2f}, "
f"Periodic Sharpe={r.periodic_sharpe:.2f}, MaxDD=${r.max_drawdown:.2f}, "
f"Strength={r.avg_strength:.0f}"
)
# Export comparison report across news filters
report_df = tester.get_comparison_report()
print(report_df)🤖 Native MCP (Model Context Protocol) Server for AI Agents
yfinance-ta-patterns includes a built-in, zero-overhead Native MCP JSON-RPC 2.0 Server (yfinance-ta-mcp) that exposes institutional technical analysis, candlestick pattern scanning, AI confluence scoring, trade setups, macroeconomic calendars, and market news directly to AI coding assistants and autonomous agent runtimes (Claude Code, Claude Desktop, Cursor, Windsurf, Google Antigravity, Gemini CLI, and any client supporting the Model Context Protocol).
Optimized for Frontier Reasoning Models (Claude 3.7 Sonnet with Extended Thinking, OpenAI o3-mini / o1, DeepSeek-R1, Gemini 2.5 Pro / Flash, and GPT-4.5).
🚀 Instant Launch
# Direct execution without prior installation (via uvx):
uvx --from yfinance-ta-patterns yfinance-ta-mcp
# Or if installed in your Python environment:
yfinance-ta-mcp⚙️ Client Configurations
1. Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"yfinance-ta": {
"command": "uvx",
"args": ["--from", "yfinance-ta-patterns", "yfinance-ta-mcp"]
}
}
}2. Cursor / Windsurf (mcp.json or Extension Settings)
{
"mcpServers": {
"yfinance-ta": {
"command": "uvx",
"args": ["--from", "yfinance-ta-patterns", "yfinance-ta-mcp"]
}
}
}🛠️ Available MCP Tools
Tool | Description | Key Arguments |
| Scans a symbol for active candlestick patterns, computes deterministic AI Confluence Scores (0.0–1.0), and generates ATR-based Trade Setups (Entry, Stop-Loss, TP1, TP2). |
|
| High-throughput concurrent scanner across up to 25 symbols with isolated timeouts and aggregated trade opportunities. |
|
| Institutional unbiased next-open backtester ranking patterns by win rate, total PnL, periodic Sharpe, and max drawdown. |
|
| Live high-impact macroeconomic calendar events relevant to the asset's currency with in-memory caching. |
|
| Live market news headlines, publishers, and publication timestamps for an asset. |
|
📚 MCP Resources & Prompts
Resources:
ta://patterns/catalog— Canonical catalog of all 61 candlestick patterns with recognition rules and runtime mode.ta://forex/56-pairs— Canonical universe of 56 major and cross currency pairs.
Prompts:
ta_market_analyst_prompt— Generates structured quantitative portfolio manager reasoning prompts tailored for Claude 3.7 Sonnet, o3-mini, and DeepSeek-R1.
Development & Testing
Run the test suite and quality checks:
# Run pytest across full test suite (510+ tests)
uv run --extra dev pytest -v
# or with standard pytest
pytest -v
# Linter and formatting check
uv run --extra dev ruff check .
uv run --extra dev ruff format --check .
# Static type check
uv run --extra dev mypy yfinance_ta_patterns
# Build source distribution and binary wheel
uv buildAll 602+ tests pass with 100% success rate on Linux x86_64 across CPython 3.8 through 3.15 and free-threaded CPython 3.14t (No-GIL), with cross-platform automated matrix verification on Windows and macOS.
🌐 High-Performance Systems Ecosystem
yfinance-ta-patterns is developed by @eminsk as part of an open-source engineering ecosystem:
⚡ NanoVector — Bare-metal C99/AVX2 vector search & episodic memory engine (~120KB) with Native MCP Server (
pip install nanovector).🧠 AgentJIT — Just-In-Time Compiler for AI Agent Trajectories with speculative de-optimization guards (
pip install agentjit).⚡ NanoGEMM — Minimalist, bare-metal AVX2+FMA SIMD matrix multiplication engine in ~100KB for sub-microsecond CPU neural network inference (
pip install nanogemm).🖥️ NanoRecall — 100% Private, offline desktop memory & semantic screen search engine powered by NanoVector (
pip install nanorecall).🛒 avito-sdk — Headless Avito scraping & data extraction SDK with price drop tracking, Playwright cookies, Telegram/VK bots, and Native MCP Server (
pip install avito-sdk).📊 xlsx_vievers — Headless Excel formula engine (129+ functions), desktop spreadsheet processor, SIMD SSE2 math engine, and Native MCP Server (
pip install xlsx-viewer-pro).🎥 screenvideo — Lightweight desktop screen recorder with WASAPI audio and a standalone pure x64 Flat Assembler (FASM) native edition.
☕ Support, Community & Donations
If you find this project valuable, encounter issues, or would like to support ongoing development:
⭐ Star the Repository: If yfinance-ta-patterns powers your market analysis or trading algorithms, give us a star on GitHub — it helps more traders and quants discover the tool!
🐛 Report Issues & Bugs: Found a bug, pattern calculation discrepancy, or edge case? Please open an Issue!
💬 Join Discussions: Have strategies, ideas, or custom patterns to share? Start or join a thread in GitHub Discussions!
☕ Donate (USDT TRC-20):
TDVbEdnpgNgoAhNcn1EwXxWHiR3RKLit5P
(Network: TRON / TRC-20 | Verify on TronScan)
📜 Version History & Changelog
See CHANGELOG.md for full detailed release history, technical audit notes, and benchmark comparisons.
🚀 v0.3.72 — Clarified exact verified runtime scopes in documentation: Tier-1 Linux x86_64, Windows & macOS CI matrices, wheels-only resolution for free-threaded Python 3.13t, and explicit PyPI dependency boundaries for PyPy and CPython 3.16.
🚀 v0.3.71 — Fixed MCP watchlist concurrent scan race condition on pandas 2.x shared
Index._cachevia_isolated_frame(), preventing spurious duplicate timestamp errors, and expanded test suite (602 tests passed).🚀 v0.3.70 — Pinned MCP server clock in event risk tests to UTC midday, eliminating the 00:00–00:16 UTC test failure window, added 15-minute event risk grace window boundary tests, and expanded test suite (599 tests passed).
🚀 v0.3.69 — Inclusive
--end-datesemantics forwarding next midnight to yfinance, strict inverted range rejection (--start-date>--end-date), 1m 7-day window enforcement across single-sided ranges and inclusive calendar spans, table-drivenMarketDataLoader._clamp_period_for_intervalcovering arbitrary periods, pure-Pythonfast_score_batchexact length matching without list mutation, and expanded test suite (597 tests passed).🚀 v0.3.68 — Live Yahoo Finance 1m intraday limit separation (depth: 30d, query span: 7d), CLI span validation,
gemm.pyfast_score_batchoversized buffer scalar broadcasting fix across native and fallback branches, CLI--backtesterror safety guarding--calendar/--newshooks, expanded ISO-3 country support (ARE,CHL,COL,MYS,PHL), module-level constant hoisting, removal of obsolete_STOCK_COLLISIONS, platform documentation for[gemm], and expanded test suite (563 tests passed).🚀 v0.3.67 — Connected CLI
--calendarand--newshooks to--backtest, added case-insensitive backtest pattern normalization andget_all_patterns()validation, multi-symbol failure isolation in JSON mode, actual date range display in ranking header, unifiedYAHOO_INTRADAY_MAX_DAYSwith>=boundary and--start-datevalidation, precious metalXAU-EURdelimiter stripping (['EUR']), G10 auto-mode bare currency restrictions protecting US equities (NOK,PEN,EGP,IDR),gemm.pynp.shares_memoryaliasing protection,fast_score_batchout=listsupport, and expanded test suite (553 tests passed).🛡️ v0.3.66 — Quantitative multi-symbol and targeted single-pattern backtesting (
yftp EURUSD GBPUSD --backtest), elimination of 3x redundant runs, strict MCP schema parameter validation (clamp=False), Yahoo Finance intraday history limits and--dateclamping,gemm.pyout=buffer support, pure-Python linear algebra resilience ((K, 1)weights and empty batch[]), macroeconomic calendar currency resolution for precious metals (XAU/XAG), and expanded test suite (539 tests passed).🛡️ v0.3.65 — Comprehensive audit resolution: fixed CLI positional symbol deduplication (
yftp SPY), unpinnednanogemminto optional extra[gemm]to prevent numpy environment conflicts, sanitizedfast_score_batchfloat32 layout, restoredcdl_hikkakemodwarmup parity, corrected FX 4h Friday weekly close release timing, and excluded precious metals from macroeconomic calendar currency queries.✨ v0.3.64 — Modernized CLI output banners with clear built-in TA-Lib status and active hardware SIMD backend reporting; removed noisy manual C-binary compilation hints from regular scans, isolating them to
yftp --check-talib.⚡ v0.3.63 — Integrated
nanogemmdirectly into core base dependencies, enabling automatic out-of-the-box AVX2+FMA SIMD matrix acceleration for standardpip installanduv addcommands without requiring manual extra flags.🚀 v0.3.62 — Integrated hybrid linear algebra & NanoGEMM AVX2+FMA SIMD matrix acceleration engine (
yfinance_ta_patterns.gemm),fast_matmul,fast_score_batch,cosine_similarity_matrix, CLI diagnostic ISA display (yftp --check-talib), dynamic PyPI and Conda download badges, and expanded test suite (512 tests passed).🛡️ v0.3.61 — Deep audit resolution across Forex Friday close retention over weekends, Yahoo Finance intraday history clamping (730d), CLI
--format jsonpurity, precious metals normalization (XAU/XAG), macroeconomic calendar equity ticker shielding, TA-Lib warmup parity, and MCP JSON-RPC 2.0 batch support.🤖 v0.3.60 — Positional symbol CLI arguments (
yftp SPY NVDA), native--mcpflag, and Smithery AI Agent Registry integration.📦 v0.3.59 — Zero-binary autonomous packaging without mandatory external C TA-Lib or scikit-learn.
🧪 v0.3.45 — 100.000% mathematical parity with canonical C TA-Lib across all 61 candlestick patterns.
License
MIT License. See LICENSE for details.
Available Tools
6 toolsta_backtest_patternsBacktest Candlestick PatternsARead-only
Run quantitative historical backtesting of all candlestick patterns on a symbol (next-open execution) and return the top-performing patterns ranked by composite score or win rate.
| Name | Required | Description | Default |
|---|---|---|---|
| top_n | No | Number of top-ranked patterns to return (default: 10) | |
| period | No | Backtest period (default: '1y'; auto-clamped for intraday intervals) | 1y |
| symbol | Yes | Ticker symbol (e.g. 'BTC-USD', 'AAPL') | |
| sort_by | No | Ranking metric: 'composite' (balances win rate, PF, Sharpe, log trades) or 'win_rate' | composite |
| timeframe | No | Timeframe interval (default: '1d') | 1d |
| filter_news | No | If true, skips trades on days with high-impact macroeconomic events using the economic calendar | |
| min_signals | No | Minimum total signals required to include a pattern (default: 1) | |
| holding_period | No | Bars to hold each trade (default: 5) |
Output Schema
| Name | Required | Description |
|---|---|---|
| period | No | |
| symbol | No | |
| sort_by | No | |
| timeframe | No | |
| filter_news | No | |
| top_patterns | No | |
| holding_period | No | |
| news_dates_filtered | No | |
| total_patterns_evaluated | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds real behavioral context the annotations do not: trades are executed at next-open and results are ranked rather than raw. It still omits computational cost/latency, which matters for a backtest that runs over an arbitrary period.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single tight sentence with the operation front-loaded and the return shape trailing. No filler, no repetition of name or title.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With an output schema present, return-value detail need not be in the description, and all eight parameters are fully documented. For a read-only computation tool this is nearly complete; only guidance on cost/period tradeoffs and sibling differentiation is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with defaults, enums, and ranges documented inline (top_n, sort_by, timeframe, filter_news, min_signals, holding_period). The description restates only the ranking metric, adding nothing beyond the schema, so the baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource: 'Run quantitative historical backtesting of all candlestick patterns on a symbol' and the output ('top-performing patterns ranked by composite score or win rate'). Clear and specific, but it does not differentiate itself from the lookalike sibling ta_scan_symbol, which also scans patterns on a symbol.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explains what the tool computes but never says when to choose it over ta_scan_symbol or ta_scan_watchlist, nor when a live scan is preferable to a historical backtest. No exclusions, prerequisites, or alternatives are offered.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ta_get_economic_calendarGet Macroeconomic Calendar for AssetARead-only
Get macroeconomic calendar events (live verified feed) automatically filtered by the currencies impacting a selected asset symbol (e.g. 'EURUSD=X' -> EUR, USD; 'AAPL' -> USD; 'GBPJPY' -> GBP, JPY; 'BTC-USD' -> USD). Returns an empty list with source='unavailable' if the live feed is unreachable.
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Number of days ahead from date_from when date_to is omitted (default: 7, max: 60) | |
| symbol | Yes | Selected asset ticker symbol or currency pair (e.g. 'EURUSD=X', 'EUR/USD', 'GBPUSD', 'AAPL', 'BTC-USD', 'SAP.DE') | |
| date_to | No | End date in YYYY-MM-DD format (defaults to date_from + days) | |
| countries | No | Optional override list of currency codes or countries (e.g. ['USD', 'EUR']). When omitted, automatically resolved from 'symbol'. | |
| date_from | No | Start date in YYYY-MM-DD format (defaults to today UTC) | |
| importances | No | Filter by event importance level: '1' (low), '2' (medium), '3' (high). Also accepts 'low', 'medium', 'high'. Omit for all levels. | |
| max_results | No | Maximum number of calendar events to return (default: 30, max: 100) |
Output Schema
| Name | Required | Description |
|---|---|---|
| events | No | |
| source | No | |
| symbol | No | |
| date_to | No | |
| message | No | |
| date_from | No | |
| currencies | No | |
| importances | No | |
| total_events | No | |
| truncated_to | No | |
| filter_countries | No | |
| normalized_symbol | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds real behavioral context beyond that: the feed is 'live verified' and, on failure, the tool degrades gracefully by returning an empty list with source='unavailable' rather than erroring — a failure mode an agent needs to handle.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, zero filler: the first front-loads what the tool does and its filtering logic, the second immediately covers the degraded-return case. Nothing is repeated from the schema or annotations.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return-shape explanation is not required, and the description still notes the empty/source='unavailable' case. Combined with the 100% documented schema, an agent has enough to call it correctly; only usage routing against siblings (e.g. ta_get_news) and any data-source/latency caveats are absent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so all seven parameters (days, date_from/date_to, countries, importances, max_results) are already documented in the schema itself, including defaults, bounds, and the override behavior of 'countries'. The description reinforces symbol resolution with examples but adds little beyond what the schema already declares.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Specific verb ('Get') plus a precise resource ('macroeconomic calendar events') with the scoping rule spelled out: events are auto-filtered to the currencies implied by the asset symbol. The worked symbol-to-currency examples ('EURUSD=X' -> EUR, USD; 'AAPL' -> USD) make the tool's behavior unambiguous and clearly separate it from ta_get_news or the pattern/scan siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied rather than stated: an agent can infer you call this when you want macro events relevant to a symbol, and the 'countries' param is described as an override of the automatic resolution. But there is no explicit when-to-use guidance, no mention of when to prefer ta_get_news or a raw calendar, and no stated prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ta_get_newsGet Market News HeadlinesBRead-only
Fetch recent market news headlines, publishers, and publication timestamps for a given ticker symbol (e.g. 'AAPL', 'NVDA', 'BTC-USD').
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of news headlines to return (default: 10, max: 50) | |
| symbol | Yes | Ticker symbol (e.g. 'AAPL', 'NVDA', 'BTC-USD') |
Output Schema
| Name | Required | Description |
|---|---|---|
| news | No | |
| source | No | |
| status | No | |
| symbol | No | |
| message | No | |
| total_news | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety and external-source profile is covered. The description adds no behavioral context beyond that — no news freshness window, source coverage, latency, or rate-limit behavior — and the return-field list it does give is redundant with the output schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with the action, resource, return fields, and parameter inline. No filler and nothing buried.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With a complete input schema, an output schema, and annotations covering safety, the description needs little more. The one real gap is the time window for 'recent' news, which an agent cannot derive from the structured fields.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so both symbol and limit (default 10, max 50) are fully documented in the schema. The description only repeats the symbol examples already present in the schema, adding no new semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description gives a specific verb (Fetch) and resource (recent market news headlines, publishers, timestamps) scoped to a ticker symbol. It is unambiguous against siblings like ta_scan_symbol, ta_backtest_patterns, or ta_get_economic_calendar, though it never names an alternative to differentiate explicitly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no when-to-use guidance, no statement of prerequisites, and no mention of when a different tool would be preferable. The agent must infer the news-fetching role purely from the resource noun.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ta_list_patternsList Supported Candlestick PatternsARead-only
List all supported candlestick patterns, TA-Lib binary status, and Python No-GIL runtime status.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| version | No | |
| patterns | No | |
| gil_disabled | No | |
| talib_status | No | |
| total_patterns | No | |
| talib_available | No | |
| fallback_patterns | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered. The description adds that the response also reports TA-Lib binary status and Python No-GIL runtime status, which is useful context about diagnostic content, but nothing about auth, limits, or failure modes — and with an output schema present, some of this may already be documented.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler; every clause (patterns, TA-Lib status, No-GIL status) contributes distinct information about what the call returns.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter, read-only listing tool with an output schema and full annotation coverage, the description supplies everything needed to select and invoke it. Return-value details are delegated to the output schema, which exists.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters and the schema has no properties, so there is no parameter semantics to explain. The baseline for a parameterless tool applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ("List") and resource ("candlestick patterns") and is clearly distinguishable from siblings like ta_scan_symbol, ta_scan_watchlist and ta_backtest_patterns, which perform operations rather than enumerate. It does not name an alternative, but the purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The enumeration intent implies its use as a discovery step before scanning or backtesting, but the description never states when to call it versus the scan/backtest siblings, nor any prerequisites. Usage is inferred rather than stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ta_scan_symbolScan Symbol Patterns & AI ConfluenceARead-only
Scan a market symbol (Stocks, Crypto, Forex, Indices, Commodities, e.g. 'BTC-USD', 'NVDA', 'AAPL', 'EURUSD=X') for candlestick patterns, compute AI Confluence Scores (Trend + RSI + Volume + ATR), and generate actionable Trade Setups (Entry, Stop-Loss, TP1, TP2).
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | Historical lookback period ('7d' for 1m, '60d' for 5m/15m/30m, '6mo'/'1y'/'2y' for 1h/4h/1d; auto-clamped to Yahoo Finance limits) | 6mo |
| symbol | Yes | Ticker symbol (e.g. 'BTC-USD', 'NVDA', 'EURUSD=X') | |
| compact | No | If true (default), returns streamlined trade setups to minimize token usage and stay well below LLM context limits; if false, returns full indicator dumps. | |
| timeframe | No | Timeframe interval ('15m', '1h', '4h', '1d', '1wk') | 1d |
| max_patterns | No | Maximum number of active pattern setups to return (default: 25, max: 50) | |
| include_brief | No | If true, include a human-readable markdown_brief alongside structured JSON patterns | |
| lookback_bars | No | Number of recent bars to evaluate for active patterns (1-60) | |
| min_confidence | No | Minimum AI Confluence score in [0.0, 1.0] |
Output Schema
| Name | Required | Description |
|---|---|---|
| engine | No | |
| period | No | |
| setups | No | |
| symbol | No | |
| compact | No | |
| patterns | No | |
| timezone | No | |
| timeframe | No | |
| event_risk | No | |
| truncated_to | No | |
| markdown_brief | No | |
| market_summary | No | |
| total_patterns_found | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description usefully conveys the output shape (patterns, confluence scores, trade setups with entry/SL/TP levels), which is behavioral context beyond the annotations, but it omits the data source, lookback clamping behavior, and any latency or rate-limit characteristics.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence that leads with the action and resource, then the computed outputs; there is no filler or repetition. The parenthetical enumerations make it slightly dense but every clause carries information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return-value detail is unnecessary, and annotations cover the read-only/open-world profile. The description is sufficient for an agent to select and call the tool, with only minor gaps around when this scan should be preferred over the watchlist or backtest siblings.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% – every parameter (period, timeframe, compact, max_patterns, lookback_bars, min_confidence, include_brief) already carries its own description and defaults in the schema. The description adds no parameter-level meaning, so the baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb ('Scan') and resource ('a market symbol'), and enumerates exactly what is produced: candlestick patterns, AI Confluence Scores (Trend + RSI + Volume + ATR), and trade setups with Entry/SL/TP1/TP2. It is unambiguous what the tool does, but it never contrasts itself with the sibling ta_scan_watchlist, so sibling differentiation is only implied by the singular 'a market symbol'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied: the asset-class list ('Stocks, Crypto, Forex, Indices, Commodities') and example tickers tell the agent what inputs are in scope, but there is no explicit when-to-use guidance nor when to prefer ta_scan_watchlist or ta_backtest_patterns instead. No exclusions or prerequisites are stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
ta_scan_watchlistScan Watchlist Patterns & Confluence RankingARead-only
Scan multiple ticker symbols in batch (up to 25 symbols) and rank all detected candlestick pattern setups across the watchlist by AI Confluence Score descending.
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | Historical lookback period (auto-clamped for intraday intervals) | 6mo |
| compact | No | If true (default), returns streamlined trade setups to minimize token usage and stay well below LLM context limits; if false, returns full indicator dumps. | |
| symbols | Yes | List of ticker symbols (max 25, e.g. ['AAPL', 'NVDA', 'MSFT', 'BTC-USD']) | |
| timeframe | No | Timeframe interval (default: '1d') | 1d |
| max_results | No | Maximum number of ranked setups to return (default: 25, max: 50) | |
| lookback_bars | No | Number of recent bars per symbol to evaluate (default: 2) | |
| min_confidence | No | Minimum AI Confluence score in [0.0, 1.0] |
Output Schema
| Name | Required | Description |
|---|---|---|
| engine | No | |
| errors | No | |
| period | No | |
| compact | No | |
| timeframe | No | |
| truncated_to | No | |
| opportunities | No | |
| symbols_scanned | No | |
| symbols_requested | No | |
| total_opportunities | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds the descending AI-Confluence ranking behavior and the 25-symbol cap, but the cap duplicates the schema's maxItems and nothing is said about cost/rate behavior of scanning many symbols; the schema's 'compact' note covers token usage instead.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence that names the operation, the batch constraint, and the sort order with no filler. Every clause earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With a full input schema, an output schema, and read-only annotations, the description covers the essentials an agent needs to invoke the tool. The remaining gap is usage routing versus ta_scan_symbol, which is the one thing structured fields cannot supply.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% across all seven parameters, so the schema already carries the semantics. The description restates only the 25-symbol limit and adds no new detail on period, timeframe, min_confidence, lookback_bars, or how ranking interacts with max_results.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (scan), a specific resource (multiple ticker symbols in batch), a scope cap (up to 25 symbols), and the output ordering (ranked by AI Confluence Score descending). The 'multiple ... in batch' phrasing implicitly separates it from ta_scan_symbol, but the sibling is never named, so the differentiation rests on inference.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is only implied: the batch/watchlist framing suggests this is the tool for scanning a list of symbols at once. There is no explicit when-to-use, no when-not-to-use, and no routing to ta_scan_symbol for single-symbol scans, so an agent must infer the boundary itself.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.3.60- First observed
ta_backtest_patterns - First observed
ta_get_economic_calendar - First observed
ta_get_news - First observed
ta_list_patterns - First observed
ta_scan_symbol - First observed
ta_scan_watchlist
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: single-symbol scan vs batch watchlist scan, backtesting vs live scanning, pattern listing, economic calendar, and news. No two tools overlap in function.
All tools follow a consistent snake_case pattern with the 'ta_' prefix and verb_noun structure (e.g., ta_scan_symbol, ta_get_news). This makes the set predictable and easy to navigate.
Six tools is well-scoped for a technical analysis pattern server: it covers individual and batch scanning, backtesting, pattern reference, and contextual data without redundancy. Each tool earns its place.
The surface covers core workflows (scan, backtest, list patterns, context) but lacks tools for custom pattern definitions, timeframe selection, or watchlist persistence. These are minor gaps that an agent can work around by supplying parameters each time.
Maintenance
Related MCP Connectors
Live LinReg fan charts, 64-setup playbook, 11-section MTF TA. Remote MCP, no API key.
Live crypto technical analysis for agents: 200+ causal indicators, signals and liquidity sweeps.
Research-only MCP server: your AI as a quant research desk. 90 tools, no trades, no brokers.
Graded stock setups, options flow, and multi-window trend research over a hosted OAuth MCP endpoint.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceLocal-first backtesting engine with built-in overfitting detection (PBO, deflated Sharpe, bootstrap CI, walk-forward) and a native MCP server for AI agents to validate trading strategies.4Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA comprehensive MCP service for cryptocurrency data acquisition with advanced technical analysis capabilities, supporting 100+ exchanges, 158 TA-Lib indicators, and dual transport protocols (stdio and HTTP/SSE).5MIT
- AlicenseNot gradedqualityAmaintenanceA local MCP server that connects TradingView Desktop to AI assistants via Chrome DevTools Protocol, enabling Pine Script development, multi-timeframe analysis, and Wyckoff scanning with a rules engine.44 npm1MIT
- AlicenseBqualityAmaintenanceA local-first MCP server providing market data, deterministic technical analysis, chart rendering, and optional TradingView Supercharts browser workflows via stdio and a loopback REST API.383MIT