Learn R Programming

Examples of using FinCal

Created on Fri Jul 19 2013
Updated on Mon May 12 15:57:11 2014

FinCal -- Time Value of Money, time series analysis and Computational Finance

FinCal is available on [CRAN] (http://cran.r-project.org/web/packages/FinCal/) and GitHub

install.packages("FinCal",dependencies=TRUE) # from CRAN

or

library("devtools")
install_github("felixfan/FinCal") # from GitHub
library(FinCal)

Functions available:

ls("package:FinCal")
 [1] "bdy"                   "bdy2mmy"              
 [3] "candlestickChart"      "cash.ratio"           
 [5] "coefficient.variation" "cogs"                 
 [7] "current.ratio"         "ddb"                  
 [9] "debt.ratio"            "diluted.EPS"          
[11] "discount.rate"         "ear"                  
[13] "ear.continuous"        "ear2bey"              
[15] "ear2hpr"               "EIR"                  
[17] "EPS"                   "financial.leverage"   
[19] "fv"                    "fv.annuity"           
[21] "fv.simple"             "fv.uneven"            
[23] "geometric.mean"        "get.ohlc.google"      
[25] "get.ohlc.yahoo"        "get.ohlcs.google"     
[27] "get.ohlcs.yahoo"       "gpm"                  
[29] "harmonic.mean"         "hpr"                  
[31] "hpr2bey"               "hpr2ear"              
[33] "hpr2mmy"               "irr"                  
[35] "iss"                   "lineChart"            
[37] "lineChartMult"         "lt.d2e"               
[39] "mmy2hpr"               "n.period"             
[41] "npm"                   "npv"                  
[43] "pmt"                   "pv"                   
[45] "pv.annuity"            "pv.perpetuity"        
[47] "pv.simple"             "pv.uneven"            
[49] "quick.ratio"           "r.continuous"         
[51] "r.norminal"            "r.perpetuity"         
[53] "sampling.error"        "SFRatio"              
[55] "Sharpe.ratio"          "slde"                 
[57] "total.d2e"             "twrr"                 
[59] "volumeChart"           "was"                  
[61] "wpr"                  

Getting help on a function (e.g., pv)

help{pv}    # display the documentation for the function
args{pv}    # see arguments of the function
example{pv} # see example of using the function

Citations

  • Yanhui Fan. (2016) FinCal: package for time value of money calculation, time series analysis and computational finance. Zenodo.

Copy Link

Version

Install

install.packages('FinCal')

Version

0.6.3

License

GPL (>= 2)

Last Published

July 29th, 2016

Functions in FinCal (0.6.3)

ddb

Depreciation Expense Recognition -- double-declining balance (DDB), the most common declining balance method, which applies two times the straight-line rate to the declining balance.
candlestickChart

Technical analysts - Candlestick chart: show prices for each period as a continuous line. The box is clear if the closing price is higher than the opening price, or filled red if the closing is lower than the opening price.
diluted.EPS

diluted Earnings Per Share
cash.ratio

cash ratio -- Liquidity ratios measure the firm's ability to satisfy its short-term obligations as they come due.
coefficient.variation

Computing Coefficient of variation
cogs

Cost of goods sold and ending inventory under three methods (FIFO,LIFO,Weighted average)
bdy2mmy

Computing money market yield (MMY) for a T-bill
bdy

Computing bank discount yield (BDY) for a T-bill
current.ratio

current ratio -- Liquidity ratios measure the firm's ability to satisfy its short-term obligations as they come due.
debt.ratio

debt ratio -- Solvency ratios measure the firm's ability to satisfy its long-term obligations.
ear2hpr

Computing HPR, the holding period return
EPS

Basic Earnings Per Share
fv

Estimate future value (fv)
EIR

Equivalent/proportional Interest Rates
financial.leverage

financial leverage -- Solvency ratios measure the firm's ability to satisfy its long-term obligations.
fv.annuity

Estimate future value of an annuity
ear2bey

bond-equivalent yield (BEY), 2 x the semiannual discount rate
ear.continuous

Convert stated annual rate to the effective annual rate with continuous compounding
discount.rate

Computing the rate of return for each period
ear

Convert stated annual rate to the effective annual rate
get.ohlcs.yahoo

Batch download stock prices from Yahoo Finance (open, high, low, close, volume, adjusted)
gpm

gross profit margin -- Evaluate a company's financial performance
fv.uneven

Computing the future value of an uneven cash flow series
fv.simple

Estimate future value (fv) of a single sum
lt.d2e

long-term debt-to-equity -- Solvency ratios measure the firm's ability to satisfy its long-term obligations.
hpr

Computing HPR, the holding period return
harmonic.mean

harmonic mean, average price
get.ohlcs.google

Batch download stock prices from Google Finance (open, high, low, close, volume)
get.ohlc.yahoo

Download stock prices from Yahoo Finance (open, high, low, close, volume, adjusted)
mmy2hpr

Computing HPR, the holding period return
hpr2bey

bond-equivalent yield (BEY), 2 x the semiannual discount rate
hpr2ear

Convert holding period return to the effective annual rate
irr2

Computing IRR, the internal rate of return
iss

calculate the net increase in common shares from the potential exercise of stock options or warrants
pv

Estimate present value (pv)
pv.annuity

Estimate present value (pv) of an annuity
lineChart

Technical analysts - Line charts: show prices for each period as a continuous line
get.ohlc.google

Download stock prices from Google Finance (open, high, low, close, volume)
geometric.mean

Geometric mean return
lineChartMult

Technical analysts - Line charts: show prices for each period as a continuous line for multiple stocks
pv.perpetuity

Estimate present value of a perpetuity
pv.simple

Estimate present value (pv) of a single sum
irr

Computing IRR, the internal rate of return
volumeChart

Technical analysts - Volume charts: show each period's volume as a vertical line
twrr

Computing TWRR, the time-weighted rate of return
quick.ratio

quick ratio -- Liquidity ratios measure the firm's ability to satisfy its short-term obligations as they come due.
hpr2mmy

Computing money market yield (MMY) for a T-bill
npv

Computing NPV, the PV of the cash flows less the initial (time = 0) outlay
pv.uneven

Computing the present value of an uneven cash flow series
pmt

Estimate period payment
SFRatio

Computing Roy's safety-first ratio
r.norminal

Convert a given continuous compounded rate to a norminal rate
Sharpe.ratio

Computing Sharpe Ratio
was

calculate weighted average shares -- weighted average number of common shares
slde

Depreciation Expense Recognition -- Straight-line depreciation (SL) allocates an equal amount of depreciation each year over the asset's useful life
n.period

Estimate the number of periods
wpr

Weighted mean as a portfolio return
total.d2e

total debt-to-equity -- Solvency ratios measure the firm's ability to satisfy its long-term obligations.
r.continuous

Convert a given norminal rate to a continuous compounded rate
npm

net profit margin -- Evaluate a company's financial performance
r.perpetuity

Rate of return for a perpetuity
sampling.error

Computing Sampling error