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

setDefaults for getQuote.av #316

Closed
helgasoft opened this issue Oct 23, 2020 · 3 comments
Closed

setDefaults for getQuote.av #316

helgasoft opened this issue Oct 23, 2020 · 3 comments
Assignees
Labels

Comments

@helgasoft
Copy link

Description

Documentation says in setDefaults(name...), name = name of function, quoted or unquoted. For getQuote.av only the quoted name works.

Expected behavior

both quoted or unquoted names to work

Minimal, reproducible example

setDefaults(getQuote.av, api.key='xxx')
# Error in setDefaults(getQuote.av, api.key = "xxx") :   object 'getQuote.av' not found
setDefaults('quantmod:::getQuote.av', api.key='xxx')
# Error in get(fun, mode = "function", envir = envir) :   object 'quantmod:::getQuote.av' of mode 'function' was not found
setDefaults('getQuote.av', api.key='xxx')
# works, huh
@joshuaulrich
Copy link
Owner

Thanks for the report! It looks like this is because getQuote.av() is not exported from the quantmod namespace. I'll investigate.

joshuaulrich added a commit that referenced this issue Nov 6, 2020
setDefaults() was not able to find unexported functions (e.g.
getQuote.av()), so users could not set defaults for them.

The bulk of the changes are in setDefaults() in order to verify the
function exists, exported or not, and has a call to importDefaults().

Then we always capture the call in getDefaults() and unsetDefaults()
to avoid the possibility that the function is not exported. We do not
need to re-verify because the default options will only exist if
setDefaults() created them.

Fixes #316.
@joshuaulrich
Copy link
Owner

This took much longer than I expected (10-12 hours), but I finally got it working. Please give it a try and let me know if you run into any edge cases.

@joshuaulrich joshuaulrich self-assigned this Nov 7, 2020
joshuaulrich added a commit that referenced this issue Nov 7, 2020
Flagged by R CMD check.

See #316.
@helgasoft
Copy link
Author

Thank you, the updated version 0.4.17.1 works fine.

@joshuaulrich joshuaulrich added this to the Release 0.4.18 milestone Nov 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants