Skip to content

Icarus is a Python package designed to facilitate the backtesting of trading strategies. It provides a framework to simulate and evaluate trading decisions based on historical data.

License

Notifications You must be signed in to change notification settings

devthakker/Icarus-bt

Repository files navigation

ICARUS-BT

ICARUS-BT

Riley: Backtesting Engine for Trading Strategies

Python PyPI PyPI - Downloads GitHub

Overview

Icarus is a Python package designed to facilitate the backtesting of trading strategies. It provides a framework to simulate and evaluate trading decisions based on historical data, calculate various performance metrics, and generate graphical representations of the results. Riley is equipped with features to compute metrics like Sharpe ratio and Sortino ratio, allowing traders and quantitative analysts to assess the risk-adjusted returns of their strategies.

Features

  1. Backtesting: Riley enables users to simulate the execution of trading strategies on historical data. It supports various order types, including market orders, limit orders, and stop orders, allowing for flexible trade execution scenarios.

  2. Performance Metrics: The package includes functions to calculate essential performance metrics commonly used in financial analysis. These metrics include but are not limited to the following:

  3. Data Sources: Icarus provides support for multiple data sources, including Yahoo Finance (via yfinance) and CSV files. This allows users to easily fetch historical price data or load data from their own sources.

  4. Graphical Representation: Riley provides capabilities to generate graphical representations of backtesting results. This includes visualizations of strategy performance, equity curves, trade signals, and other relevant data.

  5. Candlestick Charts: Icarus provides capabilities to generate candlestick charts for the backtested ticker. This allows users to visualize the price action of the ticker over the backtesting period.

  6. Customization: Riley is designed to be flexible and customizable. It allows users to specify the stake amount, stake percentage, or stake dollars for each trade. Additionally, users can specify the commission amount for each trade, as well as the slippage percentage. This allows for a wide range of backtesting scenarios.

  7. Optimization capabilities: Not yet implemented.

  8. Portfolio Management: Not yet implemented.

  9. Risk Management: Not yet implemented.

  10. Visit the WIKI for more information.

Installation

To install Icarus, follow these steps:

  1. Ensure that you have Python 3.10 or above installed on your system.
  2. Open a terminal or command prompt.
  3. Run the following command to install Riley using pip:
pip install ICARUS-BT

Please visit the INSTALLATION page on the wiki for more information.

Getting Started

To begin using Icarus for backtesting trading strategies, follow the example below:

import Icarus as ic
import strategy as st


# Create an instance of the BacktestEngine
riley = ic.Riley()

# Set Cash Amount
riley.set_cash(10000)

# Fetch data chosen source
data = ic.source.csv('HistoricalData/F.csv')

# Alternatively, pull data from Yahoo Finance
# Also, you can specify the start and end dates

# data = ic.source.PandasDF(data.data)
# data = ic.source.yFinance('F', '2020-01-01', '2020-12-31')

# Add data to the backtest engine
riley.add_data(data)

# Set the ticker for the backtest
riley.set_ticker('F')

#Add the strategy class
riley.set_strategy(st.BollingerBands())

# Set the stake amount
riley.set_stake_quantity(50)

# Alternatively, you can set the stake percentage or the stake dollars
# riley.set_stake_percentage(100)
# riley.set_stake_dollars(1000)

# Add metrics to the backtest engine
riley.add_metric(ic.metrics.SharpeRatio, 'sharpe')
riley.add_metric(ic.metrics.SortinoRatio, 'sortino')

# Run the backtest
riley.run()

# Generate graphical representation of the backtest results
riley.plot()
# riley.plot_bar()

Please visit the RILEY page on the wiki for more information.

Graphical Representation

Icarus provides capabilities to generate graphical representations of backtesting results. This includes visualizations of strategy performance, equity curves, trade signals, and other relevant data. Please visit the GRAPHS page on the wiki for more information.

ICARUS-BT

Candlestick Charts

Icarus provides capabilities to generate candlestick charts for the backtested ticker. This allows users to visualize the price action of the ticker over the backtesting period.

BAR-CHART

Documentation

For more information on how to use Riley, please refer to the WIKI.

License

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

Contributing

Icarus is an open-source project, and contributions are welcome. If you find any issues, have suggestions for improvements, or would like to add new features, please submit a pull request on the GitHub repository, as well as detailed information on what is changed, added, or improved. Please visit the CONTRIBUTING page for more information.

Contact

If you have any questions, suggestions, or feedback, feel free to reach out to the development team at devin.thakker@outlook.com

We hope Icarus proves to be a valuable tool for backtesting and evaluating your trading strategies. Happy trading!

Credits

About

Icarus is a Python package designed to facilitate the backtesting of trading strategies. It provides a framework to simulate and evaluate trading decisions based on historical data.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages