Skip to content

Commit

Permalink
Merge pull request #119 from codetalker7/change-package-name
Browse files Browse the repository at this point in the history
Changing package name to `TSFrames`.
  • Loading branch information
chiraganand authored Nov 11, 2022
2 parents abe2132 + a234c5e commit d476907
Show file tree
Hide file tree
Showing 48 changed files with 800 additions and 800 deletions.
36 changes: 18 additions & 18 deletions Benchmark.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TimeFrames Benchmarks
# TSFrames Benchmarks

```
import .TimeFrames
import .TSFrames
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 a TimeFrame object from DataFrame
## Creating a TSFrame object from DataFrame
```
@benchmark TimeFrames.TimeFrame(data) setup=(data = df)
@benchmark TSFrames.TSFrame(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 TimeFrames.apply(data, Month, mean,[:Open, :Close]) setup=(data=ts)
@benchmark TSFrames.apply(data, Month, mean,[:Open, :Close]) setup=(data=ts)
```

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

```
@benchmark TimeFrames.apply(data, Year, sum,[:Low, :Close]) setup=(data=ts)
@benchmark TSFrames.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 TimeFrames.lag(data,2) setup=(data = ts)
@benchmark TSFrames.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 TimeFrames.diff(data,1) setup=(data = ts)
@benchmark TSFrames.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 TimeFrames.pctchange(data,1) setup=(data = ts)
@benchmark TSFrames.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 TimeFrames.computelogreturns(data[1:500,2]) setup = (data = ts)
@benchmark TSFrames.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 TimeFrames.rollapply(mean, data, 3, 5) setup = (data = ts)
@benchmark TSFrames.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 = TimeFrames.TimeFrame(df2)
ts2 = TSFrames.TSFrame(df2)
```
### Left Join

```
@benchmark TimeFrames.leftjoin(ts,ts2)
@benchmark TSFrames.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 = TimeFrames.TimeFrame(df2)
### Right Join

```
@benchmark TimeFrames.rightjoin(ts,ts2)
@benchmark TSFrames.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 = TimeFrames.TimeFrame(df2)
### Inner Join

```
@benchmark TimeFrames.innerjoin(ts,ts2)
@benchmark TSFrames.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 = TimeFrames.TimeFrame(df2)
### Outer Join

```
@benchmark TimeFrames.outerjoin(ts,ts2)
@benchmark TSFrames.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 = TimeFrames.TimeFrame(df2)
```
df3 = df[1:300,[:timestamp,:Open,:High,:Low,:Close]]
df4 = df[300:end,[:timestamp,:Open,:High,:Low,:Close]]
ts3 = TimeFrames.TimeFrame(df3)
ts4 = TimeFrames.TimeFrame(df4)
ts3 = TSFrames.TSFrame(df3)
ts4 = TSFrames.TSFrame(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 = "TimeFrames"
name = "TSFrames"
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 @@
# TimeFrames.jl
# TSFrames.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)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://xKDR.github.io/TSFrames.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://xKDR.github.io/TSFrames.jl/dev)
![Build Status](https://github.com/xKDR/TSFrames.jl/actions/workflows/documentation.yml/badge.svg)
[![codecov](https://codecov.io/gh/xKDR/TSFrames.jl/branch/main/graph/badge.svg?token=9qkJUtdgrz)](https://codecov.io/gh/xKDR/TSFrames.jl)

TimeFrames is a Julia package to handle timeseries data. It provides a
TSFrames is a Julia package to handle timeseries data. It provides a
convenient interface for the commonly used timeseries data
manipulations. TimeFrames is built on top of the powerful and mature
manipulations. TSFrames 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 TimeFrames
## Installing TSFrames

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

## Basic usage

### 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.
### Creating TSFrame objects
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, TimeFrames
julia> using CSV, Dates, DataFrames, TSFrames

julia> ts = CSV.read("IBM.csv", TimeFrame)
(252 x 6) TimeFrame with Dates.Date Index
julia> ts = CSV.read("IBM.csv", TSFrame)
(252 x 6) TSFrame 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", TimeFrame)
233 rows omitted
```

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.
As another example of this, consider the following code, which converts a `TimeArray` object to a `TSFrame` 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 TimeFrames, MarketData;
julia> using TSFrames, MarketData;

julia> TimeFrame(MarketData.yahoo(:AAPL))
10550×6 TimeFrame with Date Index
julia> TSFrame(MarketData.yahoo(:AAPL))
10550×6 TSFrame 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> TimeFrame(MarketData.yahoo(:AAPL))
### Indexing
```julia
julia> ts[1:10, [:Close]]
(10 x 1) TimeFrame with Dates.Date Index
(10 x 1) TSFrame 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> TimeFrames.subset(ts, from, to)
(24 x 6) TimeFrame with Date Index
julia> TSFrames.subset(ts, from, to)
(24 x 6) TSFrame 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> TimeFrames.subset(ts, from, to)
```julia
julia> ep = endpoints(ts, Week(1));
julia> ts_weekly = ts[ep]
(52 x 6) TimeFrame with Date Index
(52 x 6) TSFrame 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 TimeFrames [user guide](https://xkdr.github.io/TimeFrames.jl/dev/user_guide/) for more
Head to the TSFrames [user guide](https://xkdr.github.io/TSFrames.jl/dev/user_guide/) for more
examples and functionality. The API reference is available on the
[documentation](https://xkdr.github.io/TimeFrames.jl/dev/api/) page.
[documentation](https://xkdr.github.io/TSFrames.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"
TimeFrames = "9f90e835-9451-4aaa-bcb1-743a1b8d2f84"
TSFrames = "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 TimeFrames
using TSFrames
using Documenter

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

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

deploydocs(;
repo="github.com/xKDR/TimeFrames.jl",
repo="github.com/xKDR/TSFrames.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 = TimeFrames
CurrentModule = TSFrames
```

# TimeFrames API reference
# TSFrames API reference

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

```@index
```

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

0 comments on commit d476907

Please sign in to comment.