Skip to content

A Python project that simulates a portfolio backtest using an equal-weighted long and short portfolio determined by 12-month returns.

Notifications You must be signed in to change notification settings

sapk806/cross_sectional_factor_backtest_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cross Sectional Factor Backtest

Overview

My project gathers the 12-month returns of assets using Yahoo Finance tickers and uses the returns to decide which assets to go long or go short on.

Dependencies

  • Python 3.13+
  • pandas
  • numpy
  • matplotlib
  • yfinance
  • jupyter

How to Run

  • Activate the virtual environment with the required packages and run the script in the main.py file:
  1. Activate the virtual environment.
source .venv/bin/activate
  1. Install dependencies.
pip install -r requirements.txt
  1. Run the full backtest.
python main.py

Output

  • Plot of cumulative return at each date, with drawdowns filled in when the highest return seen at the date is higher than the current cumulative return.
  • Performance metrics
    • Cumulative return
    • Sharpe ratio
    • Max drawdown
    • t-value

About

A Python project that simulates a portfolio backtest using an equal-weighted long and short portfolio determined by 12-month returns.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published