finance

package
v1.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// US(NASD) 30/360
	CountNasd = iota
	// Actual/actual
	CountActualActual
	// Actual/360
	CountActual360
	// Actual/365
	CountActual365
	// European 30/360
	CountEuropean
)

These constants are used in the bonds functions (parameter "basis"), for specifying the basis for the type of day count: 这些常数用在bond函数(参数“ basis”)中,用于指定日计数类型的基础:

View Source
const (
	// MaxIterations determines the maximum number of iterations performed by the Newton-Raphson algorithm.
	// MaxIterations确定由Newton-Raphson算法执行的最大迭代次数。
	MaxIterations = 30
	// Precision determines how close to the solution the Newton-Raphson algorithm should arrive before stopping.
	// 精度确定了牛顿-拉夫森算法在停止之前应该到达解决方案的程度。
	Precision = 1E-6
)
View Source
const (
	PayEnd = iota
	PayBegin
)

These constants are used in the TVM functions (parameter "paymentType"). They determine whether payments occur at the end or at the beginning of each period: 这些常量用于TVM功能(参数“ paymentType”)。 他们确定付款是在每个期间的结束还是开始时进行:

Variables

This section is empty.

Functions

func DaysDifference

func DaysDifference(date1 int64, date2 int64, basis int) int

DaysDifference returns the difference of days between two dates based on a daycount basis. DaysDifference根据daycount返回两个日期之间的天数差。 Date1 and date2 are UNIX timestamps (seconds). Date1和date2是UNIX时间戳(秒)

func DaysPerYear

func DaysPerYear(year int, basis int) int

DaysPerYear returns the number of days in the year based on a daycount basis. DaysPerYear返回基于天数的一年中的天数。

func DepreciationFixedDeclining

func DepreciationFixedDeclining(cost float64, salvage float64, life int, period int, month int) (float64, error)

DepreciationFixedDeclining returns the depreciation of an asset using the fixed-declining balance method DepreciationFixedDeclining使用固定递减余额方法返回资产的折旧 Excel equivalent: DB Excel等效项:DB

func DepreciationSYD

func DepreciationSYD(cost float64, salvage float64, life int, per int) float64

DepreciationSYD returns the depreciation for an asset in a given period using the sum-of-years' digits method DepreciationSYD使用年数总和方法返回给定期间内资产的折旧 Excel equivalent: SYD Excel等效项:SYD

func DepreciationStraightLine

func DepreciationStraightLine(cost float64, salvage float64, life int) (float64, error)

DepreciationStraightLine returns the straight-line depreciation of an asset for each period DepreciationStraightLine返回每个期间资产的直线折旧 Excel equivalent: SLN Excel等效项:SLN

func DiscountRate

func DiscountRate(settlement int64, maturity int64, price float64, redemption float64, basis int) float64

DiscountRate returns the discount rate for a bond DiscountRate返回债券的折现率 settlement is the unix timestamp (seconds) for the settlement date 结算是结算日期的UNIX时间戳(秒) maturity is the unix timestamp (seconds) for the maturity date 到期时间是到期日期的Unix时间戳(秒) price is the bond's price per $100 face value 价格是面值$ 100的债券的价格 redemption is the bond's redemption value per $100 face value 赎回是债券面值$ 100的债券的赎回价值 Excel equivalent: DISC Excel等效项:DISC

func EffectiveRate

func EffectiveRate(nominal float64, numPeriods int) (float64, error)

EffectiveRate returns the effective interest rate given the nominal rate and the number of compounding payments per year. EffectiveRate在给定名义利率和每年复利支付次数的情况下返回有效利率。 Excel equivalent: EFFECT Excel等效项:EFFECT

func FutureValue

func FutureValue(rate float64, numPeriods int, pmt float64, pv float64, paymentType int) (fv float64, err error)

FutureValue returns the Future Value of a cash flow with constant payments and interest rate (annuities). FutureValue返回具有固定付款额和利率(年金)的现金流的Future Value。 Excel equivalent: FV Excel等效项:FV

func InterestPayment

func InterestPayment(rate float64, period int, numPeriods int, pv float64, fv float64, paymentType int) (float64, error)

InterestPayment returns the interest payment for a given period for a cash flow with constant periodic payments (annuities) InterestPayment返回给定期间的利息支付,该现金流具有固定的定期付款(年金) Excel equivalent: IMPT Excel等效项:IMPT

func InternalRateOfReturn

func InternalRateOfReturn(values []float64, guess float64) (float64, error)

InternalRateOfReturn returns the internal rate of return of a cash flow series. InternalRateOfReturn返回现金流量系列的内部收益率。 Guess is a guess for the rate, used as a starting point for the iterative algorithm. Guess是对速率的猜测,用作迭代算法的起点。 Excel equivalent: IRR Excel等效项:IRR

func ModifiedInternalRateOfReturn

func ModifiedInternalRateOfReturn(values []float64, financeRate float64, reinvestRate float64) (float64, error)

ModifiedInternalRateOfReturn returns the internal rate of return of a cash flow series, considering both financial and reinvestment rates ModifiedInternalRateOfReturn返回考虑财务和再投资率的现金流量系列的内部收益率 financeRate is the rate on the money used in the cash flow. financeRate是现金流量中所用资金的比率。 reinvestRate is the rate received when reinvested reinvestRate是再投资时收到的汇率 Excel equivalent: MIRR Excel等效项:MIRR

func NetPresentValue

func NetPresentValue(rate float64, values []float64) float64

NetPresentValue returns the Net Present Value of a cash flow series given a discount rate NetPresentValue在给定折现率的情况下返回现金流量系列的净现值 Excel equivalent: NPV Excel等效项:NPV

