From 23a3c665e1ac9128bc5416a2b4c7618a178f744c Mon Sep 17 00:00:00 2001 From: Sanjuktha Date: Thu, 25 Apr 2024 15:04:16 +0530 Subject: [PATCH 1/3] Use Artifacts.jl for sample data in README.md. --- Artifacts.toml | 6 ++++++ Project.toml | 1 + README.md | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 Artifacts.toml diff --git a/Artifacts.toml b/Artifacts.toml new file mode 100644 index 0000000..01e1296 --- /dev/null +++ b/Artifacts.toml @@ -0,0 +1,6 @@ +[ibm] +git-tree-sha1 = "c8f3ebdaa31904fdd971537498f85bf9e61801cc" + + [[ibm.download]] + sha256 = "31dd579169751f728b9aaf6dcc1fd9d32be4513bdb462bf5edd0df9a083d4704" + url = "https://gist.github.com/san-ath/9acea52b988e752b375617266f981d20/raw/c8f3ebdaa31904fdd971537498f85bf9e61801cc.tar.gz" diff --git a/Project.toml b/Project.toml index 5640fbb..b6719ea 100644 --- a/Project.toml +++ b/Project.toml @@ -13,6 +13,7 @@ ShiftedArrays = "1277b4bf-5013-50f5-be3d-901d8477a67a" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" +Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" [compat] DataFrames = "1.3.2" diff --git a/README.md b/README.md index ccad571..ab10314 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ julia> Pkg.add("TSFrames") TSFrames is a [Tables.jl](https://github.com/JuliaData/Tables.jl) compatible package. This helps in easy conversion between `TSFrame` objects and other [Tables.jl](https://github.com/JuliaData/Tables.jl) compatible types. For example, to load a `CSV` into a `TSFrame` object, we do the following. ```julia -julia> using CSV, Dates, DataFrames, TSFrames +julia> using CSV, Dates, DataFrames, TSFrames, Artifacts -julia> ts = CSV.read("IBM.csv", TSFrame) +julia> ts = CSV.read(joinpath(artifact"ibm", "IBM.csv"), TSFrame) 252x6 TSFrame with Date Index Index Open High Low Close Adj Close Volume From e40cc4efa1dc105d1ab8573de185eafa250fb488 Mon Sep 17 00:00:00 2001 From: Sanjuktha Date: Thu, 25 Apr 2024 18:07:47 +0530 Subject: [PATCH 2/3] Fix dependencies and other errors in demo_finance.md --- docs/Project.toml | 2 ++ docs/src/demo_finance.md | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index 0b6c035..80f5c35 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -6,6 +6,8 @@ MarketData = "945b72a4-3b13-509d-9b46-1525bb5c06de" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +Impute = "f7bf1975-0170-51b9-8c5f-a992d46b9575" +GLM = "38e38edf-8417-5370-95a0-9cbbq8c7f171a" TSFrames = "9f90e835-9451-4aaa-bcb1-743a1b8d2f84" [compat] diff --git a/docs/src/demo_finance.md b/docs/src/demo_finance.md index 9c33c1f..285c3ce 100644 --- a/docs/src/demo_finance.md +++ b/docs/src/demo_finance.md @@ -5,7 +5,7 @@ To load the IBM historical data, we will use the `MarketData.yahoo` function from [MarketData.jl](https://github.com/JuliaQuant/MarketData.jl), which returns the data in the form of a `TimeArray`. We just simply pass this on to the `TSFrame` constructor. ```@repl e1 -using TSFrames, MarketData, Plots, Statistics, Impute +using TSFrames, MarketData, Plots, Statistics, Impute, GLM ibm_ts = TSFrame(MarketData.yahoo(:IBM)) ``` @@ -145,13 +145,14 @@ within the window. ```@repl e1 sp500 = TSFrame(MarketData.yahoo("^GSPC")); sp500_adjclose = TSFrames.subset(sp500, date_from, date_to)[:, ["AdjClose"]] +ibm_adjclose = ibm[:, [:Index, :AdjClose]] sp500_ibm = join(sp500_adjclose, ibm_adjclose, jointype=:JoinBoth) sp500_ibm_returns = diff(log.(sp500_ibm)) TSFrames.rename!(sp500_ibm_returns, ["SP500", "IBM"]); function regress(data) - ll = lm(@formula(IBM ~ SP500), data) + ll = lm(@formula(SP500 ~ IBM), data) co::Real = coef(ll)[coefnames(ll) .== "IBM"][1] sd::Real = Statistics.std(residuals(ll)) return (co, sd) From 68d5c01a48610ee43e5401d20175f3f8ac00a5a9 Mon Sep 17 00:00:00 2001 From: Sanjuktha Date: Thu, 25 Apr 2024 18:44:52 +0530 Subject: [PATCH 3/3] Fixing error in GLM UUID. --- docs/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Project.toml b/docs/Project.toml index 80f5c35..c221314 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -7,7 +7,7 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Impute = "f7bf1975-0170-51b9-8c5f-a992d46b9575" -GLM = "38e38edf-8417-5370-95a0-9cbbq8c7f171a" +GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a" TSFrames = "9f90e835-9451-4aaa-bcb1-743a1b8d2f84" [compat]