Skip to main content

BQuant — Quantitative Research Toolkit

BQuant is a toolkit for quantitative research of financial markets. Its core is a universal zone-analysis pipeline: it is not tied to any particular indicator and works with any oscillator.

Install

pip install bquant

Python 3.12+.

Quick start

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

data = get_sample_data('tv_xauusd_1h')

# The pipeline is indicator-agnostic: swap the `.with_indicator()` call,
# everything else stays the same.
result = (
    analyze_zones(data)
    .with_indicator('pandas_ta', 'rsi', length=14)
    .detect_zones('threshold', indicator_role='value',
                  upper_threshold=70, lower_threshold=30)
    .analyze(clustering=True)
    .build()
)

print(len(result.zones))                              # 64
print(sorted({zone.type for zone in result.zones}))   # ['neutral', 'overbought', 'oversold']

A zone is addressed by role (indicator_role='value'), not by column name. Column names depend on the library and on the call parameters and change with them; roles do not.

MACD zones in one line — a preset over the same pipeline:

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

result = analyze_macd_zones(get_sample_data('tv_xauusd_1h'))

print(len(result.zones))                              # 32
print(sorted({zone.type for zone in result.zones}))   # ['bear', 'bull']

Note that the zone vocabulary follows the indicator: an oscillator crossing zero yields bull/bear, a bounded one yields overbought/neutral/oversold.

What is in the box

Zone analysis. Five detection strategies (zero_crossing, threshold, line_crossing, preloaded, combined) and five metric families (swing, shape, divergence, volatility, volume), plus hypothesis testing and clustering over the resulting zones.

Indicators. Built-in implementations (SMA, EMA, RSI, MACD, Bollinger Bands) and anything from pandas-ta or TA-Lib through one factory:

from bquant.data.samples import get_sample_data
from bquant.indicators import LibraryManager

data = get_sample_data('tv_xauusd_1h')

LibraryManager.load_all_libraries()
rsi = LibraryManager.create_indicator('pandas_ta', 'rsi', length=14)

print(rsi.calculate(data).data.columns.tolist())   # ['RSI_14']

Data. OHLCV loading, processing and validation, with sample datasets embedded in the package so that every example runs without external files.

Visualization. Interactive financial charts and statistical plots (Plotly, Matplotlib).

Performance. Vectorized computation and a two-level cache (memory + disk).

Command line

bquant list                                  # available sample datasets
bquant analyze tv_xauusd_1h                  # zones, MACD by default
bquant analyze tv_xauusd_1h --indicator rsi  # any supported oscillator
bquant analyze --json --no-chart             # structured output, for programs
bquant analyze mt_xauusd_m15 -o chart.html   # save the chart

Every flag and the JSON schema: CLI guide.

Documentation

Quick start first result in five minutes
Zone analysis pipeline the full builder reference
Tutorials step-by-step scenarios
API reference module by module
Developer guide extending the package

Development

git clone https://github.com/kogriv/bquant.git
cd bquant
python -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e ".[dev]"   # extras: dev, docs, notebooks — extra `full` не существует
pytest

Extras: dev, docs, notebooks, research, full.

Repository layout: bquant/ is the package itself; tests/, docs/ and examples/ support it; research/ and scripts/ hold notebook-style studies and automation.

Status

Beta. The public API changes between releases without deprecation windows — renames are carried through in one change, and CHANGELOG.md records every breaking change with its replacement. Pin an exact version if you need stability.

Not in the package: machine learning. The bquant.ml placeholder was removed in 0.0.7 because both of its public functions only ever raised NotImplementedError.

License

MIT — see LICENSE.

Contact

Author: kogriv · kogriv@gmail.com

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.15.tar.gz (1.2 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.15-py3-none-any.whl (519.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bquant-0.0.15.tar.gz
  • Upload date:
  • Size: 1.2 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.15.tar.gz
Algorithm Hash digest
SHA256 c85e2529a2886de0e780117ed8013b73efd406d1aba6f52a7283cc301cab842f
MD5 a97c8567340d253162500706cf6394ae
BLAKE2b-256 cc8f0808455e0ddd9e82853386c9956811ac39aa6038bbdc4c93ff8bdcfc49a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bquant-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 519.6 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.15-py3-none-any.whl
Algorithm Hash digest
SHA256 3c70d958b4ae1c094eb16860cb18d40ae4c4c405f6c5f726e7f614f8cd8fbe9e
MD5 689e51e8a25790d628a9ecb606239c88
BLAKE2b-256 34844d02354658717681cb298f6c6faf00cdbe5e495ef9d3ea571de11b88fa33

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.16

2 files

This release

0.0.15 This release

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

0.0.9

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