Skip to content

Commit

Permalink
Update Statistical Learning based Portfolio Optimization.R
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickKae authored Jul 22, 2023
1 parent 5580ace commit 8613797
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Statistical Learning based Portfolio Optimization.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ library(factoextra)
library(dendextend)
library(cluster)
library(RColorBrewer)
library(shinybusy)

# User Interface
ui <- fluidPage(
Expand Down Expand Up @@ -51,7 +52,8 @@ ui <- fluidPage(
choices = c("Risk Weighted" = "risk", "Equally Weighted" = "equally")),
actionButton("submit", "Optimize"),
tags$style(type='text/css', "#info-text { margin-top: 40px; }"),
HTML("<p id='info-text'>This web application utilizes the <a href='https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3237540' target='_blank'>Hierarchical Equal Risk Contribution</a> (HERC) approach, a modern portfolio optimization method developed by Raffinot (2018). It combines the unique strengths of the pioneering <a href='https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2708678' target='_blank'>Hierarchical Risk Parity</a> (HRP) method by López de Prado (2016) and <a href='https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2840729' target='_blank'>Hierarchical Clustering-Based Asset Allocation</a> (HCAA) method by Raffinot (2017).<br><br>
HTML("<p id='info-text'><b>Recommendation:</b> It is recommended to use this application on a desktop for the best user experience.<br><br>
This web application utilizes the <a href='https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3237540' target='_blank'>Hierarchical Equal Risk Contribution</a> (HERC) approach, a modern portfolio optimization method developed by Raffinot (2018). It combines the unique strengths of the pioneering <a href='https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2708678' target='_blank'>Hierarchical Risk Parity</a> (HRP) method by López de Prado (2016) and <a href='https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2840729' target='_blank'>Hierarchical Clustering-Based Asset Allocation</a> (HCAA) method by Raffinot (2017).<br><br>
Traditional portfolio optimization suffers from significant instability, primarily due to treating the vector space of return series as a fully connected graph, where each node can potentially substitute for another. This complicated structure magnifies minute estimation errors, leading to unstable solutions.
Hierarchical clustering-based tree structures address this issue by eliminating irrelevant links.<br><br><br>
Expand All @@ -65,14 +67,14 @@ Hierarchical clustering-based tree structures address this issue by eliminating
<b>Output:</b><br><br>
On the right panel, you will find:</b><br>
1) A labelled pie chart representing the optimized portfolio.<br>
2) A table listing each security's portfolio weight and cluster membership.<br>
3) A dendrogram illustrating the hierarchical structure of the securities.<br>
1) A dendrogram illustrating the hierarchical structure of the securities.<br>
2) A labelled pie chart representing the optimized portfolio.<br>
3) A table listing each security's portfolio weight and cluster membership.<br>
4) A graph depicting the cumulative returns of the securities and the optimized portfolio based on the used data.<br>
5) A bar chart comparing the Sharpe ratios of the securities and the optimized portfolio.<br><br>
The application automatically identifies the optimal clustering method.<br><br><br>
For more information on this and my other projects, please visit my <a href='https://github.com/YannickKae' target='_blank'>GitHub profile</a>.</p>")
The application automatically identifies the optimal linkage method.<br><br><br>
For more information on this and my other projects, please visit my <a href='https://github.com/YannickKae/Statistical-Learning-based-Portfolio-Optimization' target='_blank'>GitHub</a>.</p>")
),

mainPanel(
Expand All @@ -91,8 +93,11 @@ For more information on this and my other projects, please visit my <a href='htt
server <- function(input, output) {

observeEvent(input$submit, {

req(input$input_matrix)

show_modal_spinner(color = "white") # show the modal window

######################## Step 1) gathering the Data ###############################

# Get the tickers from input
Expand Down Expand Up @@ -557,6 +562,8 @@ server <- function(input, output) {
axis.title = element_text(size = 14)) # Adjust axis title size
})

remove_modal_spinner() # remove it when done

})
}

Expand Down

0 comments on commit 8613797

Please sign in to comment.