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.
Metadata
Release files for backtester-machine 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| backtester_machine-0.1.2.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| backtester_machine-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / backtester_machine-0.1.2.tar.gz
| Download URL | backtester_machine-0.1.2.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc3eb60a86ce47d256e834893e9a10896edb40fbbef86b59f1eda0dfe6e88473
|
|
BLAKE2b-256 checksum How to use checksums |
5b98573178fe22cc36c7eb62c6b9f99ba7a3ecb6316e64d6272fb8fc25cf8659
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Release files / backtester_machine-0.1.2-py3-none-any.whl
| Download URL | backtester_machine-0.1.2-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d56fd1568f86672c3bf942d5f97f822ef8066e5ef2649ed48e71783cc99f8eea
|
|
BLAKE2b-256 checksum How to use checksums |
0c5523fdce8f8f7e6577275cb5adc7e8796f0853544984a5ac673a312b1a77e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|