Package: tidyquant 1.0.12.9000

Matt Dancho

tidyquant: Tidy Quantitative Financial Analysis

Bringing business and financial analysis to the 'tidyverse'. The 'tidyquant' package provides a convenient wrapper to various 'xts', 'zoo', 'quantmod', 'TTR' and 'PerformanceAnalytics' 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 'purrr', 'dplyr', 'tidyr', 'ggplot2', 'lubridate', etc. See the 'tidyquant' website for more information, documentation and examples.

Authors:Matt Dancho [aut, cre], Davis Vaughan [aut]

tidyquant_1.0.12.9000.tar.gz
tidyquant_1.0.12.9000.zip(r-4.7)tidyquant_1.0.12.9000.zip(r-4.6)tidyquant_1.0.12.9000.zip(r-4.5)
tidyquant_1.0.12.9000.tgz(r-4.6-any)tidyquant_1.0.12.9000.tgz(r-4.5-any)
tidyquant_1.0.12.9000.tar.gz(r-4.7-any)tidyquant_1.0.12.9000.tar.gz(r-4.6-any)
tidyquant_1.0.12.9000.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
tidyquant/json (API)

# Install 'tidyquant' in R:
install.packages('tidyquant', repos = c('https://business-science.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/business-science/tidyquant/issues

Pkgdown/docs site:https://business-science.github.io

Datasets:
  • FANG - Stock prices for the "FANG" stocks.

On CRAN:

Conda:

dplyrfinancial-analysisfinancial-datafinancial-statementsmultiple-stocksperformance-analysisperformanceanalyticsquantmodstockstock-exchangesstock-indexesstock-listsstock-performancestock-pricesstock-symboltidyversetime-seriestimeseriesxts

13.39 score 910 stars 1 packages 5.7k scripts 16k downloads 2 mentions 161 exports 140 dependencies

Last updated from:a5cb868d79. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK281
source / vignettesOK395
linux-release-x86_64OK271
macos-release-arm64OK151
macos-oldrel-arm64OK107
windows-develOK164
windows-releaseOK123
windows-oldrelOK135
wasm-releaseOK165

Exports:%>%ABSAS_DATEAS_DATETIMEav_api_keyAVERAGEAVERAGE_IFSCEILING_DATECEILING_DAYCEILING_MONTHCEILING_QUARTERCEILING_WEEKCEILING_YEARCHANGECHANGE_FIRSTLASTcoord_x_datecoord_x_datetimeCORCOUNTCOUNT_DAYSCOUNT_IFSCOUNT_UNIQUECOVCREATE_IFSCUMULATIVE_MAXCUMULATIVE_MEANCUMULATIVE_MEDIANCUMULATIVE_MINCUMULATIVE_PRODUCTCUMULATIVE_SUMDATEDATE_SEQUENCEDATE_TO_DECIMALDATE_TO_NUMERICDATEVALUEDAYDMYDMY_HDMY_HMDMY_HMSDOMDOWEDATEEOMONTHEXPFIRSTFLOOR_DATEFLOOR_DAYFLOOR_MONTHFLOOR_QUARTERFLOOR_WEEKFLOOR_YEARFVgeom_barchartgeom_bbandsgeom_bbands_geom_candlestickgeom_mageom_ma_HOLIDAY_SEQUENCEHOLIDAY_TABLEHOURIRRLAGLASTLEADLOGMAXMAX_IFSMDAYMDYMDY_HMDY_HMMDY_HMSMEDIANMEDIAN_IFSMINMIN_IFSMINUTEMONTHMONTHDAYNET_WORKDAYSNOWNPVNTHpalette_darkpalette_greenpalette_lightPCT_CHANGEPCT_CHANGE_FIRSTLASTpivot_tablePMTPVQDAYquandl_api_keyquandl_searchQUARTERQUARTERDAYRATERETURNROUND_DATEROUND_DAYROUND_MONTHROUND_QUARTERROUND_WEEKROUND_YEARscale_color_tqscale_colour_tqscale_fill_tqSECONDSQRTSTDEVSUMSUM_IFStheme_tqtheme_tq_darktheme_tq_greentidyquant_conflictstiingo_api_keyTODAYtq_exchangetq_exchange_optionstq_fund_holdingstq_fund_source_optionstq_gettq_get_optionstq_indextq_index_optionstq_mutatetq_mutate_tq_mutate_fun_optionstq_mutate_xytq_mutate_xy_tq_performancetq_performance_tq_performance_fun_optionstq_portfoliotq_portfolio_tq_repeat_dftq_transformtq_transform_xytq_transmutetq_transmute_tq_transmute_fun_optionstq_transmute_xytq_transmute_xy_VARVLOOKUPWDAYWEEKWEEKDAYWEEKNUMWEEKNUM_ISOWORKDAY_SEQUENCEYEARYEAR_ISOYEARFRACYMDYMD_HYMD_HMYMD_HMS

Dependencies:anytimeaskpassbase64encBHbitbit64bslibcachemcellrangerclassclicliprclockcodetoolscolorspacecpp11crayoncrosstalkcurldata.tableDEoptimRdiagramdigestdplyrevaluatefarverfastmapfontawesomeforcatsforecastfracdifffsfurrrfuturefuture.applygenericsggplot2globalsgluegowergtablehardhathighrhmshtmltoolshtmlwidgetshttrhttr2ipredisobandjquerylibjsonliteKernSmoothknitrlabelinglaterlatticelavalazyevallifecyclelistenvlmtestlubridatemagrittrMASSMatrixmemoisemimemvtnormnlmennetnumDerivopensslotelpadrparallellypcaPPPerformanceAnalyticspillarpkgconfigplotlyprettyunitsprodlimprogressprogressrpromisespurrrpyinitquadprogquantmodR6rappdirsRColorBrewerRcppRcppArmadilloRcppRollreadrreadxlrecipesrematchrlangrmarkdownRobStatTMrobustbaserpartrrcovrsampleS7sassscalesshapeslidersparsevctrsSQUAREMstringistringrsurvivalsystibbletidyrtidyselecttimechangetimeDatetimetktinytextseriestsfeaturesTTRtzdburcautf8vctrsviridisLitevroomwarpwithrxfunxtsyamlzoo

Core Functions in tidyquant
Overview | Prerequisites | 1.0 Retrieve Consolidated Symbol Data | 1.1 Stock Indexes | 1.2 Stock Exchanges | 1.0 Get Quantitative Data | 2.1 Yahoo! Finance | 2.2 FRED Economic Data | 2.3 Nasdaq Data Link (Quandl) API | Authentication | Search | Getting Nasdaq Data Link Data | 2.4 Tiingo API | Getting Tiingo Data | 2.5 Alpha Vantage API | Getting Alpha Vantage Data | 2.6 Bloomberg | Getting Bloomberg Data | 3.0 Mutate Quantitative Data | 3.1 Transmute Quantitative Data, tq_transmute | Working with non-OHLC data | 3.2 Mutate Quantitative Data, tq_mutate | Mutate rolling regressions with rollapply | 3.3 _xy Variants, tq_mutate_xy and tq_transmute_xy | Mutate with two primary inputs

Last update: 2026-03-16
Started: 2017-01-29

Performance Analysis with tidyquant
Overview | 1.0 Key Concepts | 2.0 Quick Example | 3.0 Workflow | 3.1 Individual Assets | Step 1A: Get stock prices | Step 2A: Mutate to returns | Step 3A: Aggregate to Portfolio Returns (Skipped) | Step 4: Analyze Performance | 3.2 Portfolios (Asset Groups) | Single Portfolio | Steps 1A and 2A: Asset Period Returns | Steps 1B and 2B: Baseline Period Returns | Step 3A: Aggregate to Portfolio Period Returns | Method 1: Aggregating a Portfolio using Vector of Weights | Method 2: Aggregating a Portfolio using Two Column tibble with Symbols and Weights | Step 3B: Merging Ra and Rb | Step 4: Computing the CAPM Table | Multiple Portfolios | Steps 1 and 2 are the Exact Same as the Single Portfolio Example | Step 3A: Aggregate Portfolio Returns for Multiple Portfolios | Steps 3B and 4: Merging and Assessing Performance | 4.0 Available Functions | 4.1 table.Stats | 4.2 table.CAPM | 4.3 table.AnnualizedReturns | 4.4 table.Correlation | 4.5 table.DownsideRisk | 4.6 table.DownsideRiskRatio | 4.7 table.HigherMoments | 4.8 table.InformationRatio | 4.9 table.Variability | 4.10 VaR | 4.11 SharpeRatio | 5.0 Customizing using the ... | 5.1 Customizing tq_portfolio | 5.2 Customizing tq_performance

Last update: 2026-03-16
Started: 2017-02-11

Charting with tidyquant
Overview | Prerequisites | Chart Types | Line Chart | Bar Chart | Candlestick Chart | Charting Multiple Securities | Visualizing Trends | Moving Averages | Example 1: Charting the 50-day and 200-day simple moving average | Example 2: Charting exponential moving averages | Example 3: Charting moving averages for multiple stocks at once | Bollinger Bands | Example 1: Applying BBands using a SMA | Example 2: Modifying the appearance of Bollinger Bands | Example 3: Adding BBands to multiple stocks | ggplot2 Functionality | Example 1: Log Scale with scale_y_log10 | Example 2: Regression trendlines with geom_smooth | Example 3: Charting volume with geom_segment | Themes | Dark

Last update: 2024-09-02
Started: 2017-01-29

Introduction to tidyquant
2-Minutes To Tidyquant | Benefits | A Few Core Functions with A Lot of Power | Integrates the Quantitative Analysis Functionality of xts/zoo, quantmod TTR and Performance Analytics | Designed for the data science workflow of the tidyverse | Implements ggplot2 Functionality for Financial Visualizations | Performance Analysis of Asset and Portfolio Returns

Last update: 2024-09-02
Started: 2017-01-29

R Quantitative Analysis Package Integrations in tidyquant
Overview | Prerequisites | 1.0 Function Compatibility | zoo Functionality | xts Functionality | quantmod Functionality | TTR Functionality | PerformanceAnalytics Functionality | 2.0 Quantitative Power In Action | Example 1: Use quantmod periodReturn to Convert Prices to Returns | Example 1A: Getting and Charting Annual Returns | Example 1B: Getting Daily Log Returns | Example 2: Use xts to.period to Change the Periodicity from Daily to Monthly | Without Periodicity Aggregation | With Monthly Periodicity Aggregation | Example 3: Use TTR runCor to Visualize Rolling Correlations of Returns | Example 4: Use TTR MACD to Visualize Moving Average Convergence Divergence | Example 5: Use xts apply.quarterly to Get the Max and Min Price for Each Quarter | Example 6: Use zoo rollapply to visualize a rolling regression | Example 7: Use Return.clean and Return.excess to clean and calculate excess returns

Last update: 2024-09-02
Started: 2017-01-29

Scaling and Modeling with tidyquant
Overview | Prerequisites | 1.0 Scaling the Getting of Financial Data | Method 1: Map a character vector with multiple stock symbols | Method 2: Map a tibble with stocks in first column | Method 2A: Make a tibble | Method 2B: Use index or exchange | 2.0 Scaling the Mutation of Financial Data | 3.0 Modeling Financial Data using purrr | Example: Applying a Regression Model to Detect a Positive Trend | Analyze a Single Stock | Scale to Many Stocks | 4.0 Error Handling when Scaling | Pros and Cons to Built-In Error-Handling | Bad Apples Fail Gracefully, tq_get

Last update: 2024-09-02
Started: 2017-03-02

Excel in R with tidyquant

Last update: 2023-09-29
Started: 2020-02-29

Readme and manuals

Help Manual

Help pageTopics
tidyquant: Integrating quantitative financial analysis tools with the tidyversetidyquant-package tidyquant
Set Alpha Vantage API Keyav_api_key
Zoom in on plot regions using date ranges or date-time rangescoord_x_date coord_x_datetime
Deprecated functionsdeprecated tq_transform tq_transform_xy
Excel Date and Time FunctionsAS_DATE AS_DATETIME CEILING_DATE CEILING_DAY CEILING_MONTH CEILING_QUARTER CEILING_WEEK CEILING_YEAR COUNT_DAYS DATE DATEVALUE DATE_SEQUENCE DATE_TO_DECIMAL DATE_TO_NUMERIC DAY DMY DMY_H DMY_HM DMY_HMS DOM DOW EDATE EOMONTH excel_date_functions FLOOR_DATE FLOOR_DAY FLOOR_MONTH FLOOR_QUARTER FLOOR_WEEK FLOOR_YEAR HOLIDAY_SEQUENCE HOLIDAY_TABLE HOUR MDAY MDY MDY_H MDY_HM MDY_HMS MINUTE MONTH MONTHDAY NET_WORKDAYS NOW QDAY QUARTER QUARTERDAY ROUND_DATE ROUND_DAY ROUND_MONTH ROUND_QUARTER ROUND_WEEK ROUND_YEAR SECOND TODAY WDAY WEEK WEEKDAY WEEKNUM WEEKNUM_ISO WORKDAY_SEQUENCE YEAR YEARFRAC YEAR_ISO YMD YMD_H YMD_HM YMD_HMS
Excel Financial Math Functionsexcel_financial_math_functions FV IRR NPV PMT PV RATE
Excel Summarising "If" FunctionsAVERAGE_IFS COUNT_IFS CREATE_IFS excel_if_functions MAX_IFS MEDIAN_IFS MIN_IFS SUM_IFS
Excel Pivot Tableexcel_pivot_table pivot_table
Excel Reference Functionsexcel_ref_functions VLOOKUP
Excel Statistical Mutation FunctionsABS CHANGE CUMULATIVE_MAX CUMULATIVE_MEAN CUMULATIVE_MEDIAN CUMULATIVE_MIN CUMULATIVE_PRODUCT CUMULATIVE_SUM excel_stat_mutation_functions EXP LAG LEAD LOG PCT_CHANGE RETURN SQRT
Excel Statistical Summary FunctionsAVERAGE CHANGE_FIRSTLAST COR COUNT COUNT_UNIQUE COV excel_stat_summary_functions FIRST LAST MAX MEDIAN MIN NTH PCT_CHANGE_FIRSTLAST STDEV SUM VAR
Stock prices for the "FANG" stocks.FANG
Plot Bollinger Bands using Moving Averagesgeom_bbands geom_bbands_
Plot Financial Charts in ggplot2geom_barchart geom_candlestick geom_chart
Plot moving averagesgeom_ma geom_ma_
tidyquant palettes for use with scalespalette_dark palette_green palette_light palette_tq
Query or set Nasdaq Data Link API Keyquandl_api_key
Search the Nasdaq Data Link databasequandl_search
tidyquant colors and fills for ggplot2.scale_color_tq scale_colour_tq scale_fill_tq scale_manual
tidyquant themes for ggplot2.theme_tq theme_tq_dark theme_tq_green
Conflicts between the tidyquant and other packagestidyquant_conflicts
Set Tiingo API Keytiingo_api_key
Get quantitative data in 'tibble' formattq_get tq_get_options
Get all stocks in a stock index or stock exchange in 'tibble' formattq_exchange tq_exchange_options tq_fund_holdings tq_fund_source_options tq_index tq_index_options
Mutates quantitative datatq_mutate tq_mutate_ tq_mutate_fun_options tq_mutate_xy tq_mutate_xy_ tq_transmute tq_transmute_ tq_transmute_fun_options tq_transmute_xy tq_transmute_xy_
Computes a wide variety of summary performance metrics from stock or portfolio returnstq_performance tq_performance_ tq_performance_fun_options
Aggregates a group of returns by asset into portfolio returnstq_portfolio tq_portfolio_ tq_repeat_df