Skip to main content

A short description of the project.

Project description

Signalab

Tick-level backtesting for quantitative FX and CFD research

Python 3.13+ License: MIT PyPI

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, implement perform(). Need a custom indicator? Subclass Indicator and implement compute(). 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


Download files

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

Source Distribution

signalab-0.1.3.tar.gz (52.4 kB view details)

Uploaded Source

Built Distribution

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

signalab-0.1.3-py3-none-any.whl (42.6 kB view details)

Uploaded Python 3

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

Hashes for signalab-0.1.3.tar.gz
Algorithm Hash digest
SHA256 aea61b994afb43daad2b93edb7abc233f897f1e7f7c430e866ef078f5fd05b80
MD5 6339c52f7828e56ca57d92a667d6d652
BLAKE2b-256 71584e40c6e6bfc861346087494389d137f2237aecb55a8d897b4f9caa4c505d

See more details on using hashes here.

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

Hashes for signalab-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8a75aa03ccb70dfcc9a6acb6aa8a8d2b5566bf542ded4ea73902f06f5bc13613
MD5 35129844a98b4f14cf92aaff000bb82e
BLAKE2b-256 b5d3fd3bae57553ae3ddd40c122d9513c6d10f00c6172673dc60f6405d8e7375

See more details on using hashes here.

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