Coder Social home page Coder Social logo

dysonance / temporal.jl Goto Github PK

View Code? Open in Web Editor NEW
99.0 9.0 25.0 3.16 MB

Time series implementation for the Julia language focused on efficiency and flexibility

License: Other

Julia 100.00%
julia julia-language scientific-computing timeseries time-series econometrics finance time-series-analysis economics quantitative-finance quantitative-trading io data-structures data-analysis data-visualization

temporal.jl's Introduction

Build Status Coverage Status codecov.io

Temporal

This package provides a flexible & efficient time series class, TS, for the Julia programming language. While still early in development, the overarching goal is for the class to be able to slice & dice data with the rapid prototyping speed of R's xts and Python's pandas packages, while retaining the performance one expects from Julia.

See the documentation for a more in-depth look at the package and some of the pain points it may solve when doing technical research with time series data.

Below is a brief teaser with a minimal use case illustrating a small subset of features. This example also makes use of the Indicators.jl package, which provides a series of financial market technical analysis indicators with wrappers for the Temporal.TS type. Visualization is offered through the Plots.jl package, which Temporal leverages through RecipesBase.jl.

using Temporal, Plots, Indicators

crude = quandl("CHRIS/CME_CL1")
gasoline = quandl("CHRIS/CME_RB1")

prices = [crude["2012/2019", :Settle] gasoline["2012/2019", :Settle]]
prices.fields = [:Crude, :Gasoline]
prices = dropnan(prices)
daily_returns = diff(log(prices))
cumulative_returns = cumprod(1 + daily_returns)

spread = cumulative_returns[:,1] - cumulative_returns[:,2]
spread = [spread sma(spread, n=200)]
spread.fields = Symbol.(["Spread", "SMA (200)"])

gr()
ℓ = @layout[ a{0.7h}; b{0.3h} ]
plot(cumulative_returns, c=[:black :purple], layout=ℓ, subplot=1)
plot!(spread, c=[:blue :orange], layout=ℓ, subplot=2)

alt text

temporal.jl's People

Contributors

cmey avatar dysonance avatar femtotrader avatar fredrikekre avatar juliatagbot avatar maccam912 avatar moelf avatar staticfloat avatar zhubonan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

temporal.jl's Issues

Provide an example in doc with random values (instead of remote data)

Hello,

A very simple example with random value should probably be given in doc. Maybe something like this (to avoid to rely on remote data, but with a random seed to ensure reproducibility)

srand(1234)
idx=DateTime(2010,1,1):Dates.Hour(1):DateTime(2017,1,1)-Dates.Hour(1)
n = length(idx)
price=100+cumsum(2*(rand(n)-0.5))
volume=rand(n)*1000
ts = TS([price volume], collect(idx), [:price, :volume])

Kind regards

Downloading data produces a stack trace

Hello,

I get a stack trace when I run the following simple code:

using Temporal quandl("AAPL")

I am using v0.7 on Julia 1.4.2 on Windows 10. The stack trace is:
`julia> quandl("AAPL")
ERROR: HTTP.ExceptionRequest.StatusError(422, "GET", "/api/v3/datasets/AAPL.csv?&order=asc&collapse=daily&transform=none&api_key=", HTTP.Messages.Response:
"""
HTTP/1.1 422 Unprocessable Entity
Date: Thu, 16 Jul 2020 20:24:56 GMT
Content-Type: text/csv
Content-Length: 141
Connection: keep-alive
Set-Cookie: __cfduid=dd5b5b7f08e0ac20a7e37e8ed837cdf251594931094; expires=Sat, 15-Aug-20 20:24:54 GMT; path=/; domain=.quandl.com; HttpOnly; SameSite=Lax; Secure
Allow: GET, HEAD, POST, PUT, DELETE, OPTIONS, PATCH
Cache-Control: private
Content-Disposition: attachment; filename=errors.csv
Content-Transfer-Encoding: binary
Vary: Origin
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Rack-CORS: miss; no-origin
X-RateLimit-Limit: 50
X-RateLimit-Remaining: 49
X-Request-Id: a2cbe1dc-4b35-4625-901a-6666037b4049
X-Runtime: 0.004441
X-XSS-Protection: 1; mode=block
CF-Cache-Status: DYNAMIC
cf-request-id: 03fae63dbd00000a98cd231200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5b3e730f9a6f0a98-CEB

code,message
QECx05,The url you requested is incorrect. Please use the following url instead: /api/v3/datasets/:database_code/:dataset_code.
""")
Stacktrace:
[1] request(::Type{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}, ::HTTP.URIs.URI, ::Vararg{Any,N} where N; kw::Base.Iterators.Pairs{Symbol,Union{Nothing, Bool},Tuple{Symbol,Symbol},NamedTuple{(:iofunction, :reached_redirect_limit),Tuple{Nothing,Bool}}}) at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\ExceptionRequest.jl:22
[2] (::Base.var"#58#60"{Base.var"#58#59#61"{ExponentialBackOff,HTTP.RetryRequest.var"#2#3"{Bool,HTTP.Messages.Request},typeof(HTTP.request)}})(::Type{T} where T, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Symbol,Union{Nothing, Bool},Tuple{Symbol,Symbol},NamedTuple{(:iofunction, :reached_redirect_limit),Tuple{Nothing,Bool}}}) at .\error.jl:288
[3] #request#1 at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\RetryRequest.jl:44 [inlined]
[4] request(::Type{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}; http_version::VersionNumber, target::String, parent::Nothing, iofunction::Nothing, kw::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:reached_redirect_limit,),Tuple{Bool}}}) at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\MessageRequest.jl:51
[5] request(::Type{HTTP.BasicAuthRequest.BasicAuthLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}; kw::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:reached_redirect_limit,),Tuple{Bool}}}) at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\BasicAuthRequest.jl:28
[6] request(::Type{HTTP.RedirectRequest.RedirectLayer{HTTP.BasicAuthRequest.BasicAuthLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}; redirect_limit::Int64, forwardheaders::Bool, kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\RedirectRequest.jl:24
[7] request(::Type{HTTP.RedirectRequest.RedirectLayer{HTTP.BasicAuthRequest.BasicAuthLayer{HTTP.MessageRequest.MessageLayer{HTTP.RetryRequest.RetryLayer{HTTP.ExceptionRequest.ExceptionLayer{HTTP.ConnectionRequest.ConnectionPoolLayer{HTTP.StreamRequest.StreamLayer{Union{}}}}}}}}}, ::String, ::HTTP.URIs.URI, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}) at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\RedirectRequest.jl:21
[8] request(::String, ::String, ::Array{Pair{SubString{String},SubString{String}},1}, ::Array{UInt8,1}; headers::Array{Pair{SubString{String},SubString{String}},1}, body::Array{UInt8,1}, query::Nothing, kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\HTTP.jl:314
[9] request at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\HTTP.jl:314 [inlined] (repeats 2 times)
[10] #get#12 at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\HTTP.jl:391 [inlined]
[11] get at C:\Users\dkgur.julia\packages\HTTP\ZggHU\src\HTTP.jl:391 [inlined]
[12] quandl(::String; from::String, thru::String, freq::Char, calc::String, sort::Char, rows::Int64, auth::String) at C:\Users\dkgur.julia\packages\Temporal\aaVHO\src\data\quandl.jl:77
[13] quandl(::String) at C:\Users\dkgur.julia\packages\Temporal\aaVHO\src\data\quandl.jl:59
[14] top-level scope at REPL[10]:1`

