Earn Higher Grades With Instant Assignment Help.Ask Question!

Python Programming
(5/5)

Attached are two raw data files you will use. They are directly downloaded from third party, so please do not redistribute. These two files have exactly same format, except two different periods

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Programming Test in Python

Data

Attached are two raw data files you will use. They are directly downloaded from third party, so please do not redistribute. These two files have exactly same format, except two different periods. You need to link them together and use an overlap period – the months that exists in both files.

Columns: Each column actually represent one security. I will refer to those securities as to “Sectors”. Let’s use the first bucket “Years to Maturity (15,15.25)” as example. It has two/three securities: coupon bond, principle bond, and other. The “total” columns are not useful in this exercise.

Tabs: Each tab is one characteristics of this security you will use. It represents: Weights in benchmark, Maturity, Duration, Yield and Return.

Using Raw Data 2 as example, 2/26/1999, there is one sector with weight 1.88390%, maturity of 15.21, duration of 14.77, yield at “5.986%”; and it is a “coupon bond”. It had a return from 2/26/1999-3/31/1999 equal to -0.09%. So if you collect each of these sector characteristics  for the same month, you should be able to calculate benchmark return for March, benchmark duration, benchmark sector weights for total coupon bonds, total principle bonds, total weights in maturity 15-20 year, etc.

 

Task 1: Benchmark return and risk

Assume RawData1 file contains data for benchmark 1; and RawData2 file contains data for benchmark 2. Compute the following and save in easy-to-compare CSV file. The CSV file will have three columns:

  1. Metric name
  2. Benchmark 1
  3. Benchmark 2

You have to compute the following metrics for each of benchmark:

  1. Annualized return
  2. Annualized volatility (standard deviation)
  3. Ratio of months with positive returns to all months
  4. Maximum drawdown

Note 1: each item from above will go to the column one of the CSV file. For instance,

Metric name

Benchmark 1

Benchmark 2

Annualized return

0.037521

-0.011256

Annualized volatility

0.012345

0.098765

 

 

 

Note 2: use an overlap period – the months that exists in both files – to compute these metrics.

Note 3: use all – coupon, principal, and other bonds.

Note 4: to compute one month return, you need to weight returns. In the example above with RawData2 file, the sector with weight=1.88390% and return=-0.09% contributed to the monthly return as (1.88390)/100 * (-0.09)/100. In other words, the formula for monthly return is

, where

 

Task 2: Time series analysis

Compute and plot for each benchmark:

  • monthly returns
  • average 12-month moving average return

Compute and show as a single number(s):

  • beta of the benchmark 2 returns to the benchmark 1 returns.
  • Spearman correlation between the two benchmark monthly returns

 

Task 3: Optimization

 

  1. For each sector calculate “Roll down expected return”.

Roll down expected return of sector A = (Yield of sector A –Yield of sector B )/(Maturity of sector A-Maturity of sector B)* Duration of sector A.

Sector B is the sector with shorter maturity. To find one you need to compare maturity of sector in the RawData1 file vs maturity of sector in the RawData2 file.

Compute separately for coupon, principal, and other bucket. Of course, the roll down expected return can be computed only if the data exist in both files. If not, ignore that sector / date combination.

Save the results in CSV file. Choose your own file structure.

 

The following is for extra credit:

  1. Objective of the optimization is to create a portfolio for each month with highest weighted average roll down expected return.
  2. Constraints:
  3. Total weights for Coupon bonds or Principle bonds cannot be more than 5% different.
  4. You have to bucket all the bonds into maturity buckets (15-17.5, 17.5-20, 20-22.5, 22.5-25, 25-27.5, 27.5-30) each bucket weights cannot be more than 5% different as well. Or weighted average duration of each bucket, cannot be more than 2 year difference. You can play with the constraints. Use some parameters file, so you can change the constraints easier.
  5. Total weighted average duration has to match benchmark total weighted average duration.
  6. Control turnover, monthly turnover can not be higher than 5%.
  7. If you assume coupon bond bid/ask yield is 5bps, and principle bond bid/ask yield spread is 3bps, times the duration of the bond, you can calculate trading cost. Taking into account the trading cost in your optimization to minimize trading cost.
  8. The output, using 2/1999 optimized weights to calculate March 1999 return. Comparing that with index return.

The optimization objective: Ideally we can create an optimized portfolio which deliver better return than benchmark, the standard deviation of the return difference each month is less than 50bps.

assignment on finance

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
907 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
933 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
692 Answers Hire Me