brk_fetcher
Bitcoin price data fetcher with multi-source fallback.
What It Enables
Fetch OHLC (Open/High/Low/Close) price data from Binance, Kraken, or the public Bitview API. Automatically falls back between sources on failure, with up to 12 hours of retries when every source is unavailable.
Key Features
- Multi-source fallback: Binance → Kraken → Bitview API
- Health tracking: Temporarily disables failing sources
- Two resolution modes: Per-date (daily) or per-block (OHLC aggregated from 1-minute candles)
- HAR file support: Import Binance 1mn data from browser network captures for historical fills
- Permanent block detection: Stops retrying on DNS/TLS failures
Core API
let mut fetcher = import?;
// Daily price
let ohlc = fetcher.get_date?;
// Block-level price (uses 1mn data when available)
let ohlc = fetcher.get_height?;
Sources
| Source | Resolution | Lookback | Notes |
|---|---|---|---|
| Binance | 1mn | ~16 hours | Best for recent blocks |
| Kraken | 1mn | ~10 hours | Fallback for recent |
| Bitview API | Per-height and daily | Full history | Fallback for older data |
HAR Import
For historical 1-minute data beyond API limits, export network requests from Binance's web interface and place the HAR file in the imports directory.
Built On
brk_errorfor error handlingbrk_loggerfor retry loggingbrk_typesforDate,Height,Timestamp,OHLCCents