The above stack trace was produced using the master branch, but they look very similar. Testing Tmporal from the package manager also produces 2 broken io tests even though my internet connection is working:
(@v1.4) pkg> test Temporal Testing Temporal Status C:\Users\dkgur\AppData\Local\Temp\jl_kH0qBq\Manifest.toml`
[cd3eb016] HTTP v0.8.16
[83e8ac13] IniFile v0.5.0
[682c06a0] JSON v0.21.0
[739be429] MbedTLS v1.0.2
[c8ffd9c3] MbedTLS_jll v2.16.6+1
[69de0a69] Parsers v1.0.7
[3cdcf5f2] RecipesBase v0.7.0
[a110ec8f] Temporal v0.7.0 #master (https://github.com/dysonance/Temporal.jl.git)
[2a0f44e3] Base64
[ade2ca70] Dates
[8ba89e20] Distributed
[b77e0a4c] InteractiveUtils
[76f85450] LibGit2
[8f399da3] Libdl
[37e2e46d] LinearAlgebra
[56ddb016] Logging
[d6f4376e] Markdown
[a63ad114] Mmap
[44cfe95a] Pkg
[de0858da] Printf
[3fa0cd96] REPL
[9a3f8284] Random
[ea8e919c] SHA
[9e88b42a] Serialization
[6462fe0b] Sockets
[2f01184e] SparseArrays
[10745b16] Statistics
[8dfed614] Test
[cf7118a7] UUIDs
[4ec0a83e] Unicode
252x4 TS{Float64,Date}: 2019-11-08 to 2020-07-16

Index A B C D
2019-11-08 0.8661 0.4502 0.9594 0.9521
2019-11-09 0.9948 0.9384 0.8096 0.9424
2019-11-10 0.3264 0.5326 0.2504 0.2482
2019-11-11 0.6428 0.6582 0.1355 0.933
2019-11-12 0.7978 0.0047 0.6722 0.5679
2019-11-13 0.5892 0.2168 0.0405 0.3032
2019-11-14 0.1981 0.6567 0.5017 0.9752
2019-11-15 0.7119 0.911 0.634 0.4111
2019-11-16 0.6058 0.2036 0.4646 0.9898
2019-11-17 0.0928 0.6436 0.1313 0.6184
2019-11-18 0.5315 0.9159 0.567 0.2534
2019-11-19 0.7706 0.3761 0.2601 0.5941
2019-11-20 0.4898 0.8794 0.5664 0.7599
2019-11-21 0.0851 0.2963 0.0035 0.0947
2019-11-22 0.5599 0.9097 0.9785 0.1205
2019-11-23 0.9376 0.272 0.4989 0.4511
2019-11-24 0.5303 0.6947 0.3957 0.6087
2019-11-25 0.2301 0.8582 0.3287 0.6649
2019-11-26 0.9735 0.9111 0.3314 0.8324
2019-11-27 0.8876 0.2737 0.6894 0.0207

2020-06-26 0.7617 0.3402 0.2275 0.872
2020-06-27 0.2454 0.1151 0.5005 0.671
2020-06-28 0.9098 0.7523 0.573 0.672
2020-06-29 0.9143 0.6959 0.3421 0.1491
2020-06-30 0.2511 0.6313 0.9313 0.14
2020-07-01 0.9774 0.3955 0.8392 0.0142
2020-07-02 0.0961 0.1851 0.2567 0.8728
2020-07-03 0.7827 0.5948 0.12 0.6628
2020-07-04 0.4327 0.0303 0.7383 0.628
2020-07-05 0.8772 0.462 0.9595 0.2959
2020-07-06 0.7684 0.5016 0.7627 0.4249
2020-07-07 0.9006 0.4791 0.7409 0.0413
2020-07-08 0.9629 0.7901 0.5071 0.9711
2020-07-09 0.1149 0.2433 0.9242 0.376
2020-07-10 0.7813 0.2351 0.2312 0.459
2020-07-11 0.4592 0.0172 0.0301 0.8592
2020-07-12 0.0127 0.0435 0.5869 0.0521
2020-07-13 0.4127 0.9581 0.0893 0.7118
2020-07-14 0.0711 0.9451 0.3769 0.862
2020-07-15 0.5912 0.5112 0.0936 0.7683
2020-07-16 0.6777 0.7085 0.7081 0.4689
1x4 TS{Float64,Date}: 2019-11-08 to 2019-11-08

Index A B C D
2019-11-08 0.8085 0.6463 0.739 0.1027

Test Summary: | Pass Total
Initialization | 1528 1528
Test Summary: | Pass Total
Rename | 15 15
Test Summary: | Pass Total
Subsetting | 83 83
Test Summary: | Pass Total
Mutating | 35 35
Test Summary: | Pass Total
Combining | 25 25
Test Summary: | Pass Total
Operations | 64 64
Test Summary: | Pass Total
Filtering | 16 16
Test Summary: | Pass Total
OHLC | 22 22
Test Summary: | Pass Total
Collapsing | 19 19
Test Summary: | Pass Total
Conversion | 6 6
Test Summary: | Pass Broken Total
Input/Output | 6 2 8
Testing Temporal tests passed
`
Thank you in advance for any help. I realise that this must be a problem unique to me as it has not been reported by anyone else and is a very simple example.

