Giter VIP home page Giter VIP logo

nisa-g / capm-web-application-financial-analysis Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 8 KB

This project showcases a web application that is designed to perform CAPM calculations for different stocks. The application uses Python programming language and its libraries such as Pandas, NumPy, Streamlit and Plotly, to gather stock data from Yahoo Finance and perform calculations to determine expected returns.

Python 100.00%
capm financial-analysis financial-data project-data sp500 sp500-data-analysis stock-market streamlit streamlit-webapp

capm-web-application-financial-analysis's Introduction

CAPM Web Application | Financial Analysis Project

โš™๏ธ Tool : Python
๐Ÿ’ป Frameworks : Streamlit
๐Ÿ—‚๏ธ Source Dataset : SP500

๐Ÿ“‚ Project Overview

This project showcases a web application that is designed to perform CAPM calculations for different stocks. The application uses Python programming language and its libraries such as Pandas, NumPy, Streamlit and Plotly, to gather stock data from Yahoo Finance and perform calculations to determine expected returns.



๐Ÿ“‚ Task 1 - Project Understanding

Background Information

CAPM

  • CAPM is a model that describes the relationship between the expected return and risk of securities.
  • CAPM indicates that the expected return on a security is equal to the risk-free return plus a risk premium.


Figure 1 โ€” CAPM Formula


Risk Free Asset Return

  • A risk free asset could be a US Government 10 year Treasury bill.
  • Investors who are extremely risk averse would prefer to buy the risk free asset to protect their money and earn a low return.
  • If investors are interested in gaining more return, they have to bear more risk compared to the risk free asset.

Market Portfolio Return

  • Market portfolio includes all securities in the market. A good representation of th emarket portfolio is the S&P 500.
  • Market portfolio return is the average return of the overall return of the SP500.

Beta

It is a measure of a stock's risk (volatility of returns) reflected by measuring the fluctuation of its price changes relative to the overall market.

รŸ = 0: No Market Sensitivity
รŸ < 1: Low Market Sensitivity
รŸ = 1: Same as Market (Neutral)
รŸ > 1: High Market Sensitivity
รŸ < 0: Negative Market Sensitivity

Project Objective:

  • To develop a wep application for CAPM financial model analysis.
  • To evaluate the risk associated with different investment options by using CAPM to calculate the expected rate of return for each investment.

๐Ÿ“‚ Task 2 - Development of Web Application

Background Information

We developed a web application using Python with Streamlit framework to quickly create interactive and data-driven web application. Streamlit is known for its simplicity and ease of use, making it a best choice for us looking to deploy data applications without extensive web development expertise. Here's the methodology to develop the web application using Streamlit:

1. Application Code:

  • Create CAPM_Returns.py and capm_funtions.py to write the code for our web application.
  • Import the necessary libraries, including streamlit, pandas, yfinance, datetime and pandas-datareader.
  • Define the layout and functionality of our application, including text inputs.

2. Data Integration:

  • Get input from user and download data for SP500.
  • Create functions to normalize prices based on the initial price, calculate daily returns and beta value.

3. Run Application:

  • Open cmd terminal, navigate to our project directory, and run the application using streamlit run CAPM_Returns.py

๐Ÿ“‚ Task 3 - Web Deployment

Result

Click to view full code of CAPM Return

Click to view full code of CAPM Functions


Figure 2 โ€” Dataframe head and dataframe tail with 4 selected stocks (Tesla, Apple, Amazon & Google).




Figure 3 โ€” Price of all stocks before and after normalizing.




Figure 4 โ€” Calculated Beta value and CAPM return value.


capm-web-application-financial-analysis's People

Contributors

nisa-g avatar

Stargazers

 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.