Header menu logo ExcelFinancialFunctions

Excel Financial Functions

This is a .NET library that provides the full set of financial functions from Excel. It can be used from both F# and C# as well as from other .NET languages. The main goal for the library is compatibility with Excel, by providing the same functions, with the same behaviour.

Note though that this is not a wrapper over the Excel library; the functions have been re-implemented in managed code so that you do not need to have Excel installed to use this library.

The package is available on NuGet. NuGet Status

You can also use ExcelFinancialFunctions in dotnet interactive notebooks, in Visual Studio Code or Jupyter, or in F# scripts (.fsx files), by referencing the package as follows:

#r "nuget: ExcelFinancialFunctions" // Use the latest version 

Example

This example demonstrates using the YIELD function to calculate bond yield.

#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)

Samples & documentation

The library comes with comprehensible documentation. The tutorials and articles are automatically generated from *.fsx files in [the docs folder][docs]. The API reference is automatically generated from Markdown comments in the library implementation.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding new public API, please also consider adding samples that can be turned into a documentation.

The library was originally developed by Luca Bolognese, the initial version can be downloaded here. It is available under Apache License, for more information see the License file in the GitHub repository.

namespace System
namespace Excel
namespace Excel.FinancialFunctions
type Financial = static member AccrInt: issue: DateTime * firstInterest: DateTime * settlement: DateTime * rate: float * par: float * frequency: Frequency * basis: DayCountBasis * calcMethod: AccrIntCalcMethod -> float + 1 overload static member AccrIntM: issue: DateTime * settlement: DateTime * rate: float * par: float * basis: DayCountBasis -> float static member AmorDegrc: cost: float * datePurchased: DateTime * firstPeriod: DateTime * salvage: float * period: float * rate: float * basis: DayCountBasis * excelCompliant: bool -> float static member AmorLinc: cost: float * datePurchased: DateTime * firstPeriod: DateTime * salvage: float * period: float * rate: float * basis: DayCountBasis -> float static member CoupDays: settlement: DateTime * maturity: DateTime * frequency: Frequency * basis: DayCountBasis -> float static member CoupDaysBS: settlement: DateTime * maturity: DateTime * frequency: Frequency * basis: DayCountBasis -> float static member CoupDaysNC: settlement: DateTime * maturity: DateTime * frequency: Frequency * basis: DayCountBasis -> float static member CoupNCD: settlement: DateTime * maturity: DateTime * frequency: Frequency * basis: DayCountBasis -> DateTime static member CoupNum: settlement: DateTime * maturity: DateTime * frequency: Frequency * basis: DayCountBasis -> float static member CoupPCD: settlement: DateTime * maturity: DateTime * frequency: Frequency * basis: DayCountBasis -> DateTime ...
<summary> A wrapper class to expose the Excel financial functions API to .NET clients </summary>
static member Financial.Yield: settlement: DateTime * maturity: DateTime * rate: float * pr: float * redemption: float * frequency: Frequency * basis: DayCountBasis -> float
Multiple items
[<Struct>] type DateTime = new: year: int * month: int * day: int -> unit + 10 overloads member Add: value: TimeSpan -> DateTime member AddDays: value: float -> DateTime member AddHours: value: float -> DateTime member AddMilliseconds: value: float -> DateTime member AddMinutes: value: float -> DateTime member AddMonths: months: int -> DateTime member AddSeconds: value: float -> DateTime member AddTicks: value: int64 -> DateTime member AddYears: value: int -> DateTime ...
<summary>Represents an instant in time, typically expressed as a date and time of day.</summary>

--------------------
DateTime ()
   (+0 other overloads)
DateTime(ticks: int64) : DateTime
   (+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : DateTime
   (+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : DateTime
   (+0 other overloads)
[<Struct>] type Frequency = | Annual = 1 | SemiAnnual = 2 | Quarterly = 4
<summary> The number of coupon payments per year </summary>
Frequency.SemiAnnual: Frequency = 2
[<Struct>] type DayCountBasis = | UsPsa30_360 = 0 | ActualActual = 1 | Actual360 = 2 | Actual365 = 3 | Europ30_360 = 4
<summary> The type of Day Count Basis </summary>
DayCountBasis.UsPsa30_360: DayCountBasis = 0
<summary> US 30/360 </summary>

Type something to start searching.