Ziplime is a cutting-edge platform designed to democratize algorithmic trading by providing ordinary users with the tools to create, backtest, analyze, and deploy trading strategies on real trading accounts. The platform integrates advanced AI capabilities to assist users in writing, debugging, optimizing, and enhancing their trading algorithms. Ziplime leverages the robust Zipline backtesting engine, which was once the core of Quantopian, and extends its functionality with additional features such as fundamental and alternative data. This documentation will guide you through the key features and functionalities of Ziplime.

Key Features

AI-Powered Code Assistance

Ziplime’s built-in AI assists users in:

  • Writing Code: Generate trading algorithms based on user descriptions.

  • Debugging Code: Identify and fix errors in the code.

  • Optimizing Code: Improve the performance and efficiency of trading strategies.

  • Enhancing Code: Provide suggestions for additional features and improvements.

Backtesting Engine

Ziplime uses the Zipline backtesting engine, enhanced with:

  • Daily and Minute Data: Backtest strategies on both daily and minute-level data.

  • Fundamental and Alternative Data: Incorporate fundamental and alternative datasets for more comprehensive backtesting.

Cloud-Based Execution

  • Cloud Backtesting: Run backtests in the cloud using internal data.

  • Results Visualization: View backtest results through detailed graphs, tables, and reports.

Historical Backtest Management

  • Save and Compare: Save all backtests and compare historical performance with current strategies.

Data Coverage

Ziplime supports backtesting on:

  • US Stocks: Comprehensive data on American equities (TOP 1500 stocks).

  • ETFs: Extensive coverage of Exchange-Traded Funds (TOP 500 ETFs).

  • Futures: Data on futures contracts for diversified strategy testing (TOP 50 futures).

Creating a New Strategy

  1. Describe Your Strategy: Provide a detailed description of your trading strategy.

  2. AI Code Generation: Use the AI to generate the initial code for your strategy.

  3. Review and Edit: Review the generated code and make any necessary adjustments.

Running a Backtest

  1. Select Data: Choose the dataset (daily, minute, fundamental, or alternative) for your backtest.

  2. Run Backtest: Execute the backtest in the cloud.

  3. Analyze Results: Examine the results through interactive graphs, tables, and reports.

Managing Backtests

  1. Save Backtest: Save the backtest results for future reference.

  2. Compare Backtests: Compare the performance of different backtests to evaluate strategy improvements.

Example Workflow

Step 1: Strategy Description

I want to create a momentum-based trading strategy
that buys stocks that have increased by more than 5%
in the last 10 days and sells them after a 10% gain
or a 5% loss.

Step 2: AI Code Generation

from zipline.api import order, record, symbol

def initialize(context):
    context.lookback = 10
    context.gain_threshold = 0.10
    context.loss_threshold = -0.05

def handle_data(context, data):
    for stock in context.portfolio.positions:
        current_price = data.current(stock, 'price')
        historical_prices = data.history(stock, 'price', bar_count=context.lookback, frequency='1d')
        price_change = (current_price - historical_prices[0]) / historical_prices[0]
        
        if price_change > 0.05:
            order(stock, 1)
        elif price_change > context.gain_threshold or price_change < context.loss_threshold:
            order(stock, -1)

Step 3: Running the Backtest

  1. Select Data: Choose daily data for US stocks.

  2. Run Backtest: Execute the backtest in the cloud.

  3. Analyze Results: Review the performance metrics and visualizations.

Step 4: Saving and Comparing

  1. Save Backtest: Save the backtest results.

  2. Compare Backtests: Compare with previous backtests to assess strategy improvements.