Spaces:
Running
Running
0.2.0 - new performance summary tab
Browse files
app/app.R
CHANGED
@@ -106,15 +106,6 @@ gen_custom_palette <- function(ls_model) {
|
|
106 |
}
|
107 |
|
108 |
|
109 |
-
# max drawdown
|
110 |
-
# https://stackoverflow.com/questions/13733166/maxdrawdown-function
|
111 |
-
drawdown <- function(pnl) {
|
112 |
-
cum.pnl <- c(0, cumsum(pnl))
|
113 |
-
drawdown <- cum.pnl - cummax(cum.pnl)
|
114 |
-
return(tail(drawdown, -1))
|
115 |
-
}
|
116 |
-
maxdrawdown <- function(pnl)min(drawdown(pnl))
|
117 |
-
|
118 |
|
119 |
# ==============================================================================
|
120 |
# UI
|
@@ -142,9 +133,8 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
142 |
id = "sidebar",
|
143 |
sidebarMenu(
|
144 |
menuItem(text = "Start Here", tabName = "start", icon = icon("play")),
|
145 |
-
menuItem(text = "
|
146 |
menuItem(text = "Raw Data", tabName = "raw_data", icon = icon("download")),
|
147 |
-
# menuItem(text = "Model Performance", tabName = "performance", icon = icon("line-chart")),
|
148 |
menuItem(text = "Community Events", tabName = "community", icon = icon("users")),
|
149 |
menuItem(text = "About", tabName = "about", icon = icon("question-circle"))
|
150 |
),
|
@@ -211,7 +201,22 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
211 |
|
212 |
pickerInput(inputId = "model",
|
213 |
label = " ",
|
214 |
-
choices = sort(Rnumerai::get_leaderboard()$username),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
multiple = TRUE,
|
216 |
width = "100%",
|
217 |
options = list(
|
@@ -273,11 +278,11 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
273 |
# Payout Summary
|
274 |
# ========================================================================
|
275 |
|
276 |
-
tabItem(tabName = "
|
277 |
|
278 |
fluidPage(
|
279 |
|
280 |
-
markdown("# **
|
281 |
markdown("### Remember to refresh the charts after making changes to model selection or settings below."),
|
282 |
markdown("### **NOTE**: the charts may take a while to render if you have selected a lot of models."),
|
283 |
|
@@ -301,10 +306,10 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
301 |
|
302 |
column(6,
|
303 |
|
304 |
-
markdown("## **Step 5:
|
305 |
br(),
|
306 |
actionBttn(inputId = "button_filter",
|
307 |
-
label = "
|
308 |
color = "primary",
|
309 |
icon = icon("refresh"),
|
310 |
style = "gradient",
|
@@ -317,7 +322,37 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
317 |
tabsetPanel(type = "tabs",
|
318 |
|
319 |
|
320 |
-
tabPanel("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
|
322 |
br(),
|
323 |
|
@@ -353,7 +388,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
353 |
),
|
354 |
|
355 |
|
356 |
-
tabPanel("Payout
|
357 |
|
358 |
br(),
|
359 |
|
@@ -368,7 +403,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
368 |
),
|
369 |
|
370 |
|
371 |
-
tabPanel("Payout
|
372 |
|
373 |
br(),
|
374 |
|
@@ -383,7 +418,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
383 |
),
|
384 |
|
385 |
|
386 |
-
tabPanel("Payout
|
387 |
|
388 |
br(),
|
389 |
|
@@ -391,7 +426,6 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
391 |
|
392 |
br(),
|
393 |
|
394 |
-
|
395 |
markdown("![new_tc_change](https://i.ibb.co/XjKwtzr/screenshot-2023-10-05-at-10.png)"),
|
396 |
|
397 |
br(),
|
@@ -414,6 +448,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
414 |
DTOutput("dt_payout_sim_overall"),
|
415 |
|
416 |
br(),
|
|
|
417 |
br(),
|
418 |
|
419 |
markdown("### **Payout Simulation (Individual Models)**"),
|
@@ -426,7 +461,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
426 |
|
427 |
),
|
428 |
|
429 |
-
tabPanel("Chart (
|
430 |
|
431 |
br(),
|
432 |
|
@@ -440,7 +475,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
440 |
|
441 |
),
|
442 |
|
443 |
-
tabPanel("Chart (
|
444 |
# br(),
|
445 |
# materialSwitch(inputId = "switch_scale_payout",
|
446 |
# label = "Fixed Scale?",
|
@@ -460,33 +495,6 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
460 |
),
|
461 |
|
462 |
|
463 |
-
# ========================================================================
|
464 |
-
# Model Performance
|
465 |
-
# ========================================================================
|
466 |
-
|
467 |
-
tabItem(tabName = "performance",
|
468 |
-
fluidPage(
|
469 |
-
|
470 |
-
markdown("# **Model Performance**"),
|
471 |
-
|
472 |
-
markdown("![image](https://media.giphy.com/media/cftSzNoCTfSyAWctcl/giphy.gif)")
|
473 |
-
|
474 |
-
# markdown("### **Note 1**: Experimental features. Changes to be expected in the coming days."),
|
475 |
-
# markdown("### **Note 2**: Define the range in `Payout Summary` first."),
|
476 |
-
# br(),
|
477 |
-
# tabsetPanel(type = "tabs",
|
478 |
-
# tabPanel("Boxplot - TCP",
|
479 |
-
# br(),
|
480 |
-
# markdown("### **TC Percentile by Model**"),
|
481 |
-
# shinycssloaders::withSpinner(plotlyOutput("plot_boxplot_tcp"))
|
482 |
-
# )
|
483 |
-
# ) # End of tabsetPanel
|
484 |
-
|
485 |
-
) # End of fluidPage
|
486 |
-
|
487 |
-
),
|
488 |
-
|
489 |
-
|
490 |
# ========================================================================
|
491 |
# Raw Data
|
492 |
# ========================================================================
|
@@ -551,6 +559,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
551 |
- #### **0.1.7** — Added CoE Meetup GitHub page to `Community`
|
552 |
- #### **0.1.8** — Various improvements in `Payout Summary`
|
553 |
- #### **0.1.9** — Added `Payout Sim` based on new Corr and TC multipier settings
|
|
|
554 |
"),
|
555 |
|
556 |
br(),
|
@@ -569,7 +578,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
569 |
|
570 |
footer = shinydashboardPlus::dashboardFooter(
|
571 |
left = "Powered by ❤️, ☕, Shiny, and 🤗 Spaces",
|
572 |
-
right = paste0("Version 0.
|
573 |
|
574 |
)
|
575 |
|
@@ -630,11 +639,13 @@ server <- function(input, output) {
|
|
630 |
}
|
631 |
)
|
632 |
|
|
|
633 |
|
634 |
# ============================================================================
|
635 |
# Reactive: DataTable
|
636 |
# ============================================================================
|
637 |
|
|
|
638 |
output$dt_model <- DT::renderDT({
|
639 |
|
640 |
# Raw Data
|
@@ -695,6 +706,7 @@ server <- function(input, output) {
|
|
695 |
})
|
696 |
|
697 |
|
|
|
698 |
# ============================================================================
|
699 |
# Reactive: filtering data for all charts
|
700 |
# ============================================================================
|
@@ -705,7 +717,6 @@ server <- function(input, output) {
|
|
705 |
|
706 |
# Reformat and Filter
|
707 |
d_filter <- reformat_data(react_d_raw())
|
708 |
-
d_filter <- d_filter[pay_ftr > 0, ] # ignoring the new daily rounds for now
|
709 |
d_filter <- d_filter[round >= input$range_round[1], ]
|
710 |
d_filter <- d_filter[round <= input$range_round[2], ]
|
711 |
|
@@ -722,7 +733,8 @@ server <- function(input, output) {
|
|
722 |
# Summarise payout
|
723 |
d_smry <-
|
724 |
react_d_filter() |>
|
725 |
-
lazy_dt() |>
|
|
|
726 |
filter(stake > 0) |>
|
727 |
group_by(round, date_open, date_resolved, resolved) |>
|
728 |
summarise(staked_models = n(),
|
@@ -742,7 +754,13 @@ server <- function(input, output) {
|
|
742 |
{
|
743 |
|
744 |
# Get filtered data
|
745 |
-
d_smry <- as.data.table(react_d_filter())
|
|
|
|
|
|
|
|
|
|
|
|
|
746 |
|
747 |
# Calculate rate of return (%)
|
748 |
d_smry[, rate_of_return_percent := payout / stake * 100]
|
@@ -771,7 +789,13 @@ server <- function(input, output) {
|
|
771 |
{
|
772 |
|
773 |
# Get filtered data
|
774 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
775 |
|
776 |
# Apply clip to corrV2
|
777 |
d_payout[, corrV2_final := corrV2]
|
@@ -821,7 +845,13 @@ server <- function(input, output) {
|
|
821 |
{
|
822 |
|
823 |
# Get filtered data
|
824 |
-
d_payout <- as.data.table(react_d_filter())
|
|
|
|
|
|
|
|
|
|
|
|
|
825 |
|
826 |
# Apply clip to corrV2
|
827 |
d_payout[, corrV2_final := corrV2]
|
@@ -864,6 +894,80 @@ server <- function(input, output) {
|
|
864 |
})
|
865 |
|
866 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
867 |
|
868 |
|
869 |
# ============================================================================
|
@@ -893,8 +997,13 @@ server <- function(input, output) {
|
|
893 |
output$text_payout_sim <- renderText({
|
894 |
if (nrow(react_d_filter()) >= 1) "New Payout Simulation (NOTE: Experimental!)" else " "
|
895 |
})
|
896 |
-
|
897 |
-
|
|
|
|
|
|
|
|
|
|
|
898 |
|
899 |
# ============================================================================
|
900 |
# Reactive valueBox outputs: Rounds
|
@@ -1352,7 +1461,50 @@ server <- function(input, output) {
|
|
1352 |
})
|
1353 |
|
1354 |
|
1355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1356 |
|
1357 |
# ============================================================================
|
1358 |
# Reactive: Model Performance Charts
|
|
|
106 |
}
|
107 |
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
# ==============================================================================
|
111 |
# UI
|
|
|
133 |
id = "sidebar",
|
134 |
sidebarMenu(
|
135 |
menuItem(text = "Start Here", tabName = "start", icon = icon("play")),
|
136 |
+
menuItem(text = "Performance Summary", tabName = "performance", icon = icon("line-chart")), # icon("credit-card")
|
137 |
menuItem(text = "Raw Data", tabName = "raw_data", icon = icon("download")),
|
|
|
138 |
menuItem(text = "Community Events", tabName = "community", icon = icon("users")),
|
139 |
menuItem(text = "About", tabName = "about", icon = icon("question-circle"))
|
140 |
),
|
|
|
201 |
|
202 |
pickerInput(inputId = "model",
|
203 |
label = " ",
|
204 |
+
# choices = sort(Rnumerai::get_leaderboard()$username),
|
205 |
+
choices = unique(c(sort(Rnumerai::get_leaderboard()$username),
|
206 |
+
|
207 |
+
"joe_the_validator_01",
|
208 |
+
"joe_the_validator_02",
|
209 |
+
"joe_the_validator_03",
|
210 |
+
"joe_the_validator_04",
|
211 |
+
"joe_the_validator_05",
|
212 |
+
|
213 |
+
"joe_the_hedgehog_01",
|
214 |
+
"joe_the_hedgehog_02",
|
215 |
+
"joe_the_hedgehog_03",
|
216 |
+
"joe_the_hedgehog_04",
|
217 |
+
"joe_the_hedgehog_05"
|
218 |
+
)
|
219 |
+
),
|
220 |
multiple = TRUE,
|
221 |
width = "100%",
|
222 |
options = list(
|
|
|
278 |
# Payout Summary
|
279 |
# ========================================================================
|
280 |
|
281 |
+
tabItem(tabName = "performance",
|
282 |
|
283 |
fluidPage(
|
284 |
|
285 |
+
markdown("# **Performance Summary**"),
|
286 |
markdown("### Remember to refresh the charts after making changes to model selection or settings below."),
|
287 |
markdown("### **NOTE**: the charts may take a while to render if you have selected a lot of models."),
|
288 |
|
|
|
306 |
|
307 |
column(6,
|
308 |
|
309 |
+
markdown("## **Step 5: Generate Summary**"),
|
310 |
br(),
|
311 |
actionBttn(inputId = "button_filter",
|
312 |
+
label = "Generate / Refresh",
|
313 |
color = "primary",
|
314 |
icon = icon("refresh"),
|
315 |
style = "gradient",
|
|
|
322 |
tabsetPanel(type = "tabs",
|
323 |
|
324 |
|
325 |
+
tabPanel("KPIs (Models)",
|
326 |
+
|
327 |
+
br(),
|
328 |
+
|
329 |
+
h3(strong(textOutput(outputId = "text_performance_models"))),
|
330 |
+
|
331 |
+
br(),
|
332 |
+
|
333 |
+
DTOutput("dt_performance_summary"),
|
334 |
+
|
335 |
+
br(),
|
336 |
+
|
337 |
+
markdown("#### **Notes**:
|
338 |
+
|
339 |
+
- **avg_corrV2**: Average `CORRv2`
|
340 |
+
- **sharpe_corrV2**: Sharpe Ratio of `CORRv2`
|
341 |
+
|
342 |
+
- **avg_tc**: Average True Contribution (`TC`)
|
343 |
+
- **sharpe_tc**: Sharpe Ratio of True Contribution (`TC`)
|
344 |
+
|
345 |
+
- **avg_2C1T**: Average `2xCORRv2 + 1xTC`
|
346 |
+
- **sharpe_2C1T**: Sharpe Ratio of `2xCORRv2 + 1xTC`
|
347 |
+
|
348 |
+
"),
|
349 |
+
|
350 |
+
br()
|
351 |
+
|
352 |
+
),
|
353 |
+
|
354 |
+
|
355 |
+
tabPanel("Payout (Overview)",
|
356 |
|
357 |
br(),
|
358 |
|
|
|
388 |
),
|
389 |
|
390 |
|
391 |
+
tabPanel("Payout (Rounds)",
|
392 |
|
393 |
br(),
|
394 |
|
|
|
403 |
),
|
404 |
|
405 |
|
406 |
+
tabPanel("Payout (Models)",
|
407 |
|
408 |
br(),
|
409 |
|
|
|
418 |
),
|
419 |
|
420 |
|
421 |
+
tabPanel("Payout (Simulation)",
|
422 |
|
423 |
br(),
|
424 |
|
|
|
426 |
|
427 |
br(),
|
428 |
|
|
|
429 |
markdown("![new_tc_change](https://i.ibb.co/XjKwtzr/screenshot-2023-10-05-at-10.png)"),
|
430 |
|
431 |
br(),
|
|
|
448 |
DTOutput("dt_payout_sim_overall"),
|
449 |
|
450 |
br(),
|
451 |
+
|
452 |
br(),
|
453 |
|
454 |
markdown("### **Payout Simulation (Individual Models)**"),
|
|
|
461 |
|
462 |
),
|
463 |
|
464 |
+
tabPanel("Payout Chart (Rounds)",
|
465 |
|
466 |
br(),
|
467 |
|
|
|
475 |
|
476 |
),
|
477 |
|
478 |
+
tabPanel("Payout Chart (Models)",
|
479 |
# br(),
|
480 |
# materialSwitch(inputId = "switch_scale_payout",
|
481 |
# label = "Fixed Scale?",
|
|
|
495 |
),
|
496 |
|
497 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
# ========================================================================
|
499 |
# Raw Data
|
500 |
# ========================================================================
|
|
|
559 |
- #### **0.1.7** — Added CoE Meetup GitHub page to `Community`
|
560 |
- #### **0.1.8** — Various improvements in `Payout Summary`
|
561 |
- #### **0.1.9** — Added `Payout Sim` based on new Corr and TC multipier settings
|
562 |
+
- #### **0.2.0** — Replaced `Payout Summary` with `Performance Summary`. Added KPIs summary.
|
563 |
"),
|
564 |
|
565 |
br(),
|
|
|
578 |
|
579 |
footer = shinydashboardPlus::dashboardFooter(
|
580 |
left = "Powered by ❤️, ☕, Shiny, and 🤗 Spaces",
|
581 |
+
right = paste0("Version 0.2.0"))
|
582 |
|
583 |
)
|
584 |
|
|
|
639 |
}
|
640 |
)
|
641 |
|
642 |
+
|
643 |
|
644 |
# ============================================================================
|
645 |
# Reactive: DataTable
|
646 |
# ============================================================================
|
647 |
|
648 |
+
|
649 |
output$dt_model <- DT::renderDT({
|
650 |
|
651 |
# Raw Data
|
|
|
706 |
})
|
707 |
|
708 |
|
709 |
+
|
710 |
# ============================================================================
|
711 |
# Reactive: filtering data for all charts
|
712 |
# ============================================================================
|
|
|
717 |
|
718 |
# Reformat and Filter
|
719 |
d_filter <- reformat_data(react_d_raw())
|
|
|
720 |
d_filter <- d_filter[round >= input$range_round[1], ]
|
721 |
d_filter <- d_filter[round <= input$range_round[2], ]
|
722 |
|
|
|
733 |
# Summarise payout
|
734 |
d_smry <-
|
735 |
react_d_filter() |>
|
736 |
+
lazy_dt() |>
|
737 |
+
filter(pay_ftr > 0) |>
|
738 |
filter(stake > 0) |>
|
739 |
group_by(round, date_open, date_resolved, resolved) |>
|
740 |
summarise(staked_models = n(),
|
|
|
754 |
{
|
755 |
|
756 |
# Get filtered data
|
757 |
+
# d_smry <- as.data.table(react_d_filter() |> filter(pay_ftr > 0))
|
758 |
+
d_smry <-
|
759 |
+
react_d_filter() |>
|
760 |
+
lazy_dt() |>
|
761 |
+
filter(pay_ftr > 0) |>
|
762 |
+
filter(stake > 0) |>
|
763 |
+
as.data.table()
|
764 |
|
765 |
# Calculate rate of return (%)
|
766 |
d_smry[, rate_of_return_percent := payout / stake * 100]
|
|
|
789 |
{
|
790 |
|
791 |
# Get filtered data
|
792 |
+
# d_smry <- as.data.table(react_d_filter() |> filter(pay_ftr > 0))
|
793 |
+
d_payout <-
|
794 |
+
react_d_filter() |>
|
795 |
+
lazy_dt() |>
|
796 |
+
filter(pay_ftr > 0) |>
|
797 |
+
filter(stake > 0) |>
|
798 |
+
as.data.table()
|
799 |
|
800 |
# Apply clip to corrV2
|
801 |
d_payout[, corrV2_final := corrV2]
|
|
|
845 |
{
|
846 |
|
847 |
# Get filtered data
|
848 |
+
# d_payout <- as.data.table(react_d_filter() |> filter(pay_ftr > 0))
|
849 |
+
d_payout <-
|
850 |
+
react_d_filter() |>
|
851 |
+
lazy_dt() |>
|
852 |
+
filter(pay_ftr > 0) |>
|
853 |
+
filter(stake > 0) |>
|
854 |
+
as.data.table()
|
855 |
|
856 |
# Apply clip to corrV2
|
857 |
d_payout[, corrV2_final := corrV2]
|
|
|
894 |
})
|
895 |
|
896 |
|
897 |
+
react_d_performance_summary <- eventReactive(
|
898 |
+
input$button_filter,
|
899 |
+
{
|
900 |
+
|
901 |
+
# Get filtered data
|
902 |
+
d_pref <- as.data.table(react_d_filter())
|
903 |
+
|
904 |
+
# Add 2xCORRv2 + 1xTC
|
905 |
+
d_pref[, twoC_oneT := 2*corrV2 + tc]
|
906 |
+
|
907 |
+
# Calculate some high level stats
|
908 |
+
d_pref <-
|
909 |
+
d_pref |>
|
910 |
+
lazy_dt() |>
|
911 |
+
group_by(model) |>
|
912 |
+
summarise(total_rounds = n(),
|
913 |
+
|
914 |
+
avg_corrV2 = mean(corrV2, na.rm = T),
|
915 |
+
sharpe_corrV2 = mean(corrV2, na.rm = T) / sd(corrV2, na.rm = T),
|
916 |
+
# mdd_corrV2 = maxdrawdown(corrV2),
|
917 |
+
|
918 |
+
avg_tc = mean(tc, na.rm = T),
|
919 |
+
sharpe_tc = mean(tc, na.rm = T) / sd(tc, na.rm = T),
|
920 |
+
# mdd_tc = maxdrawdown(tc),
|
921 |
+
|
922 |
+
avg_2C1T = mean(twoC_oneT, na.rm = T),
|
923 |
+
sharpe_2C1T = mean(twoC_oneT, na.rm = T) / sd(tc, na.rm = T)
|
924 |
+
# mdd_2C1T = maxdrawdown(twoC_oneT)
|
925 |
+
|
926 |
+
) |> as.data.table()
|
927 |
+
|
928 |
+
# Return
|
929 |
+
d_pref
|
930 |
+
|
931 |
+
})
|
932 |
+
|
933 |
+
|
934 |
+
react_d_performance_summary_example <- eventReactive(
|
935 |
+
input$button_filter,
|
936 |
+
{
|
937 |
+
|
938 |
+
# Get filtered data
|
939 |
+
d_pref <- as.data.table(react_d_filter_example())
|
940 |
+
|
941 |
+
# Add 2xCORRv2 + 1xTC
|
942 |
+
d_pref[, twoC_oneT := 2*corrV2 + tc]
|
943 |
+
|
944 |
+
# Calculate some high level stats
|
945 |
+
d_pref <-
|
946 |
+
d_pref |>
|
947 |
+
lazy_dt() |>
|
948 |
+
group_by(model) |>
|
949 |
+
summarise(total_rounds = n(),
|
950 |
+
|
951 |
+
avg_corrV2 = mean(corrV2, na.rm = T),
|
952 |
+
sharpe_corrV2 = mean(corrV2, na.rm = T) / sd(corrV2, na.rm = T),
|
953 |
+
# mdd_corrV2 = maxdrawdown(corrV2),
|
954 |
+
|
955 |
+
avg_tc = mean(tc, na.rm = T),
|
956 |
+
sharpe_tc = mean(tc, na.rm = T) / sd(tc, na.rm = T),
|
957 |
+
# mdd_tc = maxdrawdown(tc),
|
958 |
+
|
959 |
+
avg_2C1T = mean(twoC_oneT, na.rm = T),
|
960 |
+
sharpe_2C1T = mean(twoC_oneT, na.rm = T) / sd(tc, na.rm = T)
|
961 |
+
# mdd_2C1T = maxdrawdown(twoC_oneT)
|
962 |
+
|
963 |
+
) |> as.data.table()
|
964 |
+
|
965 |
+
# Return
|
966 |
+
d_pref
|
967 |
+
|
968 |
+
})
|
969 |
+
|
970 |
+
|
971 |
|
972 |
|
973 |
# ============================================================================
|
|
|
997 |
output$text_payout_sim <- renderText({
|
998 |
if (nrow(react_d_filter()) >= 1) "New Payout Simulation (NOTE: Experimental!)" else " "
|
999 |
})
|
1000 |
+
|
1001 |
+
output$text_performance_models <- renderText({
|
1002 |
+
if (nrow(react_d_filter()) >= 1) "KPIs Summary (Individual Models)" else " "
|
1003 |
+
})
|
1004 |
+
|
1005 |
+
|
1006 |
+
|
1007 |
|
1008 |
# ============================================================================
|
1009 |
# Reactive valueBox outputs: Rounds
|
|
|
1461 |
})
|
1462 |
|
1463 |
|
1464 |
+
# Performance Summary
|
1465 |
+
output$dt_performance_summary <- DT::renderDT({
|
1466 |
+
|
1467 |
+
# Generate a new DT
|
1468 |
+
DT::datatable(
|
1469 |
+
|
1470 |
+
# Data
|
1471 |
+
react_d_performance_summary(),
|
1472 |
+
|
1473 |
+
# Other Options
|
1474 |
+
rownames = FALSE,
|
1475 |
+
extensions = "Buttons",
|
1476 |
+
options =
|
1477 |
+
list(
|
1478 |
+
dom = 'Bflrtip', # https://datatables.net/reference/option/dom
|
1479 |
+
buttons = list('csv', 'excel', 'copy', 'print'), # https://rstudio.github.io/DT/003-tabletools-buttons.html
|
1480 |
+
order = list(list(0, 'asc'), list(1, 'asc')),
|
1481 |
+
pageLength = 100,
|
1482 |
+
lengthMenu = c(10, 50, 100, 500, 1000),
|
1483 |
+
columnDefs = list(list(className = 'dt-center', targets = "_all")))
|
1484 |
+
) |>
|
1485 |
+
|
1486 |
+
# Reformat individual columns
|
1487 |
+
formatRound(columns = c("avg_corrV2", "sharpe_corrV2",
|
1488 |
+
"avg_tc", "sharpe_tc",
|
1489 |
+
"avg_2C1T", "sharpe_2C1T"
|
1490 |
+
),
|
1491 |
+
digits = 4) |>
|
1492 |
+
|
1493 |
+
formatStyle(columns = c("avg_corrV2", "sharpe_corrV2",
|
1494 |
+
"avg_tc", "sharpe_tc",
|
1495 |
+
"avg_2C1T", "sharpe_2C1T"
|
1496 |
+
),
|
1497 |
+
color = styleInterval(cuts = c(-1e-15, 1e-15),
|
1498 |
+
values = c("#D24141", "#D1D1D1", "#00A800")))
|
1499 |
+
|
1500 |
+
# formatStyle(columns = c("model",
|
1501 |
+
# "sum_pay_2C1T", "sum_pay_1C3T",
|
1502 |
+
# "shp_pay_2C1T", "shp_pay_1C3T"
|
1503 |
+
# ), fontWeight = "bold")
|
1504 |
+
|
1505 |
+
})
|
1506 |
+
|
1507 |
+
|
1508 |
|
1509 |
# ============================================================================
|
1510 |
# Reactive: Model Performance Charts
|