Hi Charles,
myportfolio is a Matrix, i.e. Array{Any,2}, so you need two indices to
access it:
julia> myportfolio
1x1 Array{Any,2}:
"GOOG/NASDAQ_GOOD"
julia> myportfolio[1,1]
"GOOG/NASDAQ_GOOD"
julia> typeof(myportfolio[1,1])
ASCIIString
Best regards,
Eric
On Saturday, December 5, 2015 at 6:59:41 AM UTC+8, Charles Santana wrote:
>
> wow! That simple! Yes it works!
>
> Thanks, Seth!
>
> Charles
>
> On 4 December 2015 at 23:53, Seth <[email protected] <javascript:>>
> wrote:
>
>> Maybe this will work for you?
>>
>> julia> a = "foobarbaz"
>> "foobarbaz"
>>
>> julia> b = SubString(a,3,6)
>> "obar"
>>
>> julia> typeof(b)
>> SubString{ASCIIString}
>>
>> julia> c = ASCIIString(b)
>> "obar"
>>
>> julia> typeof(c)
>> ASCIIString
>>
>>
>>
>> On Friday, December 4, 2015 at 2:48:12 PM UTC-8, Charles Santana wrote:
>>>
>>> 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})
>>>
>>>
>>> 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
>>>
>>
>
>
> --
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles
>