Open joshuaulrich opened 8 months ago
Thanks for the thoughts!
This works now. Can you give some examples of parameters you would want to vary by symbol in (i.)? It's not clear to me why you'd want to import a set of symbols into one object if they didn't have the same dates.
This "works" now. The output list is in the same order as the symbols passed to the import method. Duplicate symbols are an issue though (see below). Can you expand on what you mean by (ii.)?
require(rfimport)
s <- c(sym_yahoo("SPY"), sym_tiingo("SPY"))
x <- import_ohlc_collection(s)
sapply(x, attr, "src")
## SPY SPY
## "tiingo" "tiingo"
### reverse the symbol source order...
s <- c(sym_tiingo("SPY"), sym_yahoo("SPY"))
x <- import_ohlc_collection(s)
sapply(x, attr, "src")
## SPY SPY
## "tiingo" "tiingo"
This probably deserves discussion in its own issue.
Not sure what you're proposing here. Maybe an example would help?
I started an ohlc_collection class for things like this, and that's the class import_ohlc_collection()
returns. There's a subset method for it, but doesn't do anything other than regular list subsetting (by symbol). We could add arguments for "source", "dates", etc.
not suggesting these are issues. was writing these down as notes for myself and figured it woudl be better to put them somewhere safe
not suggesting these are issues
I didn't think you were saying these were problems. I view them as feature requests and/or enhancements. I just wanted them in their own place so they were their own topic and easier to find later.
I would be careful about imposing too much boilerplate on users with nested functions. Most of the time users will only be using one source and that should be easy to use without having further considerations.
@ggrothendieck thanks for the feedback! I assume you're referring to the import_*(sym_*())
code? How do you think we could get around that?
Off the top of my head, we could parse a single string that has the source at the beginning. For example:
import_ohlc("yahoo:AAPL,SPY,IBM") # yahoo finance
import_ohlc("tiingo:AAPL,SPY,IBM") # tiingo
But that's a bit of a pain if the symbols are in a vector.
Another idea is to have a global option that users can set to a single source, and we can add a src = getOption("rfimport_default_sym_source")
argument to the import*
functions.
From @ethanbsmith:
Some use cases/scenarios that I think would be useful while considering design decisions:
simplify
type parameter could even be the default to make interactive use less cumbersome.apply
,mcapply
,foreach
etc. (preferable)foreach
, which allows the consumer to specify a sequential or parallel backend.c()
result data from previous calls to diff sources and diff date ranges.rbind()
symbol within a source.lapply
scenarios)