milktrader / Quandl.jl

Julia api to Quandl open source financial, economic and social datasets
Other
67 stars 31 forks source link

function naming #110

Open femtotrader opened 7 years ago

femtotrader commented 7 years ago

Hello,

I wonder if functions like quandlget or quandlsearch shouldn't be simply named get and search with an other parameter (source) being used for multiple dispatch

quandl = Quandl()
get(quandl, "GOOG/NASDAQ_QQQ")

and

search(quandl, "GDP USA", results=30)

Kind regards

milktrader commented 7 years ago

maybe dispatch quandl as a symbol?

search(:quandl, "GDP USA", results=30)

milktrader commented 7 years ago

Or probably more elegant to just use quandl(s::String) for get and quandl(s::String, n::Int) for search?

femtotrader commented 7 years ago

I think it's better for future usage to use quandl as a struct and not a symbol because you could store API key inside (for credentials).

You could also store in this struct session (for caching queries)...

An other point is that it will also provide a similar interface then https://github.com/femtotrader/DataReaders.jl

and https://github.com/pazzo83/NOAAData.jl/issues/1

femtotrader commented 7 years ago

A last point is that method with same name and same signature than

search(::Symbol, ::AbstractString, ::Int)

is more probable than

search(::Quandl, ::AbstractString, ::Int)
milktrader commented 7 years ago

Here is the quandlget dispatch:

function quandlget(id::AbstractString; order="des", rows=100, frequency="daily",            transformation="none",  from="", to="", format="TimeArray", api_key="", silent=false)

If we change kwargs to parameters (i.e., get rid of the ;) then we have a unique dispatch for get. Is that cheating?