Skip to content

Commit

Permalink
Merge pull request #83 from Arkoniak/version_update
Browse files Browse the repository at this point in the history
Bump
  • Loading branch information
Arkoniak committed Apr 1, 2022
2 parents 27f4ad6 + 2fe84e6 commit cbeb769
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MarketData.jl is licensed under the MIT License (MIT)

Copyright (c) 2013-2021 Algorithm Alpha, LLC
Copyright (c) 2013-2022 Algorithm Alpha, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MarketData"
uuid = "945b72a4-3b13-509d-9b46-1525bb5c06de"
authors = ["JuliaQuant <https://github.com/JuliaQuant>"]
version = "0.13.9"
version = "0.13.10"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand All @@ -18,7 +18,7 @@ HTTP = "0.8, 0.9"
Reexport = "0.2, 1.0"
TimeSeries = "0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23"
julia = "1"
JSON3 = "1.9.1"
JSON3 = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
26 changes: 13 additions & 13 deletions src/downloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,31 +165,31 @@ https://www.ons.gov.uk/timeseriestool
- fred() which accesses the St. Louis Federal Reserve financial and economic data sets.
- yahoo() which is a wrapper from downloading financial time series for stocks from Yahoo Finance.
"""
function ons(timeseries::AbstractString="L522",dataset::AbstractString="MM23")
function ons(timeseries::AbstractString = "L522", dataset::AbstractString = "MM23")
url = "https://api.ons.gov.uk/dataset/$dataset/timeseries/$timeseries/data"
res = HTTP.get(url)
@assert res.status == 200
json = JSON3.read(String(res.body))
json = JSON3.read(HTTP.payload(res))
ta = nothing
if "months" in keys(json)
data = json["months"]
dates = [Date(x["year"]*" "*x["month"],dateformat"Y U") for x in data]
values = [parse(Float64,x["value"]) for x in data]
ta = TimeArray((timestamp=dates,monthly=values),timestamp=:timestamp)
dates = [Date(x["year"]*" "*x["month"], dateformat"Y U") for x in data]
values = [parse(Float64, x["value"]) for x in data]
ta = TimeArray((timestamp = dates, monthly = values),timestamp=:timestamp)
end
if "quarters" in keys(json)
data = json["quarters"]
dates = [Date(x["year"]*" "*string(parse(Int,x["quarter"][2])*3-2),dateformat"Y m") for x in data]
dates = [Date(x["year"]*" "*string(parse(Int, x["quarter"][2])*3-2),dateformat"Y m") for x in data]
values = [parse(Float64,x["value"]) for x in data]
tb = TimeArray((timestamp=dates,quarterly=values),timestamp=:timestamp)
ta === nothing ? ta = tb : ta = merge(ta,tb;method=:outer)
tb = TimeArray((timestamp = dates, quarterly = values), timestamp = :timestamp)
ta === nothing ? ta = tb : ta = merge(ta, tb; method = :outer)
end
if "years" in keys(json)
data = json["years"]
dates = [Date(x["year"]) for x in data]
values = [parse(Float64,x["value"]) for x in data]
tb = TimeArray((timestamp=dates,yearly=values),timestamp=:timestamp)
ta === nothing ? ta = tb : ta = merge(ta,tb;method=:outer)
values = [parse(Float64, x["value"]) for x in data]
tb = TimeArray((timestamp = dates, yearly = values), timestamp = :timestamp)
ta === nothing ? ta = tb : ta = merge(ta, tb; method = :outer)
end
TimeArray(ta,meta=json["description"])
end
TimeArray(ta, meta = json["description"])
end
1 change: 0 additions & 1 deletion test/downloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ using Test
@test ta |> timestamp |> length > 100
ta = fred("DGS10")
@test ta |> timestamp |> length > 100
@test !(ta isa TimeArray{T} where T<:AbstractString)
end

@testset "Yahoo" begin
Expand Down

2 comments on commit cbeb769

@Arkoniak
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/57786

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.13.10 -m "<description of version>" cbeb769eba0969d61258c7b66f9104d2fba75d6a
git push origin v0.13.10

Please sign in to comment.