Institutional-grade market candlestick pattern scanner with multi-asset backtesting, AI confluence scoring, and LLM market intelligence.
pip install yfinance-ta-patterns==0.3.39 Copy PIP instructions
High-performance Python library and CLI 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.
Universal runtime compatibility across CPython 3.8 to 3.14, PyPy 3.8 to 3.11 with high-speed JIT tracing, and legacy Windows 7+ support. Free-threaded CPython 3.14t and 3.15.0rc2t are verified when the interpreter is started with its GIL disabled; standard CPython 3.15 remains preview-only until upstream Windows dependency wheels are available.
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.
# 1. Full institutional setup with all extras (TA-Lib + Scikit-Learn repair + AI): uv add "yfinance-ta-patterns[all]" --no-config # 2. Standard install (pure-Python fallback, zero C compiler required): uv add yfinance-ta-patterns --no-config # 3. Free-Threaded (No-GIL / PEP 703: 3.14t, 3.15t): uv python pin 3.14t # PowerShell: use the matching release wheelhouse and keep the GIL disabled. $env:PYTHON_GIL = "0" uv add "yfinance-ta-patterns[all]" --find-links https://github.com/eminsk/yfinance-ta-patterns/releases/expanded_assets/v0.3.26 --no-config # 4. High-Performance PyPy JIT (PyPy 3.8, 3.9, 3.10, 3.11): uv python pin pypy-3.8 uv add "yfinance-ta-patterns[all]" --no-config # 5. Instant execution without installing into environment: uvx --from yfinance-ta-patterns yftp --all-patterns --symbol AAPL --timeframe 1h --ai 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 TA-Lib & Dependencies (Pre-built Wheels on Release v0.3.26) All 37 binary wheels are pre-compiled and attached to Release v0.3.26:
# PyPy 3.8 (Windows 7+ compatible): uv pip install https://github.com/eminsk/yfinance-ta-patterns/releases/download/v0.3.26/ta_lib-0.7.1-pp38-pypy38_pp73-win_amd64.whl uv pip install https://github.com/eminsk/yfinance-ta-patterns/releases/download/v0.3.26/pandas-2.0.3-pp38-pypy38_pp73-win_amd64.whl uv pip install https://github.com/eminsk/yfinance-ta-patterns/releases/download/v0.3.26/curl_cffi-0.16.3-pp38-pypy38_pp73-win_amd64.whl # PyPy 3.9: uv pip install https://github.com/eminsk/yfinance-ta-patterns/releases/download/v0.3.26/ta_lib-0.7.1-pp39-pypy39_pp73-win_amd64.whl uv pip install https://github.com/eminsk/yfinance-ta-patterns/releases/download/v0.3.26/pandas-2.3.3-pp39-pypy39_pp73-win_amd64.whl # PyPy 3.10: uv pip install https://github.com/eminsk/yfinance-ta-patterns/releases/download/v0.3.26/ta_lib-0.7.1-pp310-pypy310_pp73-win_amd64.whl uv pip install https://github.com/eminsk/yfinance-ta-patterns/releases/download/v0.3.26/pandas-2.3.3-pp310-pypy310_pp73-win_amd64.whl # PyPy 3.11: uv pip install https://github.com/eminsk/yfinance-ta-patterns/releases/download/v0.3.26/ta_lib-0.7.1-pp311-pypy311_pp73-win_amd64.whl uv pip install https://github.com/eminsk/yfinance-ta-patterns/releases/download/v0.3.26/pandas-3.0.5-pp311-pypy311_pp73-win_amd64.whl CPython Free-Threaded (No-GIL 3.14t – 3.15t): Use the uv add ... --find-links command from Quick Start. It selects the matching pandas, curl_cffi, and TA-Lib wheels together, rather than mixing a release wheel with incompatible PyPI dependencies.
brew install ta-lib export TA_INCLUDE_PATH="$(brew --prefix)/include" export TA_LIBRARY_PATH="$(brew --prefix)/lib" uv pip install ta-lib Linux (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 Installation Status Recommendation Python 3.14t Free-Threaded (No-GIL) ✅ Verified Start with PYTHON_GIL=0 or -X gil=0; use the Windows TA-Lib release wheelhouse. Python 3.13t Free-Threaded (No-GIL) Best effort Use the fallback or provide compatible third-party wheels for the desired extras. Python 3.15t Free-Threaded (No-GIL) ✅ Verified on 3.15.0rc2 Use the matching release wheel and revalidate after the final release. Python 3.15 Standard (GIL) Preview On Windows, wait for an upstream pandas cp315 wheel or build pandas from source. Python 3.13 Standard (GIL) ✅ 100% Supported Current stable Python release. Full support for native TA-Lib and pre-built wheels. Python 3.12 Standard (GIL) ✅ 100% Supported Long-Term Support release with instant sub-second wheel installation. 🚀 Ready-to-Use Examples (examples/) The repository includes production-ready backtesting and real-time scanning scripts in the examples/ directory:
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.
# Run with Python: python examples/multi_pair_backtest.py # Or run with uv: uv run examples/multi_pair_backtest.py Sample 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.csv 2. 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.
# Run with Python: python examples/live_signals_scanner.py # Or run with uv: uv run examples/live_signals_scanner.py Sample 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 GPT-4o / Claude: yftp --all-patterns --symbol EURUSD --timeframe 1h --period 60d --prompt CLI Reference yfinance-ta-patterns [-h] [-v] (--pattern PATTERN | --all-patterns) [--symbol SYMBOL] [--period PERIOD] [--timeframe TIMEFRAME] [--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 -v, --version Show package version. --pattern Single candlestick pattern (e.g. HAMMER, DOJI, CDLKICKING). --all-patterns Scan and display signals for all available candlestick patterns. --symbol Ticker symbol (e.g. AAPL, BTC-USD, GC=F, EURUSD). --period History period (5d, 60d, 1y, max). --timeframe Interval alias (M1, M5, M15, M30, H1, H4, D1) or yfinance interval (1m, 5m, 15m, 1h, 4h, 1d). --date Filter signals for a specific date (YYYY-MM-DD). --start-date / --end-date Date range filter (YYYY-MM-DD). --execution Execution timing: next_open (unbiased, enters on bar i+1) or close (legacy). --min-signals Minimum signal count required for ranking (reduces overfitting from 1-trade samples). --commission Fixed transaction cost per round-trip trade in backtester. --slippage Slippage in price units applied adversely to entries and exits. --auto-adjust Enable dividend and split adjustments (recommended for long multi-year stock backtests). --ai Enrich detected patterns with AI confidence scoring, signal grade, and trade setups. --min-confidence Minimum confidence threshold for AI scoring ($0.0$ to $1.0$, default: $0.0$). --ai-analyst Run executive AI market analysis with synthesis and trade setups. --prompt Generate an LLM prompt ready to pass to ChatGPT, Claude, or local LLMs. --format Output format: text (default), json, or markdown. 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:
# Run pytest across test suite uv run --extra dev 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 build 🌐 High-Performance Systems Ecosystem yfinance-ta-patterns is developed by @eminsk as part of an open-source engineering ecosystem:
yfinance technical-analysis candlestick-patterns ta-lib ai trading forex stocks crypto algorithmic-trading free-threaded no-gil pep-703 windows-7 pypy pypy3 rich
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.




