crypto trained
The learned layer of the crypto guru: price is flows through a fragmented, levered venue graph: research, not financial advice, on public read-only data only.
mental model
BTC price is the clearing price of flows through a fragmented, levered, 24/7 venue graph. It is not the output of fundamentals.
- Slow layer (months to years): supply schedule and miner economics, holder cost basis (realized cap, MVRV), stablecoin and ETF rails, and the global liquidity and risk regime. This layer sets the regime; the
market-mechanicsguide owns it in depth. - Fast layer (minutes to days): perp leverage (OI, funding, basis), order book depth, and forced flows (liquidations, margin calls, redemptions). This layer sets the path and nearly all tail days, and
market-mechanicscovers it in the same depth. - Narrative is the story told after the fact. Treat it as a hypothesis that must be linked to flows, never as the explanation itself.
- The measurement is the product: fake volume, venue quirks, timestamp units, and revisions decide whether a "signal" exists.
The working method is the reasoning-framework guide: explain the move, judge the signal, verify the mechanism.
examples
The market-lab examples run all of this end to end and are verified. The minimal leak-free funding join below was verified:
fr = funding()["rate"] # time floored to hour: fundingTime has +1ms jitterdaily = fr.resample("1D").mean() # 3 prints per day at 00/08/16 UTCfwd7 = np.log(px).shift(-7) - np.log(px) # forward, so it is the target, never a feature# overlap-aware: Newey-West with maxlags >= horizonsm.OLS(fwd7, sm.add_constant(z)).fit(cov_type="HAC", cov_kwds={"maxlags": 7})
The epoch fix for data.binance.vision: ts // 1000 if ts > 1e14 else ts, then unit="ms" (the to_utc helper).
best practices
- Explain moves in sigma units and in UTC minutes before you tell a story (framework A of
reasoning-framework). - Treat funding, basis, and OI as crash-risk and positioning variables, not as direction signals. This agrees with BIS WP 1087 and with H1 below.
- Always test the reverse direction and the base rate, and count independent episodes.
- Use data.binance.vision for bulk history (no rate limit, reproducible files) and REST only for the recent tail, as the binance public data readme recommends.
- Pin every claim to a venue, a sample window, and an access date. For features and models, route to feature-engineering, ml, and xgboost. For storage and pipelines, route to olap and data-pipeline.
strengths
- The data is unusually open. Full tick and kline history, funding, and 5-minute OI metrics come free from Binance. On-chain data is public. There is a free Coin Metrics community tier.
- Leverage mechanics are exchange-documented formulas, so a cascade can be verified minute by minute (H2).
- 24/7 trading gives a large number of observations for microstructure work.
weaknesses / pain points
- Cycle-level questions (halvings, MVRV bands) have n≈3-5. No statistics can rescue them.
- Regimes shift. Funding's predictive IC decayed toward zero, and macro correlation rose after 2020.
- Vendor on-chain metrics (LTH, SOPR, exchange flows) depend on proprietary attribution that gets revised. Glassnode definitions were not opened here.
- The best causal data (liquidation feeds, order book depth history, ETF flows by the hour) is paid or real-time only. Binance has no historical liquidation dump for USD-M:
liquidationSnapshotreturned 404 for BTCUSDT.
gotchas
- data.binance.vision spot timestamps are microseconds from 2025-01-01 (
1760140800000000, 16 digits). Futures files are still ms. A mixed concat silently lands spot data in the year 57,000 or produces NaT. - Spot vision CSVs have no header row, futures vision CSVs do. Reading both with the same
header=drops a row or turns the header into data. - Funding
fundingTimehas ms jitter (1790496000001). An exact join on the 8h grid misses rows, so floor to the hour. startTime=0on/fapi/v1/fundingRatereturned only the latest page (500 rows, from 2026-04). A naive paginator "finishes" with 5 months of data and no error. Start from the perp launch (2019-09-10). The docs say the default without time params is the latest records.- Funding is clamped. 23.4% of days sit exactly at 0.01%/8h (the interest-rate default, Binance FAQ).
pd.qcutfails on duplicate edges, so rank first. Funding can also switch to hourly in stress, so check interval counts. - Levels correlate spuriously. Stablecoin supply vs price shows +0.85 in levels. The prediction is +0.14 and not significant.
- Naive p-values on overlapping windows lie. 7d funding IC: naive p = 0.017, Newey-West t = -0.93.
- BTC's daily close (00:00 UTC) is asynchronous with the US equity close. Daily correlations are understated, and weekend BTC moves land on Monday equity rows.
- "Active addresses" are not users, and "exchange outflows" include custody and ETF reshuffles. Treat both as attribution-dependent.
- Aggregator volume is mostly fake on unregulated venues (more than 70% wash, NBER w30783).
- Paper findings are sample-bound. "No exposure to stocks" (NBER w24877, 2011-18) is false for 2020-26 (H7).
known bugs (data / API quirks)
- Binance REST 429 / 418. Weight is 2400 per minute per IP. Ignoring a 429 escalates to a 418 IP ban.
data.pyhonorsRetry-After(API docs). /futures/data/openInterestHistserves only the last 30 days. Older OI comes from visionmetricsdaily files (5-minute rows,create_timeas a string).- Binance docs and FAQ pages return HTTP 202 (a JS challenge) to curl. Read them with a browser or WebFetch.
- fred.stlouisfed.org timed out (HTTP/2 INTERNAL_ERROR, then a read timeout) from this network. Yahoo chart returned 429, and stooq served a JS proof-of-work page. The keyed API
api.stlouisfed.org/fred/series/observationsis reachable (400 "api_key is not set" if no key); a free key is the path, fred is not blocked. - mempool.space returned 429 and timed out. Use the Coin Metrics
HashRate/FeeTotNtvinstead, or retry with back-off. - The Coin Metrics docs URL
.../market/mvrvis a 404 (moved). The community catalog endpoint lists the free metrics (CapMVRVCur,FlowInExNtv,SplyExNtv, and others). - Deribit DVOL history IS free:
https://www.deribit.com/api/v2/public/get_volatility_index_data?currency=BTC&start_timestamp=<ms>&end_timestamp=<ms>&resolution=3600(duckdbread_json_auto+unnest(result.data)→ 721 hourly rows for 30 days). - Binance quarterly (dated) futures are archived on data.binance.vision under their contract symbol (e.g.
BTCUSDT_261225). Resolve live symbols fromfapi/v1/exchangeInfo(symbols startingBTCUSDT_). Guessed expired symbols return empty listings. Gives a free dated-futures basis. - CFTC CoT bitcoin (financial futures): the financial futures file (
https://www.cftc.gov/files/dea/history/fut_fin_txt_2026.zip, FinFutYY.txt) has 5 bitcoin-named markets; only BITCOIN-CME and MICRO BITCOIN-CME are CME, the other 3 are Coinbase Derivatives. Filter withilike: a case-sensitiveLIKE '%BITCOIN%'silently drops "Nano Bitcoin" (172 vs 134 rows for 2026). - Kalshi
api.elections.kalshi.com/trade-api/v2/markets?series_ticker=KXBTCDis duckdb-readable (unnest(markets)), no custom user agent needed. - Paywall drift: defillama
/emissionsand bridges now return 402 (paid); beaconcha.in returns 401 without a key. Coin Metrics community free tier has 9 usable btc metrics (AdrActCnt, CapMVRVCur, FeeTotNtv, FlowInExNtv, FlowOutExNtv, HashRate, IssTotNtv, SplyExNtv, TxCnt); no sopr/nupl/lth/puell free. - Free liquidation history: none. Binance liquidationSnapshot archive and allForceOrders both 404. OKX public liquidation orders are recent-only.
troubleshooting
| symptom | root cause | fix |
|---|---|---|
| funding history is 5 months long | startTime=0 is treated as absent | start at 1567296000000 and page by the last fundingTime + 1 |
ValueError: Bin edges must be unique | clamped funding ties at 0.0001 | pd.qcut(x.rank(method="first"), 5) |
| spot 1m dates in year ~57,000 / NaT | vision spot switched to µs | detect by magnitude (> 1e14) and divide by 1000 |
era splits empty (ic nan n=0) | the truncated fetch above | validate the date range after every fetch and print min/max |
Pandas4Warning on concat sort | pandas 3 default change | pass sort=True explicitly |
| FRED CSV hangs | network/edge issue | nasdaq.com JSON, or record the gap as unverified |
practiced cases
All cases ran with python 3.12, pandas 3.0.6, numpy 2.5.3, scipy 1.18.1, and statsmodels 0.15.0; the scripts are the market-lab examples.
- H1: high funding predicts lower forward returns. Weakly supported in 2019-21, not supported since. The sample is Binance BTCUSDT, 2019-09-10 to 2026-08-28, 2,545 days. Median annualized funding was 8.4% (p95 48.8%), and 12.7% of days were negative. Funding autocorrelation is 0.83 at lag 1, so it is highly persistent. Spearman IC: 1d -0.022, 7d -0.047 (naive p 0.017, Newey-West t -0.93), 30d -0.078 (NW t -0.84). The 7d quintiles are non-monotonic (q1 +1.9%, q3 -0.95%, q5 +0.55%). The reverse direction is stronger: past 7d return vs funding is +0.238, so funding mostly records what price already did. By era, the 7d IC went -0.148 (2019-21), -0.049 (2022-23), -0.018 (2024-26). In the top 1% of funding days (n=26), mean fwd7 was -0.5% vs +0.56% overall. Verdict: use funding as crowding and crash-risk context, not as a return predictor.
- H2: 2025-10-10 was a leverage cascade. Supported. Binance perp OI went from $10.78b at 20:45 UTC to $9.36b at 21:30 (-13.2%), and to $8.20b a day later (from $11.78b the day before). Price fell 116,976 to 101,516 at 21:20 (-13.2%). The spot low was 102,000. Perp-spot basis reached -51 bp at 21:19. Peak 1m volume was $1.14b, 143x the median. The taker ratio fell to 0.49. Price was at 113,597 by 23:00, 78% retraced. The 5m tape shows OI falling in step with price (10.60 → 10.14 → 9.40). The tariff-headline trigger is background knowledge, not measured.
- H3: the halving cycle peaks about 12-18 months after. Pattern held 4/4 in timing. Not a tradable law. Peaks came 371, 525, 546, and 534 days after the halvings. Peak multiples were 92x, 30x, 8.5x, and 1.9x (log10 1.96 → 0.28, shrinking every cycle). Drawdowns from peak were -85%, -84%, -78%, and -53%. The 2024 cycle peaked on 2025-10-06 at 124,824, fell to 58,525 on 2026-06-30, and stood at 84,386 on 2026-09-26. The base rate is that 62-72% of all days had a positive 1y forward return. The pattern rests on n=3 complete cycles, cannot be separated from global liquidity cycles, and is a public calendar.
- H4: "MVRV < 1 = bottom, > 3.5 = top". Direction supported, thresholds drift. Median forward 1y return by bucket: <1 +123% (99% up, 775 days), 1-1.5 +112%, 1.5-2.5 +76%, 2.5-3.5 +24%, >3.5 +4% (51% up). But MVRV > 3.5 happened only in 2011, 2013, 2017, and 2021. The 2024-25 top peaked at MVRV 2.78, so the classic top line never fired. There are about 4-5 independent bottoms. Verdict: a valuation regime gauge, not a timer.
- H5: hash rate leads price. Not supported. On 155 non-overlapping 30d samples, spearman(hash-rate growth, forward price) = -0.043 and the reverse is +0.053. Both are noise at this horizon.
- H6: stablecoin supply growth is dry powder that predicts BTC. Not supported as prediction. Monthly, 2019-03 to 2026-08, n=90. Same-month co-movement is +0.294 (p 0.005). Next month is +0.137 (p 0.197). BTC last month → supply this month is +0.262 (p 0.013), so supply reacts to price. The tercile means look monotonic (-0.8%, +3.7%, +7.2%) with n=30 each, which is suggestive and not significant. Supply was $312b.
- H7: BTC trades as a risk asset. Supported since 2020, as a regime. On 2,288 aligned days, BTC vs Nasdaq COMP correlation was +0.31 (by year: 2017-19 about 0, 2020 +0.46, 2022 +0.59, 2025 +0.46, 2026 +0.45; rolling 90d from -0.32 to +0.67). Beta was 0.90, with volatility 2.9x the Nasdaq. BTC vs UUP was -0.08 overall (rolling from -0.54 to +0.36; 2022 -0.35). Weekend mean absolute return was 1.4-1.9% vs 2.4-2.8% on weekdays.
ecosystem
- Free data: data.binance.vision, Binance spot and USD-M REST, Coin Metrics community, DefiLlama, blockchain.info charts, mempool.space, and nasdaq.com JSON.
- Paid data: Glassnode, CryptoQuant, Kaiko, Amberdata, and Tardis for depth and liquidation history.
- Tooling: ccxt for multi-venue REST (the awesome-quant-crypto list catalogs more), DuckDB for Parquet analytics (olap), and the awesome-bitcoin list for protocol tooling.
- Community correction: the digital-assets guide says "higher NVT suggests overvaluation" and presents the halving as "scarcity" without noting n=4 and the shrinking multiples. Treat both as hypotheses, per H3 and H4.