Why is the `namefix` needed when constructing a TS?

First of all - thanks for the great package!

I'm just starting with Julia so might be missing some obvious things. One thing that caught me off guard with TS is that the column names are sanitized into alphanumeric-only names. Why is this necessary?

I'd like to have my names with underscores and I haven't seen problems with those in other parts of the Julia ecosystem - can underscores be whitelisted?

`using Temporal; using Temporal` takes 13 times slower on Julia 1.2, Julia 1.3

here's tests on travis.

$ time julia -e '@info VERSION; using Temporal'
[ Info: 1.1.1
real	0m1.258s
user	0m1.170s
sys	0m0.204s

$ time julia -e '@info VERSION; using Temporal; using Temporal'
[ Info: 1.1.1
real	0m3.696s
user	0m3.576s
sys	0m0.228s

$ time julia -e '@info VERSION; using Temporal; using Temporal; using Temporal'
[ Info: 1.1.1
real	0m3.638s
user	0m3.508s
sys	0m0.245s
$ time julia -e '@info VERSION; using Temporal'
[ Info: 1.3.0-DEV.433
real	0m1.173s
user	0m1.036s
sys	0m0.253s

$ time julia -e '@info VERSION; using Temporal; using Temporal'
[ Info: 1.3.0-DEV.433
real	0m15.681s                      <=====================
user	0m15.503s
sys	0m0.292s

$ time julia -e '@info VERSION; using Temporal; using Temporal; using Temporal'
[ Info: 1.3.0-DEV.433
real	0m15.632s                     <=====================
user	0m15.476s
sys	0m0.268s

Yahoo API Bug

Running the following code doesn't work (using latest master on Julia v1.0.0).

using Temporal
prices = yahoo("AAPL", from="2010-01-01")

I am getting the following error message.

ERROR: LoadError: MethodError: no method matching cookies(::HTTP.Messages.Response)
Closest candidates are:
  cookies(::HTTP.Messages.Request) at /Users/jacob.amos/.julia/packages/HTTP/nUK4f/src/cookies.jl:316
Stacktrace:
 [1] yahoo_get_crumb() at /Users/jacob.amos/.julia/dev/Temporal/src/io.jl:279
 [2] (::getfield(Temporal, Symbol("#kw##yahoo")))(::NamedTuple{(:from,),Tuple{String}}, ::typeof(yahoo), ::String) at ./none:0
 [3] top-level scope at none:0
 [4] include at ./boot.jl:317 [inlined]
 [5] include_relative(::Module, ::String) at ./loading.jl:1038
 [6] include(::Module, ::String) at ./sysimg.jl:29
 [7] include(::String) at ./client.jl:388
 [8] top-level scope at none:0

It would appear that the HTTP package functionality has changed. Temporal should resolve this so that Yahoo data fetches can work again.

add plotting functionality!

It looks like Plots.jl now support precompilation. Since adding a Plots dependency would have kept Temporal from precompiling (the only reason that these features were not yet added), it could well now be time to implement plotting recipes.

(However, if it goes back to not precompiling, then Temporal would no longer precompile. This is something that should be watched very closely.)

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Google Finance data download API

Would be great to get a Google Finance API function working on here, especially since the recent hassle coming from the changes to the Yahoo Finance API.

Support DataStreams and/or IterableTables

DataStreams is a fast, generic framework for transferring table-like data structures in Julia
https://github.com/JuliaData/DataStreams.jl
http://juliadata.github.io/DataStreams.jl/stable/
https://www.youtube.com/watch?v=N39V6JMWazo

Implementing a TS.Sink will help to convert easily DataFrame (from DataFrames.jl) or any other supported DataStream Source (CSV, SQLite, ODBC...) to Temporal.TS.

Implementing a TS.Source will help to convert a Temporal.TS to any DataStream Sink (DataFrame, CSV, SQLite, ODBC...)

Error using Yahoo connector

First, I would like to thank you very much for this package.

Today started getting the following error message. After

using Temporal
a = yahoo("AAPL", from="2010-06-09", thru=string(Dates.today()), freq='w')

I get

connect: connection timed out (ETIMEDOUT)
in yieldto(::Task, ::ANY) at .\event.jl:136
in wait() at .\event.jl:169
in wait(::Condition) at .\event.jl:27
in stream_wait(::TCPSocket, ::Condition, ::Vararg{Condition,N}) at .\stream.jl:44
in wait_connected(::TCPSocket) at .\stream.jl:265
in connect at .\stream.jl:960 [inlined]
in connect(::IPv4, ::Int64) at .\socket.jl:677
in open_stream(::HttpCommon.Request, ::MbedTLS.SSLConfig, ::Float64, ::Nullable{URIParser.URI}, ::Nullable{URIParser.URI}) at C:\JuliaPro-0.5.0.5\pkgs-0.5.0.5\v0.5\Requests\src\streaming.jl:186
in #do_stream_request#23(::Dict{AbstractString,AbstractString}, ::Void, ::Void, ::Void, ::Array{Requests.FileParam,1}, ::Void, ::Dict{Any,Any}, ::Bool, ::Int64, ::Array{HttpCommon.Response,1}, ::MbedTLS.SSLConfig, ::Bool, ::Bool, ::Bool, ::Nullable{URIParser.URI}, ::Nullable{URIParser.URI}, ::Requests.#do_stream_request, ::URIParser.URI, ::String) at C:\JuliaPro-0.5.0.5\pkgs-0.5.0.5\v0.5\Requests\src\Requests.jl:381
in do_stream_request(::URIParser.URI, ::String) at C:\JuliaPro-0.5.0.5\pkgs-0.5.0.5\v0.5\Requests\src\Requests.jl:344
in #do_request#22(::Array{Any,1}, ::Function, ::URIParser.URI, ::String) at C:\JuliaPro-0.5.0.5\pkgs-0.5.0.5\v0.5\Requests\src\Requests.jl:311
in #get#29(::Array{Any,1}, ::Function, ::URIParser.URI) at C:\JuliaPro-0.5.0.5\pkgs-0.5.0.5\v0.5\Requests\src\Requests.jl:444
in #get#28(::Array{Any,1}, ::Function, ::String) at C:\JuliaPro-0.5.0.5\pkgs-0.5.0.5\v0.5\Requests\src\Requests.jl:443
in #yahoo#64(::String, ::String, ::Char, ::Function, ::String) at C:\JuliaPro-0.5.0.5\pkgs-0.5.0.5\v0.5\Temporal\src\io.jl:291
in (::Temporal.#kw##yahoo)(::Array{Any,1}, ::Temporal.#yahoo, ::String) at .\<missing>:0

Modify column name of "Adj Close"

Hello,

right now it does not seems possible to plot the column"Adj Close" because of the whitespace. Adj Close should be renamed to perhaps "Adj_Close" so that we can plot it with

plot(data[:Adj_Close])

Reply

Hello Jacob,

Sorry, I can't reach you through LinkedIn or Twitter for the simple reason that I don't use those services.

The project has nothing to do with Julia or Temporal.jl. I have already a python program which is able to deal with the full market depth and create features for a classification model (HFT). I need to extend that code to add more relevant features.

I would be interested in hiring you. Let me know if you can help.

My email is gauthier.jeremie.1(at)gmail.com.

Jeremie Gauthier

Can not install "Temporal.jl" with latest "Plots(v1.6.4)" and "RecipesBase" !

Can not install "Temporal.jl" with latest "Plots(v1.6.4)" and "RecipesBase" !

Pkg.add("Temporal")

My versioninfo()
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: AMD Ryzen 5 3600X 6-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, znver2)
Environment:
JULIA.EXECUTABLEPATH = C:\Users\USER\AppData\Local\Julia-1.3.1\bin\ & set JULIA_NUM_THREADS=12 & julia.exe
JULIA_NUM_THREADS = 12

The return message as below:
Resolving package versions...
Unsatisfiable requirements detected for package Plots [91a5bcdd]:
Plots [91a5bcdd] log:
├─possible versions are: [0.12.1-0.12.4, 0.13.0-0.13.1, 0.14.0-0.14.2, 0.15.0-0.15.1, 0.16.0, 0.17.0-0.17.4, 0.18.0, 0.19.0-0.19.3, 0.20.0-0.20.6, 0.21.0, 0.22.0-0.22.5, 0.23.0-0.23.2, 0.24.0, 0.25.0-0.25.3, 0.26.0-0.26.3, 0.27.0-0.27.1, 0.28.0-0.28.4, 0.29.0-0.29.9, 1.0.0-1.0.14, 1.1.0-1.1.4, 1.2.0-1.2.6, 1.3.0-1.3.7, 1.4.0-1.4.4, 1.5.0-1.5.9, 1.6.0-1.6.4] or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions [0.12.1-0.12.4, 0.13.0-0.13.1, 0.14.0-0.14.2, 0.15.0-0.15.1, 0.16.0, 0.17.0-0.17.4, 0.18.0, 0.19.0-0.19.3, 0.20.0-0.20.6, 0.21.0, 0.22.0-0.22.5, 0.23.0-0.23.2, 0.24.0, 0.25.0-0.25.3, 0.26.0-0.26.3, 0.27.0-0.27.1, 0.28.0-0.28.4, 0.29.0-0.29.9, 1.0.0-1.0.14, 1.1.0-1.1.4, 1.2.0-1.2.6, 1.3.0-1.3.7, 1.4.0-1.4.4, 1.5.0-1.5.9, 1.6.0-1.6.4]
├─restricted by compatibility requirements with FixedPointNumbers [53c48c17] to versions: [0.29.0-0.29.9, 1.0.0-1.0.14, 1.1.0-1.1.4, 1.2.0-1.2.6, 1.3.0-1.3.7, 1.4.0-1.4.4, 1.5.0-1.5.9, 1.6.0-1.6.4] or uninstalled, leaving only versions: [0.29.0-0.29.9, 1.0.0-1.0.14, 1.1.0-1.1.4, 1.2.0-1.2.6, 1.3.0-1.3.7, 1.4.0-1.4.4, 1.5.0-1.5.9, 1.6.0-1.6.4]
│ └─FixedPointNumbers [53c48c17] log:

rename columns name using a (or several) Pair of Symbol or a Function (Symbol -> Symbol)

Hello,

A rename! function which rename several columns name using a Dict of Symbols or a column name using 2 Symbols (from_name, to_name) or a Pair of Symbol could probably be an interesting feature to have

See #20 (comment)

Kind regards

PS :

Such a rename! function could be implemented like this:

function rename!(data::TS, d::Dict{Symbol, Symbol})
    flag = false
    for (i, field) in enumerate(data.fields)
        if field in keys(d)
            data.fields[i] = d[field]
            flag = true
        end
    end
    flag
end

rename! could also accept Pair{Symbol, Symbol} or 2 symbols as parameter

function rename!(data::TS, from_name::Symbol, to_name::Symbol)
    rename!(data, Dict(from_name=>to_name))
end

function rename!(data::TS, p::Pair{Symbol, Symbol})
    rename!(data, Dict(p))
end

Construct TS from NamedTuple

Hello,

DataFrame from DataFrames.jl can be construct from NamedTuple

julia> using Dates

julia> using DataFrames

julia> data = (time=[DateTime(2018, 11, 21, 12, 0), DateTime(2018, 11, 21, 13, 0)], col1=[10.2, 11.2], col2=[20.2, 21.2])
(time = DateTime[2018-11-21T12:00:00, 2018-11-21T13:00:00], col1 = [10.2, 11.2], col2 = [20.2, 21.2])

julia> DataFrame(data)
2×3 DataFrame
│ Row │ time                │ col1    │ col2    │
│     │ DateTime            │ Float64 │ Float64 │
├─────┼─────────────────────┼─────────┼─────────┤
│ 12018-11-21T12:00:0010.220.2    │
│ 22018-11-21T13:00:0011.221.2

It will be nice if Temporal.TS could also be constructed like this.

julia> using Temporal

julia> TS(data)

maybe passing name of datetime column should be considered (as a Symbol).

julia> TS(data, index=:time)

LibPQ uses this kind of mechanism
https://invenia.github.io/LibPQ.jl/latest/index.html

Kind regards

PS : similar to JuliaStats/TimeSeries.jl#394

rename columns name using a function

Following #20 (comment)

A rename! function implementation could also accept a function as 2nd parameter which could rename column name in place.

Something like

rename!(data, c->replace(c, " ", ""))

Although TS column names are Symbol... not String so it will become

rename!(data, c->Symbol(replace(String(c), " ", "")))

but I'd prefer the Symbol/String complexity be hidden.

Update HTTP version

Current version of Temporal.jl uses HTTP 0.8. Current version of HTTP is 0.9, so usage of Temporal.jl is degrading all other packages. Can we bump HTTP to 0.9?

Better doc

Following #12 (comment)
porting documentation to Documenter.jl may be considered
A second step could be to improve doc and work on better docstrings, and maybe doctests

Request

Hello Mr. Amos,

My name is Jeremie Gauthier. I am working in the field of high-frequency trading with 2 Ph.D students in machine learning. (Sorry, I didn't find another way to communicate with you)

I have already created a python program which is able to reformat the full market depth into the limit order book (i.e. bid, ask, limit, market and cancellation orders) with a certain time window. I am now interested in extending that code in order to get more relevant data to feed a classification model.

My attention is focused on the following article: https://arxiv.org/pdf/1810.10845.pdf

Can you help? The project is roughly programming in python.

Last row of TS is not displayed

Hello,

Last row of TS is not displayed.

Here is an example inspired from README to show issue (fixing also some depreciation warnings)

using Test
using Temporal
using Dates
using Random


N, K = (2, 4);

Random.seed!(1);

v = rand(N, K);

t = today()-Day(N-1):Day(1):today();

f = [:A, :B, :C, :D];

X = TS(v, t, f)

println(X)

@test size(X) == (N, K)

Here is output:

2x4 TS{Float64,Date}: 2018-11-20 to 2018-11-21

Index       A       B       C       D
2018-11-20  0.236   0.3127  0.4886  0.9519

Kind regards

Enhanced missing values support

Latest version of Julia comes with native support for missing values. See here.

Temporal should now support these values. This would probably also be a good time to move the focus of development over to version 0.7/master, as this is likely going to be the version closest to what 1.0 looks like when it comes out.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.