mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-29 21:39:26 -07:00
binder: snapshot
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use std::{collections::HashSet, fmt::Write as FmtWrite, fs, io, path::Path};
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use brk_grouper::{
|
||||
AGE_RANGE_NAMES, AMOUNT_RANGE_NAMES, EPOCH_NAMES, GE_AMOUNT_NAMES, LT_AMOUNT_NAMES,
|
||||
MAX_AGE_NAMES, MIN_AGE_NAMES, SPENDABLE_TYPE_NAMES, TERM_NAMES, YEAR_NAMES,
|
||||
@@ -37,6 +39,32 @@ pub fn generate_javascript_client(
|
||||
|
||||
fs::write(output_path, output)?;
|
||||
|
||||
// Update package.json version if it exists in the same directory
|
||||
if let Some(parent) = output_path.parent() {
|
||||
let package_json_path = parent.join("package.json");
|
||||
if package_json_path.exists() {
|
||||
update_package_json_version(&package_json_path)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Update the version field in package.json to match the current VERSION.
|
||||
fn update_package_json_version(package_json_path: &Path) -> io::Result<()> {
|
||||
let content = fs::read_to_string(package_json_path)?;
|
||||
let mut package: serde_json::Value = serde_json::from_str(&content)
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
|
||||
if let Some(obj) = package.as_object_mut() {
|
||||
obj.insert("version".to_string(), json!(VERSION));
|
||||
}
|
||||
|
||||
let updated = serde_json::to_string_pretty(&package)
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
|
||||
fs::write(package_json_path, updated + "\n")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -269,7 +297,7 @@ fn generate_base_client(output: &mut String) {
|
||||
*/
|
||||
|
||||
const _isBrowser = typeof window !== 'undefined' && 'caches' in window;
|
||||
const _runIdle = (fn) => (globalThis.requestIdleCallback ?? setTimeout)(fn);
|
||||
const _runIdle = (/** @type {{VoidFunction}} */ fn) => (globalThis.requestIdleCallback ?? setTimeout)(fn);
|
||||
|
||||
/** @type {{Promise<Cache | null>}} */
|
||||
const _cachePromise = _isBrowser
|
||||
|
||||
@@ -30,7 +30,7 @@ pub fn generate_python_client(
|
||||
writeln!(output, "from __future__ import annotations").unwrap();
|
||||
writeln!(
|
||||
output,
|
||||
"from typing import TypeVar, Generic, Any, Optional, List, Literal, TypedDict, Final"
|
||||
"from typing import TypeVar, Generic, Any, Optional, List, Literal, TypedDict, Final, Union"
|
||||
)
|
||||
.unwrap();
|
||||
writeln!(output, "import httpx\n").unwrap();
|
||||
@@ -296,7 +296,7 @@ fn schema_to_python_type_ctx(schema: &Value, current_type: Option<&str>) -> Stri
|
||||
base_type.clone()
|
||||
};
|
||||
} else if !types.is_empty() {
|
||||
let union = types.join(" | ");
|
||||
let union = format!("Union[{}]", types.join(", "));
|
||||
return if has_null {
|
||||
format!("Optional[{}]", union)
|
||||
} else {
|
||||
@@ -321,13 +321,16 @@ fn schema_to_python_type_ctx(schema: &Value, current_type: Option<&str>) -> Stri
|
||||
.collect();
|
||||
let filtered: Vec<_> = types.iter().filter(|t| *t != "Any").collect();
|
||||
if !filtered.is_empty() {
|
||||
return filtered
|
||||
.iter()
|
||||
.map(|s| s.as_str())
|
||||
.collect::<Vec<_>>()
|
||||
.join(" | ");
|
||||
return format!(
|
||||
"Union[{}]",
|
||||
filtered
|
||||
.iter()
|
||||
.map(|s| s.as_str())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
);
|
||||
}
|
||||
return types.join(" | ");
|
||||
return format!("Union[{}]", types.join(", "));
|
||||
}
|
||||
|
||||
// Check for format hint without type (common in OpenAPI)
|
||||
|
||||
@@ -1055,43 +1055,6 @@ impl Ratio1ySdPattern {
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct AXbtPattern {
|
||||
pub _1d_dominance: BlockCountPattern<StoredF32>,
|
||||
pub _1m_blocks_mined: Indexes<StoredU32>,
|
||||
pub _1m_dominance: Indexes<StoredF32>,
|
||||
pub _1w_blocks_mined: Indexes<StoredU32>,
|
||||
pub _1w_dominance: Indexes<StoredF32>,
|
||||
pub _1y_blocks_mined: Indexes<StoredU32>,
|
||||
pub _1y_dominance: Indexes<StoredF32>,
|
||||
pub blocks_mined: BlockCountPattern<StoredU32>,
|
||||
pub coinbase: UnclaimedRewardsPattern,
|
||||
pub days_since_block: Indexes<StoredU16>,
|
||||
pub dominance: BlockCountPattern<StoredF32>,
|
||||
pub fee: FeePattern2,
|
||||
pub subsidy: FeePattern2,
|
||||
}
|
||||
|
||||
impl AXbtPattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
_1d_dominance: BlockCountPattern::new(client.clone(), &format!("{base_path}/1d_dominance")),
|
||||
_1m_blocks_mined: Indexes::new(client.clone(), &format!("{base_path}/1m_blocks_mined")),
|
||||
_1m_dominance: Indexes::new(client.clone(), &format!("{base_path}/1m_dominance")),
|
||||
_1w_blocks_mined: Indexes::new(client.clone(), &format!("{base_path}/1w_blocks_mined")),
|
||||
_1w_dominance: Indexes::new(client.clone(), &format!("{base_path}/1w_dominance")),
|
||||
_1y_blocks_mined: Indexes::new(client.clone(), &format!("{base_path}/1y_blocks_mined")),
|
||||
_1y_dominance: Indexes::new(client.clone(), &format!("{base_path}/1y_dominance")),
|
||||
blocks_mined: BlockCountPattern::new(client.clone(), &format!("{base_path}/blocks_mined")),
|
||||
coinbase: UnclaimedRewardsPattern::new(client.clone(), &format!("{base_path}/coinbase")),
|
||||
days_since_block: Indexes::new(client.clone(), &format!("{base_path}/days_since_block")),
|
||||
dominance: BlockCountPattern::new(client.clone(), &format!("{base_path}/dominance")),
|
||||
fee: FeePattern2::new(client.clone(), &format!("{base_path}/fee")),
|
||||
subsidy: FeePattern2::new(client.clone(), &format!("{base_path}/subsidy")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct ActivePriceRatioPattern {
|
||||
pub ratio: Indexes<StoredF32>,
|
||||
@@ -1129,6 +1092,43 @@ impl ActivePriceRatioPattern {
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct AXbtPattern {
|
||||
pub _1d_dominance: BlockCountPattern<StoredF32>,
|
||||
pub _1m_blocks_mined: Indexes<StoredU32>,
|
||||
pub _1m_dominance: Indexes<StoredF32>,
|
||||
pub _1w_blocks_mined: Indexes<StoredU32>,
|
||||
pub _1w_dominance: Indexes<StoredF32>,
|
||||
pub _1y_blocks_mined: Indexes<StoredU32>,
|
||||
pub _1y_dominance: Indexes<StoredF32>,
|
||||
pub blocks_mined: BlockCountPattern<StoredU32>,
|
||||
pub coinbase: UnclaimedRewardsPattern,
|
||||
pub days_since_block: Indexes<StoredU16>,
|
||||
pub dominance: BlockCountPattern<StoredF32>,
|
||||
pub fee: FeePattern2,
|
||||
pub subsidy: FeePattern2,
|
||||
}
|
||||
|
||||
impl AXbtPattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
_1d_dominance: BlockCountPattern::new(client.clone(), &format!("{base_path}/1d_dominance")),
|
||||
_1m_blocks_mined: Indexes::new(client.clone(), &format!("{base_path}/1m_blocks_mined")),
|
||||
_1m_dominance: Indexes::new(client.clone(), &format!("{base_path}/1m_dominance")),
|
||||
_1w_blocks_mined: Indexes::new(client.clone(), &format!("{base_path}/1w_blocks_mined")),
|
||||
_1w_dominance: Indexes::new(client.clone(), &format!("{base_path}/1w_dominance")),
|
||||
_1y_blocks_mined: Indexes::new(client.clone(), &format!("{base_path}/1y_blocks_mined")),
|
||||
_1y_dominance: Indexes::new(client.clone(), &format!("{base_path}/1y_dominance")),
|
||||
blocks_mined: BlockCountPattern::new(client.clone(), &format!("{base_path}/blocks_mined")),
|
||||
coinbase: UnclaimedRewardsPattern::new(client.clone(), &format!("{base_path}/coinbase")),
|
||||
days_since_block: Indexes::new(client.clone(), &format!("{base_path}/days_since_block")),
|
||||
dominance: BlockCountPattern::new(client.clone(), &format!("{base_path}/dominance")),
|
||||
fee: FeePattern2::new(client.clone(), &format!("{base_path}/fee")),
|
||||
subsidy: FeePattern2::new(client.clone(), &format!("{base_path}/subsidy")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct BitcoinPattern<T> {
|
||||
pub average: Indexes4<T>,
|
||||
@@ -1164,60 +1164,31 @@ impl<T: DeserializeOwned> BitcoinPattern<T> {
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct BlockSizePattern<T> {
|
||||
pub average: Indexes4<T>,
|
||||
pub average: Indexes3<T>,
|
||||
pub cumulative: Indexes3<T>,
|
||||
pub max: Indexes4<T>,
|
||||
pub median: Indexes5<T>,
|
||||
pub min: Indexes4<T>,
|
||||
pub pct10: Indexes5<T>,
|
||||
pub pct25: Indexes5<T>,
|
||||
pub pct75: Indexes5<T>,
|
||||
pub pct90: Indexes5<T>,
|
||||
pub sum: Indexes4<T>,
|
||||
pub max: Indexes3<T>,
|
||||
pub median: Indexes2<T>,
|
||||
pub min: Indexes3<T>,
|
||||
pub pct10: Indexes2<T>,
|
||||
pub pct25: Indexes2<T>,
|
||||
pub pct75: Indexes2<T>,
|
||||
pub pct90: Indexes2<T>,
|
||||
pub sum: Indexes3<T>,
|
||||
}
|
||||
|
||||
impl<T: DeserializeOwned> BlockSizePattern<T> {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
average: Indexes4::new(client.clone(), &format!("{base_path}/average")),
|
||||
average: Indexes3::new(client.clone(), &format!("{base_path}/average")),
|
||||
cumulative: Indexes3::new(client.clone(), &format!("{base_path}/cumulative")),
|
||||
max: Indexes4::new(client.clone(), &format!("{base_path}/max")),
|
||||
median: Indexes5::new(client.clone(), &format!("{base_path}/median")),
|
||||
min: Indexes4::new(client.clone(), &format!("{base_path}/min")),
|
||||
pct10: Indexes5::new(client.clone(), &format!("{base_path}/pct10")),
|
||||
pct25: Indexes5::new(client.clone(), &format!("{base_path}/pct25")),
|
||||
pct75: Indexes5::new(client.clone(), &format!("{base_path}/pct75")),
|
||||
pct90: Indexes5::new(client.clone(), &format!("{base_path}/pct90")),
|
||||
sum: Indexes4::new(client.clone(), &format!("{base_path}/sum")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct RelativePattern {
|
||||
pub neg_unrealized_loss_rel_to_market_cap: Indexes27<StoredF32>,
|
||||
pub net_unrealized_pnl_rel_to_market_cap: Indexes26<StoredF32>,
|
||||
pub supply_in_loss_rel_to_circulating_supply: Indexes27<StoredF64>,
|
||||
pub supply_in_loss_rel_to_own_supply: Indexes27<StoredF64>,
|
||||
pub supply_in_profit_rel_to_circulating_supply: Indexes27<StoredF64>,
|
||||
pub supply_in_profit_rel_to_own_supply: Indexes27<StoredF64>,
|
||||
pub supply_rel_to_circulating_supply: Indexes<StoredF64>,
|
||||
pub unrealized_loss_rel_to_market_cap: Indexes27<StoredF32>,
|
||||
pub unrealized_profit_rel_to_market_cap: Indexes27<StoredF32>,
|
||||
}
|
||||
|
||||
impl RelativePattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
neg_unrealized_loss_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/neg_unrealized_loss_rel_to_market_cap")),
|
||||
net_unrealized_pnl_rel_to_market_cap: Indexes26::new(client.clone(), &format!("{base_path}/net_unrealized_pnl_rel_to_market_cap")),
|
||||
supply_in_loss_rel_to_circulating_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_loss_rel_to_circulating_supply")),
|
||||
supply_in_loss_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_loss_rel_to_own_supply")),
|
||||
supply_in_profit_rel_to_circulating_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_profit_rel_to_circulating_supply")),
|
||||
supply_in_profit_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_profit_rel_to_own_supply")),
|
||||
supply_rel_to_circulating_supply: Indexes::new(client.clone(), &format!("{base_path}/supply_rel_to_circulating_supply")),
|
||||
unrealized_loss_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_loss_rel_to_market_cap")),
|
||||
unrealized_profit_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_profit_rel_to_market_cap")),
|
||||
max: Indexes3::new(client.clone(), &format!("{base_path}/max")),
|
||||
median: Indexes2::new(client.clone(), &format!("{base_path}/median")),
|
||||
min: Indexes3::new(client.clone(), &format!("{base_path}/min")),
|
||||
pct10: Indexes2::new(client.clone(), &format!("{base_path}/pct10")),
|
||||
pct25: Indexes2::new(client.clone(), &format!("{base_path}/pct25")),
|
||||
pct75: Indexes2::new(client.clone(), &format!("{base_path}/pct75")),
|
||||
pct90: Indexes2::new(client.clone(), &format!("{base_path}/pct90")),
|
||||
sum: Indexes3::new(client.clone(), &format!("{base_path}/sum")),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1251,6 +1222,62 @@ impl UnrealizedPattern {
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct RelativePattern {
|
||||
pub neg_unrealized_loss_rel_to_market_cap: Indexes27<StoredF32>,
|
||||
pub net_unrealized_pnl_rel_to_market_cap: Indexes26<StoredF32>,
|
||||
pub supply_in_loss_rel_to_circulating_supply: Indexes27<StoredF64>,
|
||||
pub supply_in_loss_rel_to_own_supply: Indexes27<StoredF64>,
|
||||
pub supply_in_profit_rel_to_circulating_supply: Indexes27<StoredF64>,
|
||||
pub supply_in_profit_rel_to_own_supply: Indexes27<StoredF64>,
|
||||
pub supply_rel_to_circulating_supply: Indexes<StoredF64>,
|
||||
pub unrealized_loss_rel_to_market_cap: Indexes27<StoredF32>,
|
||||
pub unrealized_profit_rel_to_market_cap: Indexes27<StoredF32>,
|
||||
}
|
||||
|
||||
impl RelativePattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
neg_unrealized_loss_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/neg_unrealized_loss_rel_to_market_cap")),
|
||||
net_unrealized_pnl_rel_to_market_cap: Indexes26::new(client.clone(), &format!("{base_path}/net_unrealized_pnl_rel_to_market_cap")),
|
||||
supply_in_loss_rel_to_circulating_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_loss_rel_to_circulating_supply")),
|
||||
supply_in_loss_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_loss_rel_to_own_supply")),
|
||||
supply_in_profit_rel_to_circulating_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_profit_rel_to_circulating_supply")),
|
||||
supply_in_profit_rel_to_own_supply: Indexes27::new(client.clone(), &format!("{base_path}/supply_in_profit_rel_to_own_supply")),
|
||||
supply_rel_to_circulating_supply: Indexes::new(client.clone(), &format!("{base_path}/supply_rel_to_circulating_supply")),
|
||||
unrealized_loss_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_loss_rel_to_market_cap")),
|
||||
unrealized_profit_rel_to_market_cap: Indexes27::new(client.clone(), &format!("{base_path}/unrealized_profit_rel_to_market_cap")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct AddresstypeToHeightToAddrCountPattern<T> {
|
||||
pub p2a: Indexes2<T>,
|
||||
pub p2pk33: Indexes2<T>,
|
||||
pub p2pk65: Indexes2<T>,
|
||||
pub p2pkh: Indexes2<T>,
|
||||
pub p2sh: Indexes2<T>,
|
||||
pub p2tr: Indexes2<T>,
|
||||
pub p2wpkh: Indexes2<T>,
|
||||
pub p2wsh: Indexes2<T>,
|
||||
}
|
||||
|
||||
impl<T: DeserializeOwned> AddresstypeToHeightToAddrCountPattern<T> {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
p2a: Indexes2::new(client.clone(), &format!("{base_path}/p2a")),
|
||||
p2pk33: Indexes2::new(client.clone(), &format!("{base_path}/p2pk33")),
|
||||
p2pk65: Indexes2::new(client.clone(), &format!("{base_path}/p2pk65")),
|
||||
p2pkh: Indexes2::new(client.clone(), &format!("{base_path}/p2pkh")),
|
||||
p2sh: Indexes2::new(client.clone(), &format!("{base_path}/p2sh")),
|
||||
p2tr: Indexes2::new(client.clone(), &format!("{base_path}/p2tr")),
|
||||
p2wpkh: Indexes2::new(client.clone(), &format!("{base_path}/p2wpkh")),
|
||||
p2wsh: Indexes2::new(client.clone(), &format!("{base_path}/p2wsh")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct Constant0Pattern<T> {
|
||||
pub dateindex: Indexes5<T>,
|
||||
@@ -1279,33 +1306,6 @@ impl<T: DeserializeOwned> Constant0Pattern<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct AddresstypeToHeightToAddrCountPattern<T> {
|
||||
pub p2a: Indexes16<T>,
|
||||
pub p2pk33: Indexes17<T>,
|
||||
pub p2pk65: Indexes18<T>,
|
||||
pub p2pkh: Indexes19<T>,
|
||||
pub p2sh: Indexes20<T>,
|
||||
pub p2tr: Indexes21<T>,
|
||||
pub p2wpkh: Indexes22<T>,
|
||||
pub p2wsh: Indexes23<T>,
|
||||
}
|
||||
|
||||
impl<T: DeserializeOwned> AddresstypeToHeightToAddrCountPattern<T> {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
p2a: Indexes16::new(client.clone(), &format!("{base_path}/p2a")),
|
||||
p2pk33: Indexes17::new(client.clone(), &format!("{base_path}/p2pk33")),
|
||||
p2pk65: Indexes18::new(client.clone(), &format!("{base_path}/p2pk65")),
|
||||
p2pkh: Indexes19::new(client.clone(), &format!("{base_path}/p2pkh")),
|
||||
p2sh: Indexes20::new(client.clone(), &format!("{base_path}/p2sh")),
|
||||
p2tr: Indexes21::new(client.clone(), &format!("{base_path}/p2tr")),
|
||||
p2wpkh: Indexes22::new(client.clone(), &format!("{base_path}/p2wpkh")),
|
||||
p2wsh: Indexes23::new(client.clone(), &format!("{base_path}/p2wsh")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct BlockIntervalPattern<T> {
|
||||
pub average: Indexes3<T>,
|
||||
@@ -1359,6 +1359,29 @@ impl _0satsPattern {
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct _10yTo12yPattern {
|
||||
pub activity: ActivityPattern,
|
||||
pub price_paid: PricePaidPattern2,
|
||||
pub realized: RealizedPattern2,
|
||||
pub relative: RelativePattern2,
|
||||
pub supply: SupplyPattern2,
|
||||
pub unrealized: UnrealizedPattern,
|
||||
}
|
||||
|
||||
impl _10yTo12yPattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
activity: ActivityPattern::new(client.clone(), &format!("{base_path}/activity")),
|
||||
price_paid: PricePaidPattern2::new(client.clone(), &format!("{base_path}/price_paid")),
|
||||
realized: RealizedPattern2::new(client.clone(), &format!("{base_path}/realized")),
|
||||
relative: RelativePattern2::new(client.clone(), &format!("{base_path}/relative")),
|
||||
supply: SupplyPattern2::new(client.clone(), &format!("{base_path}/supply")),
|
||||
unrealized: UnrealizedPattern::new(client.clone(), &format!("{base_path}/unrealized")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct UpTo1dPattern {
|
||||
pub activity: ActivityPattern,
|
||||
@@ -1406,24 +1429,22 @@ impl _0satsPattern2 {
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct _10yTo12yPattern {
|
||||
pub activity: ActivityPattern,
|
||||
pub price_paid: PricePaidPattern2,
|
||||
pub realized: RealizedPattern2,
|
||||
pub relative: RelativePattern2,
|
||||
pub supply: SupplyPattern2,
|
||||
pub unrealized: UnrealizedPattern,
|
||||
pub struct SupplyPattern2 {
|
||||
pub supply: SupplyPattern,
|
||||
pub supply_half: ActiveSupplyPattern,
|
||||
pub supply_half_value: ActiveSupplyPattern,
|
||||
pub supply_value: SupplyValuePattern,
|
||||
pub utxo_count: Indexes3<StoredU64>,
|
||||
}
|
||||
|
||||
impl _10yTo12yPattern {
|
||||
impl SupplyPattern2 {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
activity: ActivityPattern::new(client.clone(), &format!("{base_path}/activity")),
|
||||
price_paid: PricePaidPattern2::new(client.clone(), &format!("{base_path}/price_paid")),
|
||||
realized: RealizedPattern2::new(client.clone(), &format!("{base_path}/realized")),
|
||||
relative: RelativePattern2::new(client.clone(), &format!("{base_path}/relative")),
|
||||
supply: SupplyPattern2::new(client.clone(), &format!("{base_path}/supply")),
|
||||
unrealized: UnrealizedPattern::new(client.clone(), &format!("{base_path}/unrealized")),
|
||||
supply: SupplyPattern::new(client.clone(), &format!("{base_path}/supply")),
|
||||
supply_half: ActiveSupplyPattern::new(client.clone(), &format!("{base_path}/supply_half")),
|
||||
supply_half_value: ActiveSupplyPattern::new(client.clone(), &format!("{base_path}/supply_half_value")),
|
||||
supply_value: SupplyValuePattern::new(client.clone(), &format!("{base_path}/supply_value")),
|
||||
utxo_count: Indexes3::new(client.clone(), &format!("{base_path}/utxo_count")),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1449,27 +1470,6 @@ impl ActivityPattern {
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct SupplyPattern2 {
|
||||
pub supply: SupplyPattern,
|
||||
pub supply_half: ActiveSupplyPattern,
|
||||
pub supply_half_value: ActiveSupplyPattern,
|
||||
pub supply_value: SupplyValuePattern,
|
||||
pub utxo_count: Indexes3<StoredU64>,
|
||||
}
|
||||
|
||||
impl SupplyPattern2 {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
supply: SupplyPattern::new(client.clone(), &format!("{base_path}/supply")),
|
||||
supply_half: ActiveSupplyPattern::new(client.clone(), &format!("{base_path}/supply_half")),
|
||||
supply_half_value: ActiveSupplyPattern::new(client.clone(), &format!("{base_path}/supply_half_value")),
|
||||
supply_value: SupplyValuePattern::new(client.clone(), &format!("{base_path}/supply_value")),
|
||||
utxo_count: Indexes3::new(client.clone(), &format!("{base_path}/utxo_count")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct FeePattern2 {
|
||||
pub base: Indexes2<Sats>,
|
||||
@@ -1526,18 +1526,18 @@ impl UnclaimedRewardsPattern {
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct PricePaidPattern2 {
|
||||
pub max_price_paid: Indexes3<Dollars>,
|
||||
pub min_price_paid: Indexes3<Dollars>,
|
||||
pub price_percentiles: PricePercentilesPattern,
|
||||
pub struct ActiveSupplyPattern {
|
||||
pub bitcoin: Indexes3<Bitcoin>,
|
||||
pub dollars: Indexes3<Dollars>,
|
||||
pub sats: Indexes3<Sats>,
|
||||
}
|
||||
|
||||
impl PricePaidPattern2 {
|
||||
impl ActiveSupplyPattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
max_price_paid: Indexes3::new(client.clone(), &format!("{base_path}/max_price_paid")),
|
||||
min_price_paid: Indexes3::new(client.clone(), &format!("{base_path}/min_price_paid")),
|
||||
price_percentiles: PricePercentilesPattern::new(client.clone(), &format!("{base_path}/price_percentiles")),
|
||||
bitcoin: Indexes3::new(client.clone(), &format!("{base_path}/bitcoin")),
|
||||
dollars: Indexes3::new(client.clone(), &format!("{base_path}/dollars")),
|
||||
sats: Indexes3::new(client.clone(), &format!("{base_path}/sats")),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1560,18 +1560,18 @@ impl CoinbasePattern {
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct ActiveSupplyPattern {
|
||||
pub bitcoin: Indexes3<Bitcoin>,
|
||||
pub dollars: Indexes3<Dollars>,
|
||||
pub sats: Indexes3<Sats>,
|
||||
pub struct PricePaidPattern2 {
|
||||
pub max_price_paid: Indexes3<Dollars>,
|
||||
pub min_price_paid: Indexes3<Dollars>,
|
||||
pub price_percentiles: PricePercentilesPattern,
|
||||
}
|
||||
|
||||
impl ActiveSupplyPattern {
|
||||
impl PricePaidPattern2 {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
bitcoin: Indexes3::new(client.clone(), &format!("{base_path}/bitcoin")),
|
||||
dollars: Indexes3::new(client.clone(), &format!("{base_path}/dollars")),
|
||||
sats: Indexes3::new(client.clone(), &format!("{base_path}/sats")),
|
||||
max_price_paid: Indexes3::new(client.clone(), &format!("{base_path}/max_price_paid")),
|
||||
min_price_paid: Indexes3::new(client.clone(), &format!("{base_path}/min_price_paid")),
|
||||
price_percentiles: PricePercentilesPattern::new(client.clone(), &format!("{base_path}/price_percentiles")),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1593,6 +1593,21 @@ impl<T: DeserializeOwned> BlockCountPattern<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct SupplyValuePattern {
|
||||
pub bitcoin: Indexes2<Bitcoin>,
|
||||
pub dollars: Indexes2<Dollars>,
|
||||
}
|
||||
|
||||
impl SupplyValuePattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
bitcoin: Indexes2::new(client.clone(), &format!("{base_path}/bitcoin")),
|
||||
dollars: Indexes2::new(client.clone(), &format!("{base_path}/dollars")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct PricePaidPattern {
|
||||
pub max_price_paid: Indexes3<Dollars>,
|
||||
@@ -1624,21 +1639,6 @@ impl _1dReturns1mSdPattern {
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct SupplyValuePattern {
|
||||
pub bitcoin: Indexes2<Bitcoin>,
|
||||
pub dollars: Indexes2<Dollars>,
|
||||
}
|
||||
|
||||
impl SupplyValuePattern {
|
||||
pub fn new(client: Arc<BrkClientBase>, base_path: &str) -> Self {
|
||||
Self {
|
||||
bitcoin: Indexes2::new(client.clone(), &format!("{base_path}/bitcoin")),
|
||||
dollars: Indexes2::new(client.clone(), &format!("{base_path}/dollars")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Pattern struct for repeated tree structure.
|
||||
pub struct SatsPattern {
|
||||
pub cumulative: Indexes3<Sats>,
|
||||
|
||||
Reference in New Issue
Block a user