# Financial

Functions to develop a financial analysis

## annual interest rate(settlement, maturity, investment, redemption, [basis])

Annual interest rate function returns the interest rate

Parameters
Name Required Type Description

settlement

Yes

Date

The date when bond exchange is settled between buyer and seller (transfer completed and payment made)

maturity

Yes

Date

The date when bond is repaid in full

investment

Yes

Number

The amount invested in the security

redemption

Yes

Number

Value of security per 100

basis

No

Number

The date system to be used to calculate a year’s number of days (US NASD = 0, number of days in month and year = 1, number of days in month and 360 days in year = 2, number of days in month and 365 days in year = 3, European = 4)

 Number
Examples
``financial.annual interest rate(date(2008, 2, 15), date(2008, 5, 15), 1000000, 1014420, 0) => 0.05768``

## annual nominal interest rate(effective rate, number of periods per year)

Annual nominal interest rate function returns the annual nominal interest rate

Parameters
Name Required Type Description

effective rate

Yes

Number

The effective interest rate

number of periods per year

Yes

Number

The number of periods per year

 Number
Examples
``financial.annual nominal interest rate(0.053543, 4) => 0.05250032``

## asset depreciation(cost, salvage, life, period, [month])

Asset depreciation function returns the depereciation of the asset for a period

Parameters
Name Required Type Description

cost

Yes

Number

The cost of the asset

salvage

Yes

Number

The value of the asset at the end of the depreciation

life

Yes

Number

The number of periods before the asset is being depreciated

period

Yes

Number

The period

month

No

Number

The number of months for the first year. Default value is set to 12

 Number
Examples
``financial.asset depreciation(1000000, 100000, 6, 1, 7) => 186083.33333333``

## cumulative interest payments(rate, number of periods, present value, start period, end period, type)

Cumulative interest payments function returns the cumulative interest paid between two periods

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate

number of periods

Yes

Number

The total number of payments

present value

Yes

Number

The present value of the asset. Default value is set to 0

start period

Yes

Number

The first period

end period

Yes

Number

The last period

type

Yes

Number

Two values are accepted: 0 (payment at the end of each period) and 1 (payment at the beginning of each period). Default value is set to 0

 Number
Examples
``financial.cumulative interest payments(0.09, 30, 125000, 13, 24, 0) => -11135.23213``

## cumulative principal payment(rate, number of periods, present value, start period, end period, type)

Cumulative principal payment function returns the cumulative interest paid for a period and a constant rate

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate

number of periods

Yes

Number

The total number of payments

present value

Yes

Number

The present value of the asset. Default value is set to 0

start period

Yes

Number

The first period

end period

Yes

Number

The last period

type

Yes

Number

Two values are accepted: 0 (payment at the end of each period) and 1 (payment at the beginning of each period). Default value is set to 0

 Number
Examples
``financial.cumulative principal payment(0.09, 360, 125000, 13, 24, 0) => -934.1``

## decimal fraction to decimal number(fractional dollar, fraction)

decimal fraction to decimal number function returns a decimal number

Parameters
Name Required Type Description

fractional dollar

Yes

Number

Decimal fraction

fraction

Yes

Number

Denominator of decimal fraction

 Number
Examples
``financial.decimal fraction to decimal number(1.2, 16) => 2.25``

## decimal number to decimal fraction(decimal dollar, fraction)

decimal number to decimal fraction function returns a decimal fraction

Parameters
Name Required Type Description

decimal dollar

Yes

Number

Decimal number

fraction

Yes

Number

Denominator of decimal fraction

 Number
Examples
``financial.decimal number to decimal fraction(5.5, 12) => 5.06``

## depreciation for accounting period(cost, date purchased, first period, salvage, period, rate, [basis])

Depreciation for each accounting period function returns the depreciation of an asset for an accounting period

Parameters
Name Required Type Description

cost

Yes

Number

The cost of the asset

date purchased

Yes

Date

The date when the asset was purchased

first period

Yes

Date

The end date of the first period

salvage

Yes

Number

The value of the asset at the end of the depreciation

period

Yes

Number

The period

rate

Yes

Number

The interest rate (it can be a depreciation)

basis

No

Number

The date system to be used to calculate a year’s number of days (US NASD = 0, number of days in month and year = 1, number of days in month and 360 days in year = 2, number of days in month and 365 days in year = 3, European = 4)

 Number
