Skip to main content

A package for backtesting portfolio strategies and trading signals

Project description

This package serve for two backtesting scenarios:

  1. Portfolio Backtest:

    1. A portfolio object is constructed by either weight or share. Input format should be a pandas dataframe with rebalance dates as index and security tickers as columns. The end date of the backtest should also be specified. Otherwise the last day available in price data is used.
    2. The benchmark of the portfolio is encouraged to specify. Two ways are supported to specify benchmark. Input benchmark weight in benchmark variable when the portfolio is initialized. Or construct a portfolio object as benchmark and set it to the benchmark attribute of the testing portfolio.
    3. Before backtest, use 'set_price(price_data)' method to specify price data. Backtest result can be generated by 'backtest()' method.
    4. To check the result, use 'plot_performance()', 'performance_summary', 'period_performance'.
    5. More information about the definitions of performance metrics: Annualized is assumed to have 250 trading days. Active return is the difference of total return from portfolio to benchmark for the whole period. Active risk is the standard deviation of daily active return multiply square root of trading days in the period. Information Ratio is active return divided by active risk.
  2. Trading Strategy Backtest: (Under 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

backtest_pkg-0.1.0.tar.gz (5.1 MB view hashes)

Uploaded Source

Built Distribution

backtest_pkg-0.1.0-py3-none-any.whl (9.3 kB view hashes)

Uploaded Python 3

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