stocks: Fast Functions for Stock Market Analysis

Functions for analyzing historical performance of stocks or other investments. Calculate maximum draw-down, Sharpe ratio, Sortino ratio, risk return ratio, alpha and beta from the capital assets pricing model (CAPM), and other commonly used metrics of stock performance. C++ used where possible to improve processing speed.

AuthorDane R. Van Domelen
Date of publication2016-01-11 18:25:23
MaintainerDane R. Van Domelen <>

View on R-Forge

Man pages

balances: Calculate Balances Based on Initial Balance and Vector of...

balances_weighted: Calculate Balances of a Weighted Portfolio of Various Funds

beta_trailing50: Beta for Last 50 Daily Gains

capm_daily: Calculate Capital Assets Pricing Model (CAPM) Metrics Based...

convert_rate: Convert Gain from One Time Interval to Another

daily_yearly: Convert Daily Gain to X-year Gain

diffs: Lagged Differences (Alternate Implementation)

final_balance: Calculate Final Balance Based on Initial Balance and Vector...

gains_rate: Calculate Growth Rate From a Vector of Stock or Investment...

historical_performance: Analyze Historical Performance of Individual Funds or a...

mdd: Maximum Drawdown

monthly_gains: Calculate Monthly Gains for One or More Tickers

neg: Return Negative Elements of a Numeric Vector

nonneg: Return Non-Negative Elements of a Numeric Vector

nonpos: Return Non-Positive Elements of a Numeric Vector

pchanges: Lagged Proportion/Percent Changes

pdiffs: Lagged Proportion/Percent Differences

pos: Return Positive Elements of a Numeric Vector

prices_rate: Calculate Growth Rate From a Vector of Stock Prices or...

ratios: Ratios of Subsequent Elements in a Numeric Vector

rrr: Risk-Return Ratio

sharpe_ratio: Sharpe Ratio

sortino_ratio: Sortino Ratio

stocks-package: Fast Functions for Stock Market Analysis

ticker_dates: Get Yahoo! Finance Start/End Dates for One or More Tickers

twofund_portfolio: Analyze Historical Performance of Two-Fund Portfolio as a...

vanguard_etfs: List of Vanguard ETFs and their inception dates, current as...

yearly_daily: Convert X-year Gain to Average Daily Gain

yearly_gains: Calculate Yearly Gains for One or More Tickers

zzz: Daily Closing Prices for Imaginary Stock ZZZ Over 10 Years


balances Man page
balances.weighted Man page
beta.trailing50 Man page
capm.daily Man page
convert.rate Man page
daily.yearly Man page
diffs Man page
final.balance Man page
gains.rate Man page
historical.performance Man page
mdd Man page
monthly.gains Man page
neg Man page
nonneg Man page
nonpos Man page
pchanges Man page
pdiffs Man page
pos Man page
prices.rate Man page
ratios Man page
rrr Man page
sharpe.ratio Man page
sortino.ratio Man page
stocks Man page
stocks-package Man page
ticker.dates Man page
twofund.portfolio Man page
vanguardetfs Man page
yearly.daily Man page
yearly.gains Man page
zzz Man page

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.