/DataReaders.jl

A Julia library to get remote data via Requests.jl and get DataFrame (from DataFrames.jl) or TimeArray (from TimeSeries.jl)

Primary LanguageJuliaMIT LicenseMIT

DataReaders.jl

Build Status

Coverage Status

codecov.io

WORK IN PROGRESS!!!

A Julia library to get remote data via Requests.jl and get DataFrames thanks to DataFrames.jl.

Inspired by Pandas-DataReader.

Install

Pkg.clone("https://github.com/JuliaDataReaders/DataReaders.jl.git")

Usage

Import DataReaders

using DataReaders

Google daily finance

One symbol

julia> dr = DataReader("google");

julia> symb = DataSymbol("MSFT");

julia> dt_start = DateTime("2015-04-01");

julia> dt_end = DateTime("2015-04-15");

julia> response = get(dr, symb, dt_start, dt_end);

julia> df = DataFrame(response);

julia> println(df);
10x6 DataFrames.DataFrame
│ Row │ Date       │ Open  │ High  │ Low   │ Close │ Volume   │
┝━━━━━┿━━━━━━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━━━━┥
│ 12015-04-0140.640.7640.3140.7236865322 │
│ 22015-04-0240.6640.7440.1240.2937487476 │
│ 32015-04-0640.3441.7840.1841.5439223692 │
│ 42015-04-0741.6141.9141.3141.5328809375 │
│ 52015-04-0841.4641.6941.0441.4224753438 │
│ 62015-04-0941.2541.6241.2541.4825723861 │
│ 72015-04-1041.6341.9541.4141.7228022002 │
│ 82015-04-1341.442.0641.3941.7630276692 │
│ 92015-04-1441.842.0341.3941.6524244382 │
│ 102015-04-1541.7642.4641.6842.2627343581

Several symbols

julia> dr = DataReader("google");

julia> symbols = DataSymbol.(["IBM", "MSFT"])
2-element Array{DataReaders.DataSymbol,1}:
 DataReaders.DataSymbol("IBM")
 DataReaders.DataSymbol("MSFT")

julia> dt_start = DateTime("2015-04-01");

julia> dt_end = DateTime("2015-04-15");

julia> multi_symbol_response = get(dr, symbols, dt_start, dt_end);

julia> data = DataFrame(multi_symbol_response);

julia> println(data)
DataStructures.OrderedDict(DataReaders.DataSymbol("IBM")=>10x6 DataFrames.DataFrame
│ Row │ Date       │ Open   │ High   │ Low    │ Close  │ Volume  │
┝━━━━━┿━━━━━━━━━━━━┿━━━━━━━━┿━━━━━━━━┿━━━━━━━━┿━━━━━━━━┿━━━━━━━━━┥
│ 12015-04-01160.23160.62158.39159.183700791 │
│ 22015-04-02159.52162.54158.89160.454671578 │
│ 32015-04-06159.69162.8158.7162.043465682 │
│ 42015-04-07161.67163.84161.62162.073147975 │
│ 52015-04-08161.72163.55161.01161.852524323 │
│ 62015-04-09161.7162.47160.72162.342263490 │
│ 72015-04-10162.34163.33161.25162.862515703 │
│ 82015-04-13162.37164.0162.36162.383868911 │
│ 92015-04-14162.42162.74160.79162.32719287 │
│ 102015-04-15162.63164.96162.5164.133498756 │,DataReaders.DataSymbol("MSFT")=>10x6 DataFrames.DataFrame
│ Row │ Date       │ Open  │ High  │ Low   │ Close │ Volume   │
┝━━━━━┿━━━━━━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━━━━┥
│ 12015-04-0140.640.7640.3140.7236865322 │
│ 22015-04-0240.6640.7440.1240.2937487476 │
│ 32015-04-0640.3441.7840.1841.5439223692 │
│ 42015-04-0741.6141.9141.3141.5328809375 │
│ 52015-04-0841.4641.6941.0441.4224753438 │
│ 62015-04-0941.2541.6241.2541.4825723861 │
│ 72015-04-1041.6341.9541.4141.7228022002 │
│ 82015-04-1341.442.0641.3941.7630276692 │
│ 92015-04-1441.842.0341.3941.6524244382 │
│ 102015-04-1541.7642.4641.6842.2627343581 │)

Done / ToDo

Done:

  • Yahoo Finance daily DataReaders
  • Support several symbols for Google Finance daily DataReaders - return as OrderedDict
  • Google Finance daily DataReaders (only one symbol at a time)
  • Unit testing
  • Continuous Integration

ToDo: