Metadata-Version: 2.2
Name: nanoback
Version: 1.0.1
Summary: C++20 event-driven multi-asset backtesting engine with paper-trading bridge, analytics dashboard, WFO/Monte Carlo validation, and execution-realistic simulation.
Keywords: backtesting,trading,latency,microstructure,pybind11
Author: Tapesh Chandra Das
Project-URL: Homepage, https://github.com/td-02/BACKTESTER
Project-URL: Source, https://github.com/td-02/BACKTESTER
Project-URL: Issues, https://github.com/td-02/BACKTESTER/issues
Requires-Python: >=3.11
Requires-Dist: numpy>=1.26
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Provides-Extra: io
Requires-Dist: pandas>=2.2; extra == "io"
Requires-Dist: pyarrow>=15.0; extra == "io"
Requires-Dist: yfinance>=0.2.40; extra == "io"
Provides-Extra: viz
Requires-Dist: plotly>=5.24; extra == "viz"
Requires-Dist: streamlit>=1.40; extra == "viz"
Description-Content-Type: text/markdown

# BACKTESTER (`nanoback`)

`nanoback` is a C++20 event-driven backtesting engine with Python APIs for research, paper trading, and production-grade validation workflows.

## What's New (v1.0)

- Live bridge (`v0.6`): `PaperBroker` streams real-time ticks into the same engine path as backtests
- Safety reconciliation: `Reconciler` detects and optionally auto-corrects engine-vs-broker position drift
- Interactive reporting:
  - `result.plot()` equity + underwater drawdown
  - `result.to_html("report.html")` self-contained shareable report
  - `result.dashboard()` Streamlit analytics panel
  - `sweep_result.heatmap(...)` Plotly parameter robustness diagnostics
  - `wfo_result.plot()` IS vs OOS Sharpe + OOS equity
- Release quality:
  - Multi-platform wheel publishing through `cibuildwheel`
  - Benchmark regression guard on CI merges to `main`
  - Expanded edge-case regression suite

## Install

```bash
pip install nanoback
```

Optional extras:

```bash
pip install "nanoback[io,viz]"
```

## Core Example

```python
import numpy as np
import nanoback as nb

result = nb.run_backtest(
    timestamps=np.array([1, 2, 3, 4], dtype=np.int64),
    prices=np.array([100.0, 101.0, 99.0, 102.0], dtype=np.float64),
    signals=np.array([1, 1, 0, -1], dtype=np.int64),
    config=nb.BacktestConfig(max_position=2),
)

print(result)
fig = result.plot()
result.to_html("report.html")
```

## Paper Trading Bridge (`v0.6`)

```python
from datetime import datetime, timedelta, timezone
from nanoback.paper import PaperBroker, PaperTick
import nanoback as nb

class Feed:
    def __init__(self, ticks):
        self._ticks = list(ticks)
    def next_tick(self, timeout_seconds=None):
        return self._ticks.pop(0) if self._ticks else None
    def fetch_positions(self):
        return {"AAA": 0.0}
    def submit_order(self, symbol, quantity_delta):
        pass

def strategy(tick, state):
    return {"AAA": 1}

broker = PaperBroker(
    symbols=["AAA"],
    strategy=strategy,
    feed=Feed([PaperTick(timestamp_ns=1, symbol="AAA", price=100.0)]),
    config=nb.BacktestConfig(max_position=2),
)
broker.run_until(datetime.now(timezone.utc) + timedelta(seconds=1))
```

## Repo Layout

- `cpp/`, `include/nanoback/`: core engine and bindings
- `python/nanoback/`: analytics, live bridge, strategy, sweep/WFO/MC modules
- `benchmarks/`: latency/stress harnesses and baselines
- `tests/`: regression suite

## Development

```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -e .[dev]
python -m pytest
```
