Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Finance use case - tenor conversions to time spans #459
I thought I would add this as an issue, hoping that some functionality like this is already in lubridate. I have what we call tenors in finance, examples are
Is there already something like this?
Do I understand correctly that you want specialized parsers to get from
There is an internal unit parser since in lubridate:
> lubridate:::parse_period_unit("1y") $n  1 $unit  "y"
That's the closest it gets at the moment.
pushed a commit
Aug 17, 2016
But let's think of a proper and consistent API first. I would very much prefer to have a more generic string parser. Something like
Also need to check what ISO standard has to say about it. Related #362
I certainly agree that parsing the ISO standards is an excellent goal to reach for.
My question is, how about both? That is, have the ability to parse simple
Of course, if you would rather this functionality be external to lubridate, just let me know and I will close this issue and related PR.
Unfortunately, in the case of tenors M is used for month, the tenors are always assumed to be a day or greater and generally interpreted in a case-insensitive way. H and S are fair game. A popular example is LIBOR 3M the three month London interbank offered rate. There is also LIBOR 6M and EURIBOR 6M for example.
referenced this issue
Aug 19, 2016
I have decided to fix this now. I need it to fix some misused of character comparison in a bunch of revdeps.
As a by product you can now directly compare to strings:
> duration("day") < "day 1sec"  TRUE
Arbitrary abreviation of units and repeated units is supported.
> period("1sec 1second 1s 1 s")  "4S"