Manage Quanux Statistics

by quantDIY

skill

Guide for developing and operating the QuanuX Statistics & Research Node.

Skill Details

Repository Files

6 files in this skill directory


name: manage-quanux-statistics description: Guide for developing and operating the QuanuX Statistics & Research Node.

QuanuX Statistics Node

The QuanuX Statistics Node (quanux_stats) is a purpose-built service for real-time market analysis and signal generation. It bridges the gap between raw market data and high-level strategy logic by providing pre-calculated metrics.

Capabilities

  1. Online Statistics:

    • Uses Welford's Algorithm to track Variance and Standard Deviation with $O(1)$ complexity/storage per tick.
    • Tracks Z-scores relative to a rolling window (default 100 ticks).
    • Calculates Pairwise Correlation matrices in real-time.
  2. Data Persistence:

    • Ingests MARKET.* data from NATS (JSON format).
    • Writes to DuckDB (market_stats.duckdb) for offline research and backtesting.
    • Future: Will support Parquet export for S3 archival.
  3. Signal Publishing:

    • Publishes derived metrics to STATS.<SYMBOL> on NATS.
    • Format: {"symbol": "ES", "volatility": 12.5, "z_score": 1.2, ...}

Architecture

  • Language: C++20
  • Core: StatsEngine class.
  • Storage: stats_map_ (Red-Black Tree) for per-symbol state.
  • Concurrency: Single-threaded NATS consumer (for now) protected by std::mutex for future expansion.

Development Guide

Adding a New Metric

  1. Update InstrumentStats in include/stats_engine.h: Add a new accumulator (e.g., double sum_log_return).
  2. Update update() in src/stats_engine.cpp: Implement the online update formula.
  3. Publish: Add the new field to the json derived object in the NATS callback.

Running Locally

# Build
cd QuanuX-Statistics/cpp/build
make quanux_stats

# Run (Ensure NATS is up)
./quanux_stats

Dependencies

  • DuckDB: Embedded DB for storage.
  • NATS C Client: High-performance messaging.
  • Eigen: Linear algebra (Matrix operations).
  • nlohmann/json: Serialization.

Related Skills

Attack Tree Construction

Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.

skill

Grafana Dashboards

Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.

skill

Matplotlib

Foundational plotting library. Create line plots, scatter, bar, histograms, heatmaps, 3D, subplots, export PNG/PDF/SVG, for scientific visualization and publication figures.

skill

Scientific Visualization

Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.

skill

Seaborn

Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.

skill

Shap

Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model

skill

Pydeseq2

Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.

skill

Query Writing

For writing and executing SQL queries - from simple single-table queries to complex multi-table JOINs and aggregations

skill

Pydeseq2

Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.

skill

Scientific Visualization

Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.

skill

Skill Information

Category:Skill
Last Updated:1/27/2026