First Finance Project
$30-250 CAD
Paid on delivery
You are required to follow the steps below and hand in *.ipynb and *html versions of your Jupyter notebook.
Import packages as follows:
import [login to view URL] as plt
import numpy as np
import pandas as pd
Download from [login to view URL] data on SPY, Apple (AAPL) and JP Morgan (JPM) between 2014-08-18 and 2019-08-15
Print the first five rows of SPY.
Plot SPY’s adjusted close starting from 2019-01-01.
Plot Apple’s adjusted close starting from 2019-01-01.
Calculate daily returns from the adj close for SPY and the two other stocks. Then show the first five returns. Use pandas.DataFrame.pct_change()
Repeat the exercise above by defining your own function called ‘percent_change” that takes any pandas series of type integer or float as input and outputs the percentage change between each consecutive pair of elements in the input as a numpy array. Use this function to create a new column ‘percent_change’ in the original dataset.
Calculate the beta for Apple as the slope when Apple’s returns are regressed against SPY’s returns. You can either use the formula for the slope in a linear regression or import Python’s linear regression model. The instruction for the latter is:
from sklearn.linear_model import LinearRegression as LR
Denote the first 100 returns in the data set as “historical” and the rest as “future”
Using historical data, calculate the mean and standard deviation of the returns for JPM and AAPL. Hint: Look up [login to view URL]() and [login to view URL]()
Calculate the correlation between the historical returns of JPM and AAPL. Hint lookup [login to view URL]()
Construct a portfolio consisting of Apple and JP Morgan. Using future returns, calculate the mean and standard deviation of returns when the weight of the first stock in the portfolio is w and the weight of the second stock in the portfolio is 1-w. Consider w values of 0.2, 0.4, 0.6, and 0.8
Calculate the Sharpe ratio assuming zero risk-free rate (so that the Sharpe ratio = mean return/SD return) for the future returns of each stock and for the four portfolios where w = 0.2, 0.4, 0.6, and 0.8.
Project ID: #27444162
About the project
Awarded to:
Hi there, I see you need to find a Python programmer. I can help you with this. Hope to see your response.
2 freelancers are bidding on average $100 for this job
Hello Potential Client. I am professional software developer with 10 years experiences of DataMining, Padans and Python. I have developed many Project. I can start working right now and can do it successfully. I’m wait More