xuebaunion@vip.163.com

3551 Trousdale Rkwy, University Park, Los Angeles, CA

留学生论文指导和课程辅导

无忧GPA：https://www.essaygpa.com

工作时间：全年无休-早上8点到凌晨3点

扫码添加客服微信

扫描添加客服微信

Python代写-FE630

时间：2020-12-18

FE630 Portfolio Theory and Applications

Final Project

Due date for the project: December 22nd, 2020

Prof. Papa Momar Ndiaye

December 1, 2020

1

FE630 Portfolio Theory and Application Final Project

1 Overview

This project aims 1) to build a factor-based model allocation namely a Long/Short

Global Macro Strategy with a Target Beta and 2) to evaluate its sensitivity to

variations of Beta and its sensitivity to the length of the estimators for covariance

matrix and the expected returns under different market scenarios.

Students may work individually or in small teams (typically up to 3 peo-

ple). Each team is required to build an investment strategy that maxi-

mizes the return of the portfolio subject to a constraint of target Beta,

where Beta is the usual single factor Market risk measure. The port-

folio will be weekly reallocated (re-optimized every week to generate

new weights) from March 2007 to end of November 2020. For practical

considerations, we will assume that our universe of investment is a set of ETFs

large enough to represent the World global economy and that our factor model

is the French Fama 3-factor model. The data needed for the project are freely

available for download from Ken French’s website for the factors historical val-

ues (http://mba.tuck.dartmouth.edu/pages/faculty/ken.french) and from Quandl

(www.quandl.com) or yahoo for the ETFs.

The performance and the risk profiles of such a strategy may be very sensitive

to the target Beta and the market environment. A low Beta meaning a strategy

that aims to be de-correlated to the global market represented by the S&P 500,

while a high Beta meaning that, having a big appetite for risk, we are aiming

to ride or scale up the market risk. In addition to that, such a strategy is likely

to to be quite sensitive to the estimators used for the Risk Model and the Alpha

Model (for example the length of the look-back period used for estimation risk and

expected returns), so it is important to understand the impact of those estimators

on the Portfolio’s characteristics: realized return, volatility, skewness, VaR/ CVaR

and risk to performance ratios such as the Sharpe ratio.

To simplify, we will assume in this project that once the factor model built, we

will use trend following estimators for the Expected returns, namely the sample

mean and the sample covariance. As the quality of those sample estimators depend

on the length of the look-back period, we will typically consider 3 cases: a long look-

back period ( ≥ 120 days), a short look-back period ( ≤ 40 days) and a medium

look-back period, and use the notational conventions Long-Term estimators (LT),

Short-Term estimators (ST) and Mid-Term estimators (MT), defining therefore a

Term-Structure for the Covariance and Expected Return. A similar remark on

the dependance on the look-back period can be made for the estimation of the

coefficients of the model as they are computed using a regression on the factors.

Consequently, a central question is to assess properly the impact of the length of

2

FE630 Portfolio Theory and Application Final Project

those regression-based estimators on the realized performance and risk indicators

of the optimized portfolio.

In summary, the behavior of the optimal portfolio built from a specific com-

bination of estimators for Covariance and Expected Return may change with the

Market environment and the target Beta (a particular strategy being defined by a

specific combination, for example S9060(0.5) - say using 60 days for estimation of co-

variance, 90 days for estimation of Expected Returns and a target β = 0.5). The

goal of this project is to understand, analyze and compare the behavior

of strategies built using chosen combinations of return/risk estimators

and Target Beta during several historical periods : before the subprime

(2008) crisis, during that crisis and after the crisis. The factor model

we will use, known as the French Fama 3-factor model has 3 factors,

Momentum, Value and Size.

2 Investment Strategy

We will consider an portfolio optimization problem of the form:

max

ω∈Rn

ρTω − λ(ω − ωp)TΣ(ω − ωp)

n∑

i=1

βmi ωi = β

m

T

n∑

i=1

ωi = 1, −2 ≤ ωi ≤ 2,

(1)

where

• Σ is the the covariance matrix between the securities returns (computed from

the Factor Model), ωp is the composition of a reference Portfolio (the previous

Portfolio when rebalancing the portfolio and ωp has all its components equal

to 1/n for the first allocation) and λ is a small regularization parameter to

limit the turnover;

• βmi =

cov(ri, rM)

σ2(rM)

is the Beta of security Si as defined in the CAPM Model

so that βmP =

n∑

i=1

βmi ωi is the Beta of the Portfolio;

• βmT is the Portfolio’s Target Beta, for example βmT = −1, βmT = −0.5, βmT = 0,

βmT = 0.5, β

m

T = 1, β

m

T = 1.5.

3

FE630 Portfolio Theory and Application Final Project

The French Fama factor models are well documented in the literature but

reminded here for reference. For instance, under the 3-factor model, the random

return of a security is given by the formula

ri = rf + β

3

i (rM − rf ) + bsirSMB + bvi rHML + αi + εi (2)

with E(εi) = 0 in such a way that we have in terms of Expected Returns

ρi = rf + β

3

i (ρM − rf ) + bsiρSMB + bvi ρHML + αi. (3)

In equation (2), the 3 coefficients β3i , b

s

i and b

v

i and estimated by making a linear

regression of the time series yi = ρi−rf against the time series ρM−rf (Momentum

Factor), rSMB (Size Factor) and ρHML (Value Factor)

1. Note that in general

βmi 6= β3i and needs to be estimated by a separated regression or computed directly.

3 Investment Universe and Analysis Setup

3.1 Investment Universe

We will consider the following set of ETFs that you can download from Yahoo,

Google or Quandl from March 1st, 2007 to June 30th, 2020.

1. CurrencyShares Euro Trust (FXE)

2. iShares MSCI Japan Index (EWJ)

3. SPDR GOLD Trust (GLD)

4. Powershares NASDAQ-100 Trust (QQQ)

5. SPDR S&P 500 (SPY)

6. iShares Lehman Short Treasury Bond (SHV)

7. PowerShares DB Agriculture Fund (DBA)

8. United States Oil Fund LP (USO)

9. SPDR S&P Biotech (XBI)

10. iShares S&P Latin America 40 Index (ILF)

11. iShares MSCI Pacific ex-Japan Index Fund (EPP)

12. SPDR DJ Euro Stoxx 50 (FEZ)

1ρM for Market hence Momentum, ρSMB for Small minus Big and ρHML for High minus Low

4

FE630 Portfolio Theory and Application Final Project

3.2 Benchmark

The benchmark will be the Market Portfolio S&P 500 ( SPY ETF)

3.3 Analysis Periods and Bactkesting

• Divide the overall analysis period into 3 sub-periods: before, during and after

the subprime crisis.

• Run separate backtests for each sub-period when comparing strategies. Note

that there are different angles for such comparison: (1) Impact of Beta Target

on a given Term-Structure: compare S20040 (βT1) to S

200

40 (βT2) or (2) impact

of various term structure given Beta: for example, compare S20040 (0.5) to

S9040(0.5).

• Run also a comparison over the whole period from March 1st, 2007 to Novem-

ber 30th, 2019.

• For your backtesting, rebalance your portfolios once a week.

3.4 Performance and Risk Reporting for comparing Strategies

Use a Performance Analytics Module in R, Matlab or Python as much as possible

for the Risk and Performance Reporting. Below is the list of Key Indicators to

report your Optimal Strategies. All daily indicators will be annualized assuming

that each year has 250 business days. For example, the Reporting for a Strategy

over a given period (example: from 03/01/1997 to 12/30/2008) will be provided

by a summarizing Table with the following lines

• Cumulated PnL or Return

• Daily Mean Arithmetic / Geometric Return, Daily Min Return

• Max 10 days Drawdown

• Volatility

• Sharpe Ratio

• Skewness, Kurtosis

• Modified VaR, CVaR

In addition to that table:

5

FE630 Portfolio Theory and Application Final Project

1. Plot the evolution the graph of cumulated daily Profit and Loss (PnL) as-

suming that you invest $100 at the first allocation date in Portfolio and $100

in the S&P 500 (when you benchmark your strategies against the Market,

the SPY is representing the S&P500 Index).

2. Plot and analyze the distribution of daily Returns.

3. A summarizing Table with the following lines for comparison with the un-

derlying

For comparison with between the strategies and the S&P, a summary table

may look like:

S9060(β

m

T = 0.5) S

30

120(β

m

T = 1) S

90

180(β

m

T = 0) SPY

Mean Return 12

...

Max DD 8

3.5 Tools

• Data can be downloaded from R, Matlab or Python using the APIs provided

by Quandl. Alternatively, you may use native functions when available,

for example in R, ”get.hist.quote”2, or ”get data yahoo” using Pandas in

Python.

• The strategies will be implemented using the Quadratic Solver in R, Matlab

or Python.

4 Submission of the Final Report

You have to submit the following.

1. A final report can be a Word, Latex File or PPT slides presenting your

findings and conclusions about the impact of the estimators on the behavior

of your strategy, and also what kind of estimators would recommend to use,

when and why (before, during and after the crisis). So to repeat again, a

global period of backtest from 2007 to November 2018, with 3 sub-periods

(before, during and after the crisis) and 2 axes of analysis: sensitivity to

the term-structure of estimators (short-term, mid-term and long-term) for

covariance and expected returns and sensitivity to β.

2 fxe < −get.hist.quote(instrument = ”fxe”, start = ”2007− 01− 01”, end = ”2018− 12−

01”, quote = ”Close”)

6

FE630 Portfolio Theory and Application Final Project

2. The report should contain a clear description of the notations, models and

strategies you have analyzed, the graphs and summarizing tables supporting

your quantitative and qualitative analysis. You can include a brief descrip-

tion of the computational engine you have built but should not include any

code or Rmarkdown output.

3. It is mandatory to submit also the code developed for the project (R, Matlab,

Python or other) and all supporting graphs, tables and simulation results in

a Zip file. The code should ready to run when unzipped and with minimal

directions to the evaluators. The submitted code will be tested for compar-

ison and it is a requirement to build your code in a modular and clearly

documented manner..

Appendix

A Practical aspects

For estimation of the parameters of the factor model, you can use a cross sectional

regression model by gathering all the individual securities model in a single ”big”

factor model. If you assume, that you have 3 factors, then the model at time t for

each asset is given by

reit = αi + β

3

i (rMt − rft) + bsirSMBt + bvi rHMLt + αi + εit (4)

with reit = rit− rft, and moreover the εit are independent of the factors and satisfy

cov(εit, εjs) =

{

σ2i when i = j, and t = s

0 otherwise.

A.1 Time Series Model for a given Security

If we consider T observations of the excess return of Security Si stacked in a column

vector Ri =

rei1

rei2

...

reiT

, we have the time series regression model for Security i:

Ri = 1Tαi + Fβi + εi for i = 1, 2, . . . n (5)

where

7

FE630 Portfolio Theory and Application Final Project

• βi =

β3ibsi

bvi

is the (3 by 1) vector of Betas

• F =

f

′

1

...

f

′

T

=

rM1 − rf1 rSMB1 rHML1... . . . ...

rMT − rfT rSMBT rHMLT

is the is the (T x 3) matrix of

observations of the factors.

• the residual term εi is a (T by 1) vector satisfying E(εiε

′

i) = σ

2

i IT

The previous model is well-suited for a regression to estimate the coefficients of

the model using data for the securities and the factors.

A.2 Cross Sectional Model

Alternatively, we can use a cross sectional formulation that can be useful for risk

analysis including the derivation of the covariance matrix of the returns. If we

define Rt =

re1t

re2t

...

rent

, the vector of all Securities excess returns at time t, then we

can write

Rt = α + Bft + εt for t = 1, 2, . . . T, (6)

where

• B

β

′

1

β

′

2

...

β

′

n

=

β

3

1 b

s

1 b

v

1

...

. . .

...

β3n b

s

n b

v

n

is a N by 3 matrix,

• ft =

rMt − rf1rSMBt

rHMLt

is the vector of factor returns at time t.

• E(εtε

′

t|ft) = D = diag(σ21, . . . , σ2n)

The cross sectional model implies that if Ωf is the covariance of the factors, then

cov(Rt) = BΩfB

′

+D (7)

which implies that

cov(Rit) = βiΩfβi + σ

2

I (8)

and

cov(Rit, Rjt) = βiΩfβj (9)

8

Final Project

Due date for the project: December 22nd, 2020

Prof. Papa Momar Ndiaye

December 1, 2020

1

FE630 Portfolio Theory and Application Final Project

1 Overview

This project aims 1) to build a factor-based model allocation namely a Long/Short

Global Macro Strategy with a Target Beta and 2) to evaluate its sensitivity to

