MIT-licensed open-source backtest engine and cost model from the Arbitrix trading toolkit.
Project description
arbitrix-core
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 withContents: writescope onG14MB0/arbitrix-core. - Public repo
developmentbranch is overwritten on every sync. Do not commit directly to that branch.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arbitrix_core-0.1.1.tar.gz.
File metadata
- Download URL: arbitrix_core-0.1.1.tar.gz
- Upload date:
- Size: 160.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ceaa34a5cebe38814a5fe3238cfba4507df4832b27afac85e419e731a9ce6869
|
|
| MD5 |
bd08aa441d9ebea435c8f4e6368b77d4
|
|
| BLAKE2b-256 |
d45d0f8dd0419314cf7b6eff9744475789bb8142316c346763ca2d74625c8ca6
|
Provenance
The following attestation bundles were made for arbitrix_core-0.1.1.tar.gz:
Publisher:
release.yml on G14MB0/arbitrix-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arbitrix_core-0.1.1.tar.gz -
Subject digest:
ceaa34a5cebe38814a5fe3238cfba4507df4832b27afac85e419e731a9ce6869 - Sigstore transparency entry: 1399860532
- Sigstore integration time:
-
Permalink:
G14MB0/arbitrix-core@c121ac7859537e0fed799ceb97a16e96bfbe8afe -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/G14MB0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c121ac7859537e0fed799ceb97a16e96bfbe8afe -
Trigger Event:
push
-
Statement type:
File details
Details for the file arbitrix_core-0.1.1-py3-none-any.whl.
File metadata
- Download URL: arbitrix_core-0.1.1-py3-none-any.whl
- Upload date:
- Size: 50.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cee86abe1e3ea1c00900eec3da9ded643d6a9c892319ab457d6632ac171b710
|
|
| MD5 |
ca044fcf48acd67cb0b897f9844795f3
|
|
| BLAKE2b-256 |
f5443d441d70db1f7c2afa770f22c741621f1ff9b6bd3eeb7be7b01a73bc53b2
|
Provenance
The following attestation bundles were made for arbitrix_core-0.1.1-py3-none-any.whl:
Publisher:
release.yml on G14MB0/arbitrix-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arbitrix_core-0.1.1-py3-none-any.whl -
Subject digest:
2cee86abe1e3ea1c00900eec3da9ded643d6a9c892319ab457d6632ac171b710 - Sigstore transparency entry: 1399860568
- Sigstore integration time:
-
Permalink:
G14MB0/arbitrix-core@c121ac7859537e0fed799ceb97a16e96bfbe8afe -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/G14MB0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c121ac7859537e0fed799ceb97a16e96bfbe8afe -
Trigger Event:
push
-
Statement type: