Skip to main content

BQuant - Quantitative Research Toolkit

BQuant is a universal toolkit for quantitative research of financial markets. The project starts with MACD zone analysis as the first use case, but the architecture is designed for exploring various aspects: technical indicators, chart patterns, candlestick formations, time series, and machine learning applications.

🔧 Key Features

Zone Analysis - Universal Pipeline v2.1

  • Universal API: Works with any indicator (MACD, RSI, AO, custom) through fluent builder pattern
  • 5 Detection Strategies: zero_crossing, threshold, line_crossing, preloaded, combined
  • Advanced Analysis: Swing, divergence, volume, volatility strategies with automatic feature extraction
  • Statistical Testing: Automatic hypothesis tests and clustering analysis
  • Caching Support: Performance optimization with memory and disk caching

Core Features

  • Universal Configuration System: Flexible settings for data sources, indicators, and analysis
  • Extensible Indicator Library: Includes optimized built-in indicators and supports external libraries like pandas-ta and TA-Lib
  • Rich Visualization Tools: Create interactive financial charts and statistical plots with Plotly and Matplotlib
  • Performance-Oriented: Features a two-level caching system and performance monitoring tools
  • Command-Line Interface: Provides a simple CLI for quick analysis and data management

🚀 Quick Start

Installation

# Install in development mode
pip install -e .

# Install with optional dependencies
pip install -e .[dev,notebooks]

Basic Usage - Universal Pipeline v2.1

from bquant.data.samples import get_sample_data
from bquant.analysis.zones import analyze_zones

# Load sample data
data = get_sample_data('tv_xauusd_1h')

# Universal Pipeline - работает с любым индикатором
result = (
    analyze_zones(data)
    .with_indicator('pandas_ta', 'rsi', length=14)
    .detect_zones('threshold', indicator_col='RSI_14', 
                  upper_threshold=70, lower_threshold=30)
    .analyze(clustering=True)
    .build()
)

print(f"Found {len(result.zones)} zones")
print(f"Statistics: {result.statistics}")

MACD-зоны в одну строку

from bquant.analysis.zones import analyze_macd_zones

result = analyze_macd_zones(data)  # пресет поверх того же пайплайна

MACDZoneAnalyzer (и обёртки create_macd_analyzer / analyze_macd_zones из bquant.indicators.macd) удалён. Замена — пресет выше либо полный билдер analyze_zones(...). Сам индикатор MACD не менялся.

pandas-ta indicators in one line

from bquant.indicators import LibraryManager

# Load external libraries (pandas-ta, TA-Lib when installed)
LibraryManager.load_all_libraries()

# "Simple way" to access any pandas-ta indicator discovered dynamically
rsi = LibraryManager.create_indicator('pandas_ta', 'rsi', length=14)
result = rsi.calculate(data)
print(result.data.tail())

See the LibraryManager documentation for more examples.

Command Line

# List available sample datasets
bquant list

# Detect and analyze zones (MACD by default) on a sample dataset
bquant analyze tv_xauusd_1h

# Any oscillator: the zone vocabulary follows the indicator
bquant analyze tv_xauusd_1h --indicator rsi

# Structured output, for programs rather than for reading
bquant analyze --json --no-chart

# Analyze and save the chart to a file
bquant analyze mt_xauusd_m15 -o chart.html

See the CLI guide for every flag and the JSON schema.

📋 Project Structure

This is a monorepo that contains:

  • bquant/ - Python package (for PyPI)
  • research/ - Jupyter notebooks and experiments
  • scripts/ - Automation scripts
  • data/ - Data storage
  • tests/ - Test suite
  • docs/ - Documentation

🛠️ Development

Setting up development environment

# Create virtual environment
python -m venv .venv

# Activate (Windows)
.venv\Scripts\activate

# Activate (Linux/Mac)
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Install in development mode with all extras
pip install -e .[full]

Running tests

pytest tests/ -v

📚 Documentation

Universal Pipeline v2.1

  • Quick Start - 5 минут до первого результата
  • API Reference - полная документация Universal Pipeline
  • Examples - готовые примеры для всех индикаторов
  • MACD Zone Analysis - пресет, билдер, стратегии детекции, модульное использование

Complete Documentation

Architecture

  • Two-Layer Design: Simplification from 3 to 2 layers
  • Zero Hardcode: ZERO hardcoded indicators, full universality
  • Design Patterns: Strategy, Dependency Injection, Builder, Registry
  • Test Suite: green on every release; the count is recorded per release in CHANGELOG.md rather than repeated here, so it cannot go stale

🎯 Roadmap

  • Phase 1 (Completed): Core functionality (data loading, processing, validation), advanced MACD analysis, and statistical engine.
  • Phase 2 (In Progress): Extended visualization options, implementation of Time Series and other indicator analysis modules (currently stubs).
  • Phase 3 (Planned): Chart pattern recognition and enhanced automation pipelines. Machine learning is not currently part of the package: the bquant.ml placeholder was removed in 0.0.7 because both of its public functions only ever raised NotImplementedError.

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests.

📞 Contact

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bquant-0.0.9.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bquant-0.0.9-py3-none-any.whl (470.9 kB view details)

Uploaded Python 3

File details

Details for the file bquant-0.0.9.tar.gz.

File metadata

  • Download URL: bquant-0.0.9.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for bquant-0.0.9.tar.gz
Algorithm Hash digest
SHA256 b300f20aa44b85ac91fe183440812925900fb70761d54ec15fd863c157e7d436
MD5 622a7f8f5e32324232deddc878e4fc48
BLAKE2b-256 e6ad4a104022e7d37c6170b427019d5153a622b4dd7e61c45587bd1b165eab04

See more details on using hashes here.

File details

Details for the file bquant-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: bquant-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 470.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for bquant-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 e4a389086e4aaba191aa827534dc27851b25912b39d7e5d325205a8fb0cd034d
MD5 3040c8c03f776f1f341e34c970175bad
BLAKE2b-256 cebe80d7385467df72fbb3f6d9306b0e190d4af6c5f1704bfaff824d18432522

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

This release

0.0.9 This release

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

0.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page