Dhruv Toshniwal

Real-Time Data Processing with the Quant Back-testing Framework

June 2023

Real-Time Data Processing with the Quant Back-testing Framework

Project Overview

This project demonstrates a Python script for backtesting a trading strategy using historical stock price data. The strategy is based on a simple moving average (SMA) crossover and relative strength index (RSI) conditions.

Key Features

  • Fetches historical stock price data from Yahoo Finance
  • Calculates technical indicators like SMA and RSI using pandas_ta
  • Implements a strategy based on SMA crossover and RSI conditions
  • Executes buy and sell orders using the backtrader framework
  • Computes performance metrics including:
    • Final portfolio value
    • Sharpe Ratio
    • Drawdown
  • Saves the equity curve plot as an image file

Project Requirements

To run the project, install the following libraries:

  • pip install backtrader
  • pip install yfinance
  • pip install pandas_ta
  • pip install matplotlib

Getting Started

  1. Clone the repository: git clone https://github.com/DhruvAjayToshniwal/Quant-Backtesting-Framework-v1.0.git
  2. Install required libraries
  3. Customize the script with preferred stock symbol, date range, and strategy parameters
  4. Run the script and review backtest results

Output

The backtest script generates:

  • Final Portfolio Value
  • Performance Metrics
  • Equity Curve Plot (saved as equity_curve.png)

Acknowledgements

This project leverages documentation from:

For more details, explore the GitHub repository.