A short description of the project.
Project description
Signalab
Tick-level backtesting for quantitative FX and CFD research
Signalab is a research-focused backtesting library that simulates trading at raw tick resolution — every bid/ask update — rather than bar-close approximations. It models the execution mechanics that matter for FX and CFD strategies: bid/ask spread, per-lot commissions, and daily swap/carry costs, with margin tracking and automatic liquidation.
Key features
-
Tick-level simulation — the loop runs on every raw bid/ask update. Indicator signals computed on candles are injected back into the tick stream at exact candle-close timestamps — no lookahead, no bar approximation.
-
Simple and easy to extend — subclass
Strategy, implementperform(). Need a custom indicator? SubclassIndicatorand implementcompute(). That's it! -
Vectorized computations — indicators and analytics are implemented as vectorized operations on the full data arrays. The engine coordinates the data flow, but all computations are done in batches for maximum performance.
-
Parallel parameter grid — test dozens of strategy/indicator parameter combinations in one command. Run them in parallel and get a ranked report of all runs with their metrics and configs.
Install
pip install signalab
Quick showcase
from signalab import (
MarketData, BacktestEngine, Account,
RSI, Strategy, Action
)
class MyStrategy(Strategy):
def __init__(self, name="My Strategy", label="my_strat", stop_loss=50):
super().__init__(name=name, label=label)
self.stop_loss = stop_loss
def perform(self, market):
if self.account.floating_pl() < -self.stop_loss:
self.account.close_all_positions()
if self.account.open_position_count > 0:
return
buy_signals = self.buy_signal_count()
sell_signals = self.sell_signal_count()
if buy_signals >= sell_signals:
self.account.open(Action.BUY, size=0.01)
else:
self.account.open(Action.SELL, size=0.01)
data = MarketData.load_from_ticks("EURUSD_ticks.csv")
report = BacktestEngine().run(
data = data,
indicators = [RSI(period=14)],
strategies = [MyStrategy()],
)
r = report.get_account_report()
print(r.metrics())
# {
# 'total_return': 0.12,
# 'sharpe_ratio': 1.43,
# 'max_drawdown': -0.07,
# 'win_rate': 0.54,
# ...
# }
More examples and tutorials coming soon!
🚀 Project starter provided by Cookie Pyrate
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 signalab-0.1.3.tar.gz.
File metadata
- Download URL: signalab-0.1.3.tar.gz
- Upload date:
- Size: 52.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aea61b994afb43daad2b93edb7abc233f897f1e7f7c430e866ef078f5fd05b80
|
|
| MD5 |
6339c52f7828e56ca57d92a667d6d652
|
|
| BLAKE2b-256 |
71584e40c6e6bfc861346087494389d137f2237aecb55a8d897b4f9caa4c505d
|
File details
Details for the file signalab-0.1.3-py3-none-any.whl.
File metadata
- Download URL: signalab-0.1.3-py3-none-any.whl
- Upload date:
- Size: 42.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a75aa03ccb70dfcc9a6acb6aa8a8d2b5566bf542ded4ea73902f06f5bc13613
|
|
| MD5 |
35129844a98b4f14cf92aaff000bb82e
|
|
| BLAKE2b-256 |
b5d3fd3bae57553ae3ddd40c122d9513c6d10f00c6172673dc60f6405d8e7375
|