Clarification on Time Alignment for Taker Buy/Sell Volume Data

I am using the Binance API to fetch Taker Buy/Sell Volume data and noticed that the timestamps appear to be left-aligned (i.e., the timestamp represents the start of the interval). For example:

  • For 15-minute data, the timestamp 2023-10-01 00:00:00 represents the interval 00:00 - 00:15.
  • The Taker Buy/Sell Volume values correspond to this interval.

Could you please confirm if this is the intended behavior? Additionally, would it be possible to provide an option to fetch data with right-aligned timestamps (i.e., the timestamp represents the end of the interval)?

If you want the timestamp 2023-10-01 00:15:00 to represent data for 00:00 → 00:15,

You will need to manually shift the timestamp by +interval duration on your side.

How to Implement Right-Aligned Timestamps?

For each kline:

interval_seconds = 15 * 60 # for 15m

Shift timestamp

right_aligned_time = datetime.fromtimestamp(open_time / 1000) + timedelta(seconds=interval_seconds)

If you use Pandas:

df[‘right_aligned_time’] = df[‘open_time’] + pd.to_timedelta(interval, unit=‘m’)

Where:
open_time is the timestamp from the Binance response (in ms)

interval is your timeframe (e.g., 15 for 15m).