Download / UniversePeriods schema
Layout
One row per listing: a pair listed without interruption is one row, a pair delisted and listed again has two, with a gap in between. listed_from is the first hour the pair was tradable, listed_until the end of the last one (exclusive), null while the pair is still listed.
| base | quote | listed_from | listed_until |
|---|
| BTC | USDT | 2017-08-17T04:00:00Z | null |
| LUNC | USDT | 2020-08-21T10:00:00Z | 2022-05-13T01:00:00Z |
| LUNC | USDT | 2022-09-09T08:00:00Z | null |
Use it to get the universe at any moment, or to join it to your own data by time range. It is the most compact and exact form: a few thousand rows for an exchange's whole history, with no interval to pick.
Plain columns, no index. listed_until is null for a pair still listed, so test it before comparing.
pandas
Filter on listed_from and listed_until to get the pairs listed at a given moment.
import pandas as pd
periods = pd.read_parquet("universe_binance_usdt_periods.parquet")
# The universe at one point in time
at = pd.Timestamp("2022-05-01", tz="UTC")
universe = periods[(periods["listed_from"] <= at) & (periods["listed_until"].isna() | (periods["listed_until"] > at))]
Polars
The same filter, with is_null() for the periods still open.
from datetime import datetime, timezone
import polars as pl
periods = pl.read_parquet("universe_binance_usdt_periods.parquet")
# The universe at one point in time
at = datetime(2022, 5, 1, tzinfo=timezone.utc)
universe = periods.filter(
(pl.col("listed_from") <= at)
& (pl.col("listed_until").is_null() | (pl.col("listed_until") > at))
)
Polars (lazy)
scan_parquet reads nothing yet: it only builds a query. Chain your operations on it, then call collect() last to run the whole query and load the result.
import polars as pl
lf = pl.scan_parquet("universe_binance_usdt_periods.parquet")
# Nothing is read yet: e.g. every pair delisted, with how long it was listed
delisted = (
lf.filter(pl.col("listed_until").is_not_null())
.with_columns((pl.col("listed_until") - pl.col("listed_from")).alias("listed_for"))
.collect()
)