Spaces:
Running
Running
Added KPI (C&M) for CorrV2 and MMC performance analysis
Browse files
app/app.R
CHANGED
|
@@ -441,49 +441,49 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
| 441 |
),
|
| 442 |
|
| 443 |
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
|
| 488 |
|
| 489 |
tabPanel("Payout (Overview)",
|
|
@@ -916,6 +916,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
| 916 |
- #### **0.2.6** — Added survey results - Ref: https://forum.numer.ai/t/around-the-world-with-numeratis-survey-for-upcoming-events
|
| 917 |
- #### **0.2.7** — Removed `KPI (C&T)` and `Payout Simulation`
|
| 918 |
- #### **0.2.8** — Changed filter starting round to 650 (first round of new payout scheme)
|
|
|
|
| 919 |
"),
|
| 920 |
|
| 921 |
br(),
|
|
@@ -934,7 +935,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
| 934 |
|
| 935 |
footer = shinydashboardPlus::dashboardFooter(
|
| 936 |
left = "Powered by ❤️, ☕, Shiny, and 🤗 Spaces",
|
| 937 |
-
right = paste0("Version 0.2.
|
| 938 |
|
| 939 |
)
|
| 940 |
|
|
@@ -1318,7 +1319,11 @@ server <- function(input, output) {
|
|
| 1318 |
d_pref <- as.data.table(react_d_filter())
|
| 1319 |
|
| 1320 |
# Add 2xCORRv2 + 1xTC
|
| 1321 |
-
d_pref[, twoC_oneT := 2*corrV2 + tc]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1322 |
|
| 1323 |
# Calculate some high level stats
|
| 1324 |
d_pref <-
|
|
@@ -1327,18 +1332,16 @@ server <- function(input, output) {
|
|
| 1327 |
group_by(model) |>
|
| 1328 |
summarise(total_rounds = n(),
|
| 1329 |
|
| 1330 |
-
|
| 1331 |
-
|
| 1332 |
-
# mdd_corrV2 = maxdrawdown(corrV2),
|
| 1333 |
|
| 1334 |
-
|
| 1335 |
-
|
| 1336 |
-
# mdd_tc = maxdrawdown(tc),
|
| 1337 |
|
| 1338 |
-
|
| 1339 |
-
|
| 1340 |
-
# mdd_2C1T = maxdrawdown(twoC_oneT)
|
| 1341 |
|
|
|
|
| 1342 |
) |> as.data.table()
|
| 1343 |
|
| 1344 |
# Return
|
|
@@ -1442,11 +1445,11 @@ server <- function(input, output) {
|
|
| 1442 |
})
|
| 1443 |
|
| 1444 |
output$text_performance_models <- renderText({
|
| 1445 |
-
if (nrow(react_d_filter()) >= 1) "KPI Analysis (
|
| 1446 |
})
|
| 1447 |
|
| 1448 |
output$text_performance_models_note <- renderText({
|
| 1449 |
-
if (nrow(react_d_filter()) >= 1) "NOTE: You may want to find out which models have high CORRv2 Sharpe and
|
| 1450 |
})
|
| 1451 |
|
| 1452 |
output$text_performance_chart <- renderText({
|
|
@@ -1761,7 +1764,7 @@ server <- function(input, output) {
|
|
| 1761 |
})
|
| 1762 |
|
| 1763 |
|
| 1764 |
-
# KPI Chart: Avg Corr vs. Avg
|
| 1765 |
output$plot_performance_avg <- renderPlotly({
|
| 1766 |
|
| 1767 |
# Data
|
|
@@ -1769,10 +1772,10 @@ server <- function(input, output) {
|
|
| 1769 |
|
| 1770 |
# Plot
|
| 1771 |
p_avg <- ggplot(d_pref,
|
| 1772 |
-
aes(x =
|
| 1773 |
text = paste("Model:", model,
|
| 1774 |
-
"\nAverage
|
| 1775 |
-
"\nAverage
|
| 1776 |
)) +
|
| 1777 |
geom_point() +
|
| 1778 |
theme(
|
|
@@ -1790,12 +1793,12 @@ server <- function(input, output) {
|
|
| 1790 |
) +
|
| 1791 |
scale_x_continuous(breaks = breaks_pretty(5)) +
|
| 1792 |
scale_y_continuous(breaks = breaks_pretty(5)) +
|
| 1793 |
-
xlab("\nAverage
|
| 1794 |
-
ylab("\nAverage
|
| 1795 |
|
| 1796 |
# Add vline and hline if needed
|
| 1797 |
-
if (min(d_pref$
|
| 1798 |
-
if (min(d_pref$
|
| 1799 |
|
| 1800 |
# Convert to Plotly
|
| 1801 |
ggplotly(p_avg, tooltip = "text") |> toWebGL()
|
|
@@ -1803,7 +1806,7 @@ server <- function(input, output) {
|
|
| 1803 |
})
|
| 1804 |
|
| 1805 |
|
| 1806 |
-
# KPI Chart: Corr Sharpe vs.
|
| 1807 |
output$plot_performance_sharpe <- renderPlotly({
|
| 1808 |
|
| 1809 |
# Data
|
|
@@ -1811,10 +1814,10 @@ server <- function(input, output) {
|
|
| 1811 |
|
| 1812 |
# Plot
|
| 1813 |
p_sharpe <- ggplot(d_pref,
|
| 1814 |
-
aes(x =
|
| 1815 |
text = paste("Model:", model,
|
| 1816 |
-
"\nSharpe Ratio of
|
| 1817 |
-
"\nSharpe Ratio of
|
| 1818 |
)) +
|
| 1819 |
geom_point() +
|
| 1820 |
theme(
|
|
@@ -1832,12 +1835,12 @@ server <- function(input, output) {
|
|
| 1832 |
) +
|
| 1833 |
scale_x_continuous(breaks = breaks_pretty(5)) +
|
| 1834 |
scale_y_continuous(breaks = breaks_pretty(5)) +
|
| 1835 |
-
xlab("\nSharpe Ratio of
|
| 1836 |
-
ylab("\nSharpe Ratio of
|
| 1837 |
|
| 1838 |
# Add vline and hline if needed
|
| 1839 |
-
if (min(d_pref$
|
| 1840 |
-
if (min(d_pref$
|
| 1841 |
|
| 1842 |
# Convert to Plotly
|
| 1843 |
ggplotly(p_sharpe, tooltip = "text") |> toWebGL()
|
|
@@ -2139,15 +2142,16 @@ server <- function(input, output) {
|
|
| 2139 |
) |>
|
| 2140 |
|
| 2141 |
# Reformat individual columns
|
| 2142 |
-
formatRound(columns = c("
|
| 2143 |
-
"
|
| 2144 |
-
"
|
|
|
|
| 2145 |
),
|
| 2146 |
digits = 4) |>
|
| 2147 |
|
| 2148 |
-
formatStyle(columns = c("
|
| 2149 |
-
"
|
| 2150 |
-
"
|
| 2151 |
),
|
| 2152 |
color = styleInterval(cuts = c(-1e-15, 1e-15),
|
| 2153 |
values = c("#D24141", "#D1D1D1", "#00A800")))
|
|
|
|
| 441 |
),
|
| 442 |
|
| 443 |
|
| 444 |
+
tabPanel("KPI (C&M)",
|
| 445 |
+
|
| 446 |
+
br(),
|
| 447 |
+
|
| 448 |
+
h3(strong(textOutput(outputId = "text_performance_models"))),
|
| 449 |
+
|
| 450 |
+
h4(textOutput(outputId = "text_performance_models_note")),
|
| 451 |
+
|
| 452 |
+
br(),
|
| 453 |
+
|
| 454 |
+
fluidRow(
|
| 455 |
+
column(width = 6, plotlyOutput("plot_performance_avg")),
|
| 456 |
+
column(width = 6, plotlyOutput("plot_performance_sharpe"))
|
| 457 |
+
),
|
| 458 |
+
|
| 459 |
+
br(),
|
| 460 |
+
br(),
|
| 461 |
+
br(),
|
| 462 |
+
|
| 463 |
+
fluidRow(DTOutput("dt_performance_summary"),
|
| 464 |
+
|
| 465 |
+
br(),
|
| 466 |
+
|
| 467 |
+
markdown("#### **Notes**:
|
| 468 |
+
|
| 469 |
+
- **avg_05cor**: Average `0.5 x CORRv2`
|
| 470 |
+
- **sharpe_05cor**: Sharpe Ratio of `0.5 x CORRv2`
|
| 471 |
+
|
| 472 |
+
- **avg_2mmc**: Average `2 x MMC`
|
| 473 |
+
- **sharpe_2mmc**: Sharpe Ratio of `2 x MMC`
|
| 474 |
+
|
| 475 |
+
- **avg_05cor2mmc**: Average `0.5 x CORRv2 + 2 x MMC`
|
| 476 |
+
- **sharpe_05cor2mmc**: Sharpe Ratio of `0.5 x CORRv2 + 2 x MMC`
|
| 477 |
+
|
| 478 |
+
"),
|
| 479 |
+
|
| 480 |
+
br()
|
| 481 |
+
),
|
| 482 |
+
|
| 483 |
+
|
| 484 |
+
br()
|
| 485 |
+
|
| 486 |
+
), # End of KPI (C&M)
|
| 487 |
|
| 488 |
|
| 489 |
tabPanel("Payout (Overview)",
|
|
|
|
| 916 |
- #### **0.2.6** — Added survey results - Ref: https://forum.numer.ai/t/around-the-world-with-numeratis-survey-for-upcoming-events
|
| 917 |
- #### **0.2.7** — Removed `KPI (C&T)` and `Payout Simulation`
|
| 918 |
- #### **0.2.8** — Changed filter starting round to 650 (first round of new payout scheme)
|
| 919 |
+
- #### **0.2.9** — Added `KPI (C&M)` for CorrV2 and MMC performance analysis
|
| 920 |
"),
|
| 921 |
|
| 922 |
br(),
|
|
|
|
| 935 |
|
| 936 |
footer = shinydashboardPlus::dashboardFooter(
|
| 937 |
left = "Powered by ❤️, ☕, Shiny, and 🤗 Spaces",
|
| 938 |
+
right = paste0("Version 0.2.9"))
|
| 939 |
|
| 940 |
)
|
| 941 |
|
|
|
|
| 1319 |
d_pref <- as.data.table(react_d_filter())
|
| 1320 |
|
| 1321 |
# Add 2xCORRv2 + 1xTC
|
| 1322 |
+
# d_pref[, twoC_oneT := 2*corrV2 + tc]
|
| 1323 |
+
|
| 1324 |
+
# Add 0.5xCORRv2 + 2xMMC
|
| 1325 |
+
d_pref[, halfC_twoM := 0.5*corrV2 + 2*mmc]
|
| 1326 |
+
|
| 1327 |
|
| 1328 |
# Calculate some high level stats
|
| 1329 |
d_pref <-
|
|
|
|
| 1332 |
group_by(model) |>
|
| 1333 |
summarise(total_rounds = n(),
|
| 1334 |
|
| 1335 |
+
avg_05cor = mean(corrV2/2, na.rm = T),
|
| 1336 |
+
sharpe_05cor = mean(corrV2/2, na.rm = T) / sd(corrV2/2, na.rm = T),
|
|
|
|
| 1337 |
|
| 1338 |
+
avg_2mmc = mean(mmc*2, na.rm = T),
|
| 1339 |
+
sharpe_2mmc = mean(mmc*2, na.rm = T) / sd(mmc*2, na.rm = T),
|
|
|
|
| 1340 |
|
| 1341 |
+
avg_05cor2mmc = mean(halfC_twoM, na.rm = T),
|
| 1342 |
+
sharpe_05cor2mmc = mean(halfC_twoM, na.rm = T) / sd(halfC_twoM, na.rm = T)
|
|
|
|
| 1343 |
|
| 1344 |
+
|
| 1345 |
) |> as.data.table()
|
| 1346 |
|
| 1347 |
# Return
|
|
|
|
| 1445 |
})
|
| 1446 |
|
| 1447 |
output$text_performance_models <- renderText({
|
| 1448 |
+
if (nrow(react_d_filter()) >= 1) "KPI Analysis (0.5xCORRv2 and 2xMMC)" else " "
|
| 1449 |
})
|
| 1450 |
|
| 1451 |
output$text_performance_models_note <- renderText({
|
| 1452 |
+
if (nrow(react_d_filter()) >= 1) "NOTE: You may want to find out which models have **both** high CORRv2 Sharpe and MMC Sharpe." else " "
|
| 1453 |
})
|
| 1454 |
|
| 1455 |
output$text_performance_chart <- renderText({
|
|
|
|
| 1764 |
})
|
| 1765 |
|
| 1766 |
|
| 1767 |
+
# KPI Chart: Avg Corr vs. Avg MMC
|
| 1768 |
output$plot_performance_avg <- renderPlotly({
|
| 1769 |
|
| 1770 |
# Data
|
|
|
|
| 1772 |
|
| 1773 |
# Plot
|
| 1774 |
p_avg <- ggplot(d_pref,
|
| 1775 |
+
aes(x = avg_2mmc, y = avg_05cor,
|
| 1776 |
text = paste("Model:", model,
|
| 1777 |
+
"\nAverage 0.5xCORRv2:", round(avg_05cor, 4),
|
| 1778 |
+
"\nAverage 2xMMC:", round(avg_2mmc, 4))
|
| 1779 |
)) +
|
| 1780 |
geom_point() +
|
| 1781 |
theme(
|
|
|
|
| 1793 |
) +
|
| 1794 |
scale_x_continuous(breaks = breaks_pretty(5)) +
|
| 1795 |
scale_y_continuous(breaks = breaks_pretty(5)) +
|
| 1796 |
+
xlab("\nAverage 2xMMC") +
|
| 1797 |
+
ylab("\nAverage 0.5xCORRv2")
|
| 1798 |
|
| 1799 |
# Add vline and hline if needed
|
| 1800 |
+
if (min(d_pref$avg_05cor) <0) p_avg <- p_avg + geom_hline(aes(yintercept = 0), linewidth = 0.25, color = "grey", linetype = "dashed")
|
| 1801 |
+
if (min(d_pref$avg_2mmc) <0) p_avg <- p_avg + geom_vline(aes(xintercept = 0), linewidth = 0.25, color = "grey", linetype = "dashed")
|
| 1802 |
|
| 1803 |
# Convert to Plotly
|
| 1804 |
ggplotly(p_avg, tooltip = "text") |> toWebGL()
|
|
|
|
| 1806 |
})
|
| 1807 |
|
| 1808 |
|
| 1809 |
+
# KPI Chart: Corr Sharpe vs. MMC Sharpe
|
| 1810 |
output$plot_performance_sharpe <- renderPlotly({
|
| 1811 |
|
| 1812 |
# Data
|
|
|
|
| 1814 |
|
| 1815 |
# Plot
|
| 1816 |
p_sharpe <- ggplot(d_pref,
|
| 1817 |
+
aes(x = sharpe_2mmc, y = sharpe_05cor,
|
| 1818 |
text = paste("Model:", model,
|
| 1819 |
+
"\nSharpe Ratio of 0.5xCORRv2:", round(sharpe_05cor, 4),
|
| 1820 |
+
"\nSharpe Ratio of 2xMMC:", round(sharpe_2mmc, 4))
|
| 1821 |
)) +
|
| 1822 |
geom_point() +
|
| 1823 |
theme(
|
|
|
|
| 1835 |
) +
|
| 1836 |
scale_x_continuous(breaks = breaks_pretty(5)) +
|
| 1837 |
scale_y_continuous(breaks = breaks_pretty(5)) +
|
| 1838 |
+
xlab("\nSharpe Ratio of 2xMMC") +
|
| 1839 |
+
ylab("\nSharpe Ratio of 0.5xCORRv2")
|
| 1840 |
|
| 1841 |
# Add vline and hline if needed
|
| 1842 |
+
if (min(d_pref$sharpe_05cor) <0) p_sharpe <- p_sharpe + geom_hline(aes(yintercept = 0), linewidth = 0.25, color = "grey", linetype = "dashed")
|
| 1843 |
+
if (min(d_pref$sharpe_2mmc) <0) p_sharpe <- p_sharpe + geom_vline(aes(xintercept = 0), linewidth = 0.25, color = "grey", linetype = "dashed")
|
| 1844 |
|
| 1845 |
# Convert to Plotly
|
| 1846 |
ggplotly(p_sharpe, tooltip = "text") |> toWebGL()
|
|
|
|
| 2142 |
) |>
|
| 2143 |
|
| 2144 |
# Reformat individual columns
|
| 2145 |
+
formatRound(columns = c("avg_05cor", "sharpe_05cor",
|
| 2146 |
+
"avg_2mmc", "sharpe_2mmc",
|
| 2147 |
+
"avg_05cor2mmc", "sharpe_05cor2mmc"
|
| 2148 |
+
|
| 2149 |
),
|
| 2150 |
digits = 4) |>
|
| 2151 |
|
| 2152 |
+
formatStyle(columns = c("avg_05cor", "sharpe_05cor",
|
| 2153 |
+
"avg_2mmc", "sharpe_2mmc",
|
| 2154 |
+
"avg_05cor2mmc", "sharpe_05cor2mmc"
|
| 2155 |
),
|
| 2156 |
color = styleInterval(cuts = c(-1e-15, 1e-15),
|
| 2157 |
values = c("#D24141", "#D1D1D1", "#00A800")))
|