Skip to content

Commit

Permalink
use mirai for oanda_studio(new.process = TRUE)
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Dec 14, 2023
1 parent c812b95 commit 18adf4f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Depends:
R (>= 3.5)
Imports:
ggplot2 (>= 3.4.0),
mirai (>= 0.11.0),
nanonext (>= 0.11.0),
RcppSimdJson (>= 0.1.9),
shiny (>= 1.4.0),
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ importFrom(ggplot2,scale_x_continuous)
importFrom(ggplot2,scale_y_continuous)
importFrom(ggplot2,theme)
importFrom(ggplot2,theme_grey)
importFrom(mirai,mirai)
importFrom(nanonext,ncurl)
importFrom(nanonext,sha256)
importFrom(shiny,HTML)
Expand All @@ -99,6 +100,7 @@ importFrom(shiny,reactiveVal)
importFrom(shiny,renderPlot)
importFrom(shiny,renderUI)
importFrom(shiny,req)
importFrom(shiny,runApp)
importFrom(shiny,selectInput)
importFrom(shiny,shinyApp)
importFrom(shiny,sliderInput)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ichimoku 1.4.11.9000 (development)

* Uses 'mirai' to run `oanda_studio(new.process = TRUE)`
* Fixes `oanda_switch()`, regression since v1.4.11.
* Internal performance enhancements.

Expand Down
5 changes: 3 additions & 2 deletions R/ichimoku-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,13 @@
#' PositionIdentity rel scale_color_manual scale_fill_manual
#' scale_x_continuous scale_y_continuous Stat StatIdentity theme theme_grey
#' %+replace%
#' @importFrom mirai mirai
#' @importFrom nanonext ncurl sha256
#' @importFrom shiny checkboxInput column downloadButton downloadHandler HTML
#' fillPage fluidPage fluidRow hoverOpts invalidateLater isolate
#' numericInput observeEvent plotOutput reactive reactiveVal renderPlot
#' renderUI req selectInput shinyApp sliderInput stopApp tags textInput
#' uiOutput wellPanel
#' renderUI req runApp selectInput shinyApp sliderInput stopApp tags
#' textInput uiOutput wellPanel
#' @importFrom RcppSimdJson is_valid_json
#' @importFrom stats na.omit sd
#' @importFrom utils packageVersion str
Expand Down
9 changes: 3 additions & 6 deletions R/oanda.R
Original file line number Diff line number Diff line change
Expand Up @@ -576,11 +576,7 @@ oanda_studio <- function(instrument = "USD_JPY",
isTRUE(new.process) && {
mc <- match.call()
mc[["new.process"]] <- NULL
cmd <- switch(.subset2(.Platform, "OS.type"),
unix = file.path(R.home("bin"), "Rscript"),
windows = file.path(R.home("bin"), "Rscript.exe"))
return(system2(command = cmd, args = c("-e", shQuote(paste0("ichimoku::", deparse(mc)))),
stdout = NULL, stderr = NULL, wait = FALSE))
return(invisible(mirai(mc, oanda_studio = oanda_studio)))
}
if (!missing(instrument)) instrument <- sub("-", "_", toupper(force(instrument)), fixed = TRUE)
granularity <- match.arg(granularity, c("D", "W", "M",
Expand Down Expand Up @@ -771,7 +767,8 @@ oanda_studio <- function(instrument = "USD_JPY",
session$onSessionEnded(stopApp)
}

shinyApp(ui = ui, server = server, options = list(launch.browser = launch.browser, ...))
app <- shinyApp(ui = ui, server = server, options = list(launch.browser = launch.browser, ...))
runApp(app)

}

Expand Down
1 change: 1 addition & 0 deletions vignettes/reference.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ ichimoku currently has the following external package dependencies:
- ggplot2 - for graphics and visualization
- shiny - for interactive and live visualizations
- xts, zoo - for enhanced time series methods
- mirai - for running applications in background processes
- nanonext - for interfacing with external APIs and verifying the data integrity of archived objects
- RcppSimdJson - for parsing data received from external APIs

Expand Down

0 comments on commit 18adf4f

Please sign in to comment.