Closed ASaragga closed 5 years ago
Yes it does! Thank you very much @EricForgy for your explanation and for this package!
I though that in those two conventions, the condition: startdate > enddate
, then the result is -yearfrac(enddate, startdate, dc)
, or some other condition that would deal with this type of issue, would also be applied here soon like in the other conventions. So, just a aesthetical symmetry issue...
Actually I am little bit curious about this particular choice and why only for some conventions. I fear that it may give silent errors when reading settlement dates with corrupted values in large files... I mean, startdate > enddate
may happen not only because one got the dates in the wrong order while working in the REPL, for instance, but more importantly because simply one of the dates on a batch file is corrupted and happened "fortunately" to be the case that startdate > enddate
. Possibly one would want to error (or catch the error) in such cases since the -yearfrac correction or the Excel correction for that matter, would give wrong results and obscure the issue.
On my local branch made startdate > enddate
to return missing
, except for both Excel day counts conventions
if startdate > enddate
return missing
end
hoping that the machinery for missing
in Julia will help to deal more easily with this issue (accordingly also changed some reflection
test to missing
tests in runtest.jl
)
Hi @ASaragga 👋
If startdate > enddate, we want daycount to return a negative number.
I'm not sure returning missing is the right thing to do. If you want to ensure startdate < enddate, that could be a check in youre code outside DayCounts OR we can add an optional flag to DayCounts. In any case, I think an error would be better than missing 🤔
Possibly there is a use case for 'startdate > enddate' but it is not clear to me what it may be. I believe that Matlab also returns a negative number. Anyway I am closing this PR. Would like to emphasise that really appreciate your package. It is an important funding stone for the growing applied finance ecosystem in Julia.
Hi @ASaragga 👋
This is great and motivating feedback. Thanks 😊
Hi @ASaragga 👋
Thanks for this PR, but those
dc
s were intentionally left out 😊That argument is only used for dispatch and the actual
dc
value isn't used in the function. In those cases, where the argument is only used for dispatch, you do not need to include an actual variable there.Does that make sense?