Tick Time Series dedicated functions

backward

Shift all values to previous time.
Last time and first value are lost.

(backward timeserie)

parameter

timeserie: input timeserie

clockref

Define the timeserie as a clock reference, or metronome.
For any operation between several timeseries there will be one update for output if there is one update for the clockref serie.
This synchronization mode ensure that length of output timeserie is <= to clockref timeserie.

(clockref timeserie)

parameter

timeserie: timeserie than will become the reference for time

delta

Returns timeserie where each point is the current value minus previous value of the input timeserie.
So result length is input length-1, and first output point time is time of second input point time.

(delta timeserie)

parameter

timeserie: input timeserie

forward

Shift all values to next time.
First time and last value are lost.

(forward timeserie)

parameter

timeserie: input timeserie

graphsample

Subsample timeserie in order to minimize number of points but to keep same result on screen.
This is useful to get a smaller timeserie that will be drawn like the full timeserie if your output screen is nbr pixel width.
As graphsample process on a stream it can't know the future so sends lots of points at the beginning then less and less.

(graphsample nbr timeserie)

parameters

nbr: should be the number of pixels of the graph you will create with timeserie.

timeserie: input timeserie

example

show all S&P E-Mini future bid prices not null on a Full HD screen (more than 2 million points)

merge

Merge several timeseries into one, synchronize points from all timeseries.

(merge timeserie1 timeserie2 ...)

parameters

timeserie1: first input timeserie

timeserie2: second input timeserie

...: as many timeseries as you want

now

Retrieve current time

(now)

example

trade prices since 00h00 UTC until now for Bitcoin from Bitstamp

(timeserie @trade-price "bitstamp""BTC" (now))

one

Replace value of every update by 1.0 .

(one timeserie)

parameter

timeserie: input timeserie

prune

Filter points in timeserie where value doesn't change.

(prune timeserie)

parameter

timeserie: input timeserie

restrict

Only keep timeserie points in [start, stop[.
If no timezone is given with start or stop it will be "local" to timeserie timezone.

(restrict timeserie start stop)

parameters

timeserie: input timeserie

start: a time with or without date

stop: a time with or without date

sigma

Returns a timeserie where each point is the summation of all previous points in the input timeserie.

(sigma timeserie)

parameter

timeserie: input timeserie

example

Compute full volume traded during the day at any time.

(sigma (timeserie @trade-volume "rnd""STRIGI.PA"2017-10-18))

sign

Replace value of every update by its sign:

value < 0 → -1

value == 0 → 0

value > 0 → 1

(sign timeserie)

parameter

timeserie: input timeserie

sliding

Replace each update by the specified value from the sliding window.
Typical usage is a moving average.

(sliding period|int samplemode timeserie)

parameters

period|int: a duration or an int, defines the window size in time or in number of updates

samplemode: how to choose point to keep, can be open, high, low, close, sum, count

timeserie: input timeserie

examples

Average weighted by number of updates, like Bollinger Band base.
Here the average is done on 1000 updates or on a 2h window.
Using a period instead of a number of updates allows to extend Bollinger bands to high frequency data.

subsample

Keep only one point per period from input timeserie, samplemode defines which point to keep.
Each value is taken in the range [i * period, (i+1) * period[, each time value is the time of original point.