For quants
Order flow112
L1 & L2 order book76
Derivatives32
flow.flow_toxicity_scorePro
Past-normalized signed notional flow multiplied by past-normalized short-horizon realized volatility
Machine learning
219
of the 220 features stream live over WebSocket with the names and units you trained on. Streaming comes with a Live plan.
Order-flow and book imbalance across 5 to 25 levels, flow toxicity, trade-size buckets, run persistence, impact, funding and basis: the inputs short-horizon models are built on, one row per bar.
REST history and the WebSocket stream emit identical column names and units on every bar size from 1m to 1d, so the vector you trained on is the vector you predict on.
Train on timestamp="true" bars, which hold only what was observable at the close, the same information a live bar carries when it is published.
# pip install "aperiodic[pandas,stream]" scikit-learn
from datetime import date
import pandas as pd
from aperiodic import get_metrics, get_ohlcv, stream
from sklearn.linear_model import Ridge
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
X = ["volume_delta_notional", "taker_buy_sell_ratio", "flow_toxicity_score"]
bars = dict(exchange="binance-futures", symbol="perpetual-BTC-USDT:USDT",
interval="1h", timestamp="true", output="pandas",
start_date=date(2026, 7, 1), end_date=date(2026, 9, 30))
# Research: fit on point-in-time history
x = get_metrics(metric="flow", **bars).set_index("time")[X]
y = get_ohlcv(**bars).set_index("time")["close"].pct_change().shift(-1)
train = x.join(y.rename("y")).dropna()
model = make_pipeline(StandardScaler(), Ridge()).fit(train[X], train["y"])
# Live: the same columns, one row per closed bar
for msg in stream(dataset="flow", exchange="binance-futures", interval="1h",
symbols=[bars["symbol"]]):
print(msg.data["time"], model.predict(pd.DataFrame([msg.data])[X])[0])Feature set
| Feature | Measures | Plan |
|---|---|---|
| flow.volume_deltaBuy-side traded quantity minus sell-side traded quantity | ||
| l2_imbalance.imbalance_5Last top-5 bid quantity minus top-5 ask quantity | ||
| derivative_price.last_priceLast traded price observed in the interval | ||
| trade_size.large_order_volumeTotal traded notional from large trades of at least $1,000 | ||
| l2_liquidity.ask_agg_10Last total ask quantity across the top 10 levels | ||
| basis.basisLast mark price minus index price in the interval | ||
| updownticks.uptick_volumeTotal traded quantity on upticks | ||
| l1_liquidity.spread_bpsLast bid-ask spread in basis points of the midprice | ||
| ohlcv.openFirst trade price in the interval | ||
| slippage.slippage_bps_meanAverage slippage in basis points versus the prevailing quote | ||
| l1_price.midpriceMidpoint between the last best bid and ask prices | ||
| open_interest.open_interestLast open interest value in the interval |
Training sets
Workflow
One call per dataset returns a DataFrame keyed on bar open time: flow, l2_imbalance and funding here.
Concatenate on the time index and forward-fill the sparse series. Every column shares the bar grid, so there is no as-of join to get wrong.
The next-bar return from the same bars. Shift the label, never the features.
Spearman rank IC per feature and asset, averaged. Then walk forward, with a purge gap of one label horizon between train and test folds.
# pip install "aperiodic[pandas]", then export APERIODIC_API_KEY=...
from datetime import date
import pandas as pd
from aperiodic import get_derivative_metrics, get_metrics, get_ohlcv
bars = dict(exchange="binance-futures", interval="1h", timestamp="true",
start_date=date(2026, 7, 1), end_date=date(2026, 9, 30),
output="pandas", show_progress=False)
def features(symbol: str) -> pd.DataFrame:
def get(fetch, metric):
return fetch(metric=metric, symbol=symbol, **bars).set_index("time")
x = pd.concat([get(get_metrics, "flow"),
get(get_metrics, "l2_imbalance"),
get(get_derivative_metrics, "funding")], axis=1)
x = x.select_dtypes("number").ffill() # funding updates sparsely
close = get_ohlcv(symbol=symbol, **bars).set_index("time")["close"]
x["fwd_ret"] = close.pct_change().shift(-1) # label: next-bar return
return x
panel = pd.concat({coin: features(f"perpetual-{coin}-USDT:USDT")
for coin in ("BTC", "ETH", "SOL")}, names=["asset", "time"])
# Time-series rank IC: Spearman corr of each feature with the next-bar return
ic = (panel.groupby(level="asset").corr(method="spearman")["fwd_ret"]
.unstack("asset").drop("fwd_ret"))
print(ic.mean(axis=1).sort_values(key=abs).tail(10))Research
alpha-discovery.py
A grid search over features, rolling-rank windows and smoothing. Each candidate gets a direction from its correlation with the next-bar return and a cost-aware long/short backtest, ranked by Sharpe with decile returns and robustness across windows.
Open notebook →most-predictive.py
L2 book imbalance at 5, 10, 20 and 25 levels, turned into percentile-rank signals and backtested on 5m BTC bars.
Open notebook →Prime + Raw adds the inputs behind the features: every trade, top-of-book quotes, mark and index price and funding, as parquet on the same symbols and timestamps. Full-depth L2 books are not for sale.
See the raw datasetsFAQ
Terms in plain English on the licensing page.
Agents
Act as my quant research assistant. Train a machine learning model that predicts the next-bar return of crypto perpetuals from Aperiodic's point-in-time microstructure features (docs: https://aperiodic.io/start.md).
1. Install the Python client with pip install "aperiodic[pandas]" and read my key from the APERIODIC_API_KEY environment variable.
2. For BTC, ETH and SOL on binance-futures (symbols like perpetual-BTC-USDT:USDT), fetch 1h bars from 2026-07-01 to 2026-09-30 with timestamp="true" and output="pandas": the flow, l2_imbalance and trade_size metrics with get_metrics, funding and basis with get_derivative_metrics, and close prices with get_ohlcv.
3. Join everything on the bar time into one asset × time panel, forward-fill the sparse series only, and label each row with the next-bar return. Shift the label, never the features.
4. Train a LightGBM regressor with walk-forward cross-validation and a purge gap of one label horizon between train and test folds. Compare it to a ridge baseline.
5. Report out-of-sample rank IC per fold and per asset, the top 15 features by importance, and a cost-aware long/short backtest of the predictions at 5 bps per side.
Explain each step briefly and keep the code in one runnable script. Tell me what to change to run it on more symbols and longer history once I upgrade.Every metric for Q3 2026 on BTC, ETH, SOL and 10 RWA perps, free. Upgrade for the full universe, history and bar sizes.
Shown: minute lows of the 465 Binance perpetuals, 20:40–22:00 UTC on 10 Oct 2025, with BTC’s path traced · built with ohlcv 1m