Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eigen Portfolio construction via PCA (75/100) #4

Closed
joelowj opened this issue Jul 25, 2018 · 1 comment
Closed

Eigen Portfolio construction via PCA (75/100) #4

joelowj opened this issue Jul 25, 2018 · 1 comment

Comments

@joelowj
Copy link
Owner

joelowj commented Jul 25, 2018

Current submission

Asset Returns Calculation 15/15
Calculate Variances of Returns 15/15
Eigen Portfolio Weights 15/15
Second Eigen Portfolio Weights 15/15
Eigen Portfolios: Sorted by Sharpe Ratio 25/25
Portfolio with the Highest Sharpe Ratio 15/15

Having issue clearing the grader for sorted by Sharpe ratio.
The sorted sharpe ratio portfolio I am getting is 42, 104, 2, 94, 9, ... We know that 42 is definitely right, since 42 cleared the section of Portfolio with the Highest Sharpe Ratio.

@joelowj
Copy link
Owner Author

joelowj commented Sep 23, 2018

e97d5cd, managed to cleared Eigen Portfolios: Sorted by Sharpe Ratio by changing the calculation for annualized_return from

annualized_return = ts_returns.mean() * periods_per_year

to

n_years = ts_returns.shape[0] / periods_per_year
annualized_return = np.power(np.prod(1 + ts_returns),(1 / n_years)) - 1

However, results will have NaN value which I then used results.dropna(inplace=True) to remove the NaN value. This helps to cleared Eigen Portfolios: Sorted by Sharpe Ratio but Portfolio with the Highest Sharpe Ratio would fail the grader. This can be easily resolved by using

idx_highest_sharpe = np.nanargmax(sharpe_metric)

to obtained the idx with the highest sharpe instead of

idx_highest_sharpe = np.argmax(sharpe_metric).

@joelowj joelowj closed this as completed Sep 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant