### CoupDays Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Returns the number of days from the start of the coupon period to the settlement date. ```APIDOC ## CoupDays ### Description Returns the number of days from the start of the coupon period to the settlement date. ### Method Signature `static member Financial.CoupDays(settlement: DateTime * maturity: DateTime * frequency: Frequency * basis: DayCountBasis -> float` ``` -------------------------------- ### CoupDaysBS Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Returns the number of days from the start of the coupon period to the settlement date. ```APIDOC ## CoupDaysBS ### Description Returns the number of days from the start of the coupon period to the settlement date. ### Method Signature `static member Financial.CoupDaysBS(settlement: DateTime * maturity: DateTime * frequency: Frequency * basis: DayCountBasis -> float` ``` -------------------------------- ### Calculate XIRR and XNPV Source: https://fsprojects.github.io/ExcelFinancialFunctions/compatibility.html Demonstrates the calculation of XIRR and XNPV using provided cash flows and dates. Note potential differences in results compared to Excel due to root-finding algorithms and handling of negative rates. ```F# let dates = [|DateTime(2000, 2, 29); DateTime(2000, 3, 31)| let values = [|206101714.849377; -156650972.54265| // Excel: -0.960452189 Financial.XIrr(values, dates, -0.1) ``` ```F# val it : float = -0.960452195 // Excel: #NUM! Financial.XNpv(-0.960452195, values, dates) ``` ```F# val it : float = -0.008917063475 // Excel: #NUM! Financial.XNpv(-0.960452189, values, dates) ``` ```F# val it : float = 2.646784514 let values2 = [|15108163.3840923; -75382259.6628424| // Excel: #NUM! Financial.XIrr(values2, dates, -0.1) ``` ```F# val it : float = 165601346.1 // Excel: 165601345.6 Financial.XIrr(values2, dates, 0.1) ``` ```F# val it : float = 165601346.1 Financial.XNpv(165601346.1, values2, dates) ``` ```F# val it : float = -0.000269997865 Financial.XNpv(165601345.6, values2, dates) ``` ```F# val it : float = -0.004144238308 ``` -------------------------------- ### Calculate Bond Yield with YIELD Function Source: https://fsprojects.github.io/ExcelFinancialFunctions Demonstrates using the YIELD function from the ExcelFinancialFunctions library to calculate the yield of a bond. Ensure the library is referenced. ```fsharp #r "ExcelFinancialFunctions.dll" open System open Excel.FinancialFunctions // returns 0.065 or 6.5% Financial.Yield (DateTime(2008,2,15), DateTime(2016,11,15), 0.0575, 95.04287, 100.0, Frequency.SemiAnnual, DayCountBasis.UsPsa30_360) ``` -------------------------------- ### ODDLYIELD and ODDLPRICE Differences Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Demonstrates differing results between the library and LibreOffice for ODDLYIELD and ODDLPRICE functions. Note the behavior with different frequencies for OddLYield. ```fsharp Financial.OddLPrice(DateTime(1999, 2, 28), DateTime(2000, 2, 28), DateTime(1998, 2, 28), 0.07, 0.03, 130., Frequency.SemiAnnual, DayCountBasis.Actual360) ``` ```fsharp Financial.OddLYield(DateTime(1990, 6, 1), DateTime(1995, 12, 31), DateTime(1990, 1, 1), 0.002, 103., 100., Frequency.Quarterly, DayCountBasis.ActualActual) ``` ```fsharp Financial.OddLYield(DateTime(1990, 6, 1), DateTime(1995, 12, 31), DateTime(1990, 1, 1), 0.002, 103., 100., Frequency.Annual, DayCountBasis.ActualActual) ``` -------------------------------- ### Calculate Days in Coupon Period (COUPDAYS) Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Use COUPDAYS for calculating the number of days in a coupon period. Note that the equality `coupDays = coupDaysBS + coupDaysNC` may not hold for all day count bases. ```F# let cdParam = DateTime(1980, 2, 15), DateTime(2000, 2, 28), Frequency.Annual, DayCountBasis.UsPsa30_360 Financial.CoupDays cdParam Financial.CoupDaysBS cdParam Financial.CoupDaysNC cdParam Excel: 360 <> 345 + 13 LibreOffice: 360 = 345 + 15 ``` -------------------------------- ### Disc Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the discount rate for a discounted security. ```APIDOC ## Disc ### Description Calculates the discount rate for a discounted security. ### Method Signature `static member Financial.Disc(settlement: DateTime * maturity: DateTime * pr: float * redemption: float * basis: DayCountBasis -> float` ``` -------------------------------- ### ACCRINT and related functions with different DayCountBasis Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Compares ACCRINT calculations across various DayCountBasis options, showing differences between Excel and LibreOffice. The European 30/360 basis yielded the same results in tests. ```fsharp let accrint basis = Financial.AccrInt(DateTime(1990, 3, 4), DateTime(1993, 3, 31), DateTime(1992, 3, 4), 0.07, 10000., Frequency.SemiAnnual, basis) accrint DayCountBasis.UsPsa30_360 ``` ```fsharp accrint DayCountBasis.ActualActual ``` ```fsharp accrint DayCountBasis.Actual360 ``` ```fsharp accrint DayCountBasis.Actual365 ``` ```fsharp Financial.AccrIntM(DateTime(1990, 3, 4), DateTime(2010, 6, 5), 0.1, 12030.34, DayCountBasis.ActualActual) ``` ```fsharp Financial.Disc(DateTime(2003, 2, 14), DateTime(2004, 3, 31), 23., 100., DayCountBasis.ActualActual) ``` ```fsharp Financial.Duration(DateTime(1980, 2, 15), DateTime(2000, 2, 28), 100., 0.03, Frequency.Annual, DayCountBasis.Actual360) ``` ```fsharp Financial.MDuration(DateTime(1980, 2, 15), DateTime(2000, 2, 28), 100., 0.03, Frequency.SemiAnnual, DayCountBasis.Actual360) ``` ```fsharp Financial.Price(DateTime(1980, 2, 15), DateTime(2000, 2, 28), 0.07, 0.1, 100., Frequency.Annual, DayCountBasis.Actual360) ``` ```fsharp Financial.PriceDisc(DateTime(1980, 2, 15), DateTime(2000, 2, 28), 0.01, 100., DayCountBasis.ActualActual) ``` ```fsharp Financial.IntRate(DateTime(1980, 2, 15), DateTime(1980, 5, 4), 23., 130., DayCountBasis.UsPsa30_360) ``` ```fsharp Financial.TBillPrice(DateTime(1980, 2, 15), DateTime(1980, 3, 15), 2.) ``` ```fsharp Financial.Received(DateTime(1980, 2, 15), DateTime(2000, 2, 28), 200., 0.01, DayCountBasis.ActualActual) ``` -------------------------------- ### VDB Depreciation Calculation (With Switch) Source: https://fsprojects.github.io/ExcelFinancialFunctions/compatibility.html Compares VDB depreciation calculation with switching to straight-line depreciation. Excel may show discrepancies for fractional periods. ```F# let vdb sp ep switch = Financial.Vdb(100.0, 10.0, 13.0, sp, ep, 1.0, if switch then VdbSwitch.SwitchToStraightLine else VdbSwitch.DontSwitchToStraightLine) let p1sw = vdb 0.0 0.5 true let p2sw = vdb 0.5 1.0 true let totalsw = vdb 0.0 1.0 true // Excel: 0.0000 totalsw - p1sw - p2sw val p1sw : float = 3.846153846 val p2sw : float = 3.846153846 val totalsw : float = 7.692307692 val it : float = 0.0 ``` -------------------------------- ### Financial.Disc Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the discount rate for a security. ```APIDOC ## Financial.Disc (settlement, maturity, pr, redemption, basis) ### Description Calculates the discount rate for a security. ### Parameters - **settlement** (DateTime) - The security's settlement date. - **maturity** (DateTime) - The security's maturity date. - **pr** (float) - The price of the security per $100 face value. - **redemption** (float) - The redemption value of the security per $100 face value. - **basis** (DayCountBasis) - The type of day count on which the calculation is based. ### Returns - `float` - The discount rate for the security. ``` -------------------------------- ### IntRate Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the interest rate for a security. ```APIDOC ## IntRate ### Description Calculates the interest rate for a security. ### Method Signature `static member Financial.IntRate(settlement: DateTime * maturity: DateTime * investment: float * redemption: float * basis: DayCountBasis -> float` ``` -------------------------------- ### COUPDAYS Calculation Discrepancy Source: https://fsprojects.github.io/ExcelFinancialFunctions/compatibility.html Demonstrates the difference in COUPDAYS calculation between the library and Excel when dates span a leap year. The library result may differ by +/- one or two days. ```F# let settlement = DateTime(2012, 1, 1) let maturity = DateTime(2016, 2, 29) let param = settlement, maturity, Frequency.SemiAnnual, DayCountBasis.ActualActual let days = Financial.CoupDays param let bs = Financial.CoupDaysBS param let nc = Financial.CoupDaysNC param // Excel: 2 days - bs - nc val days : float = 182.0 val bs : float = 123.0 val nc : float = 59.0 val it : float = 0.0 ``` -------------------------------- ### Financial.CoupNCD Source: https://fsprojects.github.io/ExcelFinancialFunctions Returns the next coupon date after the settlement date. ```APIDOC ## Financial.CoupNCD ### Description Returns the next coupon date after the settlement date. ### Method static member CoupNCD ### Parameters - **settlement** (DateTime) - The coupon date. - **maturity** (DateTime) - The maturity date. - **frequency** (Frequency) - The number of coupon payments per year. - **basis** (DayCountBasis) - The type of day count basis to use. ### Response #### Success Response (DateTime) - Returns the next coupon date as a DateTime object. ``` -------------------------------- ### VDB Depreciation Calculation (No Switch) Source: https://fsprojects.github.io/ExcelFinancialFunctions/compatibility.html Compares VDB depreciation calculation without switching to straight-line depreciation. Excel may show discrepancies for fractional periods. ```F# let vdb sp ep switch = Financial.Vdb(100.0, 10.0, 13.0, sp, ep, 1.0, if switch then VdbSwitch.SwitchToStraightLine else VdbSwitch.DontSwitchToStraightLine) let p1 = vdb 0.0 0.5 false let p2 = vdb 0.5 1.0 false let total = vdb 0.0 1.0 false // Excel: 0.1479 total - p1 - p2 val p1 : float = 3.846153846 val p2 : float = 3.846153846 val total : float = 7.692307692 val it : float = 0.0 ``` -------------------------------- ### AMORLINC differences with date and basis Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Compares AMORLINC results between Excel and LibreOffice, showing variations based on specific dates and the DayCountBasis.UsPsa30_360. ```fsharp Financial.AmorLinc(100., DateTime(1998, 2, 28), DateTime(2000, 2, 29), 10., 0., 0.07, DayCountBasis.Actual365) ``` ```fsharp Financial.AmorLinc(100., DateTime(1998, 2, 28), DateTime(2009, 6, 30), 50., 1.7, 0.1, DayCountBasis.UsPsa30_360) ``` -------------------------------- ### Financial.OddFPrice Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Returns the odd first coupon price for a security. ```APIDOC ## Financial.OddFPrice ### Description Returns the odd first coupon price for a security. ### Parameters - **settlement** (DateTime) - The security's settlement date. - **maturity** (DateTime) - The security's maturity date. - **issue** (DateTime) - The security's issue date. - **firstCoupon** (DateTime) - The security's first coupon date. - **rate** (float) - The security's annual interest rate. - **yld** (float) - The security's yield. - **redemption** (float) - The security's redemption value per $100 par value. - **frequency** (Frequency) - The number of coupon payments per year (Annual, SemiAnnual, Quarterly). - **basis** (DayCountBasis) - The type of day count basis to use (UsPsa30_360, ActualActual, Actual360, Actual365, Europ30_360). ### Response #### Success Response (float) - Returns the odd first coupon price. ``` -------------------------------- ### Calculate Depreciation (DB) Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Use DB for the fixed-rate declining balance depreciation method. Fractional periods may not be accepted. ```F# Financial.Db(100., 10., 1., 0.3, 1.) Excel: 7.5 LibreOffice: 0.0 ``` -------------------------------- ### AMORDEGRC Calculation (Excel Compliant vs. False) Source: https://fsprojects.github.io/ExcelFinancialFunctions/compatibility.html Illustrates the difference in AMORDEGRC calculation when using Excel's 13-digit precision (true) versus standard .NET framework rounding (false). ```F# let amorDegrc excelCompliant = Financial.AmorDegrc(100.0, DateTime(2014,1,1), DateTime(2016,1,1), 50.0, 1.0, 0.3, DayCountBasis.ActualActual, excelCompliant) amorDegrc true val it : float = 23.0 amorDegrc false val it : float = 22.0 ``` -------------------------------- ### Calculate Cumulative Interest (CUMIPMT) Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Use CUMIPMT_ADD for cumulative interest calculations. Expected to be compatible with Excel. ```F# Financial.CumIPmt(0.6, 10., 100., 1.3, 2., PaymentDue.EndOfPeriod) Excel: -59.669577 LibreOffice: -119.669577 ``` -------------------------------- ### Reference ExcelFinancialFunctions Package Source: https://fsprojects.github.io/ExcelFinancialFunctions Reference the ExcelFinancialFunctions package in dotnet interactive notebooks, F# scripts, or other .NET environments using the provided NuGet command. ```fsharp #r "nuget: ExcelFinancialFunctions" // Use the latest version ``` -------------------------------- ### Calculate Cumulative Principal (CUMPRINC) Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Use CUMPRINC_ADD for cumulative principal calculations. Expected to be compatible with Excel. ```F# Financial.CumPrinc(0.6, 10., 100., 1.3, 2., PaymentDue.EndOfPeriod) Excel: -0.8811289 LibreOffice: -1.431834 ``` -------------------------------- ### Financial.Pduration Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Returns the number of periods required for an investment to reach a specified value. It takes the interest rate, present value, and future value as parameters. ```APIDOC ## Financial.Pduration ### Description Returns the number of periods required by an investment to reach a specified value. ### Parameters * **rate** (float) - The interest rate per period. * **pv** (float) - The present value of the investment. * **fv** (float) - The future value to which the investment should grow. ### Returns * **float** - The number of periods required. ``` -------------------------------- ### Define DateTime object Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Represents an instant in time. Use this constructor for creating specific dates. ```F# DateTime(2001, 2, 28) ``` -------------------------------- ### Price Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the price per $100 face value of a security that pays periodic interest. ```APIDOC ## Price ### Description Calculates the price per $100 face value of a security that pays periodic interest. ### Method Signature `static member Financial.Price(settlement: DateTime * maturity: DateTime * rate: float * yld: float * redemption: float * frequency: Frequency * basis: DayCountBasis -> float` ``` -------------------------------- ### Received Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the received amount for a fully invested security. ```APIDOC ## Received ### Description Calculates the received amount for a fully invested security. ### Method Signature `static member Financial.Received(settlement: DateTime * maturity: DateTime * investment: float * discount: float * basis: DayCountBasis -> float` ``` -------------------------------- ### ODDFYIELD and ODDFPRICE Differences Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html These functions may return invalid results in OpenOffice. The library aims for Excel compliance. ```fsharp Financial.OddFYield(DateTime(2008, 12, 11), DateTime(2021, 4, 1), DateTime(2008, 10, 15), DateTime(2009, 4, 1), 0.06, 100., 100., Frequency.Quarterly, DayCountBasis.ActualActual) ``` ```fsharp Financial.OddFPrice(DateTime(1999, 2, 28), DateTime(2010, 6, 30), DateTime(1998, 2, 28), DateTime(2009, 6, 30), 0.07, 0.03, 100., Frequency.Annual, DayCountBasis.Actual360) ``` -------------------------------- ### Financial.Rate (with guess) Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the interest rate per period of an annuity using the RATE function. This overload includes an optional guess parameter. ```APIDOC ## Financial.Rate ### Description RATE function. The interest rate per period of an annuity. ### Parameters * **nper** (float) - The total number of payment periods. * **pmt** (float) - The payment made each period. * **pv** (float) - The present value. * **fv** (float) - The future value, or a cash balance you want to attain after the last payment is made. * **typ** (PaymentDue) - When payments are due. * **guess** (float) - Your guess for what the rate will be. If omitted, 10 percent is assumed. ### Returns * **float** - The interest rate per period. ``` -------------------------------- ### Financial.XNpv Source: https://fsprojects.github.io/ExcelFinancialFunctions/compatibility.html Calculates the net present value for an investment based on a discount rate and a series of future payments (negative values) and income (positive values) at unspecified dates. ```APIDOC ## Financial.XNpv ### Description Calculates the net present value for an investment based on a discount rate and a series of future payments (negative values) and income (positive values) at unspecified dates. ### Method static member ### Parameters - **rate** (float) - Description - **values** (float seq) - Description - **dates** (DateTime seq) - Description ### Returns - float - Description ``` -------------------------------- ### Financial.OddFYield Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Returns the odd first coupon yield for a security. ```APIDOC ## Financial.OddFYield ### Description Returns the odd first coupon yield for a security. ### Parameters - **settlement** (DateTime) - The security's settlement date. - **maturity** (DateTime) - The security's maturity date. - **issue** (DateTime) - The security's issue date. - **firstCoupon** (DateTime) - The security's first coupon date. - **rate** (float) - The security's annual interest rate. - **pr** (float) - The security's price per $100 par value. - **redemption** (float) - The security's redemption value per $100 par value. - **frequency** (Frequency) - The number of coupon payments per year (Annual, SemiAnnual, Quarterly). - **basis** (DayCountBasis) - The type of day count basis to use (UsPsa30_360, ActualActual, Actual360, Actual365, Europ30_360). ### Response #### Success Response (float) - Returns the odd first coupon yield. ``` -------------------------------- ### Financial.TBillEq Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the bond-equivalent yield for a Treasury bill. ```APIDOC ## Financial.TBillEq ### Description Calculates the bond-equivalent yield for a Treasury bill. ### Parameters - **settlement** (DateTime) - The settlement date of the Treasury bill. - **maturity** (DateTime) - The maturity date of the Treasury bill. - **discount** (float) - The discount rate of the Treasury bill. ### Returns - `float` - The bond-equivalent yield. ``` -------------------------------- ### Financial.CoupPCD Source: https://fsprojects.github.io/ExcelFinancialFunctions Returns the previous coupon date before the settlement date. ```APIDOC ## Financial.CoupPCD ### Description Returns the previous coupon date before the settlement date. ### Method static member CoupPCD ### Parameters - **settlement** (DateTime) - The coupon date. - **maturity** (DateTime) - The maturity date. - **frequency** (Frequency) - The number of coupon payments per year. - **basis** (DayCountBasis) - The type of day count basis to use. ### Response #### Success Response (DateTime) - Returns the previous coupon date as a DateTime object. ``` -------------------------------- ### Calculate Double Declining Depreciation (DDB) Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Use DDB for the double-declining balance depreciation method. Fractional periods may not be accepted, potentially resulting in an error. ```F# Financial.Ddb(100., 10., 1., 0.3, 1.) Excel: 90.0 LibreOffice: Err:502 ``` -------------------------------- ### PriceDisc Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the price per $100 face value of a discounted security. ```APIDOC ## PriceDisc ### Description Calculates the price per $100 face value of a discounted security. ### Method Signature `static member Financial.PriceDisc(settlement: DateTime * maturity: DateTime * discount: float * redemption: float * basis: DayCountBasis -> float` ``` -------------------------------- ### AMORDEGRC differences Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Highlights a specific difference in AMORDEGRC calculation between Excel, Excel for Mac, and LibreOffice, particularly when using DayCountBasis.Actual365 and a boolean parameter. ```fsharp Financial.AmorDegrc(100., DateTime(1998, 2, 28), DateTime(2000, 2, 29), 10., 0.3, 0.15, DayCountBasis.Actual365, true) ``` -------------------------------- ### MDuration Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the modified Macaulay duration for a security. ```APIDOC ## MDuration ### Description Calculates the modified Macaulay duration for a security. ### Method Signature `static member Financial.MDuration(settlement: DateTime * maturity: DateTime * coupon: float * yld: float * frequency: Frequency * basis: DayCountBasis -> float` ``` -------------------------------- ### AccrInt Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the accrued interest for a security that pays interest periodically. ```APIDOC ## AccrInt ### Description Calculates the accrued interest for a security that pays interest periodically. ### Method Signature `static member Financial.AccrInt(issue: DateTime * firstInterest: DateTime * settlement: DateTime * rate: float * par: float * frequency: Frequency * basis: DayCountBasis -> float` ### Method Signature Overload `static member Financial.AccrInt(issue: DateTime * firstInterest: DateTime * settlement: DateTime * rate: float * par: float * frequency: Frequency * basis: DayCountBasis * calcMethod: AccrIntCalcMethod -> float` ``` -------------------------------- ### Financial.CoupDays Source: https://fsprojects.github.io/ExcelFinancialFunctions Returns the number of days between two coupon dates. ```APIDOC ## Financial.CoupDays ### Description Returns the number of days between two coupon dates. ### Method static member CoupDays ### Parameters - **settlement** (DateTime) - The coupon date. - **maturity** (DateTime) - The maturity date. - **frequency** (Frequency) - The number of coupon payments per year. - **basis** (DayCountBasis) - The type of day count basis to use. ### Response #### Success Response (float) - Returns the number of days as a float. ``` -------------------------------- ### Db Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the depreciation of an asset for a specified period using the fixed-declining balance method. ```APIDOC ## Db ### Description Calculates the depreciation of an asset for a specified period using the fixed-declining balance method. ### Method Signature `static member Financial.Db(cost: float * salvage: float * life: float * period: float -> float` ### Method Signature Overload `static member Financial.Db(cost: float * salvage: float * life: float * period: float * month: float -> float` ``` -------------------------------- ### AccrIntM Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the accrued interest for a security that pays interest at maturity. ```APIDOC ## AccrIntM ### Description Calculates the accrued interest for a security that pays interest at maturity. ### Method Signature `static member Financial.AccrIntM(issue: DateTime * settlement: DateTime * rate: float * par: float * basis: DayCountBasis -> float` ``` -------------------------------- ### Financial.AccrInt (Overload 1) Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the accrued interest for a security that pays periodic interest, using the 'FromIssueToSettlement' calculation method. This is equivalent to Excel's ACCRINT function. ```APIDOC ## Financial.AccrInt(issue, firstInterest, settlement, rate, par, frequency, basis) ### Description Calculates the accrued interest for a security that pays periodic interest, using "FromIssueToSettlement" calculation method. This is equivalent to Excel's ACCRINT function. ### Parameters - **issue** (DateTime) - The issue date of the security. - **firstInterest** (DateTime) - The first interest date of the security. - **settlement** (DateTime) - The settlement date of the security. - **rate** (float) - The annual interest rate of the security. - **par** (float) - The par value of the security. - **frequency** (Frequency) - The number of coupon payments per year. - **basis** (DayCountBasis) - The day count basis to use. ### Returns - **float** - The accrued interest for the security. ``` -------------------------------- ### MDuration Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html The Macauley modified duration for a security with an assumed par value of $100. ```APIDOC ## MDuration ### Description The Macauley modified duration for a security with an assumed par value of $100. ### Parameters - **settlement** (DateTime) - **maturity** (DateTime) - **coupon** (float) - **yld** (float) - **frequency** (Frequency) - **basis** (DayCountBasis) ### Returns `float` ``` -------------------------------- ### Financial.OddLPrice Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Returns the odd last coupon price for a security. ```APIDOC ## Financial.OddLPrice ### Description Returns the odd last coupon price for a security. ### Parameters - **settlement** (DateTime) - The security's settlement date. - **maturity** (DateTime) - The security's maturity date. - **lastInterest** (DateTime) - The security's last interest date. - **rate** (float) - The security's annual interest rate. - **yld** (float) - The security's yield. - **redemption** (float) - The security's redemption value per $100 par value. - **frequency** (Frequency) - The number of coupon payments per year (Annual, SemiAnnual, Quarterly). - **basis** (DayCountBasis) - The type of day count basis to use (UsPsa30_360, ActualActual, Actual360, Actual365, Europ30_360). ### Response #### Success Response (float) - Returns the odd last coupon price. ``` -------------------------------- ### Financial.XIrr (2 overloads) Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the internal rate of return for a schedule of cash flows that is not necessarily periodic. ```APIDOC ## Financial.XIrr (Overload 1) ### Description Calculates the internal rate of return for a schedule of cash flows that is not necessarily periodic. ### Parameters - **values** (float seq) - An array of cash flows corresponding to payments and income. - **dates** (DateTime seq) - A schedule of payments and income that must contain at least one negative and one positive value. ### Returns - `float` - The internal rate of return. ``` ```APIDOC ## Financial.XIrr (Overload 2) ### Description Calculates the internal rate of return for a schedule of cash flows that is not necessarily periodic, with an optional guess for the rate. ### Parameters - **values** (float seq) - An array of cash flows corresponding to payments and income. - **dates** (DateTime seq) - A schedule of payments and income that must contain at least one negative and one positive value. - **guess** (float) - A number that you guess is close to the result of XIRR. Defaults to 0.1 (10 percent). ### Returns - `float` - The internal rate of return. ``` -------------------------------- ### Financial.CoupDaysNC Source: https://fsprojects.github.io/ExcelFinancialFunctions Returns the number of days from the settlement date to the next coupon date. ```APIDOC ## Financial.CoupDaysNC ### Description Returns the number of days from the settlement date to the next coupon date. ### Method static member CoupDaysNC ### Parameters - **settlement** (DateTime) - The coupon date. - **maturity** (DateTime) - The maturity date. - **frequency** (Frequency) - The number of coupon payments per year. - **basis** (DayCountBasis) - The type of day count basis to use. ### Response #### Success Response (float) - Returns the number of days as a float. ``` -------------------------------- ### Financial.Vdb (3 overloads) Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the depreciation of an asset for a specified or partial period using a declining balance method. ```APIDOC ## Financial.Vdb (Overload 1) ### Description Calculates the depreciation of an asset for a specified or partial period by using a declining balance method. ### Parameters - **cost** (float) - The cost of the asset. - **salvage** (float) - The salvage value of the asset at the end of its useful life. - **life** (float) - The useful life of the asset. - **startPeriod** (float) - The start period for the depreciation calculation. - **endPeriod** (float) - The end period for the depreciation calculation. ### Returns - `float` - The depreciation for the specified period. ``` ```APIDOC ## Financial.Vdb (Overload 2) ### Description Calculates the depreciation of an asset for a specified or partial period by using a declining balance method. ### Parameters - **cost** (float) - The cost of the asset. - **salvage** (float) - The salvage value of the asset at the end of its useful life. - **life** (float) - The useful life of the asset. - **startPeriod** (float) - The start period for the depreciation calculation. - **endPeriod** (float) - The end period for the depreciation calculation. - **factor** (float) - The rate at which to depreciate. Defaults to 2 (double-declining balance). ### Returns - `float` - The depreciation for the specified period. ``` ```APIDOC ## Financial.Vdb (Overload 3) ### Description Calculates the depreciation of an asset for a specified or partial period by using a declining balance method. This overload includes a `noSwitch` parameter to control behavior at the beginning of the asset's life. ### Parameters - **cost** (float) - The cost of the asset. - **salvage** (float) - The salvage value of the asset at the end of its useful life. - **life** (float) - The useful life of the asset. - **startPeriod** (float) - The start period for the depreciation calculation. - **endPeriod** (float) - The end period for the depreciation calculation. - **factor** (float) - The rate at which to depreciate. Defaults to 2 (double-declining balance). - **noSwitch** (VdbSwitch) - A boolean value that specifies whether to switch to straight-line depreciation when depreciation is greater than the remaining book value. `true` (or 1) switches; `false` (or 0) does not. ### Returns - `float` - The depreciation for the specified period. ``` -------------------------------- ### Financial.CoupDaysNC Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Returns the number of days from the next coupon date to the settlement date. ```APIDOC ## Financial.CoupDaysNC ### Description Returns the number of days from the next coupon date to the settlement date. ### Parameters - **settlement** (DateTime) - The security's settlement date. - **maturity** (DateTime) - The security's maturity date. - **frequency** (Frequency) - The number of coupon payments per year (Annual, SemiAnnual, Quarterly). - **basis** (DayCountBasis) - The type of day count basis to use (UsPsa30_360, ActualActual, Actual360, Actual365, Europ30_360). ### Response #### Success Response (float) - Returns the number of days. ``` -------------------------------- ### Define Actual/360 Day Count Basis Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Specifies the Actual/360 day count basis for financial calculations. ```F# DayCountBasis.Actual360 ``` -------------------------------- ### Financial.Rate (without guess) Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the interest rate per period of an annuity using the RATE function. Assumes a default guess if not provided. ```APIDOC ## Financial.Rate ### Description RATE function. The interest rate per period of an annuity. ### Parameters * **nper** (float) - The total number of payment periods. * **pmt** (float) - The payment made each period. * **pv** (float) - The present value. * **fv** (float) - The future value, or a cash balance you want to attain after the last payment is made. * **typ** (PaymentDue) - When payments are due. ### Returns * **float** - The interest rate per period. ``` -------------------------------- ### Financial.XIrr Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the internal rate of return for a series of cash flows occurring at irregular intervals. Note: OpenOffice does not support arrays as parameters, which may lead to differences in usage and results compared to Excel. ```APIDOC ## Financial.XIrr ### Description Calculates the internal rate of return for a series of cash flows occurring at irregular intervals. ### Parameters - **cashFlows** (float[]) - The array of cash flows. Note: This parameter may not be directly supported in all environments due to array handling limitations. - **dates** (DateTime[]) - The array of dates corresponding to each cash flow. - **guess** (float) - An optional guess for the internal rate of return. ### Request Example ``` Financial.XIrr([206101714.849377; -156650972.54265], [DateTime(2001, 2, 28); DateTime(2001, 3, 31)], -0.1) ``` ### Response #### Success Response (float) - Returns the calculated internal rate of return. #### Example ``` Excel: -0.960452 LibreOffice: Err:502 (Invalid argument) ``` ``` -------------------------------- ### Financial.Fv Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the future value of an investment. ```APIDOC ## Financial.Fv (rate, nper, pmt, pv, typ) ### Description Calculates the future value of an investment. ### Parameters - **rate** (float) - The interest rate per period. - **nper** (float) - The total number of payment periods in an annuity. - **pmt** (float) - The payment made each period. - **pv** (float) - The present value, or the lump-sum amount that a series of future payments is worth right now. - **typ** (PaymentDue) - Indicates when payments are due. ### Returns - `float` - The future value of an investment. ``` -------------------------------- ### Financial.TBillPrice Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the price per $100 face value for a Treasury bill. ```APIDOC ## Financial.TBillPrice ### Description Calculates the price per $100 face value for a Treasury bill. ### Parameters - **settlement** (DateTime) - The settlement date of the Treasury bill. - **maturity** (DateTime) - The maturity date of the Treasury bill. - **discount** (float) - The discount rate of the Treasury bill. ### Returns - `float` - The price per $100 face value. ``` -------------------------------- ### Financial.Pv Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the present value of an investment using the PV function. ```APIDOC ## Financial.Pv ### Description PV function. The present value of an investment. ### Parameters * **rate** (float) - The interest rate per period. * **nper** (float) - The total number of payment periods. * **pmt** (float) - The payment made each period. * **fv** (float) - The future value, or a cash balance you want to attain after the last payment is made. * **typ** (PaymentDue) - When payments are due. ### Returns * **float** - The present value of the investment. ``` -------------------------------- ### Financial.CoupDaysBS Source: https://fsprojects.github.io/ExcelFinancialFunctions Returns the number of days from the beginning of the coupon period to the settlement date. ```APIDOC ## Financial.CoupDaysBS ### Description Returns the number of days from the beginning of the coupon period to the settlement date. ### Method static member CoupDaysBS ### Parameters - **settlement** (DateTime) - The coupon date. - **maturity** (DateTime) - The maturity date. - **frequency** (Frequency) - The number of coupon payments per year. - **basis** (DayCountBasis) - The type of day count basis to use. ### Response #### Success Response (float) - Returns the number of days as a float. ``` -------------------------------- ### Financial.AmorLinc Source: https://fsprojects.github.io/ExcelFinancialFunctions Calculates the amortization for a specified period using the straight-line method. ```APIDOC ## Financial.AmorLinc ### Description Calculates the amortization for a specified period using the straight-line method. ### Method static member AmorLinc ### Parameters - **cost** (float) - The cost of the asset. - **datePurchased** (DateTime) - The date the asset was purchased. - **firstPeriod** (DateTime) - The date of the first period. - **salvage** (float) - The salvage value at the end of the depreciation. - **period** (float) - The period for which to calculate amortization. - **rate** (float) - The rate of depreciation. - **basis** (DayCountBasis) - The type of day count basis to use. ### Response #### Success Response (float) - Returns the amortization amount as a float. ``` -------------------------------- ### Calculate XIRR with specific dates Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the Internal Rate of Return for a series of cash flows occurring at irregular intervals. Ensure dates are provided as DateTime objects. ```F# Financial.XIrr([206101714.849377; -156650972.54265], [DateTime(2001, 2, 28); DateTime(2001, 3, 31)], -0.1) ``` -------------------------------- ### Financial.Db Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the depreciation of an asset for a specified period using the fixed-declining balance method. ```APIDOC ## Financial.Db ### Description Calculates the depreciation of an asset for a specified period using the fixed-declining balance method. ### Parameters * **cost** (float) - The initial cost of the asset. * **salvage** (float) - The salvage value at the end of the useful life of the asset. * **life** (float) - The number of periods over which the asset is to be depreciated. * **period** (float) - The period for which to calculate depreciation. * **month** (float) - Optional. The number of months in the first year, if the first year is a partial year. ### Returns * **float** - The depreciation for the specified period. ``` -------------------------------- ### ISPmt Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the interest payment for an investment for a given period. ```APIDOC ## ISPmt ### Description The interest payment for an investment for a given period. ### Parameters - **rate** (float) - **per** (float) - **nper** (float) - **pv** (float) - **fv** (float) - Optional - **typ** (PaymentDue) - Optional ### Returns `float` ``` -------------------------------- ### Financial.FvSchedule Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the future value of an initial principal after applying a series of compound interest rates. ```APIDOC ## Financial.FvSchedule (principal, schedule) ### Description Calculates the future value of an initial principal after applying a series of compound interest rates. ### Parameters - **principal** (float) - The present value of the investment. - **schedule** (float seq) - A schedule of interest rates to which the principal is compounded. ### Returns - `float` - The future value of the principal after applying the interest rate schedule. ``` -------------------------------- ### Financial.Price Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the price per $100 face value of a security that pays periodic interest. It requires settlement date, maturity date, coupon rate, yield, redemption value, payment frequency, and day count basis. ```APIDOC ## Financial.Price ### Description The price per $100 face value of a security that pays periodic interest. ### Parameters * **settlement** (DateTime) - The settlement date of the security. * **maturity** (DateTime) - The maturity date of the security. * **rate** (float) - The coupon rate of the security. * **yld** (float) - The yield of the security. * **redemption** (float) - The redemption value of the security per $100 face value. * **frequency** (Frequency) - The number of coupon payments per year. * **basis** (DayCountBasis) - The day count basis to use. ### Returns * **float** - The price per $100 face value of the security. ``` -------------------------------- ### AmorLinc Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the depreciation for an accounting period using the declining balance method. ```APIDOC ## AmorLinc ### Description Calculates the depreciation for an accounting period using the declining balance method. ### Method Signature `static member Financial.AmorLinc(cost: float * datePurchased: DateTime * firstPeriod: DateTime * salvage: float * period: float * rate: float * basis: DayCountBasis -> float` ``` -------------------------------- ### DayCountBasis Enum Members Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-daycountbasis.html This snippet lists the available members of the DayCountBasis enum, each representing a specific day count convention used in financial calculations. ```APIDOC ## DayCountBasis Enum This enum defines the type of Day Count Basis used in financial calculations. ### Members - **Actual360**: Represents the Actual/360 day count basis. - **Actual365**: Represents the Actual/365 day count basis. - **ActualActual**: Represents the Actual/Actual day count basis. - **Europ30_360**: Represents the European 30/360 day count basis. - **UsPsa30_360**: Represents the US 30/360 day count basis. ``` -------------------------------- ### Duration Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the Macaulay duration for a security with an assumed periodic coupon. ```APIDOC ## Duration ### Description Calculates the Macaulay duration for a security with an assumed periodic coupon. ### Method Signature `static member Financial.Duration(settlement: DateTime * maturity: DateTime * coupon: float * yld: float * frequency: Frequency * basis: DayCountBasis -> float` ``` -------------------------------- ### TBillPrice Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Calculates the price per $100 face value of a Treasury bill. ```APIDOC ## TBillPrice ### Description Calculates the price per $100 face value of a Treasury bill. ### Method Signature `static member Financial.TBillPrice(settlement: DateTime * maturity: DateTime * discount: float -> float` ``` -------------------------------- ### Nominal Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html The annual nominal interest rate. ```APIDOC ## Nominal ### Description The annual nominal interest rate. ### Parameters - **effectRate** (float) - **npery** (float) ### Returns `float` ``` -------------------------------- ### Financial.TBillYield Source: https://fsprojects.github.io/ExcelFinancialFunctions/reference/excel-financialfunctions-financial.html Calculates the yield for a Treasury bill. ```APIDOC ## Financial.TBillYield ### Description Calculates the yield for a Treasury bill. ### Parameters - **settlement** (DateTime) - The settlement date of the Treasury bill. - **maturity** (DateTime) - The maturity date of the Treasury bill. - **pr** (float) - The price of the Treasury bill. ### Returns - `float` - The yield of the Treasury bill. ``` -------------------------------- ### Define Annual Frequency Source: https://fsprojects.github.io/ExcelFinancialFunctions/openofficediff.html Represents an annual coupon payment frequency. ```F# Frequency.Annual ```