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

Package name changed to TimeFrames. #111

Merged
merged 12 commits into from
Nov 5, 2022
36 changes: 18 additions & 18 deletions Benchmark.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TSx Benchmarks
# TimeFrames Benchmarks

```
import .TSx
import .TimeFrames
using DataFrames, Dates, BenchmarkTools, MarketData
BenchmarkTools.DEFAULT_PARAMETERS.samples = 10
df = DataFrame(ohlc)
Expand All @@ -26,9 +26,9 @@ Rows: 500

Columns: timestamp, Open, High, Low, Close

## Creating TSx object from DataFrame
## Creating a TimeFrame object from DataFrame
```
@benchmark TSx.TS(data) setup=(data = df)
@benchmark TimeFrames.TimeFrame(data) setup=(data = df)
```
```
Range (min … max): 20.400 μs … 59.300 μs ┊ GC (min … max): 0.00% … 0.00%
Expand Down Expand Up @@ -63,7 +63,7 @@ BenchmarkTools.Trial: 10 samples with 1 evaluation.
## Apply methods

```
@benchmark TSx.apply(data, Month, mean,[:Open, :Close]) setup=(data=ts)
@benchmark TimeFrames.apply(data, Month, mean,[:Open, :Close]) setup=(data=ts)
```

```
Expand All @@ -73,7 +73,7 @@ BenchmarkTools.Trial: 10 samples with 1 evaluation.
```

```
@benchmark TSx.apply(data, Year, sum,[:Low, :Close]) setup=(data=ts)
@benchmark TimeFrames.apply(data, Year, sum,[:Low, :Close]) setup=(data=ts)
```
```
Range (min … max): 279.600 μs … 508.600 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -85,7 +85,7 @@ BenchmarkTools.Trial: 10 samples with 1 evaluation.

### Lag
```
@benchmark TSx.lag(data,2) setup=(data = ts)
@benchmark TimeFrames.lag(data,2) setup=(data = ts)
```
```
Range (min … max): 47.400 μs … 117.900 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -95,7 +95,7 @@ BenchmarkTools.Trial: 10 samples with 1 evaluation.
### Diff

```
@benchmark TSx.diff(data,1) setup=(data = ts)
@benchmark TimeFrames.diff(data,1) setup=(data = ts)
```
```
Range (min … max): 155.300 μs … 257.700 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -105,7 +105,7 @@ Range (min … max): 155.300 μs … 257.700 μs ┊ GC (min … max): 0.00%
### pctchange

```
@benchmark TSx.pctchange(data,1) setup=(data = ts)
@benchmark TimeFrames.pctchange(data,1) setup=(data = ts)
```
```
Range (min … max): 161.300 μs … 263.900 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -116,7 +116,7 @@ Range (min … max): 155.300 μs … 257.700 μs ┊ GC (min … max): 0.00%
## Log returns

```
@benchmark TSx.computelogreturns(data[1:500,2]) setup = (data = ts)
@benchmark TimeFrames.computelogreturns(data[1:500,2]) setup = (data = ts)
```
```
Range (min … max): 86.000 μs … 199.600 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -125,7 +125,7 @@ Time (mean ± σ): 104.520 μs ± 34.220 μs ┊ GC (mean ± σ): 0.00% ±
```

```
@benchmark TSx.rollapply(mean, data, 3, 5) setup = (data = ts)
@benchmark TimeFrames.rollapply(mean, data, 3, 5) setup = (data = ts)
```
```
Range (min … max): 29.600 μs … 82.700 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -138,12 +138,12 @@ Time (mean ± σ): 104.520 μs ± 34.220 μs ┊ GC (mean ± σ): 0.00% ±
v = [i for i in 1:2:500]
df2 = df[v,[:timestamp,:Open,:High,:Low,:Close]]
rename!(df2, :Open => :open1, :High => :high1, :Low => :low1, :Close => :close1)
ts2 = TSx.TS(df2)
ts2 = TimeFrames.TimeFrame(df2)
```
### Left Join

```
@benchmark TSx.leftjoin(ts,ts2)
@benchmark TimeFrames.leftjoin(ts,ts2)
```
```
Range (min … max): 107.100 μs … 220.100 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -154,7 +154,7 @@ ts2 = TSx.TS(df2)
### Right Join

```
@benchmark TSx.rightjoin(ts,ts2)
@benchmark TimeFrames.rightjoin(ts,ts2)
```
```
Range (min … max): 96.700 μs … 206.400 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -165,7 +165,7 @@ ts2 = TSx.TS(df2)
### Inner Join

