Skip to content
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

Use yc_mget for multiple dates and yc_get for a single date #26

Closed
wilsonfreitas opened this issue May 4, 2022 · 3 comments
Closed

Comments

@wilsonfreitas
Copy link
Collaborator

I rarely use yield curves for multiples dates.
In instruments pricing the common use is to fetch the yield curve for one specific date and price the financial instruments with that curve.

So, my suggestion is: use yc_mget for multiple dates, following the same interface that is now used in yc_get.
And yc_get should return one single curve for the given date.

yc_mget(first_date, last_date, by = 5, cachedir(), do_cache = FALSE)
yc_get(refdate, cachedir(), do_cache = FALSE)

The same can be applied to futures_get: futures_mget for multiple dates and futures_get for a single date.

get and mget names are commonly used in nosql databases to express the same behavior/idea.

@msperlin what do you think about that?

@msperlin
Copy link
Collaborator

msperlin commented May 4, 2022

@wilsonfreitas Im not sure I get it. Function yc_get already accepts a first and last date. If user wants just one date, use the same string in both inputs.. If user wants a particular vector of dates, just filter the output data from the whole period.

But, if you fell it is worth the work, do it. I'm not particularly picky about this stuff, as long as it works as intended.

@wilsonfreitas
Copy link
Collaborator Author

It's all about API design.
I realy like to think of APIs that are inspiring and make the users happy to use them.
From an API point of view, it is very important to express clearly its main objective.
Being honest, I don't like the idea of having to declare two dates to get one date in return.

I will go on with this topic and keep you informed.

wilsonfreitas pushed a commit that referenced this issue May 9, 2022
wilsonfreitas pushed a commit that referenced this issue May 9, 2022
@wilsonfreitas
Copy link
Collaborator Author

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants