10.12.2019 Views

Python for Finance

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Time Value of Money

The following table summarizes those functions:

Function

Input format

sp.fv() fin.fv() fv(rate, nper, pmt, pv, when='end')

sp.pv() fin.pv() pv(rate, nper, pmt, fv=0.0, when='end')

sp.pmt() fin.pmt() pmt(rate, nper, pv, fv=0, when='end')

sp.npv() fin.npv() npv(rate, values)

sp.rate() fin.rate() rate(nper, pmt, pv, fv, when='end',

guess=0.1, tol=1e-06, maxiter=100)

sp.nper() fin.nper() nper(rate, pmt, pv, fv=0, when='end')

sp.irr() fin.irr() irr(values)

sp.mirr() fin.mirr() mirr(values, finance_rate, reinvest_rate)

sp.ipmt() fin.ipmt() ipmt(rate, per, nper, pv, fv=0.0,

when='end')

sp.ppmt() fin.ppmt() ppmt(rate, per, nper, pv, fv=0.0,

when='end')

Table 3.1 A list of functions contained in Scipy and numpy.lib.financial

The other financial calculator was written by the author of this book. Appendix B

shows how to download it. Here is a list of functions:

>>> import fincal

>>> dir(fincal)

['CND', 'EBITDA_value', 'IRR_f', 'IRRs_f', 'NPER', 'PMT', 'Rc_f',

'Rm_f', '__builtins__', '__cached__', '__doc__', '__file__', '__

loader__', '__name__', '__package__', '__request', '__spec__',

'bondPrice', 'bsCall', 'convert_B_M', 'duration', 'exp', 'fincalHelp',

'fvAnnuity', 'fv_f', 'get_200day_moving_avg', 'get_50day_moving_avg',

'get_52week_high', 'get_52week_low', 'get_EBITDA', 'get_all', 'get_

avg_daily_volume', 'get_book_value', 'get_change', 'get_dividend_

per_share', 'get_dividend_yield', 'get_earnings_per_share', 'get_

historical_prices', 'get_market_cap', 'get_price', 'get_price_book_

ratio', 'get_price_earnings_growth_ratio', 'get_price_earnings_ratio',

'get_price_sales_ratio', 'get_short_ratio', 'get_stock_exchange',

'get_volume', 'log', 'market_cap', 'mean', 'modified_duration', 'n_

annuity', 'npv_f', 'payback_', 'payback_period', 'pi', 'pvAnnuity',

'pvAnnuityDue', 'pvAnnuity_k_period_from_today', 'pvGrowingAnnuity',

'pvGrowingPerpetuity', 'pvPerpetuity', 'pvPerpetuityDue', 'pv_excel',

'pv_f', 'r_continuous', 're', 'sign', 'sqrt', 'urllib']

[ 82 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!