mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
fetcher: fix brk url
This commit is contained in:
@@ -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  dataset variants at their disposal. \
|
||||
Researchers and developers are free to use BRK's public API with  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). \
|
||||
|
||||
@@ -88,7 +88,7 @@ pub struct Config {
|
||||
#[arg(long, value_name = "SECONDS")]
|
||||
delay: Option<u64>,
|
||||
|
||||
/// 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<bool>,
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
@@ -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<Height, Vec<OHLCCents>>,
|
||||
dateindex_to_ohlc: BTreeMap<DateIndex, Vec<OHLCCents>>,
|
||||
@@ -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
|
||||
);
|
||||
@@ -1,9 +0,0 @@
|
||||
mod binance;
|
||||
mod brk;
|
||||
mod kraken;
|
||||
mod retry;
|
||||
|
||||
pub use binance::*;
|
||||
pub use brk::*;
|
||||
pub use kraken::*;
|
||||
use retry::*;
|
||||
@@ -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 {
|
||||
@@ -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)]
|
||||
|
||||
@@ -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<CallToolResult, McpError> {
|
||||
info!("mcp: get_version");
|
||||
|
||||
@@ -24,7 +24,6 @@ pub struct RawVec<I, T> {
|
||||
header: Header,
|
||||
parent: PathBuf,
|
||||
name: String,
|
||||
// file: Option<File>,
|
||||
// Consider Arc<ArcSwap<Option<Mmap>>> for dataraces when reorg ?
|
||||
mmap: Arc<ArcSwap<Mmap>>,
|
||||
pushed: Vec<T>,
|
||||
@@ -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![],
|
||||
|
||||
Reference in New Issue
Block a user