Case Begins: You have recently joined as a Portfolio Manager at Morgan Stanley. The…
- User
Case Begins: You have recently joined as a Portfolio Manager at Morgan Stanley. The first task assigned to you is to create a portfolio for a client who is interested in investing 1 million Euro in secondary markets. He wants the money to be “fully-invested”, but he is not aware of weight allocation in a scientific manner. Your employer has given you the responsibility to not only select the bunch of asset class for investment, but also allocate weight so as to garner more returns with limited risk. After analyzing the market trends, you are bullish in your approach and have narrowed down to the three asset classes for selection of Portfolio Universe.
- Stocks - Google, Tesla, Pfizer, Shell, AT&T
- Forex - USDINR, EURUSD, USDCAD, USDCHF, NZDUSD
- Commodities - Crude, Natural Gas, Gold, Wheat, Ethanol Asset Tickr Google GOOGL Tesla TSLA Pfizer PFE Shell SHEL AT&T T USDINR USDINR EURUSD EURUSD USDCAD USDCAD USDCHF USDCHF NZDUSD NZDUSD Crude WTI Natural Gas NG Gold XAU Wheat W1 Ethanol EH
Note: Portfolio constraints from your supervisor
- Portfolio should consist of 5 assets
- Atleast one from Commodity and one from Forex Historical Price Information To constitute Portfolio you will require the Price series for the selected datasets. For your rescue, the system portal provides an easy way to download the closing price series. You just have to pass your “employee id” to number generator and it will generate the monthly historic price series for you. Note: *Your employee id will be the student id at DCU ** Example - Student Name - Thomas Edison DCU Student No. - 1234567 emp id will be - 1234567 You have to pass on your DCU Student No. value to variable emp_id to generate the price series. Kindly run the code chunk below after passing your Student No. to generate historical price series {r} ####### enter your DCU Student id for the emp id variable emp_id <- 23260775 dig_count <- nchar(emp_id) - 3 rand_numb_init <- emp_id / (10 ^ dig_count) ################ Import date data #################### library(readxl) date_data <- read_excel(“Date.xlsx”) ############ Tickr symbols ##################### tickr_list <- c(“GOOGL”, “TSLA”,“PFE”,“SHELL”,“T”,“USDINR”,“EURUSD”,“USDCAD”,“USDCHF”,“NZDUSD”,“WTI”,“NG”,“XAU”,“W1”,“EH”) #### Historical Price series generation Portfolio Universe ############# set.seed(emp_id) raw_price_data <- matrix(,ncol = 1) multiplier <- seq(from = 3, to = 10, by = 0.5) for (i in 1:length(tickr_list)) { rand_price <- as.data.frame(runif(nrow(date_data), min=rand_numb_init, max= rand_numb_init * sample(multiplier,size = 1,replace = TRUE))) raw_price_data <- cbind(raw_price_data,rand_price) } raw_price_data <- raw_price_data[,-1] colnames(raw_price_data) <- tickr_list ######## Combining all the historical price along with Date ##3 price_data <- cbind(date_data,raw_price_data) writexl::write_xlsx(price_data,“Historical_Price_data.xlsx”) Annual risk-free rate Kindly run the code to generate the annual risk-free rate {r} annual_rf <- abs(rnorm(1,mean = 0, sd = 0.75))/1000 Price to Earning Ratio Kindly run the code to generate P/E ratio {r} ##### Price to Earning Ratio P_E_ratio <- runif(ncol(raw_price_data), min=rand_numb_init * 5, max= rand_numb_init * 5 * sample(multiplier,size = 1,replace = TRUE))/100 names(P_E_ratio) <- tickr_list , Case Detailing Ends , Rest of the questions have to be answered in context of the case study. , Question Begins , Portfolio Universe Selection
- Assistant
- User
- Assistant
- User
Error: unexpected input in "colnames(all_returns_data) <- c(colnames(returns_data), “"
- Assistant
The error you encountered,
Error: unexpected input in "colnames(all_returns_data) <- c(colnames(returns_data), “", typically results from using “curly” or “smart” quotes in your R code instead of the standard, straight quotation marks. In R programming, and most programming languages, it's important to ensure that you're using straight quotes () for string delimiters rather than the curly ones (often automatically formatted by word processors like Microsoft Word or similar text-editing software). - User
In above code the output for Index returns is not proper.....Can you change that a little bit
- Assistant
- User
Now i got min, max, 1.Quartile, 3. Quartile, Mean, Median, Sum and SE Mean for Index Returns
- Assistant
- User
Lets say Goggle's Minimum -1.702226 Maximum 1.405069
- Quartile -0.491493
- Quartile 0.485464 Mean 0.005210 Median 0.016595 Sum 0.797110 SE Mean 0.059108 and index returns -0.442344 0.470482 -0.107439 0.122156 -0.000876 -0.003438 -0.134069 0.012638 .........................comment on it. Note, the answer must state clearly which return measure you are using and the reason for opting that measure as an estimate for return.
- Assistant
- User
- Assistant
- User
Q2. Marks - 10 Portfolio Universe Selection
Since, you have to make a Portfolio constituting of five assets only, you select the assets based on the basis of two strategies as shared below.
Strategy 1:
Step 1: Calculate the Reward to Risk - (Median Return/Standard Deviation)
Step 2: Rank the Reward to Risk for Assets, then choose the top five asset while maintaining the constraint (Atleast one Commodity and one Forex)
Note: In case of tie, you choose the asset with higher mean return.
Strategy 2:
Based on Price/Earning Ratio while maintaining the constraint (Atleast one Commodity and one Forex) Note: After filtering the 5 assets, export the file either as .csv or .xlsx
Insert the code chunk below.
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.