Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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, InstrumentConfig
from arbitrix_core import costs
from arbitrix_core import load_ohlcv


class SmaCross(BaseStrategy):
    symbol = "EURUSD"
    timeframe = "H1"

    def prepare(self, df):
        prepared = df.copy()
        fast = df["close"].rolling(10).mean()
        slow = df["close"].rolling(30).mean()
        prepared["cross_up"] = (fast.shift(1) <= slow.shift(1)) & (fast > slow)
        prepared["cross_down"] = (fast.shift(1) >= slow.shift(1)) & (fast < slow)
        return prepared.dropna()

    def on_bar(self, row, portfolio):
        if row["cross_up"]:
            return [Signal(when=row.name, action="buy", price=float(row["close"]))]
        if row["cross_down"]:
            return [Signal(when=row.name, action="sell", price=float(row["close"]))]
        return []

    def stop_distance_points(self, row):
        return 0.002


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)
instrument = InstrumentConfig(
    ib_symbol="EURUSD",
    point_value=10.0,
    contract_size=1.0,
    tick_size=0.0001,
    min_order_size=0.01,
)
result = Backtester(BTConfig(), instruments={"EURUSD": instrument}).run_single(
    df,
    SmaCross(),
    risk_perc=0.01,
    initial_equity=10_000.0,
)
print(result.metrics)

run_single remains the mono-provider API. Multiprovider and multisymbol code uses the additive run_market API with the FeedKey / MarketFrames -> PreparedMarket -> MarketBars contract.

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

Sync to public repo

src/arbitrix_core is the canonical source and is published from the upstream Arbitrix monorepo via subtree split. The private workflow .github/workflows/arbitrix-core-sync.yml force-pushes that subtree 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.8a1.tar.gz (210.6 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.8a1-py3-none-any.whl (93.8 kB view details)

Uploaded Python 3

File details

Details for the file arbitrix_core-0.1.8a1.tar.gz.

File metadata

  • Download URL: arbitrix_core-0.1.8a1.tar.gz
  • Upload date:
  • Size: 210.6 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.8a1.tar.gz
Algorithm Hash digest
SHA256 86eea8c159b36a9b59ce01fc07a1f052ef96dcae53686a56df394762d2c4b73b
MD5 001864986a53aed5ec5268f30ca29a45
BLAKE2b-256 bd59399b62066a0b38b077368e252a55128cbb2aa8c7f00b9e5e38f3ff6196a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for arbitrix_core-0.1.8a1.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.8a1-py3-none-any.whl.

File metadata

  • Download URL: arbitrix_core-0.1.8a1-py3-none-any.whl
  • Upload date:
  • Size: 93.8 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.8a1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9882b4d5bfc5b0e6ddddecf1a0264e4bba9a813550e9007499eb872fb388a54
MD5 eb36ac07318e725c78626c2afaf1ba54
BLAKE2b-256 5bffedebab45faf38d8e2529e5fa41bf7a7b068f1a7ac462260c1eeffc0723ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for arbitrix_core-0.1.8a1-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.8a1 This release

2 files

0.1.7

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