-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathapp_zscore_hw.R
More file actions
executable file
·86 lines (51 loc) · 1.83 KB
/
Copy pathapp_zscore_hw.R
File metadata and controls
executable file
·86 lines (51 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
##############################
# This is a shiny app with a histogram of the price z-scores.
# To run it, just press the "Run App" button on upper right of this panel.
##############################
##############################
# Below is the setup code that runs only once at startup
# when the shiny app is started.
# In the setup code you can load packages, define functions
# and variables, source files, and load data.
library(rutils)
# Load the SPY prices
symboln <- "SPY"
pricev <- log(na.omit(get(symboln, rutils::etfenv$prices)))
# End setup code
##############################
##############################
## Define the user interface
## Create elements of the user interface
uifun <- shiny::fluidPage(
titlePanel("Histogram of Price Z-scores"),
# Create single row with inputs
fluidRow(
# Create number of bins for the histogram
# Write your code here
# Input lambda decay parameter
# Write your code here
# Render the plot
# Write your code here
), # end fluidRow
) # end user interface
##############################
## Define the server function, with the arguments "input" and "output".
# The server function performs the calculations and creates the plots.
servfun <- function(input, output) {
# Calculate the z-scores
zscores <- shiny::reactive({
cat("Calculating the z-scores\n")
# Get model parameters from input argument
# Calculate the z-scores
# Use the function HighFreq::run_var() to calculate the
# EMA variance.
# Write your code here
}) # end z-scores
# Plot the data
output$plotobj <- shiny::renderPlot({
cat("Plotting the z-scores\n")
# Write your code here
}) # end renderPlot
} # end servfun
## Return a Shiny app object
shiny::shinyApp(ui=uifun, server=servfun)