jofaichow commited on
Commit
0eb13c3
·
1 Parent(s): 3e9d498

various improvements in payout summary

Browse files
Files changed (1) hide show
  1. app/app.R +41 -18
app/app.R CHANGED
@@ -267,7 +267,7 @@ ui <- shinydashboardPlus::dashboardPage(
267
 
268
  markdown("# **Payout Summary**"),
269
  markdown("### Remember to refresh the charts after making changes to model selection or settings below."),
270
- markdown("### **Note**: the charts will take a while to render if you have selected many models."),
271
 
272
  br(),
273
 
@@ -283,7 +283,7 @@ ui <- shinydashboardPlus::dashboardPage(
283
  step = 1,
284
  min = 168, # first tournament round
285
  max = Rnumerai::get_current_round(), # note: daily payouts from round 474
286
- value = c(474, Rnumerai::get_current_round())
287
  )
288
  ),
289
 
@@ -305,11 +305,11 @@ ui <- shinydashboardPlus::dashboardPage(
305
  tabsetPanel(type = "tabs",
306
 
307
 
308
- tabPanel("Summary (All Models)",
309
 
310
  br(),
311
 
312
- h3(strong(textOutput(outputId = "text_payout_net"))),
313
 
314
  br(),
315
 
@@ -336,6 +336,17 @@ ui <- shinydashboardPlus::dashboardPage(
336
 
337
  shinycssloaders::withSpinner(plotlyOutput("plot_payout_net")),
338
 
 
 
 
 
 
 
 
 
 
 
 
339
  br(),
340
 
341
  DTOutput("dt_payout_summary"),
@@ -343,9 +354,13 @@ ui <- shinydashboardPlus::dashboardPage(
343
  br()
344
 
345
  ),
 
346
 
347
-
348
- tabPanel("Summary (Individual Models)",
 
 
 
349
 
350
  br(),
351
 
@@ -701,16 +716,24 @@ server <- function(input, output) {
701
  # Reactive: Payout Value Boxes
702
  # ============================================================================
703
 
704
- output$text_payout_net <- renderText({
705
- if (nrow(react_d_filter()) >= 1) "Net Payouts in NMR" else " "
 
 
 
 
 
 
 
 
706
  })
707
 
708
  output$text_payout_all_models <- renderText({
709
- if (nrow(react_d_filter()) >= 1) "Payouts in NMR (Stacked)" else " "
710
  })
711
 
712
  output$text_payout_ind_models <- renderText({
713
- if (nrow(react_d_filter()) >= 1) "Payouts in NMR (Individual Models)" else " "
714
  })
715
 
716
 
@@ -747,19 +770,19 @@ server <- function(input, output) {
747
  # ============================================================================
748
 
749
  output$payout_resolved <- renderValueBox({
750
- valueBox(value = as.character(format(round(sum(react_d_filter()[resolved == T, ]$payout, na.rm = T), 2), nsmall = 2)),
751
  subtitle = "Total Payout (Resolved)",
752
  color = "olive")
753
  })
754
 
755
  output$payout_pending <- renderValueBox({
756
- valueBox(value = as.character(format(round(sum(react_d_filter()[resolved == F, ]$payout, na.rm = T), 2), nsmall = 2)),
757
  subtitle = "Total Payout (Pending)",
758
  color = "yellow")
759
  })
760
 
761
  output$payout_total <- renderValueBox({
762
- valueBox(value = as.character(format(round(sum(react_d_filter()$payout, na.rm = T), 2), nsmall = 2)),
763
  subtitle = "Total Payout (All)",
764
  color = "light-blue")
765
  })
@@ -771,21 +794,21 @@ server <- function(input, output) {
771
 
772
  output$payout_average_resolved <- renderValueBox({
773
  # Use rounds with stake > 0 only
774
- valueBox(value = as.character(format(round(mean(react_d_payout_summary()[resolved == T & total_stake > 0, ]$net_payout, na.rm = T), 2), nsmall = 2)),
775
  subtitle = "Avg. Round Payout (Resolved)",
776
  color = "olive")
777
  })
778
 
779
  output$payout_average_pending <- renderValueBox({
780
  # Use rounds with stake > 0 only
781
- valueBox(value = as.character(format(round(mean(react_d_payout_summary()[resolved == F & total_stake > 0, ]$net_payout, na.rm = T), 2), nsmall = 2)),
782
  subtitle = "Avg. Round Payout (Pending)",
783
  color = "yellow")
784
  })
785
 
786
  output$payout_average <- renderValueBox({
787
  # Use rounds with stake > 0 only
788
- valueBox(value = as.character(format(round(mean(react_d_payout_summary()[total_stake > 0, ]$net_payout, na.rm = T), 2), nsmall = 2)),
789
  subtitle = "Avg. Round Payout (All)",
790
  color = "light-blue")
791
  })
@@ -1019,7 +1042,7 @@ server <- function(input, output) {
1019
  dom = 'Bflrtip', # https://datatables.net/reference/option/dom
1020
  buttons = list('csv', 'excel', 'copy', 'print'), # https://rstudio.github.io/DT/003-tabletools-buttons.html
1021
  order = list(list(0, 'asc'), list(1, 'asc')),
1022
- pageLength = 500,
1023
  lengthMenu = c(10, 50, 100, 500, 1000),
1024
  columnDefs = list(list(className = 'dt-center', targets = "_all")))
1025
  ) |>
@@ -1068,7 +1091,7 @@ server <- function(input, output) {
1068
  dom = 'Bflrtip', # https://datatables.net/reference/option/dom
1069
  buttons = list('csv', 'excel', 'copy', 'print'), # https://rstudio.github.io/DT/003-tabletools-buttons.html
1070
  order = list(list(0, 'asc'), list(1, 'asc')),
1071
- pageLength = 500,
1072
  lengthMenu = c(10, 50, 100, 500, 1000),
1073
  columnDefs = list(list(className = 'dt-center', targets = "_all")))
1074
  ) |>
 
267
 
268
  markdown("# **Payout Summary**"),
269
  markdown("### Remember to refresh the charts after making changes to model selection or settings below."),
270
+ markdown("### **NOTE**: the charts will take a while to render if you have selected a lot of models."),
271
 
272
  br(),
273
 
 
283
  step = 1,
284
  min = 168, # first tournament round
285
  max = Rnumerai::get_current_round(), # note: daily payouts from round 474
286
+ value = c(496, Rnumerai::get_current_round())
287
  )
288
  ),
289
 
 
305
  tabsetPanel(type = "tabs",
306
 
307
 
308
+ tabPanel("Overview",
309
 
310
  br(),
311
 
312
+ h3(strong(textOutput(outputId = "text_payout_overview"))),
313
 
314
  br(),
315
 
 
336
 
337
  shinycssloaders::withSpinner(plotlyOutput("plot_payout_net")),
338
 
339
+ br()
340
+
341
+ ),
342
+
343
+
344
+ tabPanel("Payout Summary (Rounds)",
345
+
346
+ br(),
347
+
348
+ h3(strong(textOutput(outputId = "text_payout_rnd"))),
349
+
350
  br(),
351
 
352
  DTOutput("dt_payout_summary"),
 
354
  br()
355
 
356
  ),
357
+
358
 
359
+ tabPanel("Payout Summary (Individual Models)",
360
+
361
+ br(),
362
+
363
+ h3(strong(textOutput(outputId = "text_payout_ind"))),
364
 
365
  br(),
366
 
 
716
  # Reactive: Payout Value Boxes
717
  # ============================================================================
718
 
719
+ output$text_payout_overview <- renderText({
720
+ if (nrow(react_d_filter()) >= 1) "Payout Summary (Overview)" else " "
721
+ })
722
+
723
+ output$text_payout_rnd <- renderText({
724
+ if (nrow(react_d_filter()) >= 1) "Payout Summary (Tournament Rounds)" else " "
725
+ })
726
+
727
+ output$text_payout_ind <- renderText({
728
+ if (nrow(react_d_filter()) >= 1) "Payout Summary (Individual Models)" else " "
729
  })
730
 
731
  output$text_payout_all_models <- renderText({
732
+ if (nrow(react_d_filter()) >= 1) "Payout Summary Chart (Stacked)" else " "
733
  })
734
 
735
  output$text_payout_ind_models <- renderText({
736
+ if (nrow(react_d_filter()) >= 1) "Payout Summary Chart (Individual Models)" else " "
737
  })
738
 
739
 
 
770
  # ============================================================================
771
 
772
  output$payout_resolved <- renderValueBox({
773
+ valueBox(value = paste(as.character(format(round(sum(react_d_filter()[resolved == T, ]$payout, na.rm = T), 1), nsmall = 1)), "NMR"),
774
  subtitle = "Total Payout (Resolved)",
775
  color = "olive")
776
  })
777
 
778
  output$payout_pending <- renderValueBox({
779
+ valueBox(value = paste(as.character(format(round(sum(react_d_filter()[resolved == F, ]$payout, na.rm = T), 1), nsmall = 1)), "NMR"),
780
  subtitle = "Total Payout (Pending)",
781
  color = "yellow")
782
  })
783
 
784
  output$payout_total <- renderValueBox({
785
+ valueBox(value = paste(as.character(format(round(sum(react_d_filter()$payout, na.rm = T), 1), nsmall = 1)), "NMR"),
786
  subtitle = "Total Payout (All)",
787
  color = "light-blue")
788
  })
 
794
 
795
  output$payout_average_resolved <- renderValueBox({
796
  # Use rounds with stake > 0 only
797
+ valueBox(value = paste(as.character(format(round(mean(react_d_payout_summary()[resolved == T & total_stake > 0, ]$net_payout, na.rm = T), 1), nsmall = 1)), "NMR"),
798
  subtitle = "Avg. Round Payout (Resolved)",
799
  color = "olive")
800
  })
801
 
802
  output$payout_average_pending <- renderValueBox({
803
  # Use rounds with stake > 0 only
804
+ valueBox(value = paste(as.character(format(round(mean(react_d_payout_summary()[resolved == F & total_stake > 0, ]$net_payout, na.rm = T), 1), nsmall = 1)), "NMR"),
805
  subtitle = "Avg. Round Payout (Pending)",
806
  color = "yellow")
807
  })
808
 
809
  output$payout_average <- renderValueBox({
810
  # Use rounds with stake > 0 only
811
+ valueBox(value = paste(as.character(format(round(mean(react_d_payout_summary()[total_stake > 0, ]$net_payout, na.rm = T), 1), nsmall = 1)), "NMR"),
812
  subtitle = "Avg. Round Payout (All)",
813
  color = "light-blue")
814
  })
 
1042
  dom = 'Bflrtip', # https://datatables.net/reference/option/dom
1043
  buttons = list('csv', 'excel', 'copy', 'print'), # https://rstudio.github.io/DT/003-tabletools-buttons.html
1044
  order = list(list(0, 'asc'), list(1, 'asc')),
1045
+ pageLength = 100,
1046
  lengthMenu = c(10, 50, 100, 500, 1000),
1047
  columnDefs = list(list(className = 'dt-center', targets = "_all")))
1048
  ) |>
 
1091
  dom = 'Bflrtip', # https://datatables.net/reference/option/dom
1092
  buttons = list('csv', 'excel', 'copy', 'print'), # https://rstudio.github.io/DT/003-tabletools-buttons.html
1093
  order = list(list(0, 'asc'), list(1, 'asc')),
1094
+ pageLength = 100,
1095
  lengthMenu = c(10, 50, 100, 500, 1000),
1096
  columnDefs = list(list(className = 'dt-center', targets = "_all")))
1097
  ) |>