Questions tagged [tidyquant]

The R tidyquant package makes it easy to use common financial data analysis packages such as xts, zoo, and quantmod along with tidyverse data manipulation packages such as dplyr, tidyr, and purrr.

's tidyquant package brings financial analysis to the tidyverse. The tidyquant package provides a convenient wrapper to various , , and package functions and returns the objects in the tidy tibble format. The main advantage is being able to use quantitative functions with the tidyverse functions including , , , , , etc. See the tidyquant website for more information, documentation and examples.

Repositories

Detailed HTML vignettes

Other resources

Related tags

93 questions
3
votes
3 answers

R How to Pass a function as a String Inside another Function

Any assistance on this little conundrum would be mightily appreciated thanks. I am trying to pass an argument to the tq_transmute function from the tidyquant package; the value for the argument is a function, however I would like to pass it as a…
CallumH
  • 751
  • 1
  • 7
  • 22
3
votes
1 answer

R: how to access a tibble in a tibble?

I am reading Hadley's: http://r4ds.had.co.nz/tibbles.html However, I am still having difficulty referencing a tibble in a tibble. > library(tidyquant) > f <- tq_get("F", get="key.ratios") > f # A tibble: 7 x 2 section data …
AG1
  • 6,648
  • 8
  • 40
  • 57
2
votes
1 answer

Find stock market support trend lines more efficiently in R Tidyquant

I've developed some R code to find and draw trend lines on stock market data. However, the approach I'm using involves brute-force use of processing power and can take a long time, especially if I want to draw trend lines over more than a year's…
2
votes
0 answers

tq_get: error in evaluating the argument 'x' in selecting a method for function 'as_date'

When I try to use tq_get in {golem} I get the Warning: Warning: x = 'SPY', get = 'stock.prices': Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'as_date': object '_lubridate_C_valid_tz'…
Kevin P
  • 273
  • 1
  • 3
  • 13
2
votes
1 answer

Combining multiple time series in tidyverse

What is the tidyverse equivalent of 'merge'? Trying to do a small project in tidyverse... combining several time series into one by 'date': t3 <- tq_get("DGS3", get = 'economic.data', from='1900-01-01') t5 <- tq_get("DGS5", get = 'economic.data',…
ShaunC
  • 23
  • 3
2
votes
1 answer

How do you pass a list of variables to select in tq_mutate (TidyQuant) from within a function?

How can I modify my code so that I can pass a list of variables to select within tq_mutate when called from within a function? The following code works when called outside a function, but not when called inside a function: (Edited to add…
Jesse E.
  • 261
  • 1
  • 4
2
votes
1 answer

R: rolling correlation / non-standard evaluation

I am trying to calculate rolling correlation on a tibble, iterating through column names in a loop. I seem to be struggling passing variables to a function, though. This works: tbl <- tibble(date = seq(as.Date("1983-03-31"), by=7, length.out=100), …
rinspy
  • 386
  • 1
  • 10
2
votes
1 answer

Adding legend in ggplot2

I have looked through similar questions and I have a feeling I have done everything. Still not getting the desire output. I am using ggplot2 and tidyquant packages to visualize data with 2 financial trends I am trying to display a legend that…
Ann
  • 328
  • 1
  • 4
  • 14
2
votes
3 answers

getFinancials (quantmod) and tq_get (tidy quant) not working?

I'm getting the same error in both quantmod and tinyquant for financials data. Can anyone see if this is reproducable? Is this a google finance server issue? None of the below functions have been working for me.I'm not sure if it's me or the…
Joe
  • 63
  • 1
  • 2
  • 5
2
votes
1 answer

Coerce multiple objects to time series objects with different start/end dates

I am following this tutorial using the sweep package to perform tidy time series forecasting for groups of time series. Sweep extends the broom package to tidy forecast objects. Tutorial…
fed1414
  • 23
  • 4
2
votes
3 answers

Extract data from Environment in R or adjust code to save in data format.

I have the following code: It saves historic stock data from the csv file, what is exactly what i need, however all the data is in environment format and i cannot work with it. Is it possible to adjust the code so that the information would be saved…
1
vote
0 answers

Tidyquant library isn't being recognized in R 4.0.2

I was trying to learn data analysis by myself to teach my students, so I found on a website the tidyquant library. However, I got stuck in the very beginning. As consequence, I couldn't use the function tq_get(). I leave Here the commands and the…
1
vote
0 answers

R tq_get() down from tidyquant?

Is tq_get() down from tidyquant? I know the function is based off internet connection, but I've tried it from multiple computers and different connections. I was just curious if anyone is currently getting the same…
1
vote
1 answer

Error in tq_get, x = 'MKL', get = 'stock.prices': Error in new.session(): Could not establish session after 5 attempts

I am having difficulties pulling stock data. The code has worked earlier today, however this afternoon I became unable to pull any stock data at all. Is anyone else experiencing this error or have you figured out a solution. Here is a selection of…
1
vote
2 answers

Change column name with tq_get() in Tidyquant

I'm using the tq_get() function in Tidyquant to retrieve economic data from FRED: library(tidyquant) library(tidyverse) consumer_price_index <- 'CPIAUCSL' start_date <- as.Date('2022-01-01') end_date <- as.Date('2022-03-31') cpi <-…
equanimity
  • 2,371
  • 3
  • 29
  • 53
1
2 3 4 5 6 7