func NominalRate

func NominalRate(effectiveRate float64, numPeriods int) (float64, error)

NominalRate returns the nominal interest rate given the effective rate and the number of compounding payments per year. NominalRate会根据实际利率和每年的复利支付次数返回名义利率。 Excel equivalent: NOMINAL Excel等效项:NOMINAL

func Payment

func Payment(rate float64, numPeriods int, pv float64, fv float64, paymentType int) (pmt float64, err error)

Payment returns the constant payment (annuity) for a cash flow with a constant interest rate. 付款返回具有固定利率的现金流量的固定付款(年金)。 Excel equivalent: PMT Excel等效项:PMT

func Periods

func Periods(rate float64, pmt float64, pv float64, fv float64, paymentType int) (numPeriods float64, err error)

Periods returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate. 期间返回具有固定的定期付款(年金)和利率的现金流量的期间数。 Excel equivalent: NPER Excel等效项:NPER

func PresentValue

func PresentValue(rate float64, numPeriods int, pmt float64, fv float64, paymentType int) (pv float64, err error)

PresentValue returns the Present Value of a cash flow with constant payments and interest rate (annuities). 现值返回具有固定付款额和利率(年金)的现金流量的现值。 Excel equivalent: PV Excel等效项:PV

func PriceDiscount

func PriceDiscount(settlement int64, maturity int64, discount float64, redemption float64, basis int) float64

PriceDiscount returns the price per $100 face value of a discounted bond PriceDiscount返回折价债券面值$ 100的价格 settlement is the unix timestamp (seconds) for the settlement date 结算是结算日期的UNIX时间戳(秒) maturity is the unix timestamp (seconds) for the maturity date 到期时间是到期日期的Unix时间戳(秒) discount is the bond's discount rate 贴现是债券的贴现率 redemption is the bond's redemption value per $100 face value 赎回是债券面值$ 100的债券的赎回价值 Excel equivalent: PRICEDISC Excel等价物:PRICEDISC

func PrincipalPayment

func PrincipalPayment(rate float64, period int, numPeriods int, pv float64, fv float64, paymentType int) (float64, error)

PrincipalPayment returns the principal payment for a given period for a cash flow with constant periodic payments (annuities) PrincipalPayment返回给定时间段内具有固定定期付款(年金)的现金流量的本金付款 Excel equivalent: PPMT Excel等效项:PPMT

func Rate

func Rate(numPeriods int, pmt float64, pv float64, fv float64, paymentType int, guess float64) (float64, error)

Rate returns the periodic interest rate for a cash flow with constant periodic payments (annuities). Rate返回具有固定定期付款(年金)的现金流量的定期利率。 Guess is a guess for the rate, used as a starting point for the iterative algorithm. Guess是对速率的猜测,用作迭代算法的起点。 Excel equivalent: RATE Excel等效项:RATE

func ScheduledInternalRateOfReturn

func ScheduledInternalRateOfReturn(values []float64, dates []time.Time, guess float64) (float64, error)

ScheduledInternalRateOfReturn returns the internal rate of return of a scheduled cash flow series. ScheduledInternalRateOfReturn返回计划的现金流量系列的内部收益率。 Guess is a guess for the rate, used as a starting point for the iterative algorithm. Guess是对速率的猜测,用作迭代算法的起点。 Excel equivalent: XIRR Excel等效项:XIRR

func ScheduledNetPresentValue

func ScheduledNetPresentValue(rate float64, values []float64, dates []time.Time) (float64, error)

ScheduledNetPresentValue returns the Net Present Value of a scheduled cash flow series given a discount rate ScheduledNetPresentValue返回给定折扣率的计划现金流量系列的净现值 Excel equivalent: XNPV Excel等效项:XNPV

func StrconvFloat

func StrconvFloat(f float64) string

StrconvFloat 浮点转成百分数

func TBillEquivalentYield

func TBillEquivalentYield(settlement int64, maturity int64, discount float64) (float64, error)

TBillEquivalentYield returns the bond-equivalent yield for a Treasury bill TBillEquivalentYield返回国库券的等价债券收益率 settlement is the unix timestamp (seconds) for the settlement date 结算是结算日期的UNIX时间戳(秒) maturity is the unix timestamp (seconds) for the maturity date 到期时间是到期日期的Unix时间戳(秒) discount is the T-Bill discount rate 折扣是国库券的折扣率 Excel equivalent: TBILLEQ Excel等效项:TBILLEQ

func TBillPrice

func TBillPrice(settlement int64, maturity int64, discount float64) (float64, error)

TBillPrice returns the price per $100 face value for a Treasury bill TBillPrice返回面值$ 100的国库券的价格 settlement is the unix timestamp (seconds) for the settlement date 结算是结算日期的UNIX时间戳(秒) maturity is the unix timestamp (seconds) for the maturity date 到期时间是到期日期的Unix时间戳(秒) discount is the T-Bill discount rate 折扣是国库券的折扣率 Excel equivalent: TBILLPRICE Excel等效项:TBILLPRICE

func TBillYield

func TBillYield(settlement int64, maturity int64, price float64) (float64, error)

TBillYield returns the yield for a treasury bill TBillYield返回国库券的收益率 settlement is the unix timestamp (seconds) for the settlement date 结算是结算日期的UNIX时间戳(秒) maturity is the unix timestamp (seconds) for the maturity date 到期时间是到期日期的Unix时间戳(秒) price is the TBill price per $100 face value 价格是每100美元面值的TBill价格 Excel equivalent: TBILLYIELD 等效的Excel:TBILLYIELD

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL