"Sanjay kumar"
"01-Jan-2019"
The goal of project is to provide intractive plot for stock price for following stocks based on data provided by <“https://stooq.com>.
The interface provides user an ability to choose stock synbol and data range. Based on input selection, stock price trend is automationcally updated. Below is description of user input field
The application uses shinny apps. It has two parts UI and Server
library(shiny)
# Define UI for app that has sidebar pannel and main panel
ui <- fluidPage(
# App title ----
titlePanel("Stock Price Trend"),
sidebarLayout(
sidebarPanel(
#input: stock selector
selectInput("stock", "Choose stock:",list('ORCL','IBM','AMZN')
),
# Input: date range selector
dateRangeInput('dateRange',label = 'Date range input: yyyy-mm-dd',
start = Sys.Date() - 12000, end = Sys.Date()
)
),
mainPanel( # Output: linegraph ----
plotOutput(outputId = "distPlot")
)
)
)
server <- function(input, output) {
stock <- reactive({
switch(input$stock, "IBM" = IBM, "ORCL" = ORCL, "AMZN"=AMZN
)
})
output$distPlot <- renderPlot({
data<-stock() %>% filter(Date >= as.Date(input$dateRange[1],'%Y-%m-%d'))
ggplot(data,aes(Date,Close)) + geom_line(color="green", size=2)+geom_smooth() + ylab("Stock Price")
})
}
code is published at github
Documentation is publsihed at RPub
Application is published at shiniapp.io