Time buckets

Time window presentation.

class tradingstrategy.timebucket.TimeBucket

Supported time windows for candle and liquidity data.

We use term “bucket”, from the TimescaleDB slang to symbol the time window of a candle data we are querying.

The raw blockchain data is assembled to 1 minute time buckets. Then the 1 minute timebuckets are resampled to other windows.

All time windows are in UTC. Daily time buckets have their hour, minute and second set to the zero in the outputted data. Hourly time buckets have minute and hour set to zero, etc.

Python labels are reserved from the actual values, because Python symbol cannot start with a number.

m1 = '1m'

One minute candles

m5 = '5m'

Five minute candles

m15 = '15m'

Quarter candles

h1 = '1h'

Hourly candles

h4 = '4h'

Four hour candles

d1 = '1d'

Daily candles

d7 = '7d'

Weekly candles

d30 = '30d'

Monthly candles

to_timedelta() datetime.timedelta

Get delta object for a TimeBucket definition.

You can use this to construct arbitrary timespans or iterate candle data.

to_frequency() pandas._libs.tslibs.offsets.DateOffset

Get frequncy input for Pandas fuctions.

You can use this to construct arbitrary timespans or iterate candle data.