```
@benchmark TSx.innerjoin(ts,ts2)
@benchmark TimeFrames.innerjoin(ts,ts2)
```
```
Range (min … max): 71.800 μs … 180.400 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -176,7 +176,7 @@ ts2 = TSx.TS(df2)
### Outer Join

```
@benchmark TSx.outerjoin(ts,ts2)
@benchmark TimeFrames.outerjoin(ts,ts2)
```
```
Range (min … max): 114.300 μs … 228.800 μs ┊ GC (min … max): 0.00% … 0.00%
Expand All @@ -189,8 +189,8 @@ ts2 = TSx.TS(df2)
```
df3 = df[1:300,[:timestamp,:Open,:High,:Low,:Close]]
df4 = df[300:end,[:timestamp,:Open,:High,:Low,:Close]]
ts3 = TSx.TS(df3)
ts4 = TSx.TS(df4)
ts3 = TimeFrames.TimeFrame(df3)
ts4 = TimeFrames.TimeFrame(df4)
```

```
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "TSx"
name = "TimeFrames"
uuid = "9f90e835-9451-4aaa-bcb1-743a1b8d2f84"
authors = ["Chirag Anand", "xKDR Forum", "Naman Kumar", "Sumeet Suley"]
version = "0.1.0"
Expand Down
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# TSx
# TimeFrames

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://xKDR.github.io/TSx.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://xKDR.github.io/TSx.jl/dev)
![Build Status](https://github.com/xKDR/TSx.jl/actions/workflows/documentation.yml/badge.svg)
[![codecov](https://codecov.io/gh/xKDR/TSx.jl/branch/main/graph/badge.svg?token=9qkJUtdgrz)](https://codecov.io/gh/xKDR/TSx.jl)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://xKDR.github.io/TimeFrames.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://xKDR.github.io/TimeFrames.jl/dev)
![Build Status](https://github.com/xKDR/TimeFrames.jl/actions/workflows/documentation.yml/badge.svg)
[![codecov](https://codecov.io/gh/xKDR/TimeFrames.jl/branch/main/graph/badge.svg?token=9qkJUtdgrz)](https://codecov.io/gh/xKDR/TimeFrames.jl)

TSx is a Julia package to handle timeseries data. It provides a
TimeFrames is a Julia package to handle timeseries data. It provides a
convenient interface for the commonly used timeseries data
manipulations. TSx is built on top of the powerful and mature
manipulations. TimeFrames is built on top of the powerful and mature
[DataFrames.jl](https://github.com/JuliaData/DataFrames.jl) making
use of the many capabilities of the `DataFrame` type and being easily
extensible at the same time.

## Installing TSx
## Installing TimeFrames

```julia
julia> using Pkg
julia> Pkg.add(url="https://github.com/xKDR/TSx.jl")
julia> Pkg.add(url="https://github.com/xKDR/TimeFrames.jl")
```

## Basic usage

### Creating TS objects
TSx is a [Tables.jl](https://github.com/JuliaData/Tables.jl) compatible package. This helps in easy conversion between `TS` objects and other [Tables.jl](https://github.com/JuliaData/Tables.jl) compatible types. For example, to load a `CSV` into a `TS` object, we do the following.
### Creating TimeFrame objects
TimeFrames is a [Tables.jl](https://github.com/JuliaData/Tables.jl) compatible package. This helps in easy conversion between `TimeFrame` objects and other [Tables.jl](https://github.com/JuliaData/Tables.jl) compatible types. For example, to load a `CSV` into a `TimeFrame` object, we do the following.

```julia
julia> using CSV, Dates, DataFrames, TSx
julia> using CSV, Dates, DataFrames, TimeFrames

julia> ts = CSV.read("IBM.csv", TS)
(252 x 6) TS with Dates.Date Index
julia> ts = CSV.read("IBM.csv", TimeFrame)
(252 x 6) TimeFrame with Dates.Date Index

Index Open High Low Close Adj Close Volume
Date Float64 Float64 Float64 Float64 Float64 Int64
Expand Down Expand Up @@ -56,13 +56,13 @@ julia> ts = CSV.read("IBM.csv", TS)
233 rows omitted
```

As another example of this, consider the following code, which converts a `TimeArray` object to a `TS` object. For this, we use the `MarketData.yahoo` function from the [MarketData.jl](https://juliaquant.github.io/MarketData.jl/stable/) package, which returns a `TimeArray` object.
As another example of this, consider the following code, which converts a `TimeArray` object to a `TimeFrame` object. For this, we use the `MarketData.yahoo` function from the [MarketData.jl](https://juliaquant.github.io/MarketData.jl/stable/) package, which returns a `TimeArray` object.

```julia
julia> using TSx, MarketData;
julia> using TimeFrames, MarketData;

