server: mcp + global: refactor

This commit is contained in:
nym21
2025-06-21 12:43:14 +02:00
parent c9e0f9d985
commit c3ae3cb768
92 changed files with 13601 additions and 12554 deletions

View File

@@ -11,7 +11,6 @@ repository.workspace = true
brk_core = { workspace = true }
brk_logger = { workspace = true }
color-eyre = { workspace = true }
jiff = { workspace = true }
log = { workspace = true }
minreq = { workspace = true }
serde_json = { workspace = true }

View File

@@ -31,4 +31,4 @@
</a>
</p>
A crate that can fetch the Bitcoin price, either by date or height, from Binance and Kibo.
A crate that can fetch the Bitcoin price, either by date or height, from Binance, Kraken and the main instance of BRK.

View File

@@ -13,10 +13,8 @@ pub struct BRK {
dateindex_to_ohlc: BTreeMap<DateIndex, Vec<OHLCCents>>,
}
const API_URL: &str = "https://bitcoinresearchkit.org/api";
const API_URL: &str = "https://bitcoinresearchkit.org/api/vecs";
const RETRIES: usize = 10;
const CHUNK_SIZE: usize = 10_000;
impl BRK {
@@ -40,11 +38,11 @@ impl BRK {
.unwrap()
.get(usize::from(height.checked_sub(key).unwrap()))
.cloned()
.ok_or(eyre!("Couldn't find height in kibo"))
.ok_or(eyre!("Couldn't find height in BRK"))
}
fn fetch_height_prices(height: Height) -> color_eyre::Result<Vec<OHLCCents>> {
info!("Fetching Kibo height {height} prices...");
info!("Fetching BRK height {height} prices...");
retry(
|_| {
@@ -89,11 +87,11 @@ impl BRK {
.unwrap()
.get(usize::from(dateindex.checked_sub(key).unwrap()))
.cloned()
.ok_or(eyre!("Couldn't find date in kibo"))
.ok_or(eyre!("Couldn't find date in BRK"))
}
fn fetch_date_prices(dateindex: DateIndex) -> color_eyre::Result<Vec<OHLCCents>> {
info!("Fetching Kibo dateindex {dateindex} prices...");
info!("Fetching BRK dateindex {dateindex} prices...");
retry(
|_| {