Code Monkey home page Code Monkey logo

equal_weight_portfolio_backtest's Introduction

Equal_Weight_Portfolio_Backtester

OBJECTIVE

A Web Application built by streamlit package which rebalances daily the weights of stocks, commodities, FX, ETFs etc. Then calculates return and maximum drawdown and plots them while comparing to a base portfolio. Also has the options for weekly and monthly investments, reinvest a certain amount when the portfolio loses some percentage etc. You can see screenshots of frontend of the web application below.

PHOTOS

Photo_1

This is an image

Photo_2

This is an image

INPUT PARAMETERS

Stock list: the name of the stocks, etfs etc. you want to include in your portfolio.
Comparison list: the name of the stocks, etfs etc. you want to compare your portfolio.
Start date: start date of backtesting
Stop date: stop date of backtesting
Initial amount: initial amount of portfolio
Reinvestment option: It can be ‘percentage’ or ‘constant’. If it is set as ‘percentage’ whenever total portfolio falls below reinvestment threshold, it will reinvest lost amount. If it is set as ‘constant’, it will reinvest a constant amount which is set by ‘reinvestment amount’.
Reinvestment threshold: percentage threshold for reinvestment amount. Whenever total portfolio value loses that much percentage, the script will reinvest by the method selected in ‘reinvestment option’.
Reinvestment amount: if you set ‘reinvestment option’ as ‘constant’, whenever portfolio falls below threshold percentage, the script will reinvest that constant amount. If ‘reinvestment option’’ is set as ‘percentage’, this amount will have no effect.
Below initial percentage: Whenever, you are reinvesting with constant amount, it will increase that constant amount by ‘below initial percentage’ percent for each loss below initial amount.
Weekly amount: weekly periodic constant investment amount
Monthly amount: monthly periodic constant investment amount

OUTPUT DATA COLUMNS

Date: date
Price_X: price of the X stock
X_size: USD amount of X stock in the portfolio
Total_value: total value of the portfolio
Periodic_reinvestment: weekly or monthly periodic investments
Reinvestment_due_to_loss: Amount of reinvestment whenever loss exceeds the threshold
X_change: Amount of change made in the X stock by the script. If it is positive, then the script has bought the stock, if it is negative, then the script has sold the stock.
Total_value_percentage: total value of the portfolio in percentages compared to initial amount
Drawdown: Maximum drawdown of the portfolio

equal_weight_portfolio_backtest's People

Contributors

efeakm 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.