Examples
``financial.depreciation for accounting period(2400, date(2008, 9, 19), date(2008, 12, 31), 300, 1, 0.15, 1) => 360``

## discount as percentage(settlement, maturity, price, redemption, [basis])

Discount as percentage function returns the discount as percentage (0 to 1)

Parameters
Name Required Type Description

settlement

Yes

Date

The date when bond exchange is settled between buyer and seller (transfer completed and payment made)

maturity

Yes

Date

The date when bond is repaid in full

price

Yes

Number

Price of security per 100

redemption

Yes

Number

Value of security per 100

basis

No

Number

The date system to be used to calculate a year’s number of days (US NASD = 0, number of days in month and year = 1, number of days in month and 360 days in year = 2, number of days in month and 365 days in year = 3, European = 4)

 Number
Examples
``financial.discount as percentage(date(2018, 1, 7), date(2048, 1, 1), 97.975, 100, 0) => 6.7538E-4``

## effective annual rate(nominal rate, number of periods per year)

effective annual rate function returns the effective annual interest rate

Parameters
Name Required Type Description

nominal rate

Yes

Number

The nominal interest rate

number of periods per year

Yes

Number

The number of periods per year

 Number
Examples
``financial.effective annual rate(0.0525, 4) => 0.0535427``

## first coupon date after settlement(settlement, maturity, frequency, [basis])

First coupon date after settlement function returns the next coupon date after the settlement date

Parameters
Name Required Type Description

settlement

Yes

Date

The date when bond exchange is settled between buyer and seller (transfer completed and payment made)

maturity

Yes

Date

The date when bond is repaid in full

frequency

Yes

Number

