Skip to main content

C++20 event-driven multi-asset backtesting engine with paper-trading bridge, analytics dashboard, WFO/Monte Carlo validation, and execution-realistic simulation.

Project description

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

pip install nanoback

Optional extras:

pip install "nanoback[io,viz]"

Core Example

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)

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

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

Project details


Download files

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

Source Distribution

nanoback-1.0.1.tar.gz (65.3 kB view details)

Uploaded Source

Built Distributions

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

nanoback-1.0.1-cp313-cp313-win_amd64.whl (227.0 kB view details)

Uploaded CPython 3.13Windows x86-64

nanoback-1.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (300.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

nanoback-1.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (266.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

nanoback-1.0.1-cp313-cp313-macosx_11_0_arm64.whl (230.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

nanoback-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl (250.2 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

nanoback-1.0.1-cp312-cp312-win_amd64.whl (227.0 kB view details)

Uploaded CPython 3.12Windows x86-64

nanoback-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (300.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nanoback-1.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (266.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

nanoback-1.0.1-cp312-cp312-macosx_11_0_arm64.whl (230.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

nanoback-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl (250.2 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

nanoback-1.0.1-cp311-cp311-win_amd64.whl (225.6 kB view details)

Uploaded CPython 3.11Windows x86-64

nanoback-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (298.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nanoback-1.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (267.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

nanoback-1.0.1-cp311-cp311-macosx_11_0_arm64.whl (228.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

nanoback-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl (246.2 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

Details for the file nanoback-1.0.1.tar.gz.

File metadata

  • Download URL: nanoback-1.0.1.tar.gz
  • Upload date:
  • Size: 65.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nanoback-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b426333492096ccd2e21f5f74f503b0494784da2206b95a93e46457afe8401f6
MD5 ad32fa895d265aafdae94652fa28abf7
BLAKE2b-256 b7fa67cd0303e97d8b4005ffa5f76873cce7812a93576c888f2368cee5540c64

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1.tar.gz:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: nanoback-1.0.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 227.0 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nanoback-1.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 70683371996fd5b989b3a90d69a1330341d653c4a133ad41789bc9431ab85e19
MD5 c155aab5b25f902a806e6ca62412d4f3
BLAKE2b-256 d46fdad3a989a45f44ed6c5cc9b3b60f0a0976cc183362086606887cbdcfe0bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d23b3fd610a885db88350b76123cf680519555cbe6755917ac6254bcfbc5890a
MD5 e5baaedf1cab7752de107ce72b6b294c
BLAKE2b-256 a6145655f4ccf2e3417b06bf3cdbe5cb96d6e99d084a27a1e70a1fc4df597318

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a7f6687c73ca32cbe18b94f4496938a12b1603fa865697553cf2ff8b123ffd4f
MD5 3ed2c455c79bb4feb2a5e290a8e37a93
BLAKE2b-256 513772a7fa476c227bb131244d08b5d1c64ca664fb22283aac09c90bb3f95dc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c15f4b9dce7ef97336f2b2c076ed1b3ba5132b279ee7a348f0c03dcfd7fd86f
MD5 556e3fd363ce9e5cd6cbc923eb31fe5b
BLAKE2b-256 70c80f5696b782dcb4712fd6913cfdbcada5c64ca27dff783aa712cdd5be75e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 81eb430e0d0a7f0571bbc594d554616418f1feae4e8d5833fb504416f64e8641
MD5 ad25c74cfb40c31b7213b4c57f5a8c14
BLAKE2b-256 6a2bbfb790d08aa9d6d1b8d7290166f61888262b604920592655a8a6f6fe9ae0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: nanoback-1.0.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 227.0 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nanoback-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 134a9bc7bb7f3c2b10faac2e7cc27fe4e3812107999a5109de99bcc20ae9fa6c
MD5 db3250c3a9c1226223f185ad3e183ae2
BLAKE2b-256 117e22ea84a9a7345f94bd41839e4b6b0a3ed6d0f26d0c897f2b1c86e4ad4024

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bca09af4e0b53cb28e126d102415b14ccf44bff3368709c4ca30d6d9bd221e9d
MD5 f90dd5e86b4fb31f0b169f144f889d4c
BLAKE2b-256 550363803ce2678234b56f6ca38fdac0db56fa2eab1e46f701984086d3183630

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9274c6e4b3f5e086aa2be3eed3d6d4490deb502bbab1c42c3b22c1ffebcc4b50
MD5 811a4bf5848c27a856d99cb27161f81e
BLAKE2b-256 65a0313ec9d82055e6dac25cc7020f842ab0b7205b80e914e66050d8ba2217dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a2dd097e07966df57dc45643d337aa58f675954568217b2bcb60e2df92a8bb3
MD5 dac49f48273f66582e4c8cfbdab2098e
BLAKE2b-256 62f498b160f795a916d2dfb4b974d78dbf3fcd57df40642b9c09491407de5dde

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ba96cbbd9abd7067942fb36b0541108658039453015df77e403dd0d683e41d14
MD5 9db89199811abb015c7f060b735a3e47
BLAKE2b-256 c583bd2ae9157a4083c141ed0dcc26bf87cda2c2c8824e81c53f348e9dd3deb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: nanoback-1.0.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 225.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nanoback-1.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 84c3f641001e7d229be17a6f28bf8a85e2dbe876ddfa3720afec47a91a607e87
MD5 e0bff9f34b8103a86a8d50a77e8a1bb4
BLAKE2b-256 7ffd1eebd9143ada2527825bfad3a79e67d207cfbb67aa17319545d1dfd35c03

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1499709a01ade651b021ebe4d99df6a2cf958d110f0396ba20e349f0a264e3d0
MD5 863ce07d68e9fcf2e510a5f5da4c53a4
BLAKE2b-256 f84ce39df94bc14801918e175afbb8c53d1fbb91e0e118015d666aef933353cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ad448699bb322abb7008d200511c12fc36f552bb8243a39c54e2322b46ab0985
MD5 f2e38a9256713c4de3bdbb7023b968fa
BLAKE2b-256 7ce2a60a2ccbbabf363779a788789c42116b7eebc2f4c90328b6ef2e5fec8ce5

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 89f8bbc73040ddaa65e57ad6e1dfa02dd712f899bff870caa3a13bfc24290863
MD5 5b64c0813f72cf4482cf2da141f17428
BLAKE2b-256 4948d567aa2f12479ee45160d1ac9b730463382b311787a9e43c074d4fcad10f

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nanoback-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for nanoback-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b96872794e5777c60fec87d1b4a2139ff99308aa8f23cf0d84531cb2922be697
MD5 e417cdbeb025bb625e987d8e2f5c9056
BLAKE2b-256 17660d94d95cd7a5f9d7f709f8dec55abb6706fe000f79cd85b1519b424d246e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanoback-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl:

Publisher: publish.yml on td-02/BACKTESTER

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page