-
Notifications
You must be signed in to change notification settings - Fork 64
Behavior of AccrInt does not match Excel when firstInterest <= settlement #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @zanoo Thank you for reporting this. The official documentation does not mention any check for this value, and with other tests working I'd say it's safe to delete it. I've added the fix and test here, however the solution format and build tools also require upgrade which is only partially complete atm and I might have not enough time to get back to it very soon... Could you please checkout the branch and see if it works for you (FSharp.Core version etc)? Any help with finalizing the upgrade is also appreciated :) Kind regard, |
Hey @luajalla, apologies for getting back to you so late. Thanks for adding the fix and test. I was able to check out the branch and build it using the |
Hi, I am cleaning up old issues. This issue refers to commit 736ed9b. It has not been merged into the primary branch. Leaving the issue open to track. As a side note, it's worth checking whether or not to remove the whole check, or just change ">" to ">=". Will need to examine Excel behavior in case of "<". |
I brought Natallie's change over to a feature branch in this repo. It passed all the tests including the "console" interop tests. It's resting in the feature/issue-22 branch. I want to release the netcore replatforming out first without code changes. So I'll target this for a following bugfix release. Note that I fixed it more narrowly than she did. I kept the firstinterest check in, just allowed it to be equal to settlement date. |
Description
Calling the
AccrInt(issue, firstInterest, settlement, rate, par, frequency, basis, calcMethod = AccrIntCalcMethod.FromIssueToSettlement)
function withfirstInterest <= settlement
results in an exception. This does not occur in Excel (tested 2007 and 2013).Repro steps
Add DLL to a C# project
Execute following code:
This results in an exception.
Expected behavior
We expect this to match the output of the Excel function call
=ACCRINT(08/15/18, 02/15/19, 02/15/19, 0.02125, 100, 2, 1)
, which evaluates to1.0625
.Actual behavior
We get the following exception:
Known workarounds
Comment out the line in
bonds.fs
underlet calcAccrInt issue firstInterest settlement rate par (frequency:Frequency) basis (calcMethod:AccrIntCalcMethod) =
that looks like this:For example, it's currently (as of writing) at this line in the code.
I'm not sure how this might affect other functionality or expectations. Compiling and testing this change doesn't seem to break any of the ~200000 test cases on my machine though.
Related information
Thanks for authoring this fantastic library!
The text was updated successfully, but these errors were encountered: