global: snapshot

This commit is contained in:
nym21
2026-01-11 17:19:00 +01:00
parent 6f45ec13f3
commit ea70c381de
419 changed files with 38059 additions and 7653 deletions

View File

@@ -0,0 +1,56 @@
//! Basic example of using the BRK client.
use brk_client::{BrkClient, BrkClientOptions};
fn main() -> brk_client::Result<()> {
// Create client with default options
let client = BrkClient::new("http://localhost:3110");
// Or with custom options
let _client_with_options = BrkClient::with_options(BrkClientOptions {
base_url: "http://localhost:3110".to_string(),
timeout_secs: 60,
});
// Fetch price data using the typed tree API
let price_close = client
.tree()
.price
.usd
.split
.close
.by
.dateindex()
.range(None, Some(-3))?;
println!("Last 3 price close values: {:?}", price_close);
// Fetch block data
let block_count = client
.tree()
.blocks
.count
.block_count
.sum
.by
.height()
.range(None, Some(-3))?;
println!("Last 3 block count values: {:?}", block_count);
// Fetch supply data
let circulating = client
.tree()
.supply
.circulating
.bitcoin
.by
.dateindex()
.range(None, Some(-3))?;
println!("Last 3 circulating supply values: {:?}", circulating);
// Using generic metric fetching
let metricdata =
client.get_metric_by_index("dateindex", "price_close", None, None, None, None)?;
println!("Generic fetch result count: {}", metricdata.data.len());
Ok(())
}