julia> TS(MarketData.yahoo(:AAPL))
10550×6 TS with Date Index
julia> TimeFrame(MarketData.yahoo(:AAPL))
10550×6 TimeFrame with Date Index
Index Open High Low Close AdjClose Volume
Date Float64 Float64 Float64 Float64 Float64 Float64
───────────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -101,7 +101,7 @@ julia> TS(MarketData.yahoo(:AAPL))
### Indexing
```julia
julia> ts[1:10, [:Close]]
(10 x 1) TS with Dates.Date Index
(10 x 1) TimeFrame with Dates.Date Index

Index Close
Date Float64
Expand All @@ -123,8 +123,8 @@ julia> ts[1:10, [:Close]]
```julia
julia> from = Date(2021, 04, 29); to = Date(2021, 06, 02);

julia> TSx.subset(ts, from, to)
(24 x 6) TS with Date Index
julia> TimeFrames.subset(ts, from, to)
(24 x 6) TimeFrame with Date Index

Index Open High Low Close Adj Close Volume
Date Float64 Float64 Float64 Float64 Float64 Int64
Expand Down Expand Up @@ -160,7 +160,7 @@ julia> TSx.subset(ts, from, to)
```julia
julia> ep = endpoints(ts, Week(1));
julia> ts_weekly = ts[ep]
(52 x 6) TS with Date Index
(52 x 6) TimeFrame with Date Index

Index Open_last High_last Low_last Close_last Adj Close_last Volume_last
Date Float64 Float64 Float64 Float64 Float64 Int64
Expand All @@ -184,9 +184,9 @@ julia> plot(ts_weekly[:, [:Close_last]], size = (600, 400))

## Documentation

Head to the TSx [user guide](https://xkdr.github.io/TSx.jl/dev/user_guide/) for more
Head to the TimeFrames [user guide](https://xkdr.github.io/TimeFrames.jl/dev/user_guide/) for more
examples and functionality. The API reference is available on the
[documentation](https://xkdr.github.io/TSx.jl/dev/api/) page.
[documentation](https://xkdr.github.io/TimeFrames.jl/dev/api/) page.

## Contributions

Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MarketData = "945b72a4-3b13-509d-9b46-1525bb5c06de"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TSx = "9f90e835-9451-4aaa-bcb1-743a1b8d2f84"
TimeFrames = "9f90e835-9451-4aaa-bcb1-743a1b8d2f84"

[compat]
Documenter = "0.27.15"
16 changes: 8 additions & 8 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
using TSx
using TimeFrames
using Documenter

DocMeta.setdocmeta!(TSx, :DocTestSetup, :(using TSx, DataFrames, Dates, Statistics); recursive=true)
DocMeta.setdocmeta!(TimeFrames, :DocTestSetup, :(using TimeFrames, DataFrames, Dates, Statistics); recursive=true)

makedocs(;
modules=[TSx],
modules=[TimeFrames],
authors="xKDR Forum",
repo="https://github.com/xKDR/TSx.jl/blob/{commit}{path}#{line}",
sitename="TSx.jl",
repo="https://github.com/xKDR/TimeFrames.jl/blob/{commit}{path}#{line}",
sitename="TimeFrames.jl",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://xKDR.github.io/TSx.jl",
canonical="https://xKDR.github.io/TimeFrames.jl",
assets=String[],
),
pages=[
"Introduction" => "index.md",
"Basic demo of TSx" => "demo_finance.md",
"Basic demo of TimeFrames" => "demo_finance.md",
"User guide" => "user_guide.md",
"API reference" => "api.md",
],
Expand All @@ -24,7 +24,7 @@ makedocs(;
)

deploydocs(;
repo="github.com/xKDR/TSx.jl",
repo="github.com/xKDR/TimeFrames.jl",
devbranch="main",
target = "build",
)
8 changes: 4 additions & 4 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
```@meta
CurrentModule = TSx
CurrentModule = TimeFrames
```

# TSx API reference
# TimeFrames API reference

API reference of [TSx](https://github.com/xKDR/TSx.jl).
API reference of [TimeFrames](https://github.com/xKDR/TimeFrames.jl).

```@index
```

```@autodocs
Modules = [TSx]
Modules = [TimeFrames]
```
Loading