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.
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.
- API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes the links to the Excel documentation.
- Excel Compatibility section explains the possible differences with Excel's results.
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.
<summary> A wrapper class to expose the Excel financial functions API to .NET clients </summary>
[<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)
<summary> The number of coupon payments per year </summary>
<summary> The type of Day Count Basis </summary>
<summary> US 30/360 </summary>