Giter VIP home page Giter VIP logo

backtest_us_portfolio's Introduction

Backtesting my current US stocks portfolio

The whole project is conducted under R, and the library "tidyquant" is heavily utilized.
For a quick starting guide, please refer to the vignette written by Matt Dancho
https://cran.r-project.org/web/packages/tidyquant/vignettes/TQ00-introduction-to-tidyquant.html

This backtest serves as a regular risk monitoring procedure.
As a high-level overview, below are the main steps for the backtest procedure:

  1. Current weight of the portfolio is retrieved
  2. The period for backtesting is set (Default = 3 years)
  3. Daily stock returns over the past 3 years are obtained from yahoo finance
  4. Monthly portfolio returns are calculated from the daily stock returns by the function tq_portfolio()
  5. Some ETFs/indices that serve as benchmarks are chosen and their data is obtained again through yahoo finance
  6. Various performance metrics (e.g. Historical ES, Annualized Sharpe ratio, beta) are calculated by the function tq_performance()
  7. The time series and density plots of the monthly portfolio return are generated by the function ggplot()
  8. The evolution of wealth level is also investigated for both the portfolio and the benchmark indices
  9. Detailed checks are implemented to ensure the above metrics/plots match my personal risk appetite

This project also serves as a building block for the complete portfolio analysis that will be finalized at a later stage.
Possible future projects include:

  1. Forecasting future returns using GARCH type models
  2. Rebalancing the portfolio automatically using certain kinds of indicators
  3. Conducting portfolio optimization using the dynamic programming approach
  4. Conducting portfolio optimization using LSTM or other kinds of RNN structures

backtest_us_portfolio's People

Contributors

thk-cheng avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.