Skip to main content

A foundational trading strategy framework for simulating and managing financial trades with customizable profit tracking and balance management.

Project description

Backtester Machine

A framework for backtesting financial strategies.

Table of Contents

Installation

To install backtester_machine, clone the repository and install the package using pip:

git clone https://github.com/yourusername/backtester_machine.git
cd backtester_machine
pip install .   

Or install directly from PyPI (if available):

pip install backtester_machine

For development purposes, install the extra dependencies:

pip install backtester_machine[dev]

Examples

Example 1: Simple Backtest

from backtester_machine import Backtester, Strategy

# Define a simple strategy
class SimpleStrategy(Strategy):
    def generate_signals(self, data):
        return data['price'].rolling(3).mean() > data['price']

# Create backtester instance
bt = Backtester(SimpleStrategy())

# Run backtest on data
results = bt.run(data)
print(results)

Example 2: Advanced Backtest

from backtester_machine import Backtester, Strategy

# Define more advanced strategy
class AdvancedStrategy(Strategy):
    def generate_signals(self, data):
        return data['price'].rolling(5).mean() < data['price']

# Run with different parameters
bt = Backtester(AdvancedStrategy(), start_cash=10000, commission=0.001)
results = bt.run(data, from_date='2020-01-01', to_date='2023-01-01')
print(results)

Features

  • Customizable strategies: Define your own trading strategies with ease.
  • Multiple asset support: Backtest on various asset classes like stocks, crypto, etc.
  • Performance metrics: Built-in evaluation metrics such as returns, volatility, and drawdowns.
  • Modular design: Easily extend or modify the framework to suit your needs.

Contributions

Contributions are welcome! Please check out the contribution guidelines for more details.

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

backtester_machine-0.1.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

backtester_machine-0.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file backtester_machine-0.1.1.tar.gz.

File metadata

  • Download URL: backtester_machine-0.1.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for backtester_machine-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a11754f67566d8ea29efa473cb1fbf4dce3c32b2e6e1fc2a2708367291a26226
MD5 25d2543d4f5c1a71eb2360f538cfc20c
BLAKE2b-256 87c25e388716bdb96a5fd0380235f9381c0a3c6e8434fa54671b83f2be831905

See more details on using hashes here.

File details

Details for the file backtester_machine-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for backtester_machine-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 58aa2023baaf0ee0ce869c83d9dc3c87f029cd8eeea275f8f2f1b48dbfb5f5e4
MD5 a6b4ff83290c9af61d9877768e75bc44
BLAKE2b-256 689d20421094c9fd3f4fe977aca6c1df5390b6a9309bbee7d1ca7e0ac1f5de83

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page