| Crates.io | brk_fetcher |
| lib.rs | brk_fetcher |
| version | 0.1.0-beta.0 |
| created_at | 2025-02-23 23:31:20.578563+00 |
| updated_at | 2026-01-25 13:21:27.228435+00 |
| description | A Bitcoin price fetcher |
| homepage | https://bitcoinresearchkit.org |
| repository | https://github.com/bitcoinresearchkit/brk |
| max_upload_size | |
| id | 1566726 |
| size | 63,721 |
Bitcoin price data fetcher with multi-source fallback.
Fetch OHLC (Open/High/Low/Close) price data from Binance, Kraken, or BRK's own API. Automatically falls back between sources on failure, with 12-hour retry persistence for transient network issues.
let mut fetcher = Fetcher::import(Some(&hars_path))?;
// Daily price
let ohlc = fetcher.get_date(Date::new(2024, 4, 20))?;
// Block-level price (uses 1mn data when available)
let ohlc = fetcher.get_height(height, block_timestamp, prev_timestamp)?;
| Source | Resolution | Lookback | Notes |
|---|---|---|---|
| Binance | 1mn | ~16 hours | Best for recent blocks |
| Kraken | 1mn | ~10 hours | Fallback for recent |
| BRK API | Daily | Full history | Fallback for older data |
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.
brk_error for error handlingbrk_logger for retry loggingbrk_types for Date, Height, Timestamp, OHLCCents