diff --git a/README.md b/README.md index 37361afd8..72620cf74 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ The toolkit can be used in various ways to accommodate as many needs as possible It has a wide range of functionalities including charts, tables and simulations which you can visit for free and without the need for an account. \ Also available at: [kibo.money](https://kibo.money) // [satonomics.xyz](https://satonomics.xyz) - **[API](https://github.com/bitcoinresearchkit/brk/tree/main/crates/brk_server#brk-server)** \ - Researchers and developers are free to use BRK's public API with ![Datasets variant count](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fbitcoinresearchkit.org%2Fapi%2Fvecs%2Fvariant-count&query=%24&style=flat&label=%20&color=white) dataset variants at their disposal. \ + Researchers and developers are free to use BRK's public API with ![Datasets variant count](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fbitcoinresearchkit.org%2Fapi%2Fvecs%2Fvec-count&query=%24&style=flat&label=%20&color=white) dataset variants at their disposal. \ Just like the website, it's entirely free, with no authentication or rate-limiting. - **[AI](https://github.com/bitcoinresearchkit/brk/blob/main/crates/brk_mcp/README.md#brk-mcp)** \ LLMs have to possibility to connect to BRK's backend through a [MCP](https://modelcontextprotocol.io/introduction). \ diff --git a/crates/brk_cli/src/config.rs b/crates/brk_cli/src/config.rs index 50e2d9bed..a0851c456 100644 --- a/crates/brk_cli/src/config.rs +++ b/crates/brk_cli/src/config.rs @@ -88,7 +88,7 @@ pub struct Config { #[arg(long, value_name = "SECONDS")] delay: Option, - /// Activate the Model Context Protocol (MCP) endpoint to give LLMs access to BRK (experimental), default: false, saved + /// Activate the Model Context Protocol (MCP) endpoint to give LLMs access to BRK (experimental), default: true, saved #[serde(default, deserialize_with = "default_on_error")] #[arg(long, value_name = "BOOL")] mcp: Option, @@ -367,7 +367,7 @@ impl Config { } pub fn mcp(&self) -> bool { - self.mcp.is_some_and(|b| b) + self.mcp.is_none_or(|b| b) } pub fn watch(&self) -> bool { diff --git a/crates/brk_fetcher/src/fetchers/binance.rs b/crates/brk_fetcher/src/binance.rs similarity index 98% rename from crates/brk_fetcher/src/fetchers/binance.rs rename to crates/brk_fetcher/src/binance.rs index 6c718036b..f4bf9dcaf 100644 --- a/crates/brk_fetcher/src/fetchers/binance.rs +++ b/crates/brk_fetcher/src/binance.rs @@ -11,7 +11,7 @@ use color_eyre::eyre::{ContextCompat, eyre}; use log::info; use serde_json::Value; -use crate::{Close, Date, Dollars, Fetcher, High, Low, Open, fetchers::retry}; +use crate::{Close, Date, Dollars, Fetcher, High, Low, Open, retry}; #[derive(Clone)] pub struct Binance { diff --git a/crates/brk_fetcher/src/fetchers/brk.rs b/crates/brk_fetcher/src/brk.rs similarity index 94% rename from crates/brk_fetcher/src/fetchers/brk.rs rename to crates/brk_fetcher/src/brk.rs index 2e1270501..8b31eb542 100644 --- a/crates/brk_fetcher/src/fetchers/brk.rs +++ b/crates/brk_fetcher/src/brk.rs @@ -5,9 +5,10 @@ use color_eyre::eyre::{ContextCompat, eyre}; use log::info; use serde_json::Value; -use crate::{Close, Dollars, High, Low, Open, fetchers::retry}; +use crate::{Close, Dollars, High, Low, Open, retry}; #[derive(Default, Clone)] +#[allow(clippy::upper_case_acronyms)] pub struct BRK { height_to_ohlc: BTreeMap>, dateindex_to_ohlc: BTreeMap>, @@ -47,7 +48,7 @@ impl BRK { retry( |_| { let url = format!( - "{API_URL}/query?index=height&values=ohlc&from={}&to={}", + "{API_URL}/height-to-ohlc?from={}&to={}", height, height + CHUNK_SIZE ); @@ -96,7 +97,7 @@ impl BRK { retry( |_| { let url = format!( - "{API_URL}/query?index=dateindex&values=ohlc&from={}&to={}", + "{API_URL}/dateindex-to-ohlc?from={}&to={}", dateindex, dateindex + CHUNK_SIZE ); diff --git a/crates/brk_fetcher/src/fetchers/mod.rs b/crates/brk_fetcher/src/fetchers/mod.rs deleted file mode 100644 index 42822ce4e..000000000 --- a/crates/brk_fetcher/src/fetchers/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -mod binance; -mod brk; -mod kraken; -mod retry; - -pub use binance::*; -pub use brk::*; -pub use kraken::*; -use retry::*; diff --git a/crates/brk_fetcher/src/fetchers/kraken.rs b/crates/brk_fetcher/src/kraken.rs similarity index 99% rename from crates/brk_fetcher/src/fetchers/kraken.rs rename to crates/brk_fetcher/src/kraken.rs index ff3d4416a..9193dac4d 100644 --- a/crates/brk_fetcher/src/fetchers/kraken.rs +++ b/crates/brk_fetcher/src/kraken.rs @@ -5,7 +5,7 @@ use color_eyre::eyre::ContextCompat; use log::info; use serde_json::Value; -use crate::{Fetcher, fetchers::retry}; +use crate::{Fetcher, retry}; #[derive(Default, Clone)] pub struct Kraken { diff --git a/crates/brk_fetcher/src/lib.rs b/crates/brk_fetcher/src/lib.rs index f27391975..32d09b810 100644 --- a/crates/brk_fetcher/src/lib.rs +++ b/crates/brk_fetcher/src/lib.rs @@ -7,12 +7,18 @@ use std::{collections::BTreeMap, path::Path, thread::sleep, time::Duration}; use brk_core::{Close, Date, Dollars, Height, High, Low, OHLCCents, Open, Timestamp}; use color_eyre::eyre::Error; - -mod fetchers; - -pub use fetchers::*; use log::info; +mod binance; +mod brk; +mod kraken; +mod retry; + +pub use binance::*; +pub use brk::*; +pub use kraken::*; +use retry::*; + const TRIES: usize = 12 * 60; #[derive(Clone)] diff --git a/crates/brk_fetcher/src/fetchers/retry.rs b/crates/brk_fetcher/src/retry.rs similarity index 100% rename from crates/brk_fetcher/src/fetchers/retry.rs rename to crates/brk_fetcher/src/retry.rs diff --git a/crates/brk_mcp/src/lib.rs b/crates/brk_mcp/src/lib.rs index 118aceb6c..6009511f8 100644 --- a/crates/brk_mcp/src/lib.rs +++ b/crates/brk_mcp/src/lib.rs @@ -142,7 +142,7 @@ The response's format will depend on the given parameters, it will be: } #[tool(description = " -Get the running version of the Bitcoin Research Kit +Get the running version of the Bitcoin Research Kit. ")] async fn get_version(&self) -> Result { info!("mcp: get_version"); diff --git a/crates/brk_vec/src/variants/raw.rs b/crates/brk_vec/src/variants/raw.rs index e984e99f9..a9c98a7df 100644 --- a/crates/brk_vec/src/variants/raw.rs +++ b/crates/brk_vec/src/variants/raw.rs @@ -24,7 +24,6 @@ pub struct RawVec { header: Header, parent: PathBuf, name: String, - // file: Option, // Consider Arc>> for dataraces when reorg ? mmap: Arc>, pushed: Vec, @@ -63,9 +62,7 @@ where (mmap, header) } else { let mmap = Self::new_mmap(&file)?; - // dbg!(&mmap[..]); let header = Header::import_and_verify(&mmap, version, Format::Raw)?; - // dbg!((&header, name, I::to_string())); (mmap, header) } } @@ -86,7 +83,6 @@ where Ok(Self { mmap, header, - // file: Some(file), name: name.to_string(), parent: parent.to_owned(), pushed: vec![],