tanmaykm / JuliaTS.jl

Other
1 stars 2 forks source link

Resampling timeseries #9

Open femtotrader opened 7 years ago

femtotrader commented 7 years ago

Hello,

Resampling timeseries will be a great feature to have. Ideally API should provide the concept of DateTimeOffset or TimeFrame (timeframe could be yearly, monthly, weekly, daily, hourly, minutely... or a multiple of)

See an analog question with TimeSeries.jl https://github.com/JuliaStats/TimeSeries.jl/issues/257

Kind regards

femtotrader commented 7 years ago

an example API design could be

Define a timeframe

tf = Yearly(5, boundary=End)

or

tf = Yearly(5, boundary=Begin)

Downscaling using mean values

mean(resample(ta, tf))

Downscaling using OHLC values

ohlc(resample(ta, tf)

which use internally

downscaling using

min(resample(ta, tf)
max(resample(ta, tf)
first(resample(ta, tf)
last(resample(ta, tf)

Downscaling using sum might also be required (to sum volume for example in OHLCV data)

sum(resample(ta, tf)

resample function need to return an object let's call it TArraySampler on which mean, ohlc, min, max, first, last... this is lazy evaluation and behave like Pandas new resample API

femtotrader commented 7 years ago

I've post an example of this API usage with TimeSeries.jl (but a similar approach could be done with JuliaTS) http://stackoverflow.com/questions/20816813/resampling-a-dataframe-to-hourly-15min-and-5min-periods-in-julia/40444762#40444762

Maybe we should have a shared package (let's call it TimeFrames.jl) to define timeframes.

So timeframes could be used both for JuliaTS and TimeSeries.jl (and maybe some other packages)

What is your opinion @tanmaykm @milktrader @JeffBezanson ?

femtotrader commented 7 years ago

TimeFrames.jl created https://github.com/femtotrader/TimeFrames.jl

tanmaykm commented 7 years ago

@femtotrader Sorry, I am unable to actively participate at the moment because of other involvements. I shall add you (and others if they wish) as a collaborator to JuliaTS so that I am not the bottleneck. Thanks for your initiatives!

femtotrader commented 7 years ago

Thanks @tanmaykm for this

I want to first work on TimeSeries.jl resampling as it seems to be a in a more stable state for now than JuliaTS.jl

but I'm definitely interested in working on JuliaTS when it will we work with latest IndexedTables

tanmaykm commented 7 years ago

Sure! I can take a look at this in a few weeks.