Skip to main content

arbitrix-core

PyPI Python License CI Docs

MIT-licensed open-source backtest engine and cost model from the Arbitrix trading toolkit.

Install

pip install arbitrix-core

Optional extras:

  • arbitrix-core[fast] — enables numba JIT for the SL/TP vectorized loop.
  • arbitrix-core[docs] — mkdocs build dependencies.
  • arbitrix-core[dev] — pytest + ruff.

Quickstart

import pandas as pd

from arbitrix_core import Backtester, BTConfig, Signal, BaseStrategy
from arbitrix_core import costs
from arbitrix_core import load_ohlcv


class SmaCross(BaseStrategy):
    def generate_signals(self, df):
        fast = df["close"].rolling(10).mean()
        slow = df["close"].rolling(30).mean()
        signals = []
        for i in range(1, len(df)):
            if fast.iloc[i - 1] < slow.iloc[i - 1] and fast.iloc[i] > slow.iloc[i]:
                signals.append(Signal(when=df.index[i], action="buy", price=df["close"].iloc[i]))
            elif fast.iloc[i - 1] > slow.iloc[i - 1] and fast.iloc[i] < slow.iloc[i]:
                signals.append(Signal(when=df.index[i], action="sell", price=df["close"].iloc[i]))
        return signals


df = load_ohlcv("eurusd_h1.csv", time_col="datetime")
costs.configure(commission_per_lot=3.0, point_overrides={"EURUSD": 10.0}, allow_provider_lookups=False)
result = Backtester(BTConfig()).run_single(df, SmaCross(), risk_perc=0.01, initial_equity=10_000.0)
print(result.metrics)

Full documentation at https://g14mb0.github.io/arbitrix-core/

Sync to public repo

arbitrix-core is published from the upstream Arbitrix monorepo via subtree split. The private workflow .github/workflows/arbitrix-core-sync.yml force-pushes arbitrix/src/arbitrix_core to https://github.com/G14MB0/arbitrix-core on every push to main or development that touches the subtree, and on workflow_dispatch.

Requirements:

  • Repo secret PUBLIC_REPO_TOKEN — fine-grained PAT with Contents: write scope on G14MB0/arbitrix-core.
  • Public repo development branch is overwritten on every sync. Do not commit directly to that branch.

Download files

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

Source Distribution

arbitrix_core-0.1.7.tar.gz (189.9 kB view details)

Uploaded Source

Built Distribution

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

arbitrix_core-0.1.7-py3-none-any.whl (80.1 kB view details)

Uploaded Python 3

File details

Details for the file arbitrix_core-0.1.7.tar.gz.

File metadata

  • Download URL: arbitrix_core-0.1.7.tar.gz
  • Upload date:
  • Size: 189.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for arbitrix_core-0.1.7.tar.gz
Algorithm Hash digest
SHA256 6fd8bdb8dc01b999127e5459717a49033e274e399e972c969fa0b1828a1d040b
MD5 8ce1faf8fb6cfbfa1f009cf7deb754ed
BLAKE2b-256 b47b21d3f1036d4f1f595cd9ba2197873d10253c0658745b5101cfbb18aa4dcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for arbitrix_core-0.1.7.tar.gz:

Publisher: release.yml on G14MB0/arbitrix-core

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

File details

Details for the file arbitrix_core-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: arbitrix_core-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 80.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for arbitrix_core-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 93418d17450e8ea2acbfc0459bdbe6ec22cb490c025d264554c1c3a020d085bb
MD5 350b475496bddfe2b4a3a06513c5d4a9
BLAKE2b-256 3ccd869260d01f3be89bf4d752d4c0939352516b6145c2033c24632a4333e4e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for arbitrix_core-0.1.7-py3-none-any.whl:

Publisher: release.yml on G14MB0/arbitrix-core

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

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 files

0.1.6

2 files

0.1.5

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

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