variations of Beta and its sensitivity to the length of the estimators for covariance

matrix and the expected returns under different market scenarios.

Students may work individually or in small teams (typically up to 3 peo-

ple). Each team is required to build an investment strategy that maxi-

mizes the return of the portfolio subject to a constraint of target Beta,

where Beta is the usual single factor Market risk measure. The port-

folio will be weekly reallocated (re-optimized every week to generate

new weights) from March 2007 to end of November 2020. For practical

considerations, we will assume that our universe of investment is a set of ETFs

large enough to represent the World global economy and that our factor model

is the French Fama 3-factor model. The data needed for the project are freely

available for download from Ken French’s website for the factors historical val-

ues (http://mba.tuck.dartmouth.edu/pages/faculty/ken.french) and from Quandl

(www.quandl.com) or yahoo for the ETFs.

The performance and the risk profiles of such a strategy may be very sensitive

to the target Beta and the market environment. A low Beta meaning a strategy

that aims to be de-correlated to the global market represented by the S&P 500,

while a high Beta meaning that, having a big appetite for risk, we are aiming

to ride or scale up the market risk. In addition to that, such a strategy is likely

to to be quite sensitive to the estimators used for the Risk Model and the Alpha

Model (for example the length of the look-back period used for estimation risk and

expected returns), so it is important to understand the impact of those estimators

on the Portfolio’s characteristics: realized return, volatility, skewness, VaR/ CVaR

and risk to performance ratios such as the Sharpe ratio.

To simplify, we will assume in this project that once the factor model built, we

will use trend following estimators for the Expected returns, namely the sample

mean and the sample covariance. As the quality of those sample estimators depend

on the length of the look-back period, we will typically consider 3 cases: a long look-

back period ( ≥ 120 days), a short look-back period ( ≤ 40 days) and a medium

look-back period, and use the notational conventions Long-Term estimators (LT),

Short-Term estimators (ST) and Mid-Term estimators (MT), defining therefore a

Term-Structure for the Covariance and Expected Return. A similar remark on

the dependance on the look-back period can be made for the estimation of the

coefficients of the model as they are computed using a regression on the factors.

Consequently, a central question is to assess properly the impact of the length of

2

FE630 Portfolio Theory and Application Final Project

those regression-based estimators on the realized performance and risk indicators

of the optimized portfolio.

In summary, the behavior of the optimal portfolio built from a specific com-

bination of estimators for Covariance and Expected Return may change with the

Market environment and the target Beta (a particular strategy being defined by a

specific combination, for example S9060(0.5) - say using 60 days for estimation of co-

variance, 90 days for estimation of Expected Returns and a target β = 0.5). The

goal of this project is to understand, analyze and compare the behavior

of strategies built using chosen combinations of return/risk estimators

and Target Beta during several historical periods : before the subprime

(2008) crisis, during that crisis and after the crisis. The factor model

we will use, known as the French Fama 3-factor model has 3 factors,

Momentum, Value and Size.

2 Investment Strategy

We will consider an portfolio optimization problem of the form:

max

ω∈Rn

ρTω − λ(ω − ωp)TΣ(ω − ωp)

n∑

i=1

βmi ωi = β

m

T

n∑

i=1

ωi = 1, −2 ≤ ωi ≤ 2,

(1)

where

• Σ is the the covariance matrix between the securities returns (computed from

the Factor Model), ωp is the composition of a reference Portfolio (the previous

Portfolio when rebalancing the portfolio and ωp has all its components equal

to 1/n for the first allocation) and λ is a small regularization parameter to

limit the turnover;

• βmi =

cov(ri, rM)

σ2(rM)

is the Beta of security Si as defined in the CAPM Model

so that βmP =

n∑

i=1

βmi ωi is the Beta of the Portfolio;

• βmT is the Portfolio’s Target Beta, for example βmT = −1, βmT = −0.5, βmT = 0,

βmT = 0.5, β

m

T = 1, β

m

T = 1.5.

3

FE630 Portfolio Theory and Application Final Project

The French Fama factor models are well documented in the literature but

reminded here for reference. For instance, under the 3-factor model, the random

return of a security is given by the formula

ri = rf + β

3

i (rM − rf ) + bsirSMB + bvi rHML + αi + εi (2)

with E(εi) = 0 in such a way that we have in terms of Expected Returns

ρi = rf + β

3

i (ρM − rf ) + bsiρSMB + bvi ρHML + αi. (3)

In equation (2), the 3 coefficients β3i , b

s

i and b

v

i and estimated by making a linear

regression of the time series yi = ρi−rf against the time series ρM−rf (Momentum

Factor), rSMB (Size Factor) and ρHML (Value Factor)

1. Note that in general

βmi 6= β3i and needs to be estimated by a separated regression or computed directly.

3 Investment Universe and Analysis Setup

3.1 Investment Universe

We will consider the following set of ETFs that you can download from Yahoo,

Google or Quandl from March 1st, 2007 to June 30th, 2020.

1. CurrencyShares Euro Trust (FXE)

2. iShares MSCI Japan Index (EWJ)

3. SPDR GOLD Trust (GLD)

4. Powershares NASDAQ-100 Trust (QQQ)

5. SPDR S&P 500 (SPY)

6. iShares Lehman Short Treasury Bond (SHV)

7. PowerShares DB Agriculture Fund (DBA)

8. United States Oil Fund LP (USO)

9. SPDR S&P Biotech (XBI)

10. iShares S&P Latin America 40 Index (ILF)

11. iShares MSCI Pacific ex-Japan Index Fund (EPP)

12. SPDR DJ Euro Stoxx 50 (FEZ)

1ρM for Market hence Momentum, ρSMB for Small minus Big and ρHML for High minus Low

4

FE630 Portfolio Theory and Application Final Project

3.2 Benchmark

The benchmark will be the Market Portfolio S&P 500 ( SPY ETF)

3.3 Analysis Periods and Bactkesting

• Divide the overall analysis period into 3 sub-periods: before, during and after

the subprime crisis.

• Run separate backtests for each sub-period when comparing strategies. Note

that there are different angles for such comparison: (1) Impact of Beta Target

on a given Term-Structure: compare S20040 (βT1) to S

200

40 (βT2) or (2) impact

of various term structure given Beta: for example, compare S20040 (0.5) to

S9040(0.5).

• Run also a comparison over the whole period from March 1st, 2007 to Novem-

ber 30th, 2019.

• For your backtesting, rebalance your portfolios once a week.

3.4 Performance and Risk Reporting for comparing Strategies

Use a Performance Analytics Module in R, Matlab or Python as much as possible

for the Risk and Performance Reporting. Below is the list of Key Indicators to

report your Optimal Strategies. All daily indicators will be annualized assuming

that each year has 250 business days. For example, the Reporting for a Strategy

over a given period (example: from 03/01/1997 to 12/30/2008) will be provided

by a summarizing Table with the following lines

• Cumulated PnL or Return

• Daily Mean Arithmetic / Geometric Return, Daily Min Return

• Max 10 days Drawdown

• Volatility

• Sharpe Ratio

• Skewness, Kurtosis

• Modified VaR, CVaR

In addition to that table:

5

FE630 Portfolio Theory and Application Final Project

1. Plot the evolution the graph of cumulated daily Profit and Loss (PnL) as-

suming that you invest $100 at the first allocation date in Portfolio and $100

in the S&P 500 (when you benchmark your strategies against the Market,

the SPY is representing the S&P500 Index).

2. Plot and analyze the distribution of daily Returns.

3. A summarizing Table with the following lines for comparison with the un-

derlying

For comparison with between the strategies and the S&P, a summary table

may look like:

S9060(β

m

T = 0.5) S

30

120(β

m

T = 1) S

90

180(β

m

T = 0) SPY

Mean Return 12

...

Max DD 8

3.5 Tools

• Data can be downloaded from R, Matlab or Python using the APIs provided

by Quandl. Alternatively, you may use native functions when available,

for example in R, ”get.hist.quote”2, or ”get data yahoo” using Pandas in

Python.

• The strategies will be implemented using the Quadratic Solver in R, Matlab

or Python.

4 Submission of the Final Report

You have to submit the following.

1. A final report can be a Word, Latex File or PPT slides presenting your

findings and conclusions about the impact of the estimators on the behavior

of your strategy, and also what kind of estimators would recommend to use,

when and why (before, during and after the crisis). So to repeat again, a

global period of backtest from 2007 to November 2018, with 3 sub-periods

(before, during and after the crisis) and 2 axes of analysis: sensitivity to

the term-structure of estimators (short-term, mid-term and long-term) for

covariance and expected returns and sensitivity to β.

2 fxe < −get.hist.quote(instrument = ”fxe”, start = ”2007− 01− 01”, end = ”2018− 12−

01”, quote = ”Close”)

6

FE630 Portfolio Theory and Application Final Project

2. The report should contain a clear description of the notations, models and

strategies you have analyzed, the graphs and summarizing tables supporting

your quantitative and qualitative analysis. You can include a brief descrip-

tion of the computational engine you have built but should not include any

code or Rmarkdown output.

3. It is mandatory to submit also the code developed for the project (R, Matlab,

Python or other) and all supporting graphs, tables and simulation results in

a Zip file. The code should ready to run when unzipped and with minimal

directions to the evaluators. The submitted code will be tested for compar-

ison and it is a requirement to build your code in a modular and clearly

documented manner..

Appendix

A Practical aspects

For estimation of the parameters of the factor model, you can use a cross sectional

regression model by gathering all the individual securities model in a single ”big”

factor model. If you assume, that you have 3 factors, then the model at time t for

each asset is given by

reit = αi + β

3

i (rMt − rft) + bsirSMBt + bvi rHMLt + αi + εit (4)

with reit = rit− rft, and moreover the εit are independent of the factors and satisfy

cov(εit, εjs) =

{

σ2i when i = j, and t = s

0 otherwise.

A.1 Time Series Model for a given Security

If we consider T observations of the excess return of Security Si stacked in a column

vector Ri =

rei1

rei2

...

reiT

, we have the time series regression model for Security i:

Ri = 1Tαi + Fβi + εi for i = 1, 2, . . . n (5)

where

7

FE630 Portfolio Theory and Application Final Project

• βi =

β3ibsi

bvi

is the (3 by 1) vector of Betas

• F =

f

′

1

...

f

′

T

=

rM1 − rf1 rSMB1 rHML1... . . . ...

rMT − rfT rSMBT rHMLT

is the is the (T x 3) matrix of

observations of the factors.

• the residual term εi is a (T by 1) vector satisfying E(εiε

′

i) = σ

2

i IT

The previous model is well-suited for a regression to estimate the coefficients of

the model using data for the securities and the factors.

A.2 Cross Sectional Model

Alternatively, we can use a cross sectional formulation that can be useful for risk

analysis including the derivation of the covariance matrix of the returns. If we

define Rt =

re1t

re2t

...

rent

, the vector of all Securities excess returns at time t, then we

can write

Rt = α + Bft + εt for t = 1, 2, . . . T, (6)

where

• B

β

′

1

β

′

2

...

β

′

n

=

β

3

1 b

s

1 b

v

1

...

. . .

...

β3n b

s

n b

v

n

is a N by 3 matrix,

• ft =

rMt − rf1rSMBt

rHMLt

is the vector of factor returns at time t.

• E(εtε

′

t|ft) = D = diag(σ21, . . . , σ2n)

The cross sectional model implies that if Ωf is the covariance of the factors, then

cov(Rt) = BΩfB

′

+D (7)

which implies that

cov(Rit) = βiΩfβi + σ

2

I (8)

and

cov(Rit, Rjt) = βiΩfβj (9)

8