tidyquant | Bringing financial analysis to the tidyverse | Time Series Database library
kandi X-RAY | tidyquant Summary
kandi X-RAY | tidyquant Summary
Bringing financial and business analysis to the tidyverse.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of tidyquant
tidyquant Key Features
tidyquant Examples and Code Snippets
Community Discussions
Trending Discussions on tidyquant
QUESTION
I have seen the question asked here from 2018. I'm wondering if there is a better answer today.
Our work computers are bedeviled by an entire IT security department that seems to exist to make them useless. We are allowed to run R 3.6.3 (4.x hasn't been approved yet). We cannot connect to CRAN from behind the corporate firewall. In the past that meant we took our laptops home to install packages. But now we have a download monitor that blocks CRAN downloads even when we're on our own wi-fi.
I was attempting to get around this by downloading the package .zip files on a personal machine, transferring them via CD, and then installing with repos=NULL. I used this code
...ANSWER
Answered 2022-Feb-09 at 03:33I'm not sure if it completely addresses your needs, but package checkpoint
seems appropriate here. It allows you to download source packages from a snapshot of CRAN taken at a specified date, going back to 2014-09-17
. R 4.0.0 was released around 2020-04-24
, so the snapshot from 2020-04-01
should work for your purposes.
Here is a reproducible example:
QUESTION
In order to highlight the moving average in my ggplot visualization, I want to give it a different color (in this case grey or black for both MA lines). When it comes to to a graph representing two time series, I struggle to find the best solution. Maybe I need to take a different approach.
...ANSWER
Answered 2022-Jan-27 at 19:32I think you can get what you want by not mapping variable to color in aes()
for the MA part. I instead include group = variable
to tell ggplot2 that the two MA's should be separate series, but no difference in their color based on that.
QUESTION
My issue is: when I run the following code from one laptop in RScript.exe via Task Scheduler, I get the desired output; that is the email is sent. But when I run the same code on another machine in RScript.exe via Task Scheduler, it doesn't run. Another machine (machine 2) is able to send emails (when only the code for email is run), so I think the issue is with the following part.
results <- get_everything(query = q, page = 1, page_size = 2, language = "en", sort_by = "popularity", from = Yest, to = Today)
I am unable to find what is the issue here. Can someone please help me with this?
My code is:
...ANSWER
Answered 2022-Jan-14 at 20:17Whenever you schedule jobs, consider using a command line shell such as PowerShell or Bash to handle the automation steps, capture, and log errors and messages. Rscript fails on the second machine for some unknown reason which you cannot determine since you do not receive any error messages from console using TaskScheduler.
Therefore, consider PowerShell to run all needed Rscript.exe
calls and other commands and capture all errors to date-stamped log file. Below script redirects all console output to a .log file with messages. When Rscript
command fails, the log will dump error or any console output (i.e., head
, tail
) below it. Regularly check logs after scheduled jobs.
PowerShell script (save as .ps1 file)
QUESTION
I am plotting the donchian high and low using tidy packages. the low value does not look correct. I am probably not calling the donchian function properly as the donchian_100_low is the highest value of the row. I dont know how to fix it.
...ANSWER
Answered 2021-Dec-31 at 09:44The problem is the input into DonchianChannel
. The input needs to be a matrix of 2 columns, not 2 separate columns. If you check the help it says:
Object that is coercible to xts or matrix and contains High-Low prices.
But it is a bit unclear. The example with it shows it a bit better, either a data.frame, matrix or xts object is fine.
Note that if you want a donchian channel with n = 100
, you need to specify the n
, default is: n = 10
.
To get it to work in your case, with tidyquant:
QUESTION
There are some mistakes in the Yahoo finance historical price for the Brazilian stock "PFRM3.SA". I was trying to conditionally change a value using dplyr
. I managed to do it using case_when()
but I couldn't make it work using replace()
, which I think should be a more efficient solution.
ANSWER
Answered 2021-Dec-30 at 08:57You just need to add in rowwise
before replace
. Essentially, in your replace
statement, close/100
is returning a new calculated value for every row. When in reality, you only want to replace the values greater than 100. So, with using rowwise
, then it will only calculate per row, rather than for the whole cost
column for the values
parameter.
QUESTION
I have some price data (in the end of this question) and I am trying to plot the geom_candlestick
chart using the following:
ANSWER
Answered 2021-Dec-29 at 10:21Update:
Now without warnings (check if TZ is correct, "CST" doesn't work) and with only needed items in legend.
QUESTION
I'm having an issue with the download handler from shiny (downloadHandler) and rendering a table using DT (using renderDataTable). When I use the download handler and render the table in my flexdashboard application, the pagination gets cut off. Thus, the user cannot switch to different pages of the table as the pagination doesn't fit the container or "the box" that renders the table. This only happens when I include the downloadHandler. If I include buttons using the extension from DT, the pagination does not get cut off. The problem is that I need to use the downloadHandler as the amount of data in my application is quite large. Please note, the example data is not representative of the size of the data. Does anyone know how to fix this issue?
Here is the code that I'm using:
...ANSWER
Answered 2021-Dec-15 at 19:23After much trail and error, I have found a working solution. I have changed the overload from hidden to auto using a css chunk. This chunk makes the pagination show up when the table overflows the container. ```{css my-style, echo = FALSE}
QUESTION
I'm trying to analyze candlestick formation Marubozu in R. So far I was able to download the different stocks data and find the formation using "Candlesticks" library in one stock data. I would like to automate that process so that I can run the CSPMarubozu function on many stocks at the same time.
My main problem is that I cannot really understand how can I pass the list of data to this function. While trying to do it with for loop (Try 1) I get following error: "Error in CSPMarubozu((names(stocks_list[i])), n = 20, ATRFactor = 0.8, : Price series must contain Open, High, Low and Close." I know, that I can't pass the character variable to this function, but I can't find the way to get index names without the "" mark. (ex. "AMZN" and I need just AMZN"
My other try (Try 2) was to do it with lapply() function but the same problem occurs
Here is my code:
...ANSWER
Answered 2021-Dec-14 at 18:17This downloads stocks and then shows three different equivalent ways of processing each stock. We use dim(...) but that would be replaced with whatever processing is desired. Note that if x is an xts object for a stock having OHLC as well as adjusted close and volume then Op(x), Hi(x), Lo(x), Cl(x), Ad(x) and Vo(x) are the vectors of Open, High, Low, Close, Adjusted Close and Volume.
Although the code below seems preferable getSymbols(stocks); L <- mget(stocks)
also works to put the stocks loose into your workspace and then collect them into a list L.
QUESTION
I'd like to retrieve financial data from Yahoo using the tidyquant
package (or any other package).
For retrieving Microsoft's (index: MSFT) closing prices, the following code works fine:
...ANSWER
Answered 2021-Nov-27 at 21:36The object names with special characters can be backquoted. Also, if there are NA
values, specify the na.rm = TRUE
along with na.action = NULL
as aggregate
can remove the whole row if there is NA
in any of the columns
QUESTION
I'm trying to make the default selection when the application loads in the "Manufacturer drop down to be "ALL." Currently, the option is blank when the user loads into the application. Does anyone know how you would do this when you allow for multiple inputs?
Here's some example data to use:
...ANSWER
Answered 2021-Nov-18 at 16:01The link I provided in the comment above provides the answer you need. You just didn't implement it correctly. To specify a default for a selectInput
with multiple=TRUE
, you need to provide a vector of default values, not a scalar.
Here is a MWE to demonstrate.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tidyquant
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page