Skip to main content

Crypto back‑testing toolkit

Project description

CI PyPI version

CryptoLion Backtester

A lightweight command‑line tool for backtesting cryptocurrency strategies, optimizing parameters, walk‑forward validation, and portfolio aggregation.

Installation

pip install -r requirements.txt
pip install cryptolion-backtester

Usage

Show help and available commands:

backtester --help

Run a backtest:

backtester backtest \
  --file data/ETH_USDT_4h.csv \
  --params '{"fast":5,"slow":21,"fee":0.001,"sig":9}' \
  --save-plots

Optimize strategy parameters:

backtester optimize \
  --file data/ETH_USDT_4h.csv \
  --param-grid '{"fast":[5,8],"slow":[21,34]}' \
  --processes 4 \
  --output grid_results.csv

Aggregate multiple symbols into an equal‑weight monthly‑rebalanced portfolio:

backtester portfolio \
  --folder data/ \
  --weight equal \
  --rebalance M \
  --fee 0.001 \
  --slippage 0.0005 \
  --out-file portfolio_equity.csv

Development

Install dev dependencies and run formatting, linting, and tests:

pip install -r requirements.txt black flake8 pytest
black backtester.py tests
flake8 backtester.py tests
pytest -q

License

This project is licensed under the MIT License. See LICENSE for details.

Next Steps

  1. Verify CI Status: Check the GitHub Actions tab to ensure all tests, linting, and formatting checks pass on main and PRs.

  2. Release a new version to PyPI

    If you get a 403 Forbidden during upload it likely means the project name backtester is already taken on PyPI. We've renamed the package to cryptolion-backtester—make sure your metadata matches.

    Update package metadata

    1. Open pyproject.toml and set:
      [project]
      name = "cryptolion-backtester"
      version = "0.1.1"
      # ...
      
    2. Commit and tag:
      git add pyproject.toml
      git commit -m "chore: rename package, bump to v0.1.1"
      git tag v0.1.1
      git push origin main --tags
      

    Clean old build artifacts

    rm -rf dist build cryptolion_backtester-*.egg-info
    

    Build & upload

    pip install --upgrade build twine
    python3 -m build
    twine upload dist/*
    

    Ensure your ~/.pypirc or TWINE_USERNAME/TWINE_PASSWORD points to your valid API token for cryptolion-backtester.

Using this token

To use this API token:

  • Set your username to __token__
  • Set your password to the token value, including the pypi- prefix

For example, in ~/.pypirc:

[pypi]
username = __token__
password =

For further instructions, see the [PyPI help page](https://pypi.org/help/#invalid-auth).

Coverage Status](https://coveralls.io/github//?branch=main)

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

cryptolion-0.1.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

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

cryptolion-0.1.0-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file cryptolion-0.1.0.tar.gz.

File metadata

  • Download URL: cryptolion-0.1.0.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for cryptolion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03b5553a9655037e9c0ac0fef321a9055e6cf1387d54b3f01394b55a5b92a174
MD5 dc2af689b8a872cd626ae6652e1352fe
BLAKE2b-256 3d7ebc8ab030f4087a4dae7f30b0d9e8f0528a81f35a3997d6eba93e0914f0b4

See more details on using hashes here.

File details

Details for the file cryptolion-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cryptolion-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for cryptolion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ed6719cda63721a1fbb15b412e43822b83d45c84258e7f3a886c7bf8d965ca7
MD5 5fc9d76837866e9775fc5d88a10d6592
BLAKE2b-256 9666b086010206711232a48976072688dedb5a33d2222010a75f4002f7d3ba63

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