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

63 questions
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,428
  • 8
  • 35
  • 54
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
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
  • 423
  • 3
  • 15
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
  • 346
  • 1
  • 9
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
  • 53
  • 1
  • 1
  • 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 with changing stocks over time and changing weightvector over time

I want to be able to make a weight vector for every period, in the example here the weight vector is fixed at the beginning and there are no changes, I want to be able to change the weights. I also have changing number of stocks, so it is possible…
gilberke
  • 23
  • 4
1
vote
1 answer

Changing the value in a rank given a condition

I am trying to transform a table of stocks ranked by their return to a matrix of values that would be inputted to PerformanceAnalytics::ReturnPortfolio as the weights of the stocks in the portfolio. What I am specially looking to do is to transform…
1
vote
1 answer

How to use tidyquant (performance analytics) to calculate portfolio statistics in a portfolio with varying assets by period

I know there are good resources for calculating stock and portfolio returns using performance analytics in tidyquant for R. For example, assume we want to determine the annual portfolio returns (2011 through 2015) for a portfolio that contains…
Jcarl
  • 117
  • 1
  • 8
1
vote
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…
1
vote
1 answer

R: if else statement is handling column as whole vector

I have a data set where I want to calculate the 6 month return of stocks with tq_get (see example below) Dataset called top ticker 6month AKO.A BIG BGFV Function library(tidyverse) library(dplyr) library(tidyquant) library(riingo) calculate <-…
MelBourbon
  • 75
  • 8
1
vote
0 answers

Plotting 52 week range in R

I am trying to pull stock price data using tq_get in tidyquant, then want to plot the current price against the 52 week range. Here is an example of what I am looking to create. Basically just a visual representation of where the stock is…
1
2 3 4 5