The number of coupon paid per year (annual = 1, semiannual = 2, quarterly = 4

basis

No

Number

The date system to be used to calculate a year’s number of days (US NASD = 0, number of days in month and year = 1, number of days in month and 360 days in year = 2, number of days in month and 365 days in year = 3, European = 4)

 Date
Examples
``financial.first coupon date after settlement(date(2011, 1, 11), date(2011, 11, 11), 1, 0) => "2011-11-11"``

## fixed rate declining balance asset depreciation(cost, salvage, life, period, [factor])

Asset depreciation with fixed rate declining balance function returns the depreciation of the asset

Parameters
Name Required Type Description

cost

Yes

Number

The cost of the asset

salvage

Yes

Number

The value of the asset at the end of the depreciation

life

Yes

Number

The number of periods before the asset is being depreciated

period

Yes

Number

The period

factor

No

Number

The depreciation factor. Default value is set to 2

 Number
Examples
``financial.fixed rate declining balance asset depreciation(2400, 300, 10, 9, 2) => 80.53``

## future value(rate, number of periods, payment, present value, [type])

Future value function returns the value of an asset after a number of periods.

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate (it can be a depreciation)

number of periods

Yes

Number

The total number of payments

payment

Yes

Number

The payment made every period. Value can not change from a payment to another

present value

Yes

Number

The present value of the asset. Default value is set to 0

type

No

Number

Two values are accepted: 0 (payment at the end of each period) and 1 (payment at the beginning of each period). Default value is set to 0

 Number
Examples
``````financial.future value(0.12, 12, -1000) => 12682.503013196972

financial.future value(0.11, 35, -2000, 1, 0) => 82092.3443368492

financial.future value(0.06, 10, -200, -500, 1) => 2581.403374060179``````

## future value schedule(principal, schedule)

Future value schedule function returns the value of an asset after a number of periods with varying interest rate

Parameters
Name Required Type Description

principal

Yes

Number

The present value

schedule

Yes

Number

An array of interest rates

 Number
Examples
``financial.future value schedule(5000000, [0.05, 0.035, 0.035, 0.03, 0.03]) => 5966428.663125``

## installments interest(rate, period, number of periods, present value)

Installments interest function returns the amortization installments for a period

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate (it can be a depreciation)

period

Yes

Number

The period

number of periods

Yes

Number

The total number of payments

present value

Yes

Number

The present value of the asset. Default value is set to 0

 Number
Examples
``financial.installments interest(0.1, 0, 48, 4000) => -33.33333333``

## interest payment(rate, period, number of periods, present value, [future value], [type])

Interest payment function returns the interest rate

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate (it can be a depreciation)

period

Yes

Number

The period

number of periods

Yes

Number

The total number of payments

present value

Yes

Number

The present value of the asset. Default value is set to 0

future value

No

Number

The future value of an asset after a number of periods. Default value is set to 0

type

No

Number

Two values are accepted: 0 (payment at the end of each period) and 1 (payment at the beginning of each period). Default value is set to 0

 Number
Examples
``financial.interest payment(0.1, 1, 3, 8000, 0, 0) => -66.66666667``

## internal rate of return(values, [guess])

Internal rate of return function returns the internal rate for values

Parameters
Name Required Type Description

values

Yes

Collection of Number

Values

guess

No

Number

Estimated value expressed as a fraction

 Number
Examples
``financial.internal rate of return([-70000, 12000, 15000, 18000, 21000], 0.1) => -0.02124485``

## last coupon date before settlement(settlement, maturity, frequency, [basis])

Last coupon date before settlement function returns the last coupon date before the settlement date

Parameters
Name Required Type Description

settlement

Yes

Date

The date when bond exchange is settled between buyer and seller (transfer completed and payment made)

maturity

Yes

Date

The date when bond is repaid in full

frequency

Yes

Number

The number of coupon paid per year (annual = 1, semiannual = 2, quarterly = 4

basis

No

Number

The date system to be used to calculate a year’s number of days (US NASD = 0, number of days in month and year = 1, number of days in month and 360 days in year = 2, number of days in month and 365 days in year = 3, European = 4)

 Date
Examples
``financial.last coupon date before settlement(date(2011, 1, 25), date(2011, 11, 15), 2, 1) => "2010-11-15"``

## modified internal rate(values, finance rate, reinvest rate)

Modified internal rate function returns the modified internal rate

Parameters
Name Required Type Description

values

Yes

Collection of Number

One value at least is required, others are optional. Values are incomes per period

finance rate

Yes

Number

The interest rate of investments

reinvest rate

Yes

Number

The interest rate of reinvestment

 Number
Examples
``financial.modified internal rate([-120000, 39000, 30000, 21000, 37000, 46000], 0.1, 0.12) => 0.12609413``

## net present value(rate, values)

Net present value function returns the net present value of an asset

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate (it can be a depreciation)

values

Yes

Collection of Number

One value at least is required, others are optional. Values are incomes per period

 Number
Examples
``financial.net present value(0.1, [-10000, 3000, 4200, 6800]) => 1188.443412335223``

## number of coupon dates between settlement and maturity date(settlement, maturity, frequency, [basis])

Number of coupon dates between settlement and maturity date function returns the number of coupons between the settlement date and maturity date

Parameters
Name Required Type Description

settlement

Yes

Date

The date when bond exchange is settled between buyer and seller (transfer completed and payment made)

maturity

Yes

Date

The date when bond is repaid in full

frequency

Yes

Number

The number of coupon paid per year (annual = 1, semiannual = 2, quarterly = 4

basis

No

Number

The date system to be used to calculate a year’s number of days (US NASD = 0, number of days in month and year = 1, number of days in month and 360 days in year = 2, number of days in month and 365 days in year = 3, European = 4)

 Number
Examples
``financial.number of coupon dates between settlement and maturity date(date(2017, 5, 1), date(2018, 5, 31), 1, 0) => 2``

## number of coupon days in coupon containing settlement date(settlement, maturity, frequency, [basis])

Number of coupon days in coupon containing settlement date function returns the number of days in the coupon period that contains the settlement date

Parameters
Name Required Type Description

settlement

Yes

Date

The date when bond exchange is settled between buyer and seller (transfer completed and payment made)

maturity

Yes

Date

The date when bond is repaid in full

frequency

Yes

Number

The number of coupon paid per year (annual = 1, semiannual = 2, quarterly = 4

basis

No

Number

The date system to be used to calculate a year’s number of days (US NASD = 0, number of days in month and year = 1, number of days in month and 360 days in year = 2, number of days in month and 365 days in year = 3, European = 4)

 Number
Examples
``financial.number of coupon days in coupon containing settlement date(date(2011, 1, 11), date(2011, 11, 15), 4, 0) => 90``

## number of days from settlement date to first next coupon date(settlement, maturity, frequency, [basis])

Number of days from settlement date to first next coupon date function returns the number of days from the settlement date to the next coupon date

Parameters
Name Required Type Description

settlement

Yes

Date

The date when bond exchange is settled between buyer and seller (transfer completed and payment made)

maturity

Yes

Date

The date when bond is repaid in full

frequency

Yes

Number

The number of coupon paid per year (annual = 1, semiannual = 2, quarterly = 4

basis

No

Number

The date system to be used to calculate a year’s number of days (US NASD = 0, number of days in month and year = 1, number of days in month and 360 days in year = 2, number of days in month and 365 days in year = 3, European = 4)

 Number
Examples
``financial.number of days from settlement date to first next coupon date(date(2011, 1, 25), date(2011, 11, 15), 4, 4) => 20``

## number of days in coupon from beginning to settlement date(settlement, maturity, frequency, [basis])

Number of days in coupon from beginning to settlement date function returns the number of days between the beginning of the coupon period and its settlement date (0 to 365)

Parameters
Name Required Type Description

settlement

Yes

Date

The date when bond exchange is settled between buyer and seller (transfer completed and payment made)

maturity

Yes

Date

The date when bond is repaid in full

frequency

Yes

Number

The number of coupon paid per year (annual = 1, semiannual = 2, quarterly = 4

basis

No

Number

The date system to be used to calculate a year’s number of days (US NASD = 0, number of days in month and year = 1, number of days in month and 360 days in year = 2, number of days in month and 365 days in year = 3, European = 4)

 Number
Examples
``financial.number of days in coupon from beginning to settlement date(date(2011, 1, 25), date(2011, 11, 15), 1, 4) => 70``

## number of periods(rate, payment, present value, [future value], [type])

Number of periods function returns the number of periods for an investment

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate (it can be a depreciation)

payment

Yes

Number

The payment made every period. Value can not change from a payment to another

present value

Yes

Number

The present value of the asset. Default value is set to 0

future value

No

Number

The future value of an asset after a number of periods. Default value is set to 0

type

No

Number

Two values are accepted: 0 (payment at the end of each period) and 1 (payment at the beginning of each period). Default value is set to 0

 Number
Examples
``````financial.number of periods(0.12, -100, -1000, 10000, 1) => 59.673865674294625

financial.number of periods(0.12, -100, -1000, 10000, 0) => 60.08212285376127

financial.number of periods(0.12, -100, -1000) => -9.578594039813167``````

## particular payment(rate, period, number of periods, present value, [future value], [type])

Particular payment function returns the value of the capital for a specific payment

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate (it can be a depreciation)

period

Yes

Number

The period

number of periods

Yes

Number

The total number of payments

present value

Yes

Number

The present value of the asset. Default value is set to 0

future value

No

Number

The future value of an asset after a number of periods. Default value is set to 0

type

No

Number

Two values are accepted: 0 (payment at the end of each period) and 1 (payment at the beginning of each period). Default value is set to 0

 Number
Examples
``````financial.particular payment(0.1, 1, 24, 2000, 0, 0) => -75.62318601

financial.particular payment(0.1, 1, 24, 2000, 0, 1) => -91.52712662

financial.particular payment(0.1, 1, 24, 2000, 10000, 0) => -453.73911605``````

## payment(rate, number of periods, present value, [future value], [type])

Payment function returns the periodic payment for an annuity

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate (it can be a depreciation)

number of periods

Yes

Number

The total number of payments

present value

Yes

Number

The present value of the asset. Default value is set to 0

future value

No

Number

The future value of an asset after a number of periods. Default value is set to 0

type

No

Number

Two values are accepted: 0 (payment at the end of each period) and 1 (payment at the beginning of each period). Default value is set to 0

 Number
Examples
``````financial.payment(0.08, 10, 10000, 0, 0) => -1037.0320893591518

financial.payment(0.08, 10, 10000, 0, 1) => -1030.1643271779658

financial.payment(0.06, 18 * 12, 0, 50000, 0) => -129.08116086799095``````

## present value(rate, number of periods, payment, [future value], [type])

Present value function returns the present value of an investment

Parameters
Name Required Type Description

rate

Yes

Number

The interest rate (it can be a depreciation)

number of periods

Yes

Number

The total number of payments

payment

Yes

Number

The payment made every period. Value can not change from a payment to another

future value

No

Number

The future value of an asset after a number of periods. Default value is set to 0

type

No

Number

Two values are accepted: 0 (payment at the end of each period) and 1 (payment at the beginning of each period). Default value is set to 0

 Number
Examples
``````financial.present value(0.12, 12, 1000) => -11255.07747348463

financial.present value(0.11, 35, 2000, 1, 0) => -59650.46462412326

financial.present value(0.06, 10, 200, -500, 1) => -1480.1388136700007``````