Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refs #181, fixing documentation issues #198

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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-9cbb8c7f171a"
TSFrames = "9f90e835-9451-4aaa-bcb1-743a1b8d2f84"

[compat]
Expand Down
5 changes: 3 additions & 2 deletions docs/src/demo_finance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
```

Expand Down Expand Up @@ -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)
Expand Down
Loading