Le vendredi 04 décembre 2015 à 23:47 +0100, Charles Novaes de Santana a
écrit :
> Hi people,
> 
> Maybe it is a trivial question for most of you, but I really could
> not find a way to solve my problem.
> 
> I am using the function quandlget(id::ASCIIString) from the library 
> https://github.com/milktrader/Quandl.jl (a great contribution, by the
> way!)
> 
> Everything works fine when I use it in a straightforward way:
> 
> julia> mydat = quandl("GOOG/NASDAQ_GOOG",rows=100,format="DataFrame")
> 100x6 DataFrames.DataFrame
> | Row | Date       | Open   | High   | Low    | Close  | Volume    |
> |-----|------------|--------|--------|--------|--------|-----------|
> | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
> | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
> | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
> 
> 
> or when I do:
> 
> julia> myid = "GOOG/NASDAQ_GOOG"
> "GOOG/NASDAQ_GOOG"
> 
> julia> typeof(myid)
> ASCIIString
> 
> julia> mydat = quandl(myid,rows=100,format="DataFrame")
> 100x6 DataFrames.DataFrame
> | Row | Date       | Open   | High   | Low    | Close  | Volume    |
> |-----|------------|--------|--------|--------|--------|-----------|
> | 1   | 2015-07-08 | 521.05 | 522.73 | 516.11 | 516.83 | 1.2967e6  |
> | 2   | 2015-07-09 | 523.12 | 523.77 | 520.35 | 520.68 | 1.84235e6 |
> | 3   | 2015-07-10 | 526.29 | 532.56 | 525.55 | 530.13 | 1.95668e6 |
> 
> 
> However, I get an error when I read my data from an external file.
> Assume I have an ascii file containing only one line:
> 
> $ echo "GOOG/NASDAQ_GOOG" > portfolio.txt
> 
> $ cat portfolio.txt 
> GOOG/NASDAQ_GOOG
> 
> 
> I just read the content of this file by using readdlm and try to use
> it to call the same function quandl, but it does not work.
> 
> julia> myportfolio = readdlm("./portfolio.txt",'\n')
> 1x1 Array{Any,2}:
>  "GOOG/NASDAQ_GOOG"
> 
> julia> typeof(myportfolio[1])
> SubString{ASCIIString}
> 
> julia> mydat = quandl(myportfolio[1],rows=100,format="DataFrame")
> ERROR: MethodError: `quandlget` has no method matching
> quandlget(::SubString{ASCIIString})
Though the other posts give good solutions to your problem, you could
also file an issue against Quandl.jl to change quandlget() to accept
any AbstractString, and not only ASCIIString. That would be helpful in
legitimate cases.


Regards

> I suppose the easiest way to solve this problem is to convert my
> SubString{ASCIIString} variable to ASCIIString. Am I right here? How
> can I do it?
> 
> Does any of you have another suggestion? May be I could read my data
> in a different way instead of using readdlm? 
> 
> Thanks for any tip!
> 
> best,
> 
> Charles
> -- 
> Um axé! :)
> 
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles

Reply via email to