milktrader / Quandl.jl

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

Julia v0.3 - needs Dates in reexport for Quandl.jl #47

Closed james-crocker closed 10 years ago

james-crocker commented 10 years ago

In Quandl.jl (line 4) need Dates in reexport to work with Julia v0.3. -@reexport using TimeSeries, DataFrames +@reexport using Dates, TimeSeries, DataFrames

milktrader commented 10 years ago

What error are you getting without this? The idea is that TimeSeries reexports Dates so it should be visible.

james-crocker commented 10 years ago

rm ~/.julia/v0.3

julia> include ("quandl-test.jl")

quandl-test.jl ------------------- Pkg.add("Quandl") using Quandl

set_auth_token("xxxxxxxxxxxxxxxx")

x = quandl("GOOG/NYSE_MDY")

println(x) quandl-test.jl -------------------

RESULTS

INFO: Initializing package repository /home/j13/.julia/v0.3 INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl INFO: Installing ArrayViews v0.4.6 INFO: Installing BinDeps v0.3.3 INFO: Installing Calendar v0.4.2 INFO: Installing Codecs v0.1.2 INFO: Installing DataArrays v0.2.0 INFO: Installing DataFrames v0.5.7 INFO: Installing Dates v0.0.2 INFO: Installing FactCheck v0.1.2 INFO: Installing GZip v0.2.13 INFO: Installing GnuTLS v0.0.1 INFO: Installing HttpCommon v0.0.5 INFO: Installing HttpParser v0.0.9 INFO: Installing ICU v0.4.2 INFO: Installing JSON v0.3.7 INFO: Installing Nettle v0.1.4 INFO: Installing Quandl v0.3.10 INFO: Installing Reexport v0.0.1 INFO: Installing Requests v0.0.5 INFO: Installing SHA v0.0.2 INFO: Installing SortingAlgorithms v0.0.1 INFO: Installing StatsBase v0.6.4 INFO: Installing TimeSeries v0.4.4 INFO: Installing URIParser v0.0.2 INFO: Building ICU INFO: Building Nettle INFO: Building GnuTLS INFO: Building HttpParser

INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser Submodule 'deps/src/http-parser' (https://github.com/joyent/http-parser.git) registered for path 'deps/src/http-parser' Cloning into 'deps/src/http-parser'... remote: Counting objects: 1239, done. remote: Compressing objects: 100% (6/6), done. remote: Total 1239 (delta 2), reused 0 (delta 0) Receiving objects: 100% (1239/1239), 545.48 KiB | 839.00 KiB/s, done. Resolving deltas: 100% (728/728), done. Checking connectivity... done. Submodule path 'deps/src/http-parser': checked out '80819384450b5511a3d1c424dd92a5843c891364' INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser/deps/src INFO: Attempting to Create directory /home/j13/.julia/v0.3/HttpParser/deps/usr/lib INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser/deps/src make: Entering directory /home/j13/.julia/v0.3/HttpParser/deps/src/http-parser' cc -I. -DHTTP_PARSER_STRICT=0 -Wall -Wextra -Werror -O3 -fPIC -c http_parser.c -o libhttp_parser.o cc -shared -o libhttp_parser.so libhttp_parser.o make: Leaving directory /home/j13/.julia/v0.3/HttpParser/deps/src/http-parser' INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser/deps/src INFO: Package database updated Warning: New definition

+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376 is ambiguous with: +(DataArray{T,N},AbstractArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:326. To fix, define

+(DataArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) before the new definition. Warning: New definition

+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376 is ambiguous with: +(AbstractDataArray{T,N},AbstractArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:350. To fix, define

+(AbstractDataArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) before the new definition. Warning: New definition

+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376 is ambiguous with: +(AbstractArray{T,N},DataArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:326. To fix, define

+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},DataArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) before the new definition. Warning: New definition

+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376 is ambiguous with: +(AbstractArray{T,N},AbstractDataArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:350. To fix, define

+(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractDataArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) before the new definition. Warning: New definition

-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376 is ambiguous with: -(DataArray{T,N},AbstractArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:326. To fix, define

-(DataArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) before the new definition. Warning: New definition

-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376 is ambiguous with: -(AbstractArray{T,N},DataArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:326. To fix, define

-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},DataArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) before the new definition. Warning: New definition

-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376 is ambiguous with: -(AbstractDataArray{T,N},AbstractArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:350. To fix, define

-(AbstractDataArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) before the new definition. Warning: New definition

-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376 is ambiguous with: -(AbstractArray{T,N},AbstractDataArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:350. To fix, define

-(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractDataArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) before the new definition. Warning: New definition -(AbstractArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) at operators.jl:376 is ambiguous with: -(DataArray{T,N},AbstractArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:326. To fix, define -(DataArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) before the new definition. Warning: New definition -(AbstractArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) at operators.jl:376 is ambiguous with: -(AbstractArray{T,N},DataArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:326. To fix, define -(AbstractArray{T1<:CalendarTime,N},DataArray{T2<:CalendarTime,N}) before the new definition. Warning: New definition -(AbstractArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) at operators.jl:376 is ambiguous with: -(AbstractDataArray{T,N},AbstractArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:350. To fix, define

-(AbstractDataArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) before the new definition. Warning: New definition -(AbstractArray{T1<:CalendarTime,N},AbstractArray{T2<:CalendarTime,N}) at operators.jl:376 is ambiguous with: -(AbstractArray{T,N},AbstractDataArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:350. To fix, define

-(AbstractArray{T1<:CalendarTime,N},AbstractDataArray{T2<:CalendarTime,N}) before the new definition. ERROR: Date not defined

julia>

On Sun, Aug 24, 2014 at 8:28 PM, milktrader notifications@github.com wrote:

What error are you getting without this? The idea is that TimeSeries reexports Dates so it should be visible.

— Reply to this email directly or view it on GitHub https://github.com/milktrader/Quandl.jl/issues/47#issuecomment-53217459.

milktrader commented 10 years ago

What and where is the quandl-test.jl file? Not sure what errors you're seeing still.

james-crocker commented 10 years ago

quandl-test.jl is the test file I created to instantiate and use the Quandl library.

> vi /tmp/quandl-test.jl

#quandl-test.jl BEGIN ------------------- Pkg.add("Quandl") using Quandl

set_auth_token("xxxxxxxxxxxxxxxx")

x = quandl("GOOG/NYSE_MDY")

println(x) #quandl-test.jl END -------------------

> rm -rf ~/.julia/v0.3

> julia

julia> include("/tmp/quandl-test.jl") ... ERROR: Date not defined

On Tue, Aug 26, 2014 at 8:30 AM, milktrader notifications@github.com wrote:

What and where is the quandl-test.jl file. Not sure what errors you're seeing still.

— Reply to this email directly or view it on GitHub https://github.com/milktrader/Quandl.jl/issues/47#issuecomment-53412931.

milktrader commented 10 years ago

Can you post its contents?

james-crocker commented 10 years ago

I've provided it in each post. Is it getting stripped out? Is there somewhere else you'd like me to post it?

Here is the content again: (obviously replace the auth_token with your token, or remove if you updated your token file...)

#quandl-test.jl BEGIN ------------------- Pkg.add("Quandl") using Quandl

set_auth_token("xxxxxxxxxxxxxxxx")

x = quandl("GOOG/NYSE_MDY")

println(x) #quandl-test.jl END -------------------

On Tue, Aug 26, 2014 at 1:51 PM, milktrader notifications@github.com wrote:

Can you post it's contents?

— Reply to this email directly or view it on GitHub https://github.com/milktrader/Quandl.jl/issues/47#issuecomment-53461630.

milktrader commented 10 years ago

Yeah, the file contents are not being posted. Are you posting via the github website?

james-crocker commented 10 years ago

Sorry, was not posting via github, but via 'email'. Here are the details.

rm -rf ~/.julia/v0.3 julia julia> Pkg.add("Quandl") using Quandl set_auth_token("xxxxxxxxxxxxxxxx") x = quandl("GOOG/NYSE_MDY") println(x) ... ERROR: Date not defined in timearray at /home/j13/.julia/v0.3/Quandl/src/timearray.jl:20 in quandlget at /home/j13/.julia/v0.3/Quandl/src/api.jl:22 in include at ./boot.jl:245 in include_from_node1 at ./loading.jl:128 while loading /tmp/quandl-test.jl, in expression starting on line 6

----------------------------- 3.10Quandl New Definition Warnings ... Warning: New definition +(AbstractArray{T1<:Union(AbstractCalendarDuration,CalendarTime),N},AbstractArray{T2<:Union(AbstractCalendarDuration,CalendarTime),N}) at operators.jl:376 is ambiguous with: +(DataArray{T,N},AbstractArray{T,N}) at /home/j13/.julia/v0.3/DataArrays/src/operators.jl:326. To fix, define ...

lssimoes commented 10 years ago

As I see it, our function timearray uses some type called Date which used to be on package Datetime.jl (now deprecated in favour of Dates.jl). TimeSeries used to depend on Datetime (I guess) but changed to Dates.jl, which probably caused this error.

I'm not so sure about all I've said up there, but it must be somewhat close to that. We just need to investigate it further

milktrader commented 10 years ago

Date is a constructor in the Dates package, now a part of base. The timearray method was updated to use the Date constructor from Dates. This is likely a reexport issue that I thought was taken care of with requiring TimeSeries, but I guess not. I'll just add Dates to the REQUIRE and using statements. The worse that can happen is three unnecessary lines of code.

milktrader commented 10 years ago

This might be related https://github.com/JuliaStats/TimeSeries.jl/issues/148

milktrader commented 10 years ago

New version just pushed to METADATA with added explicit export of Dates module. Not sure this works.

james-crocker commented 10 years ago

Looks good for Quandl 3.11 - Also gone are the New Definition Warnings from prior version!

Test --------------------------------------------- rm -rf ~/.julia/v0.3 julia julia>Pkg.add("Quandl") INFO: Initializing package repository /home/j13/.julia/v0.3 INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl INFO: Updating cache of Dates... INFO: Updating cache of HttpCommon... INFO: Updating cache of Quandl... INFO: Installing ArrayViews v0.4.6 INFO: Installing BinDeps v0.3.3 INFO: Installing Codecs v0.1.2 INFO: Installing DataArrays v0.2.0 INFO: Installing DataFrames v0.5.7 INFO: Installing Dates v0.3.1 INFO: Installing GZip v0.2.13 INFO: Installing GnuTLS v0.0.1 INFO: Installing HttpCommon v0.0.6 INFO: Installing HttpParser v0.0.9 INFO: Installing JSON v0.3.7 INFO: Installing Nettle v0.1.4 INFO: Installing Quandl v0.3.11 INFO: Installing Reexport v0.0.1 INFO: Installing Requests v0.0.5 INFO: Installing SHA v0.0.2 INFO: Installing SortingAlgorithms v0.0.1 INFO: Installing StatsBase v0.6.4 INFO: Installing TimeSeries v0.4.4 INFO: Installing URIParser v0.0.2 INFO: Building Nettle INFO: Building GnuTLS INFO: Building HttpParser

INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser Submodule 'deps/src/http-parser' (https://github.com/joyent/http-parser.git) registered for path 'deps/src/http-parser' Cloning into 'deps/src/http-parser'... remote: Counting objects: 1239, done. remote: Compressing objects: 100% (6/6), done. remote: Total 1239 (delta 2), reused 0 (delta 0) Receiving objects: 100% (1239/1239), 545.48 KiB | 857.00 KiB/s, done. Resolving deltas: 100% (728/728), done. Checking connectivity... done. Submodule path 'deps/src/http-parser': checked out '80819384450b5511a3d1c424dd92a5843c891364' INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser/deps/src INFO: Attempting to Create directory /home/j13/.julia/v0.3/HttpParser/deps/usr/lib INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser/deps/src make: Entering directory /home/j13/.julia/v0.3/HttpParser/deps/src/http-parser' cc -I. -DHTTP_PARSER_STRICT=0 -Wall -Wextra -Werror -O3 -fPIC -c http_parser.c -o libhttp_parser.o cc -shared -o libhttp_parser.so libhttp_parser.o make: Leaving directory/home/j13/.julia/v0.3/HttpParser/deps/src/http-parser' INFO: Changing Directory to /home/j13/.julia/v0.3/HttpParser/deps/src INFO: Package database updated

julia> using Quandl

julia> set_auth_token("xxxxxxxxxxxxxxxx")

julia> x = quandl("GOOG/NYSE_MDY") 100x5 TimeArray{Float64,2} 2014-04-04 to 2014-08-26

         Open    High    Low     Close   Volume       

2014-04-04 | 254.08 254.48 247.94 248.57 3.25428e6
2014-04-07 | 247.95 248.49 243.46 244.33 2.45985e6
2014-04-08 | 244.19 246.3 243.0 245.76 2.056493e6
2014-04-09 | 246.54 248.33 245.56 248.15 2.205244e6
⋮ 2014-08-21 | 259.39 260.04 258.28 259.71 2.31538e6
2014-08-22 | 259.56 260.25 258.62 259.48 728656.0
2014-08-25 | 260.82 261.19 259.72 260.39 824896.0
2014-08-26 | 260.72 261.75 260.53 261.26 646068.0

james-crocker commented 10 years ago

Thanks for the fix!

milktrader commented 10 years ago

Yeah, the ambiguity warnings were from way upstream and was affecting a number of packages. That package has updated to using Dates.

prcastro commented 10 years ago

Very nice. I didn't have time to check this issue, glad it is solved.