Metadata-Version: 2.4
Name: quantcentral-sdk
Version: 0.1.0
Summary: Quantcentral.ai public Python SDK — strategy engine, indicators, stats, pairs, market calendars
Project-URL: Homepage, https://quantcentral.ai
Project-URL: Repository, https://github.com/QuantCentral-ai/quantcentral-sdk-python
Project-URL: Issues, https://github.com/QuantCentral-ai/quantcentral-sdk-python/issues
Author-email: Eric Vaillancourt <eric.vaillancourt@talsom.com>
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: backtesting,finance,indicators,quant,strategy,trading
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: exchange-calendars>=4.5
Requires-Dist: msgspec>=0.18
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.2
Requires-Dist: pydantic>=2.7
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Requires-Dist: mkdocs>=1.6; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.27; extra == 'docs'
Description-Content-Type: text/markdown

# quantcentral-sdk-python

[![PyPI version](https://img.shields.io/pypi/v/quantcentral-sdk.svg)](https://pypi.org/project/quantcentral-sdk/)
[![Python versions](https://img.shields.io/pypi/pyversions/quantcentral-sdk.svg)](https://pypi.org/project/quantcentral-sdk/)
[![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)

> Quantcentral.ai public Python SDK — strategy engine, 30+ indicators, stats, pairs analysis, market calendars.

Part of the [Quantcentral.ai](https://quantcentral.ai) ecosystem.

## Status

`v0.1.0` — initial extraction from the QuantStack monorepo. The public surface is stable for the listed modules; the cloud platform (orchestration, runners, AI agents, risk engine, marketplace) is **not** part of this package and remains proprietary.

## Install

```bash
pip install quantcentral-sdk
```

Requires Python 3.12+.

## Quickstart

```python
from quantcentral import StrategyBase, indicators
from quantcentral.strategy import Param

class SmaCross(StrategyBase):
    fast = Param(10, type=int, min=2, max=200, label="Fast SMA")
    slow = Param(50, type=int, min=2, max=400, label="Slow SMA")

    def initialize(self):
        self.closes: list[float] = []

    def on_bar(self, bar):
        self.closes.append(bar.close)
        if len(self.closes) < self.slow:
            return

        fast_sma = indicators.sma(self.closes, self.fast)
        slow_sma = indicators.sma(self.closes, self.slow)

        if fast_sma > slow_sma and not self.get_position(bar.symbol).qty:
            self.buy(bar.symbol, qty=100)
        elif fast_sma < slow_sma:
            self.close_position(bar.symbol)
```

The strategy runs unchanged in any Quantcentral runner (local, cloud, replay). Hosting the runner / data feed is out of scope for this SDK — you provide bars, the strategy reacts.

## Modules

| Module | Purpose |
|---|---|
| `quantcentral.strategy` | `StrategyBase` lifecycle (`initialize`, `on_bar`, `on_tick`), `Param` / `@input` parameter descriptors. |
| `quantcentral.indicators` | 30+ pure-Python indicators: `sma`, `ema`, `rsi`, `macd`, `bollinger_bands`, `atr`, `adx`, `vwap`, `crossover`, … |
| `quantcentral.stats` | `mean`, `stdev`, `correlation`, `linear_regression`, `rolling_mean`, `z_score`, `max_drawdown`, … |
| `quantcentral.pairs` | Cointegration helpers: `compute_hedge_ratio`, `compute_zscore`, `half_life`, `is_cointegrated`. |
| `quantcentral.contracts` | msgspec / pydantic schemas for `Bar`, `Quote`, `Order`, `Fill`, `Position`, `RunSpec`, … |
| `quantcentral.calendar` | Market calendars for NYSE, NASDAQ, TSX, LSE, JPX, ASX (via `exchange_calendars`) plus FOREX (24/5) and CRYPTO (24/7). |

## License

**Apache-2.0** — see [LICENSE](LICENSE) for details. Attribution requirements in [NOTICE](NOTICE).

## Development

```bash
git clone git@github.com:QuantCentral-ai/quantcentral-sdk-python.git
cd quantcentral-sdk-python
python -m venv venv && source venv/bin/activate
pip install -e ".[dev]"
pytest
```

Tracking: <https://github.com/QuantCentral-ai/quantcentral-planning>
