Skip to main content

No project description provided

Project description

ZipLime. The iconic backtester. Reinvented

Python version PyPi version PyPi downloads Star this repo

Elevate Your Backtesting with Speed and Flexibility

Ziplime is a powerful reimagining of the classic Zipline library, now turbocharged with the speed of Polars and enhanced with a versatile new data storage architecture. Designed for quant traders and data scientists, Ziplime retains the familiar backtesting syntax of Quantopian's Zipline while introducing groundbreaking features:

  • Unmatched Performance: Experience lightning-fast backtesting with Polars, enabling you to iterate faster and optimize strategies with ease.
  • Flexible Data Intervals: Seamlessly integrate any data interval, from minutes to months, to match your strategy's unique requirements.
  • Comprehensive Data Support: Go beyond price data. Incorporate fundamental data into your analyses for a more holistic view of the markets.
  • Portable: OS independent, runs on Linux, macOS, and Windows. Deploy using Docker.
  • Live: Use identical strategy implementations between backtesting and live deployments.

We evaluated the speed of various event-driven backtesters using a simple strategy applied to a single instrument over five years of daily data. The strategy involved entering positions based on one technical indicator and exiting based on another.

Alt text

As a result, we found that ZipLime outperforms major benchmarks in terms of speed. This advantage is largely due to the internal parallelism built into Polars, which allows ZipLime to demonstrate significant performance benefits on multi-core tests, particularly on the Apple Silicon M3

Installation

Installing Ziplime is a breeze. Simply add it to your project using Poetry:

poetry add ziplime

Usage

Ziplime is designed to provide a seamless transition from Zipline, extending its powerful capabilities with intuitive enhancement. All commands supported by zipline are also supported by ziplime with extended list of parameters for easier usage.

Data ingestion

Data ingestion works by first fetching historical data and then and then running live data fetch in the background.

Difference from original zipline:

  • --start-date and --end-date parameters - used to fetch bundle data only for specific date period
  • --symbols parameter - specifies symbols to fetch data for directly in the command
  • Running live data fetch in the background

Example:

Ingest data:

poetry run python -m ziplime ingest -b lime --frequency 1m --start-date 2024-06-01 --end-date 2024-07-31 --symbols AAPL,TSLA,AMZN

Strategy backtesting

Ziplime offers flexibility in how you run your backtesting. You can execute your strategies directly from the command line or within your Python scripts.

Run Strategy from the Command Line:

poetry run python -m ziplime -b lime --start-date 2024-11-06 --end-date 2024-11-27 --emission-rate 1m --capital-base 100000 --benchmark-symbol AAPL -f test.py --trading-calendar NYSE --print-algo

Run Strategy Within a Python Script:

For those who prefer more control and integration within their Python projects, you can run your backtest with the following function call:

result = run_algorithm(
    start=start_session,
    end=end_session,
    initialize=initialize,
    handle_data=handle_data,
    capital_base=1000,
    data_frequency='1d',
    bundle='ziplime')

This flexibility allows you to seamlessly integrate backtesting capabilities into your existing Python workflows, providing a more comprehensive and customized analytical experience

Live trade

Still in development.

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

ziplime-1.13.26.tar.gz (367.6 kB view details)

Uploaded Source

Built Distribution

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

ziplime-1.13.26-py3-none-any.whl (518.2 kB view details)

Uploaded Python 3

File details

Details for the file ziplime-1.13.26.tar.gz.

File metadata

  • Download URL: ziplime-1.13.26.tar.gz
  • Upload date:
  • Size: 367.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for ziplime-1.13.26.tar.gz
Algorithm Hash digest
SHA256 a0449a1813cead1d1c7d4d66039d714223164bea20066c1e59064e87f7affd01
MD5 5f4ca2a5a5749e79c8c8ebdc13e3bfd8
BLAKE2b-256 ddb71b5128c78b533bce82d05848bdcb712a0ba86c31e00a533d654ff09fbf24

See more details on using hashes here.

File details

Details for the file ziplime-1.13.26-py3-none-any.whl.

File metadata

  • Download URL: ziplime-1.13.26-py3-none-any.whl
  • Upload date:
  • Size: 518.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for ziplime-1.13.26-py3-none-any.whl
Algorithm Hash digest
SHA256 140f74ffa4a25d46c6214a8f3de1bdce6a9ca5c6c5b8a9725d96bafe83a19329
MD5 572370ecd57fca63298dce5fa1c5fdce
BLAKE2b-256 5a806042e9779bb1e576729e8bdd9c9e512ca767192c270ebdd23562c1c7bda7

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