jofaichow commited on
Commit
c2951c6
1 Parent(s): 156affe

various improvements in payout summary

Browse files
Files changed (1) hide show
  1. app/app.R +25 -28
app/app.R CHANGED
@@ -303,7 +303,7 @@ ui <- shinydashboardPlus::dashboardPage(
303
  tabsetPanel(type = "tabs",
304
 
305
 
306
- tabPanel("Overview (All)",
307
 
308
  br(),
309
 
@@ -343,7 +343,7 @@ ui <- shinydashboardPlus::dashboardPage(
343
  ),
344
 
345
 
346
- tabPanel("Overview (Individual)",
347
 
348
  br(),
349
 
@@ -354,7 +354,7 @@ ui <- shinydashboardPlus::dashboardPage(
354
  ),
355
 
356
 
357
- tabPanel("Chart (Stacked Payouts)",
358
 
359
  br(),
360
 
@@ -368,7 +368,7 @@ ui <- shinydashboardPlus::dashboardPage(
368
 
369
  ),
370
 
371
- tabPanel("Chart (Individual Models)",
372
  # br(),
373
  # materialSwitch(inputId = "switch_scale_payout",
374
  # label = "Fixed Scale?",
@@ -473,10 +473,11 @@ ui <- shinydashboardPlus::dashboardPage(
473
  - #### **0.1.1** — Added a functional `Payout Summary` page
474
  - #### **0.1.2** — `Payout Summary` layout updates
475
  - #### **0.1.3** — Added `Raw Data`
476
- - #### **0.1.4** — Improved and sped up `Payout Summary`
477
  - #### **0.1.5** — Replaced `corrV1` with `corrV2`
478
  - #### **0.1.6** — Added `apcwnm` and `mcwnm`
479
  - #### **0.1.7** — Added CoE Meetup GitHub page to `Community`
 
480
  "),
481
 
482
  br(),
@@ -495,7 +496,7 @@ ui <- shinydashboardPlus::dashboardPage(
495
 
496
  footer = shinydashboardPlus::dashboardFooter(
497
  left = "Powered by ❤️, ☕, Shiny, and 🤗 Spaces",
498
- right = paste0("Version 0.1.7"))
499
 
500
  )
501
 
@@ -667,19 +668,24 @@ server <- function(input, output) {
667
  input$button_filter,
668
  {
669
 
670
- # Summarise payout
 
 
 
 
 
 
671
  d_smry <-
672
- react_d_filter() |>
673
  lazy_dt() |>
674
- filter(stake > 0) |>
675
  group_by(model) |>
676
  summarise(staked_rounds = n(),
677
  net_payout = sum(payout, na.rm = T),
678
  avg_payout = mean(payout, na.rm = T),
679
- sharpe = mean(payout, na.rm = T) / sd(payout, na.rm = T)
680
- ) |>
681
- as.data.table()
682
-
683
  # Return
684
  d_smry
685
 
@@ -1066,28 +1072,19 @@ server <- function(input, output) {
1066
  ) |>
1067
 
1068
  # Reformat individual columns
1069
- formatRound(columns = c("net_payout", "avg_payout", "sharpe"), digits = 4) |>
 
 
1070
 
1071
  # formatStyle(columns = c("model"), fontWeight = "bold") |>
1072
 
1073
- formatStyle(columns = c("net_payout"),
1074
- # fontWeight = "bold",
1075
- color = styleInterval(cuts = c(-1e-15, 1e-15),
1076
- values = c("#D24141", "#D1D1D1", "#00A800"))) |>
1077
-
1078
- formatStyle(columns = c("avg_payout"),
1079
- # fontWeight = "bold",
1080
- color = styleInterval(cuts = c(-1e-15, 1e-15),
1081
- values = c("#D24141", "#D1D1D1", "#00A800"))) |>
1082
-
1083
- formatStyle(columns = c("sharpe"),
1084
  # fontWeight = "bold",
1085
  color = styleInterval(cuts = c(-1e-15, 1e-15),
1086
  values = c("#D24141", "#D1D1D1", "#00A800")))
1087
 
1088
-
1089
-
1090
-
1091
  })
1092
 
1093
 
 
303
  tabsetPanel(type = "tabs",
304
 
305
 
306
+ tabPanel("Summary (All Models)",
307
 
308
  br(),
309
 
 
343
  ),
344
 
345
 
346
+ tabPanel("Summary (Individual Models)",
347
 
348
  br(),
349
 
 
354
  ),
355
 
356
 
357
+ tabPanel("Histogram (All Models)",
358
 
359
  br(),
360
 
 
368
 
369
  ),
370
 
371
+ tabPanel("Histogram (Individual Models)",
372
  # br(),
373
  # materialSwitch(inputId = "switch_scale_payout",
374
  # label = "Fixed Scale?",
 
473
  - #### **0.1.1** — Added a functional `Payout Summary` page
474
  - #### **0.1.2** — `Payout Summary` layout updates
475
  - #### **0.1.3** — Added `Raw Data`
476
+ - #### **0.1.4** — Various improvements in `Payout Summary`
477
  - #### **0.1.5** — Replaced `corrV1` with `corrV2`
478
  - #### **0.1.6** — Added `apcwnm` and `mcwnm`
479
  - #### **0.1.7** — Added CoE Meetup GitHub page to `Community`
480
+ - #### **0.1.8** — Various improvements in `Payout Summary`
481
  "),
482
 
483
  br(),
 
496
 
497
  footer = shinydashboardPlus::dashboardFooter(
498
  left = "Powered by ❤️, ☕, Shiny, and 🤗 Spaces",
499
+ right = paste0("Version 0.1.8"))
500
 
501
  )
502
 
 
668
  input$button_filter,
669
  {
670
 
671
+ # Get filtered data
672
+ d_smry <- as.data.table(react_d_filter())
673
+
674
+ # Calculate rate of return (%)
675
+ d_smry[, rate_of_return_percent := payout / stake * 100]
676
+
677
+ # Summarise
678
  d_smry <-
679
+ d_smry |>
680
  lazy_dt() |>
 
681
  group_by(model) |>
682
  summarise(staked_rounds = n(),
683
  net_payout = sum(payout, na.rm = T),
684
  avg_payout = mean(payout, na.rm = T),
685
+ avg_rate_of_return_percent = mean(rate_of_return_percent, na.rm = T),
686
+ sharpe_rate_of_return = mean(rate_of_return_percent, na.rm = T) / sd(rate_of_return_percent, na.rm = T)
687
+ ) |> as.data.table()
688
+
689
  # Return
690
  d_smry
691
 
 
1072
  ) |>
1073
 
1074
  # Reformat individual columns
1075
+ formatRound(columns = c("net_payout", "avg_payout",
1076
+ "avg_rate_of_return_percent",
1077
+ "sharpe_rate_of_return"), digits = 4) |>
1078
 
1079
  # formatStyle(columns = c("model"), fontWeight = "bold") |>
1080
 
1081
+ formatStyle(columns = c("net_payout", "avg_payout",
1082
+ "avg_rate_of_return_percent",
1083
+ "sharpe_rate_of_return"),
 
 
 
 
 
 
 
 
1084
  # fontWeight = "bold",
1085
  color = styleInterval(cuts = c(-1e-15, 1e-15),
1086
  values = c("#D24141", "#D1D1D1", "#00A800")))
1087
 
 
 
 
1088
  })
1089
 
1090