mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
16
Cargo.lock
generated
16
Cargo.lock
generated
@@ -1238,9 +1238,9 @@ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||
|
||||
[[package]]
|
||||
name = "fjall"
|
||||
version = "3.0.3"
|
||||
version = "3.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ce4b4c3a755bae832077657db2727b29b9acc535bb471c6d91ab4fe408fd805"
|
||||
checksum = "0ebf22b812878dcd767879cb19e03124fd62563dce6410f96538175fba0c132d"
|
||||
dependencies = [
|
||||
"byteorder-lite",
|
||||
"byteview",
|
||||
@@ -2020,9 +2020,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
|
||||
[[package]]
|
||||
name = "lsm-tree"
|
||||
version = "3.0.3"
|
||||
version = "3.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "341e13fa389d2e24023c2c2c110ae556b29fa59a2e734872de295863e11a6741"
|
||||
checksum = "e9bfd2a6ea0c1d430c13643002f35800a87f200fc8ac4827f18a2db9d9fd0644"
|
||||
dependencies = [
|
||||
"byteorder-lite",
|
||||
"byteview",
|
||||
@@ -3070,9 +3070,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "1.0.3+spec-1.1.0"
|
||||
version = "1.0.4+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7614eaf19ad818347db24addfa201729cf2a9b6fdfd9eb0ab870fcacc606c0c"
|
||||
checksum = "c94c3321114413476740df133f0d8862c61d87c8d26f04c6841e033c8c80db47"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde_core",
|
||||
@@ -3703,9 +3703,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.14"
|
||||
version = "0.7.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
|
||||
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
|
||||
|
||||
[[package]]
|
||||
name = "wio"
|
||||
|
||||
@@ -68,7 +68,7 @@ brk_website = { version = "0.1.9", path = "crates/brk_website" }
|
||||
byteview = "0.10.1"
|
||||
color-eyre = "0.6.5"
|
||||
derive_more = { version = "2.1.1", features = ["deref", "deref_mut"] }
|
||||
fjall = "3.0.3"
|
||||
fjall = "3.0.4"
|
||||
indexmap = { version = "2.13.0", features = ["serde"] }
|
||||
jiff = { version = "0.2.23", features = ["perf-inline", "tz-system"], default-features = false }
|
||||
minreq = { version = "2.14.1", features = ["https", "json-using-serde"] }
|
||||
|
||||
@@ -26,7 +26,7 @@ owo-colors = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
toml = "1.0.3"
|
||||
toml = "1.0.4"
|
||||
vecdb = { workspace = true }
|
||||
|
||||
[[bin]]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,8 +12,6 @@ use vecdb::{AnyStoredVec, Database, Exit, ReadableVec, Rw, StorageMode};
|
||||
|
||||
use crate::{blocks, distribution::DynCohortVecs, indexes, prices};
|
||||
|
||||
use crate::distribution::metrics::CohortMetricsBase;
|
||||
|
||||
use super::{super::traits::CohortVecs, vecs::AddressCohortVecs};
|
||||
|
||||
const VERSION: Version = Version::new(0);
|
||||
@@ -97,7 +95,6 @@ impl AddressCohorts {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
// 1. Compute addr_count_change_1m using rolling window
|
||||
self.par_iter_mut().try_for_each(|v| {
|
||||
v.addr_count_change_1m.height.compute_rolling_change(
|
||||
starting_indexes.height,
|
||||
@@ -107,18 +104,9 @@ impl AddressCohorts {
|
||||
)
|
||||
})?;
|
||||
|
||||
// 2. Compute all metrics except net_sentiment
|
||||
self.par_iter_mut()
|
||||
.try_for_each(|v| v.compute_rest_part1(blocks, prices, starting_indexes, exit))?;
|
||||
|
||||
// 3. Compute net_sentiment.height for aggregate cohorts (weighted average).
|
||||
// Separate cohorts already computed net_sentiment in step 2 (inside compute_rest_part1).
|
||||
self.for_each_aggregate(|vecs, sources| {
|
||||
let metrics: Vec<_> = sources.iter().map(|v| &v.metrics).collect();
|
||||
vecs.metrics
|
||||
.compute_net_sentiment_from_others(starting_indexes, &metrics, exit)
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -11,28 +11,24 @@ use crate::{
|
||||
blocks, distribution::state::AddressCohortState, indexes, internal::ComputedFromHeight, prices,
|
||||
};
|
||||
|
||||
use crate::distribution::metrics::{BasicCohortMetrics, CohortMetricsBase, ImportConfig};
|
||||
use crate::distribution::metrics::{CoreCohortMetrics, ImportConfig};
|
||||
|
||||
use super::super::traits::{CohortVecs, DynCohortVecs};
|
||||
#[derive(Traversable)]
|
||||
pub struct AddressCohortVecs<M: StorageMode = Rw> {
|
||||
/// Starting height when state was imported
|
||||
starting_height: Option<Height>,
|
||||
|
||||
/// Runtime state for block-by-block processing
|
||||
#[traversable(skip)]
|
||||
pub state: Option<Box<AddressCohortState>>,
|
||||
|
||||
/// Metric vectors
|
||||
#[traversable(flatten)]
|
||||
pub metrics: BasicCohortMetrics<M>,
|
||||
pub metrics: CoreCohortMetrics<M>,
|
||||
|
||||
pub addr_count: ComputedFromHeight<StoredU64, M>,
|
||||
pub addr_count_change_1m: ComputedFromHeight<StoredF64, M>,
|
||||
}
|
||||
|
||||
impl AddressCohortVecs {
|
||||
/// Import address cohort from database.
|
||||
pub(crate) fn forced_import(
|
||||
db: &Database,
|
||||
filter: Filter,
|
||||
@@ -56,7 +52,7 @@ impl AddressCohortVecs {
|
||||
|
||||
state: states_path.map(|path| Box::new(AddressCohortState::new(path, &full_name))),
|
||||
|
||||
metrics: BasicCohortMetrics::forced_import(&cfg)?,
|
||||
metrics: CoreCohortMetrics::forced_import(&cfg)?,
|
||||
|
||||
addr_count: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
@@ -73,20 +69,19 @@ impl AddressCohortVecs {
|
||||
})
|
||||
}
|
||||
|
||||
/// Reset starting height to zero.
|
||||
pub(crate) fn reset_starting_height(&mut self) {
|
||||
self.starting_height = Some(Height::ZERO);
|
||||
}
|
||||
|
||||
/// Returns a parallel iterator over all vecs for parallel writing.
|
||||
pub(crate) fn par_iter_vecs_mut(
|
||||
&mut self,
|
||||
) -> impl ParallelIterator<Item = &mut dyn AnyStoredVec> {
|
||||
rayon::iter::once(&mut self.addr_count.height as &mut dyn AnyStoredVec)
|
||||
.chain(self.metrics.par_iter_mut())
|
||||
let mut vecs: Vec<&mut dyn AnyStoredVec> = Vec::new();
|
||||
vecs.push(&mut self.addr_count.height as &mut dyn AnyStoredVec);
|
||||
vecs.extend(self.metrics.collect_all_vecs_mut());
|
||||
vecs.into_par_iter()
|
||||
}
|
||||
|
||||
/// Commit state to disk (separate from vec writes for parallelization).
|
||||
pub(crate) fn write_state(&mut self, height: Height, cleanup: bool) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.inner.write(height, cleanup)?;
|
||||
@@ -117,15 +112,10 @@ impl DynCohortVecs for AddressCohortVecs {
|
||||
}
|
||||
|
||||
fn import_state(&mut self, starting_height: Height) -> Result<Height> {
|
||||
// Import state from runtime state if present
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
// State files are saved AT height H, so to resume at H+1 we need to import at H
|
||||
// Decrement first, then increment result to match expected starting_height
|
||||
if let Some(mut prev_height) = starting_height.decremented() {
|
||||
// Import cost_basis_data state file (may adjust prev_height to actual file found)
|
||||
prev_height = state.inner.import_at_or_before(prev_height)?;
|
||||
|
||||
// Restore supply state from height-indexed vectors
|
||||
state.inner.supply.value = self
|
||||
.metrics
|
||||
.supply
|
||||
@@ -143,14 +133,12 @@ impl DynCohortVecs for AddressCohortVecs {
|
||||
.unwrap();
|
||||
state.addr_count = *self.addr_count.height.collect_one(prev_height).unwrap();
|
||||
|
||||
// Restore realized cap from persisted exact values
|
||||
state.inner.restore_realized_cap();
|
||||
|
||||
let result = prev_height.incremented();
|
||||
self.starting_height = Some(result);
|
||||
Ok(result)
|
||||
} else {
|
||||
// starting_height is 0, nothing to import
|
||||
self.starting_height = Some(Height::ZERO);
|
||||
Ok(Height::ZERO)
|
||||
}
|
||||
@@ -174,12 +162,22 @@ impl DynCohortVecs for AddressCohortVecs {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Push addr_count from state
|
||||
if let Some(state) = self.state.as_ref() {
|
||||
self.addr_count
|
||||
.height
|
||||
.truncate_push(height, state.addr_count.into())?;
|
||||
self.metrics.truncate_push(height, &state.inner)?;
|
||||
self.metrics
|
||||
.supply
|
||||
.truncate_push(height, state.inner.supply.value)?;
|
||||
self.metrics
|
||||
.outputs
|
||||
.truncate_push(height, state.inner.supply.utxo_count)?;
|
||||
self.metrics
|
||||
.activity
|
||||
.truncate_push(height, state.inner.sent)?;
|
||||
self.metrics
|
||||
.realized
|
||||
.truncate_push(height, &state.inner.realized)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -189,15 +187,14 @@ impl DynCohortVecs for AddressCohortVecs {
|
||||
&mut self,
|
||||
height: Height,
|
||||
height_price: Cents,
|
||||
is_day_boundary: bool,
|
||||
_is_day_boundary: bool,
|
||||
) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
self.metrics.compute_then_truncate_push_unrealized_states(
|
||||
height,
|
||||
height_price,
|
||||
&mut state.inner,
|
||||
is_day_boundary,
|
||||
)?;
|
||||
state.inner.apply_pending();
|
||||
let unrealized_state = state.inner.compute_unrealized_state(height_price);
|
||||
self.metrics
|
||||
.unrealized
|
||||
.truncate_push(height, &unrealized_state)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -210,14 +207,7 @@ impl DynCohortVecs for AddressCohortVecs {
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.metrics
|
||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)?;
|
||||
// Separate cohorts (with state) compute net_sentiment = greed - pain directly.
|
||||
// Aggregate cohorts get it via weighted average in groups.rs.
|
||||
if self.state.is_some() {
|
||||
self.metrics
|
||||
.compute_net_sentiment_height(starting_indexes, exit)?;
|
||||
}
|
||||
Ok(())
|
||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)
|
||||
}
|
||||
|
||||
fn write_state(&mut self, height: Height, cleanup: bool) -> Result<()> {
|
||||
@@ -257,7 +247,7 @@ impl CohortVecs for AddressCohortVecs {
|
||||
.as_slice(),
|
||||
exit,
|
||||
)?;
|
||||
self.metrics.compute_from_stateful(
|
||||
self.metrics.compute_from_sources(
|
||||
starting_indexes,
|
||||
&others.iter().map(|v| &v.metrics).collect::<Vec<_>>(),
|
||||
exit,
|
||||
|
||||
@@ -13,8 +13,9 @@ use vecdb::{AnyStoredVec, Database, Exit, ReadOnlyClone, ReadableVec, Rw, Storag
|
||||
use crate::{blocks, distribution::DynCohortVecs, indexes, prices};
|
||||
|
||||
use crate::distribution::metrics::{
|
||||
AdjustedCohortMetrics, AllCohortMetrics, BasicCohortMetrics, CohortMetricsBase,
|
||||
ExtendedAdjustedCohortMetrics, ExtendedCohortMetrics, ImportConfig, SupplyMetrics,
|
||||
AllCohortMetrics, BasicCohortMetrics, CohortMetricsBase, CompleteCohortMetrics,
|
||||
CoreCohortMetrics, ExtendedAdjustedCohortMetrics, ExtendedCohortMetrics, ImportConfig,
|
||||
MinimalCohortMetrics, SupplyMetrics,
|
||||
};
|
||||
|
||||
use super::{percentiles::PercentileCache, vecs::UTXOCohortVecs};
|
||||
@@ -38,15 +39,15 @@ pub struct UTXOCohorts<M: StorageMode = Rw> {
|
||||
pub all: UTXOCohortVecs<AllCohortMetrics<M>>,
|
||||
pub sth: UTXOCohortVecs<ExtendedAdjustedCohortMetrics<M>>,
|
||||
pub lth: UTXOCohortVecs<ExtendedCohortMetrics<M>>,
|
||||
pub age_range: ByAgeRange<UTXOCohortVecs<ExtendedCohortMetrics<M>>>,
|
||||
pub max_age: ByMaxAge<UTXOCohortVecs<AdjustedCohortMetrics<M>>>,
|
||||
pub min_age: ByMinAge<UTXOCohortVecs<BasicCohortMetrics<M>>>,
|
||||
pub ge_amount: ByGreatEqualAmount<UTXOCohortVecs<BasicCohortMetrics<M>>>,
|
||||
pub amount_range: ByAmountRange<UTXOCohortVecs<BasicCohortMetrics<M>>>,
|
||||
pub lt_amount: ByLowerThanAmount<UTXOCohortVecs<BasicCohortMetrics<M>>>,
|
||||
pub epoch: ByEpoch<UTXOCohortVecs<BasicCohortMetrics<M>>>,
|
||||
pub class: ByClass<UTXOCohortVecs<BasicCohortMetrics<M>>>,
|
||||
pub type_: BySpendableType<UTXOCohortVecs<BasicCohortMetrics<M>>>,
|
||||
pub age_range: ByAgeRange<UTXOCohortVecs<BasicCohortMetrics<M>>>,
|
||||
pub max_age: ByMaxAge<UTXOCohortVecs<CompleteCohortMetrics<M>>>,
|
||||
pub min_age: ByMinAge<UTXOCohortVecs<CompleteCohortMetrics<M>>>,
|
||||
pub ge_amount: ByGreatEqualAmount<UTXOCohortVecs<CoreCohortMetrics<M>>>,
|
||||
pub amount_range: ByAmountRange<UTXOCohortVecs<CoreCohortMetrics<M>>>,
|
||||
pub lt_amount: ByLowerThanAmount<UTXOCohortVecs<CoreCohortMetrics<M>>>,
|
||||
pub epoch: ByEpoch<UTXOCohortVecs<CoreCohortMetrics<M>>>,
|
||||
pub class: ByClass<UTXOCohortVecs<CoreCohortMetrics<M>>>,
|
||||
pub type_: BySpendableType<UTXOCohortVecs<MinimalCohortMetrics<M>>>,
|
||||
#[traversable(skip)]
|
||||
pub(super) percentile_cache: PercentileCache,
|
||||
/// Cached partition_point positions for tick_tock boundary searches.
|
||||
@@ -83,25 +84,6 @@ impl UTXOCohorts<Rw> {
|
||||
|
||||
// Phase 2: Import separate (stateful) cohorts.
|
||||
|
||||
// age_range: ExtendedCohortMetrics with full state
|
||||
let age_range = {
|
||||
ByAgeRange::try_new(&|f: Filter, name: &'static str| -> Result<_> {
|
||||
let full_name = CohortContext::Utxo.full_name(&f, name);
|
||||
let cfg = ImportConfig {
|
||||
db,
|
||||
filter: &f,
|
||||
full_name: &full_name,
|
||||
version: v,
|
||||
indexes,
|
||||
};
|
||||
let state = Some(Box::new(UTXOCohortState::new(states_path, &full_name)));
|
||||
Ok(UTXOCohortVecs::new(
|
||||
state,
|
||||
ExtendedCohortMetrics::forced_import(&cfg)?,
|
||||
))
|
||||
})?
|
||||
};
|
||||
|
||||
// Helper for separate cohorts with BasicCohortMetrics + full state
|
||||
let basic_separate =
|
||||
|f: Filter, name: &'static str| -> Result<UTXOCohortVecs<BasicCohortMetrics>> {
|
||||
@@ -120,10 +102,46 @@ impl UTXOCohorts<Rw> {
|
||||
))
|
||||
};
|
||||
|
||||
let amount_range = ByAmountRange::try_new(&basic_separate)?;
|
||||
let epoch = ByEpoch::try_new(&basic_separate)?;
|
||||
let class = ByClass::try_new(&basic_separate)?;
|
||||
let type_ = BySpendableType::try_new(&basic_separate)?;
|
||||
let age_range = ByAgeRange::try_new(&basic_separate)?;
|
||||
|
||||
let core_separate =
|
||||
|f: Filter, name: &'static str| -> Result<UTXOCohortVecs<CoreCohortMetrics>> {
|
||||
let full_name = CohortContext::Utxo.full_name(&f, name);
|
||||
let cfg = ImportConfig {
|
||||
db,
|
||||
filter: &f,
|
||||
full_name: &full_name,
|
||||
version: v,
|
||||
indexes,
|
||||
};
|
||||
let state = Some(Box::new(UTXOCohortState::new(states_path, &full_name)));
|
||||
Ok(UTXOCohortVecs::new(
|
||||
state,
|
||||
CoreCohortMetrics::forced_import(&cfg)?,
|
||||
))
|
||||
};
|
||||
|
||||
let amount_range = ByAmountRange::try_new(&core_separate)?;
|
||||
let epoch = ByEpoch::try_new(&core_separate)?;
|
||||
let class = ByClass::try_new(&core_separate)?;
|
||||
|
||||
let type_ = BySpendableType::try_new(
|
||||
&|f: Filter, name: &'static str| -> Result<UTXOCohortVecs<MinimalCohortMetrics>> {
|
||||
let full_name = CohortContext::Utxo.full_name(&f, name);
|
||||
let cfg = ImportConfig {
|
||||
db,
|
||||
filter: &f,
|
||||
full_name: &full_name,
|
||||
version: v,
|
||||
indexes,
|
||||
};
|
||||
let state = Some(Box::new(UTXOCohortState::new(states_path, &full_name)));
|
||||
Ok(UTXOCohortVecs::new(
|
||||
state,
|
||||
MinimalCohortMetrics::forced_import(&cfg)?,
|
||||
))
|
||||
},
|
||||
)?;
|
||||
|
||||
// Phase 3: Import "all" cohort with pre-imported supply.
|
||||
let all = UTXOCohortVecs::new(
|
||||
@@ -161,7 +179,7 @@ impl UTXOCohorts<Rw> {
|
||||
UTXOCohortVecs::new(None, ExtendedCohortMetrics::forced_import(&cfg)?)
|
||||
};
|
||||
|
||||
// max_age: AdjustedCohortMetrics (adjusted + peak_regret)
|
||||
// max_age: CompleteCohortMetrics (no state, aggregates from age_range)
|
||||
let max_age = {
|
||||
ByMaxAge::try_new(&|f: Filter, name: &'static str| -> Result<_> {
|
||||
let full_name = CohortContext::Utxo.full_name(&f, name);
|
||||
@@ -174,12 +192,12 @@ impl UTXOCohorts<Rw> {
|
||||
};
|
||||
Ok(UTXOCohortVecs::new(
|
||||
None,
|
||||
AdjustedCohortMetrics::forced_import(&cfg)?,
|
||||
CompleteCohortMetrics::forced_import(&cfg)?,
|
||||
))
|
||||
})?
|
||||
};
|
||||
|
||||
// min_age: BasicCohortMetrics
|
||||
// min_age: CompleteCohortMetrics
|
||||
let min_age = {
|
||||
ByMinAge::try_new(&|f: Filter, name: &'static str| -> Result<_> {
|
||||
let full_name = CohortContext::Utxo.full_name(&f, name);
|
||||
@@ -192,14 +210,14 @@ impl UTXOCohorts<Rw> {
|
||||
};
|
||||
Ok(UTXOCohortVecs::new(
|
||||
None,
|
||||
BasicCohortMetrics::forced_import(&cfg)?,
|
||||
CompleteCohortMetrics::forced_import(&cfg)?,
|
||||
))
|
||||
})?
|
||||
};
|
||||
|
||||
// ge_amount, lt_amount: BasicCohortMetrics (no state)
|
||||
let basic_no_state =
|
||||
|f: Filter, name: &'static str| -> Result<UTXOCohortVecs<BasicCohortMetrics>> {
|
||||
// ge_amount, lt_amount: CoreCohortMetrics (no state)
|
||||
let core_no_state =
|
||||
|f: Filter, name: &'static str| -> Result<UTXOCohortVecs<CoreCohortMetrics>> {
|
||||
let full_name = CohortContext::Utxo.full_name(&f, name);
|
||||
let cfg = ImportConfig {
|
||||
db,
|
||||
@@ -210,12 +228,12 @@ impl UTXOCohorts<Rw> {
|
||||
};
|
||||
Ok(UTXOCohortVecs::new(
|
||||
None,
|
||||
BasicCohortMetrics::forced_import(&cfg)?,
|
||||
CoreCohortMetrics::forced_import(&cfg)?,
|
||||
))
|
||||
};
|
||||
|
||||
let lt_amount = ByLowerThanAmount::try_new(&basic_no_state)?;
|
||||
let ge_amount = ByGreatEqualAmount::try_new(&basic_no_state)?;
|
||||
let lt_amount = ByLowerThanAmount::try_new(&core_no_state)?;
|
||||
let ge_amount = ByGreatEqualAmount::try_new(&core_no_state)?;
|
||||
|
||||
Ok(Self {
|
||||
all,
|
||||
@@ -295,20 +313,20 @@ impl UTXOCohorts<Rw> {
|
||||
}),
|
||||
Box::new(|| {
|
||||
min_age.par_iter_mut().try_for_each(|vecs| {
|
||||
let sources = filter_sources_from(ar.iter(), Some(vecs.metrics.filter()));
|
||||
vecs.metrics.compute_base_from_others(si, &sources, exit)
|
||||
let sources = filter_sources_from(ar.iter(), Some(&vecs.metrics.filter));
|
||||
vecs.metrics.compute_from_sources(si, &sources, exit)
|
||||
})
|
||||
}),
|
||||
Box::new(|| {
|
||||
max_age.par_iter_mut().try_for_each(|vecs| {
|
||||
let sources = filter_sources_from(ar.iter(), Some(vecs.metrics.filter()));
|
||||
vecs.metrics.compute_base_from_others(si, &sources, exit)
|
||||
let sources = filter_sources_from(ar.iter(), Some(&vecs.metrics.filter));
|
||||
vecs.metrics.compute_from_sources(si, &sources, exit)
|
||||
})
|
||||
}),
|
||||
Box::new(|| {
|
||||
ge_amount.par_iter_mut().chain(lt_amount.par_iter_mut()).try_for_each(|vecs| {
|
||||
let sources = filter_sources_from(amr.iter(), Some(vecs.metrics.filter()));
|
||||
vecs.metrics.compute_base_from_others(si, &sources, exit)
|
||||
let sources = filter_core_sources_from(amr.iter(), Some(&vecs.metrics.filter));
|
||||
vecs.metrics.compute_from_sources(si, &sources, exit)
|
||||
})
|
||||
}),
|
||||
];
|
||||
@@ -366,15 +384,15 @@ impl UTXOCohorts<Rw> {
|
||||
|
||||
// 2. Compute net_sentiment.height for aggregate cohorts (weighted average).
|
||||
// Separate cohorts already computed net_sentiment in step 1 (inside compute_rest_part1).
|
||||
// Note: min_age, max_age, epoch, class are Complete tier — no net_sentiment.
|
||||
// Note: ge_amount, lt_amount, amount_range are Core tier — no net_sentiment.
|
||||
{
|
||||
let Self {
|
||||
all, sth, lth, age_range, max_age, min_age,
|
||||
ge_amount, amount_range, lt_amount,
|
||||
all, sth, lth, age_range,
|
||||
..
|
||||
} = self;
|
||||
|
||||
let ar = &*age_range;
|
||||
let amr = &*amount_range;
|
||||
let si = starting_indexes;
|
||||
|
||||
let tasks: Vec<Box<dyn FnOnce() -> Result<()> + Send + '_>> = vec![
|
||||
@@ -390,24 +408,6 @@ impl UTXOCohorts<Rw> {
|
||||
let sources = filter_sources_from(ar.iter(), Some(lth.metrics.filter()));
|
||||
lth.metrics.compute_net_sentiment_from_others_dyn(si, &sources, exit)
|
||||
}),
|
||||
Box::new(|| {
|
||||
min_age.par_iter_mut().try_for_each(|vecs| {
|
||||
let sources = filter_sources_from(ar.iter(), Some(vecs.metrics.filter()));
|
||||
vecs.metrics.compute_net_sentiment_from_others_dyn(si, &sources, exit)
|
||||
})
|
||||
}),
|
||||
Box::new(|| {
|
||||
max_age.par_iter_mut().try_for_each(|vecs| {
|
||||
let sources = filter_sources_from(ar.iter(), Some(vecs.metrics.filter()));
|
||||
vecs.metrics.compute_net_sentiment_from_others_dyn(si, &sources, exit)
|
||||
})
|
||||
}),
|
||||
Box::new(|| {
|
||||
ge_amount.par_iter_mut().chain(lt_amount.par_iter_mut()).try_for_each(|vecs| {
|
||||
let sources = filter_sources_from(amr.iter(), Some(vecs.metrics.filter()));
|
||||
vecs.metrics.compute_net_sentiment_from_others_dyn(si, &sources, exit)
|
||||
})
|
||||
}),
|
||||
];
|
||||
|
||||
tasks
|
||||
@@ -479,14 +479,14 @@ impl UTXOCohorts<Rw> {
|
||||
Box::new(|| sth.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, vc, vd, ss, exit)),
|
||||
Box::new(|| lth.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit)),
|
||||
Box::new(|| age_range.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit))),
|
||||
Box::new(|| max_age.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, vc, vd, ss, exit))),
|
||||
Box::new(|| max_age.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit))),
|
||||
Box::new(|| min_age.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit))),
|
||||
Box::new(|| ge_amount.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit))),
|
||||
Box::new(|| epoch.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit))),
|
||||
Box::new(|| class.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit))),
|
||||
Box::new(|| amount_range.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit))),
|
||||
Box::new(|| lt_amount.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit))),
|
||||
Box::new(|| type_.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(blocks, prices, starting_indexes, height_to_market_cap, ss, exit))),
|
||||
Box::new(|| type_.par_iter_mut().try_for_each(|v| v.metrics.compute_rest_part2(prices, starting_indexes, exit))),
|
||||
];
|
||||
|
||||
tasks
|
||||
@@ -613,3 +613,17 @@ fn filter_sources_from<'a, M: CohortMetricsBase + 'a>(
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Filter CoreCohortMetrics source cohorts by an optional filter.
|
||||
fn filter_core_sources_from<'a>(
|
||||
sources: impl Iterator<Item = &'a UTXOCohortVecs<CoreCohortMetrics>>,
|
||||
filter: Option<&Filter>,
|
||||
) -> Vec<&'a CoreCohortMetrics> {
|
||||
match filter {
|
||||
Some(f) => sources
|
||||
.filter(|v| f.includes(&v.metrics.filter))
|
||||
.map(|v| &v.metrics)
|
||||
.collect(),
|
||||
None => sources.map(|v| &v.metrics).collect(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use vecdb::{Exit, ReadableVec};
|
||||
|
||||
use crate::{blocks, distribution::state::UTXOCohortState, prices};
|
||||
|
||||
use crate::distribution::metrics::CohortMetricsBase;
|
||||
use crate::distribution::metrics::{CohortMetricsBase, CompleteCohortMetrics, CoreCohortMetrics, MinimalCohortMetrics};
|
||||
|
||||
use super::super::traits::DynCohortVecs;
|
||||
|
||||
@@ -161,3 +161,391 @@ impl<Metrics: CohortMetricsBase + Traversable> DynCohortVecs for UTXOCohortVecs<
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Filtered for UTXOCohortVecs<MinimalCohortMetrics> {
|
||||
fn filter(&self) -> &Filter {
|
||||
&self.metrics.filter
|
||||
}
|
||||
}
|
||||
|
||||
impl DynCohortVecs for UTXOCohortVecs<MinimalCohortMetrics> {
|
||||
fn min_stateful_height_len(&self) -> usize {
|
||||
self.metrics.min_stateful_height_len()
|
||||
}
|
||||
|
||||
fn reset_state_starting_height(&mut self) {
|
||||
self.state_starting_height = Some(Height::ZERO);
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.reset();
|
||||
}
|
||||
}
|
||||
|
||||
fn import_state(&mut self, starting_height: Height) -> Result<Height> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
if let Some(mut prev_height) = starting_height.decremented() {
|
||||
prev_height = state.import_at_or_before(prev_height)?;
|
||||
|
||||
state.supply.value = self
|
||||
.metrics
|
||||
.supply
|
||||
.total
|
||||
.sats
|
||||
.height
|
||||
.collect_one(prev_height)
|
||||
.unwrap();
|
||||
state.supply.utxo_count = *self
|
||||
.metrics
|
||||
.outputs
|
||||
.utxo_count
|
||||
.height
|
||||
.collect_one(prev_height)
|
||||
.unwrap();
|
||||
|
||||
state.restore_realized_cap();
|
||||
|
||||
let result = prev_height.incremented();
|
||||
self.state_starting_height = Some(result);
|
||||
Ok(result)
|
||||
} else {
|
||||
self.state_starting_height = Some(Height::ZERO);
|
||||
Ok(Height::ZERO)
|
||||
}
|
||||
} else {
|
||||
self.state_starting_height = Some(starting_height);
|
||||
Ok(starting_height)
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> {
|
||||
self.metrics.validate_computed_versions(base_version)
|
||||
}
|
||||
|
||||
fn truncate_push(&mut self, height: Height) -> Result<()> {
|
||||
if self.state_starting_height.is_some_and(|h| h > height) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let Some(state) = self.state.as_ref() {
|
||||
self.metrics
|
||||
.supply
|
||||
.truncate_push(height, state.supply.value)?;
|
||||
self.metrics
|
||||
.outputs
|
||||
.truncate_push(height, state.supply.utxo_count)?;
|
||||
self.metrics
|
||||
.realized
|
||||
.truncate_push(height, state.realized.cap())?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn compute_then_truncate_push_unrealized_states(
|
||||
&mut self,
|
||||
height: Height,
|
||||
height_price: Cents,
|
||||
_is_day_boundary: bool,
|
||||
) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.apply_pending();
|
||||
let unrealized_state = state.compute_unrealized_state(height_price);
|
||||
self.metrics
|
||||
.unrealized
|
||||
.truncate_push(height, &unrealized_state)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn compute_rest_part1(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.metrics
|
||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)
|
||||
}
|
||||
|
||||
fn write_state(&mut self, height: Height, cleanup: bool) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.write(height, cleanup)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset_cost_basis_data_if_needed(&mut self) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.reset_cost_basis_data_if_needed()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset_single_iteration_values(&mut self) {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.reset_single_iteration_values();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Filtered for UTXOCohortVecs<CoreCohortMetrics> {
|
||||
fn filter(&self) -> &Filter {
|
||||
&self.metrics.filter
|
||||
}
|
||||
}
|
||||
|
||||
impl DynCohortVecs for UTXOCohortVecs<CoreCohortMetrics> {
|
||||
fn min_stateful_height_len(&self) -> usize {
|
||||
self.metrics.min_stateful_height_len()
|
||||
}
|
||||
|
||||
fn reset_state_starting_height(&mut self) {
|
||||
self.state_starting_height = Some(Height::ZERO);
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.reset();
|
||||
}
|
||||
}
|
||||
|
||||
fn import_state(&mut self, starting_height: Height) -> Result<Height> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
if let Some(mut prev_height) = starting_height.decremented() {
|
||||
prev_height = state.import_at_or_before(prev_height)?;
|
||||
|
||||
state.supply.value = self
|
||||
.metrics
|
||||
.supply
|
||||
.total
|
||||
.sats
|
||||
.height
|
||||
.collect_one(prev_height)
|
||||
.unwrap();
|
||||
state.supply.utxo_count = *self
|
||||
.metrics
|
||||
.outputs
|
||||
.utxo_count
|
||||
.height
|
||||
.collect_one(prev_height)
|
||||
.unwrap();
|
||||
|
||||
state.restore_realized_cap();
|
||||
|
||||
let result = prev_height.incremented();
|
||||
self.state_starting_height = Some(result);
|
||||
Ok(result)
|
||||
} else {
|
||||
self.state_starting_height = Some(Height::ZERO);
|
||||
Ok(Height::ZERO)
|
||||
}
|
||||
} else {
|
||||
self.state_starting_height = Some(starting_height);
|
||||
Ok(starting_height)
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> {
|
||||
self.metrics.validate_computed_versions(base_version)
|
||||
}
|
||||
|
||||
fn truncate_push(&mut self, height: Height) -> Result<()> {
|
||||
if self.state_starting_height.is_some_and(|h| h > height) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let Some(state) = self.state.as_ref() {
|
||||
self.metrics
|
||||
.supply
|
||||
.truncate_push(height, state.supply.value)?;
|
||||
self.metrics
|
||||
.outputs
|
||||
.truncate_push(height, state.supply.utxo_count)?;
|
||||
self.metrics.activity.truncate_push(height, state.sent)?;
|
||||
self.metrics
|
||||
.realized
|
||||
.truncate_push(height, &state.realized)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn compute_then_truncate_push_unrealized_states(
|
||||
&mut self,
|
||||
height: Height,
|
||||
height_price: Cents,
|
||||
_is_day_boundary: bool,
|
||||
) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.apply_pending();
|
||||
let unrealized_state = state.compute_unrealized_state(height_price);
|
||||
self.metrics
|
||||
.unrealized
|
||||
.truncate_push(height, &unrealized_state)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn compute_rest_part1(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.metrics
|
||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)
|
||||
}
|
||||
|
||||
fn write_state(&mut self, height: Height, cleanup: bool) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.write(height, cleanup)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset_cost_basis_data_if_needed(&mut self) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.reset_cost_basis_data_if_needed()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset_single_iteration_values(&mut self) {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.reset_single_iteration_values();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Filtered for UTXOCohortVecs<CompleteCohortMetrics> {
|
||||
fn filter(&self) -> &Filter {
|
||||
&self.metrics.filter
|
||||
}
|
||||
}
|
||||
|
||||
impl DynCohortVecs for UTXOCohortVecs<CompleteCohortMetrics> {
|
||||
fn min_stateful_height_len(&self) -> usize {
|
||||
self.metrics.min_stateful_height_len()
|
||||
}
|
||||
|
||||
fn reset_state_starting_height(&mut self) {
|
||||
self.state_starting_height = Some(Height::ZERO);
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.reset();
|
||||
}
|
||||
}
|
||||
|
||||
fn import_state(&mut self, starting_height: Height) -> Result<Height> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
if let Some(mut prev_height) = starting_height.decremented() {
|
||||
prev_height = state.import_at_or_before(prev_height)?;
|
||||
|
||||
state.supply.value = self
|
||||
.metrics
|
||||
.supply
|
||||
.total
|
||||
.sats
|
||||
.height
|
||||
.collect_one(prev_height)
|
||||
.unwrap();
|
||||
state.supply.utxo_count = *self
|
||||
.metrics
|
||||
.outputs
|
||||
.utxo_count
|
||||
.height
|
||||
.collect_one(prev_height)
|
||||
.unwrap();
|
||||
|
||||
state.restore_realized_cap();
|
||||
|
||||
let result = prev_height.incremented();
|
||||
self.state_starting_height = Some(result);
|
||||
Ok(result)
|
||||
} else {
|
||||
self.state_starting_height = Some(Height::ZERO);
|
||||
Ok(Height::ZERO)
|
||||
}
|
||||
} else {
|
||||
self.state_starting_height = Some(starting_height);
|
||||
Ok(starting_height)
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> {
|
||||
self.metrics.validate_computed_versions(base_version)
|
||||
}
|
||||
|
||||
fn truncate_push(&mut self, height: Height) -> Result<()> {
|
||||
if self.state_starting_height.is_some_and(|h| h > height) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let Some(state) = self.state.as_ref() {
|
||||
self.metrics
|
||||
.supply
|
||||
.truncate_push(height, state.supply.value)?;
|
||||
self.metrics
|
||||
.outputs
|
||||
.truncate_push(height, state.supply.utxo_count)?;
|
||||
self.metrics.activity.truncate_push(
|
||||
height,
|
||||
state.sent,
|
||||
state.satblocks_destroyed,
|
||||
state.satdays_destroyed,
|
||||
)?;
|
||||
self.metrics
|
||||
.realized
|
||||
.truncate_push(height, &state.realized)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn compute_then_truncate_push_unrealized_states(
|
||||
&mut self,
|
||||
height: Height,
|
||||
height_price: Cents,
|
||||
_is_day_boundary: bool,
|
||||
) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.apply_pending();
|
||||
self.metrics
|
||||
.cost_basis
|
||||
.truncate_push_minmax(height, state)?;
|
||||
let unrealized_state = state.compute_unrealized_state(height_price);
|
||||
self.metrics
|
||||
.unrealized
|
||||
.truncate_push(height, &unrealized_state)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn compute_rest_part1(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.metrics
|
||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)
|
||||
}
|
||||
|
||||
fn write_state(&mut self, height: Height, cleanup: bool) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.write(height, cleanup)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset_cost_basis_data_if_needed(&mut self) -> Result<()> {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.reset_cost_basis_data_if_needed()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset_single_iteration_values(&mut self) {
|
||||
if let Some(state) = self.state.as_mut() {
|
||||
state.reset_single_iteration_values();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +1,44 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{Bitcoin, Height, Indexes, Sats, StoredF64, Version};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use rayon::prelude::*;
|
||||
use vecdb::{AnyStoredVec, AnyVec, Exit, Rw, StorageMode, WritableVec};
|
||||
|
||||
use crate::{
|
||||
blocks,
|
||||
internal::{ComputedFromHeightCumulativeSum, RollingEmas2w, ValueFromHeightCumulative},
|
||||
};
|
||||
use crate::internal::ComputedFromHeightCumulativeSum;
|
||||
|
||||
use super::ImportConfig;
|
||||
use crate::{blocks, distribution::metrics::ImportConfig, prices};
|
||||
|
||||
/// Activity metrics for a cohort.
|
||||
#[derive(Traversable)]
|
||||
use super::CoreActivity;
|
||||
|
||||
#[derive(Deref, DerefMut, Traversable)]
|
||||
pub struct ActivityMetrics<M: StorageMode = Rw> {
|
||||
/// Total satoshis sent at each height + derived indexes
|
||||
pub sent: ValueFromHeightCumulative<M>,
|
||||
#[deref]
|
||||
#[deref_mut]
|
||||
#[traversable(flatten)]
|
||||
pub core: CoreActivity<M>,
|
||||
|
||||
/// 14-day EMA of sent supply (sats, btc, usd)
|
||||
pub sent_ema: RollingEmas2w<M>,
|
||||
|
||||
/// Coin-blocks destroyed (in BTC)
|
||||
pub coinblocks_destroyed: ComputedFromHeightCumulativeSum<StoredF64, M>,
|
||||
|
||||
/// Coin-days destroyed (in BTC)
|
||||
pub coindays_destroyed: ComputedFromHeightCumulativeSum<StoredF64, M>,
|
||||
}
|
||||
|
||||
impl ActivityMetrics {
|
||||
/// Import activity metrics from database.
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
sent: cfg.import_value_cumulative("sent", Version::ZERO)?,
|
||||
sent_ema: cfg.import_emas_2w("sent", Version::ZERO)?,
|
||||
|
||||
core: CoreActivity::forced_import(cfg)?,
|
||||
coinblocks_destroyed: cfg
|
||||
.import_cumulative_sum("coinblocks_destroyed", Version::ONE)?,
|
||||
coindays_destroyed: cfg.import_cumulative_sum("coindays_destroyed", Version::ONE)?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Get minimum length across height-indexed vectors.
|
||||
pub(crate) fn min_len(&self) -> usize {
|
||||
self.sent
|
||||
.base
|
||||
.sats
|
||||
.height
|
||||
.len()
|
||||
self.core
|
||||
.min_len()
|
||||
.min(self.coinblocks_destroyed.height.len())
|
||||
.min(self.coindays_destroyed.height.len())
|
||||
}
|
||||
|
||||
/// Push activity state values to height-indexed vectors.
|
||||
pub(crate) fn truncate_push(
|
||||
&mut self,
|
||||
height: Height,
|
||||
@@ -59,7 +46,7 @@ impl ActivityMetrics {
|
||||
satblocks_destroyed: Sats,
|
||||
satdays_destroyed: Sats,
|
||||
) -> Result<()> {
|
||||
self.sent.base.sats.height.truncate_push(height, sent)?;
|
||||
self.core.truncate_push(height, sent)?;
|
||||
self.coinblocks_destroyed.height.truncate_push(
|
||||
height,
|
||||
StoredF64::from(Bitcoin::from(satblocks_destroyed)),
|
||||
@@ -71,29 +58,29 @@ impl ActivityMetrics {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Returns a parallel iterator over all vecs for parallel writing.
|
||||
pub(crate) fn par_iter_mut(&mut self) -> impl ParallelIterator<Item = &mut dyn AnyStoredVec> {
|
||||
vec![
|
||||
&mut self.sent.base.sats.height as &mut dyn AnyStoredVec,
|
||||
&mut self.core.sent.base.sats.height as &mut dyn AnyStoredVec,
|
||||
&mut self.coinblocks_destroyed.height as &mut dyn AnyStoredVec,
|
||||
&mut self.coindays_destroyed.height as &mut dyn AnyStoredVec,
|
||||
]
|
||||
.into_par_iter()
|
||||
}
|
||||
|
||||
/// Validate computed versions against base version.
|
||||
pub(crate) fn validate_computed_versions(&mut self, _base_version: Version) -> Result<()> {
|
||||
// Validation logic for computed vecs
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Compute aggregate values from separate cohorts.
|
||||
pub(crate) fn compute_from_stateful(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
others: &[&Self],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
let core_refs: Vec<&CoreActivity> = others.iter().map(|o| &o.core).collect();
|
||||
self.core
|
||||
.compute_from_stateful(starting_indexes, &core_refs, exit)?;
|
||||
|
||||
macro_rules! sum_others {
|
||||
($($field:tt).+) => {
|
||||
self.$($field).+.compute_sum_of_others(
|
||||
@@ -104,29 +91,22 @@ impl ActivityMetrics {
|
||||
};
|
||||
}
|
||||
|
||||
sum_others!(sent.base.sats.height);
|
||||
sum_others!(coinblocks_destroyed.height);
|
||||
sum_others!(coindays_destroyed.height);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// First phase of computed metrics (indexes from height).
|
||||
pub(crate) fn compute_rest_part1(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
let window_starts = blocks.count.window_starts();
|
||||
self.core
|
||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)?;
|
||||
|
||||
// 14-day EMA of sent (sats and dollars)
|
||||
self.sent_ema.compute(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_2w_ago,
|
||||
&self.sent.base.sats.height,
|
||||
&self.sent.base.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
let window_starts = blocks.count.window_starts();
|
||||
|
||||
self.coinblocks_destroyed
|
||||
.compute_rest(starting_indexes.height, &window_starts, exit)?;
|
||||
@@ -0,0 +1,79 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{Height, Indexes, Sats, Version};
|
||||
use rayon::prelude::*;
|
||||
use vecdb::{AnyStoredVec, AnyVec, Exit, Rw, StorageMode, WritableVec};
|
||||
|
||||
use crate::internal::{RollingEmas2w, ValueFromHeightCumulative};
|
||||
|
||||
use crate::{blocks, distribution::metrics::ImportConfig, prices};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct CoreActivity<M: StorageMode = Rw> {
|
||||
pub sent: ValueFromHeightCumulative<M>,
|
||||
pub sent_ema: RollingEmas2w<M>,
|
||||
}
|
||||
|
||||
impl CoreActivity {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
sent: cfg.import_value_cumulative("sent", Version::ZERO)?,
|
||||
sent_ema: cfg.import_emas_2w("sent", Version::ZERO)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_len(&self) -> usize {
|
||||
self.sent.base.sats.height.len()
|
||||
}
|
||||
|
||||
pub(crate) fn truncate_push(&mut self, height: Height, sent: Sats) -> Result<()> {
|
||||
self.sent.base.sats.height.truncate_push(height, sent)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn par_iter_mut(&mut self) -> impl ParallelIterator<Item = &mut dyn AnyStoredVec> {
|
||||
vec![&mut self.sent.base.sats.height as &mut dyn AnyStoredVec].into_par_iter()
|
||||
}
|
||||
|
||||
pub(crate) fn validate_computed_versions(&mut self, _base_version: Version) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn compute_from_stateful(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
others: &[&Self],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.sent.base.sats.height.compute_sum_of_others(
|
||||
starting_indexes.height,
|
||||
&others
|
||||
.iter()
|
||||
.map(|v| &v.sent.base.sats.height)
|
||||
.collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest_part1(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.sent
|
||||
.compute(prices, starting_indexes.height, exit)?;
|
||||
|
||||
self.sent_ema.compute(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_2w_ago,
|
||||
&self.sent.base.sats.height,
|
||||
&self.sent.base.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
mod base;
|
||||
mod core;
|
||||
|
||||
pub use base::*;
|
||||
pub use core::*;
|
||||
197
crates/brk_computer/src/distribution/metrics/cohort/complete.rs
Normal file
197
crates/brk_computer/src/distribution/metrics/cohort/complete.rs
Normal file
@@ -0,0 +1,197 @@
|
||||
use brk_cohort::Filter;
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{Dollars, Height, Indexes, Sats, Version};
|
||||
use rayon::prelude::*;
|
||||
use vecdb::{AnyStoredVec, Exit, ReadableVec, Rw, StorageMode};
|
||||
|
||||
use crate::{blocks, prices};
|
||||
|
||||
use crate::distribution::metrics::{
|
||||
ActivityMetrics, CohortMetricsBase, CostBasisBase, ImportConfig, OutputsMetrics,
|
||||
RealizedComplete, RelativeCompleteWithRelToAll, SupplyMetrics, UnrealizedComplete,
|
||||
};
|
||||
|
||||
/// Complete cohort metrics (Tier C): ~216 stored vecs.
|
||||
///
|
||||
/// Used for epoch, class, min_age, max_age cohorts.
|
||||
/// Everything in Core, plus cost basis, CDD, value created/destroyed,
|
||||
/// sent in profit/loss, net PnL change, etc.
|
||||
///
|
||||
/// Does NOT include source-only fields (peak_regret, invested_capital,
|
||||
/// raw BytesVecs) or extended-only fields (investor_price, sell_side_risk,
|
||||
/// pain/greed/net_sentiment).
|
||||
///
|
||||
/// Does NOT implement CohortMetricsBase — standalone, not usable as Source.
|
||||
#[derive(Traversable)]
|
||||
pub struct CompleteCohortMetrics<M: StorageMode = Rw> {
|
||||
#[traversable(skip)]
|
||||
pub filter: Filter,
|
||||
pub supply: Box<SupplyMetrics<M>>,
|
||||
pub outputs: Box<OutputsMetrics<M>>,
|
||||
pub activity: Box<ActivityMetrics<M>>,
|
||||
pub realized: Box<RealizedComplete<M>>,
|
||||
pub cost_basis: Box<CostBasisBase<M>>,
|
||||
pub unrealized: Box<UnrealizedComplete<M>>,
|
||||
pub relative: Box<RelativeCompleteWithRelToAll<M>>,
|
||||
}
|
||||
|
||||
impl CompleteCohortMetrics {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
filter: cfg.filter.clone(),
|
||||
supply: Box::new(SupplyMetrics::forced_import(cfg)?),
|
||||
outputs: Box::new(OutputsMetrics::forced_import(cfg)?),
|
||||
activity: Box::new(ActivityMetrics::forced_import(cfg)?),
|
||||
realized: Box::new(RealizedComplete::forced_import(cfg)?),
|
||||
cost_basis: Box::new(CostBasisBase::forced_import(cfg)?),
|
||||
unrealized: Box::new(UnrealizedComplete::forced_import(cfg)?),
|
||||
relative: Box::new(RelativeCompleteWithRelToAll::forced_import(cfg)?),
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
self.supply
|
||||
.min_len()
|
||||
.min(self.outputs.min_len())
|
||||
.min(self.activity.min_len())
|
||||
.min(self.realized.min_stateful_height_len())
|
||||
.min(self.unrealized.min_stateful_height_len())
|
||||
.min(self.cost_basis.min_stateful_height_len())
|
||||
}
|
||||
|
||||
pub(crate) fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> {
|
||||
self.supply.validate_computed_versions(base_version)?;
|
||||
self.activity.validate_computed_versions(base_version)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
let mut vecs: Vec<&mut dyn AnyStoredVec> = Vec::new();
|
||||
vecs.extend(self.supply.par_iter_mut().collect::<Vec<_>>());
|
||||
vecs.extend(self.outputs.par_iter_mut().collect::<Vec<_>>());
|
||||
vecs.extend(self.activity.par_iter_mut().collect::<Vec<_>>());
|
||||
vecs.extend(self.realized.collect_vecs_mut());
|
||||
vecs.extend(self.cost_basis.collect_vecs_mut());
|
||||
vecs.extend(self.unrealized.collect_vecs_mut());
|
||||
vecs
|
||||
}
|
||||
|
||||
/// Aggregate Complete-tier metrics from Source cohort refs.
|
||||
pub(crate) fn compute_from_sources(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
others: &[&dyn CohortMetricsBase],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
// Supply, outputs, activity: use their existing compute_from_stateful
|
||||
self.supply.compute_from_stateful(
|
||||
starting_indexes,
|
||||
&others.iter().map(|v| v.supply()).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
self.outputs.compute_from_stateful(
|
||||
starting_indexes,
|
||||
&others.iter().map(|v| v.outputs()).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
self.activity.compute_from_stateful(
|
||||
starting_indexes,
|
||||
&others.iter().map(|v| v.activity()).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Realized: aggregate only Complete-tier fields from Source's RealizedBase
|
||||
let realized_complete_refs: Vec<&RealizedComplete> = others
|
||||
.iter()
|
||||
.map(|v| &v.realized_base().complete)
|
||||
.collect();
|
||||
self.realized
|
||||
.compute_from_stateful(starting_indexes, &realized_complete_refs, exit)?;
|
||||
|
||||
// Unrealized: aggregate only Complete-tier fields
|
||||
let unrealized_complete_refs: Vec<&UnrealizedComplete> = others
|
||||
.iter()
|
||||
.map(|v| &v.unrealized_base().complete)
|
||||
.collect();
|
||||
self.unrealized
|
||||
.compute_from_stateful(starting_indexes, &unrealized_complete_refs, exit)?;
|
||||
|
||||
// Cost basis: use existing aggregation
|
||||
self.cost_basis.compute_from_stateful(
|
||||
starting_indexes,
|
||||
&others
|
||||
.iter()
|
||||
.map(|v| v.cost_basis_base())
|
||||
.collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// First phase: compute index transforms.
|
||||
pub(crate) fn compute_rest_part1(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply
|
||||
.compute(prices, starting_indexes.height, exit)?;
|
||||
self.supply
|
||||
.compute_rest_part1(blocks, starting_indexes, exit)?;
|
||||
self.outputs
|
||||
.compute_rest(blocks, starting_indexes, exit)?;
|
||||
self.activity
|
||||
.sent
|
||||
.compute(prices, starting_indexes.height, exit)?;
|
||||
self.activity
|
||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)?;
|
||||
|
||||
self.realized
|
||||
.sent_in_profit
|
||||
.compute(prices, starting_indexes.height, exit)?;
|
||||
self.realized
|
||||
.sent_in_loss
|
||||
.compute(prices, starting_indexes.height, exit)?;
|
||||
self.realized
|
||||
.compute_rest_part1(starting_indexes, exit)?;
|
||||
|
||||
self.unrealized.compute_rest(starting_indexes, exit)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Second phase: compute relative metrics and remaining.
|
||||
pub(crate) fn compute_rest_part2(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
height_to_market_cap: &impl ReadableVec<Height, Dollars>,
|
||||
all_supply_sats: &impl ReadableVec<Height, Sats>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.realized.compute_rest_part2(
|
||||
blocks,
|
||||
prices,
|
||||
starting_indexes,
|
||||
&self.supply.total.btc.height,
|
||||
height_to_market_cap,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.relative.compute(
|
||||
starting_indexes.height,
|
||||
&self.unrealized,
|
||||
&self.supply.total.sats.height,
|
||||
height_to_market_cap,
|
||||
all_supply_sats,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
153
crates/brk_computer/src/distribution/metrics/cohort/core.rs
Normal file
153
crates/brk_computer/src/distribution/metrics/cohort/core.rs
Normal file
@@ -0,0 +1,153 @@
|
||||
use brk_cohort::Filter;
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{Dollars, Height, Indexes, Sats, Version};
|
||||
use rayon::prelude::*;
|
||||
use vecdb::{AnyStoredVec, Exit, ReadableVec, Rw, StorageMode};
|
||||
|
||||
use crate::{blocks, prices};
|
||||
|
||||
use crate::distribution::metrics::{
|
||||
CoreActivity, CoreRealized, ImportConfig, OutputsMetrics,
|
||||
RelativeCompleteWithRelToAll, SupplyMetrics, UnrealizedComplete,
|
||||
};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct CoreCohortMetrics<M: StorageMode = Rw> {
|
||||
#[traversable(skip)]
|
||||
pub filter: Filter,
|
||||
pub supply: Box<SupplyMetrics<M>>,
|
||||
pub outputs: Box<OutputsMetrics<M>>,
|
||||
pub activity: Box<CoreActivity<M>>,
|
||||
pub realized: Box<CoreRealized<M>>,
|
||||
pub unrealized: Box<UnrealizedComplete<M>>,
|
||||
pub relative: Box<RelativeCompleteWithRelToAll<M>>,
|
||||
}
|
||||
|
||||
impl CoreCohortMetrics {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
filter: cfg.filter.clone(),
|
||||
supply: Box::new(SupplyMetrics::forced_import(cfg)?),
|
||||
outputs: Box::new(OutputsMetrics::forced_import(cfg)?),
|
||||
activity: Box::new(CoreActivity::forced_import(cfg)?),
|
||||
realized: Box::new(CoreRealized::forced_import(cfg)?),
|
||||
unrealized: Box::new(UnrealizedComplete::forced_import(cfg)?),
|
||||
relative: Box::new(RelativeCompleteWithRelToAll::forced_import(cfg)?),
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
self.supply
|
||||
.min_len()
|
||||
.min(self.outputs.min_len())
|
||||
.min(self.activity.min_len())
|
||||
.min(self.realized.min_stateful_height_len())
|
||||
.min(self.unrealized.min_stateful_height_len())
|
||||
}
|
||||
|
||||
pub(crate) fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> {
|
||||
self.supply.validate_computed_versions(base_version)?;
|
||||
self.activity.validate_computed_versions(base_version)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
let mut vecs: Vec<&mut dyn AnyStoredVec> = Vec::new();
|
||||
vecs.extend(self.supply.par_iter_mut().collect::<Vec<_>>());
|
||||
vecs.extend(self.outputs.par_iter_mut().collect::<Vec<_>>());
|
||||
vecs.extend(self.activity.par_iter_mut().collect::<Vec<_>>());
|
||||
vecs.extend(self.realized.collect_vecs_mut());
|
||||
vecs.extend(self.unrealized.collect_vecs_mut());
|
||||
vecs
|
||||
}
|
||||
|
||||
pub(crate) fn compute_from_sources(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
others: &[&CoreCohortMetrics],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply.compute_from_stateful(
|
||||
starting_indexes,
|
||||
&others.iter().map(|v| v.supply.as_ref()).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
self.outputs.compute_from_stateful(
|
||||
starting_indexes,
|
||||
&others.iter().map(|v| v.outputs.as_ref()).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
self.activity.compute_from_stateful(
|
||||
starting_indexes,
|
||||
&others.iter().map(|v| v.activity.as_ref()).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
self.realized.compute_from_stateful(
|
||||
starting_indexes,
|
||||
&others.iter().map(|v| v.realized.as_ref()).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
self.unrealized.compute_from_stateful(
|
||||
starting_indexes,
|
||||
&others.iter().map(|v| v.unrealized.as_ref()).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest_part1(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply
|
||||
.compute(prices, starting_indexes.height, exit)?;
|
||||
self.supply
|
||||
.compute_rest_part1(blocks, starting_indexes, exit)?;
|
||||
self.outputs
|
||||
.compute_rest(blocks, starting_indexes, exit)?;
|
||||
|
||||
self.activity
|
||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)?;
|
||||
|
||||
self.realized
|
||||
.compute_rest_part1(starting_indexes, exit)?;
|
||||
|
||||
self.unrealized.compute_rest(starting_indexes, exit)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest_part2(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
height_to_market_cap: &impl ReadableVec<Height, Dollars>,
|
||||
all_supply_sats: &impl ReadableVec<Height, Sats>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.realized.compute_rest_part2(
|
||||
blocks,
|
||||
prices,
|
||||
starting_indexes,
|
||||
&self.supply.total.btc.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.relative.compute(
|
||||
starting_indexes.height,
|
||||
&self.unrealized,
|
||||
&self.supply.total.sats.height,
|
||||
height_to_market_cap,
|
||||
all_supply_sats,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
302
crates/brk_computer/src/distribution/metrics/cohort/minimal.rs
Normal file
302
crates/brk_computer/src/distribution/metrics/cohort/minimal.rs
Normal file
@@ -0,0 +1,302 @@
|
||||
use brk_cohort::Filter;
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{
|
||||
BasisPoints16, BasisPoints32, Bitcoin, Cents, Dollars, Height, Indexes, Sats, StoredF32,
|
||||
Version,
|
||||
};
|
||||
use rayon::prelude::*;
|
||||
use vecdb::{AnyStoredVec, AnyVec, Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode, WritableVec};
|
||||
|
||||
use crate::{blocks, prices};
|
||||
|
||||
use crate::internal::{
|
||||
CentsUnsignedToDollars, ComputedFromHeight, ComputedFromHeightRatio, Identity, LazyFromHeight,
|
||||
PercentFromHeight, Price, RatioSatsBp16, ValueFromHeight,
|
||||
};
|
||||
|
||||
use crate::distribution::{
|
||||
metrics::{ImportConfig, OutputsMetrics, SupplyMetrics},
|
||||
state::UnrealizedState,
|
||||
};
|
||||
|
||||
/// Minimal realized metrics: realized cap, realized price, and MVRV ratio.
|
||||
#[derive(Traversable)]
|
||||
pub struct MinimalRealized<M: StorageMode = Rw> {
|
||||
pub realized_cap_cents: ComputedFromHeight<Cents, M>,
|
||||
pub realized_cap: LazyFromHeight<Dollars, Cents>,
|
||||
pub realized_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub realized_price_ratio: ComputedFromHeightRatio<M>,
|
||||
pub mvrv: LazyFromHeight<StoredF32>,
|
||||
}
|
||||
|
||||
/// Minimal unrealized metrics: supply in profit/loss only.
|
||||
#[derive(Traversable)]
|
||||
pub struct MinimalUnrealized<M: StorageMode = Rw> {
|
||||
pub supply_in_profit: ValueFromHeight<M>,
|
||||
pub supply_in_loss: ValueFromHeight<M>,
|
||||
}
|
||||
|
||||
/// Minimal relative metrics: supply in profit/loss relative to own supply.
|
||||
#[derive(Traversable)]
|
||||
pub struct MinimalRelative<M: StorageMode = Rw> {
|
||||
pub supply_in_profit_rel_to_own_supply: PercentFromHeight<BasisPoints16, M>,
|
||||
pub supply_in_loss_rel_to_own_supply: PercentFromHeight<BasisPoints16, M>,
|
||||
}
|
||||
|
||||
/// MinimalCohortMetrics (Tier A): ~15 stored vecs.
|
||||
///
|
||||
/// Used for type_ cohorts where most metrics are irrelevant.
|
||||
/// Does NOT implement CohortMetricsBase — standalone, not aggregatable.
|
||||
#[derive(Traversable)]
|
||||
pub struct MinimalCohortMetrics<M: StorageMode = Rw> {
|
||||
#[traversable(skip)]
|
||||
pub filter: Filter,
|
||||
pub supply: Box<SupplyMetrics<M>>,
|
||||
pub outputs: Box<OutputsMetrics<M>>,
|
||||
pub realized: Box<MinimalRealized<M>>,
|
||||
pub unrealized: Box<MinimalUnrealized<M>>,
|
||||
pub relative: Box<MinimalRelative<M>>,
|
||||
}
|
||||
|
||||
impl MinimalRealized {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let realized_cap_cents = cfg.import_computed("realized_cap_cents", Version::ZERO)?;
|
||||
let realized_cap = LazyFromHeight::from_computed::<CentsUnsignedToDollars>(
|
||||
&cfg.name("realized_cap"),
|
||||
cfg.version,
|
||||
realized_cap_cents.height.read_only_boxed_clone(),
|
||||
&realized_cap_cents,
|
||||
);
|
||||
|
||||
let realized_price = cfg.import_price("realized_price", Version::ONE)?;
|
||||
let realized_price_ratio = cfg.import_ratio("realized_price", Version::ONE)?;
|
||||
let mvrv = LazyFromHeight::from_lazy::<Identity<StoredF32>, BasisPoints32>(
|
||||
&cfg.name("mvrv"),
|
||||
cfg.version,
|
||||
&realized_price_ratio.ratio,
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
realized_cap_cents,
|
||||
realized_cap,
|
||||
realized_price,
|
||||
realized_price_ratio,
|
||||
mvrv,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
self.realized_cap_cents.height.len()
|
||||
}
|
||||
|
||||
pub(crate) fn truncate_push(&mut self, height: Height, cap: Cents) -> Result<()> {
|
||||
self.realized_cap_cents
|
||||
.height
|
||||
.truncate_push(height, cap)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
vec![&mut self.realized_cap_cents.height as &mut dyn AnyStoredVec]
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest_part2(
|
||||
&mut self,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
height_to_supply: &impl ReadableVec<Height, Bitcoin>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.realized_price.cents.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.realized_cap_cents.height,
|
||||
height_to_supply,
|
||||
|(i, cap_cents, supply, ..)| {
|
||||
let cap = cap_cents.as_u128();
|
||||
let supply_sats = Sats::from(supply).as_u128();
|
||||
if supply_sats == 0 {
|
||||
(i, Cents::ZERO)
|
||||
} else {
|
||||
(i, Cents::from(cap * Sats::ONE_BTC_U128 / supply_sats))
|
||||
}
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.realized_price_ratio.compute_ratio(
|
||||
starting_indexes,
|
||||
&prices.price.cents.height,
|
||||
&self.realized_price.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl MinimalUnrealized {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
supply_in_profit: cfg.import_value("supply_in_profit", Version::ZERO)?,
|
||||
supply_in_loss: cfg.import_value("supply_in_loss", Version::ZERO)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
self.supply_in_profit
|
||||
.sats
|
||||
.height
|
||||
.len()
|
||||
.min(self.supply_in_loss.sats.height.len())
|
||||
}
|
||||
|
||||
pub(crate) fn truncate_push(
|
||||
&mut self,
|
||||
height: Height,
|
||||
state: &UnrealizedState,
|
||||
) -> Result<()> {
|
||||
self.supply_in_profit
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, state.supply_in_profit)?;
|
||||
self.supply_in_loss
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, state.supply_in_loss)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
vec![
|
||||
&mut self.supply_in_profit.base.sats.height as &mut dyn AnyStoredVec,
|
||||
&mut self.supply_in_profit.base.cents.height as &mut dyn AnyStoredVec,
|
||||
&mut self.supply_in_loss.base.sats.height as &mut dyn AnyStoredVec,
|
||||
&mut self.supply_in_loss.base.cents.height as &mut dyn AnyStoredVec,
|
||||
]
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest(
|
||||
&mut self,
|
||||
prices: &prices::Vecs,
|
||||
max_from: Height,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply_in_profit.compute(prices, max_from, exit)?;
|
||||
self.supply_in_loss.compute(prices, max_from, exit)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl MinimalRelative {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
supply_in_profit_rel_to_own_supply: cfg
|
||||
.import_percent_bp16("supply_in_profit_rel_to_own_supply", Version::ONE)?,
|
||||
supply_in_loss_rel_to_own_supply: cfg
|
||||
.import_percent_bp16("supply_in_loss_rel_to_own_supply", Version::ONE)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn compute(
|
||||
&mut self,
|
||||
max_from: Height,
|
||||
supply_in_profit_sats: &impl ReadableVec<Height, Sats>,
|
||||
supply_in_loss_sats: &impl ReadableVec<Height, Sats>,
|
||||
supply_total_sats: &impl ReadableVec<Height, Sats>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply_in_profit_rel_to_own_supply
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
supply_in_profit_sats,
|
||||
supply_total_sats,
|
||||
exit,
|
||||
)?;
|
||||
self.supply_in_loss_rel_to_own_supply
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
supply_in_loss_sats,
|
||||
supply_total_sats,
|
||||
exit,
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl MinimalCohortMetrics {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
filter: cfg.filter.clone(),
|
||||
supply: Box::new(SupplyMetrics::forced_import(cfg)?),
|
||||
outputs: Box::new(OutputsMetrics::forced_import(cfg)?),
|
||||
realized: Box::new(MinimalRealized::forced_import(cfg)?),
|
||||
unrealized: Box::new(MinimalUnrealized::forced_import(cfg)?),
|
||||
relative: Box::new(MinimalRelative::forced_import(cfg)?),
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
self.supply
|
||||
.min_len()
|
||||
.min(self.outputs.min_len())
|
||||
.min(self.realized.min_stateful_height_len())
|
||||
.min(self.unrealized.min_stateful_height_len())
|
||||
}
|
||||
|
||||
pub(crate) fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> {
|
||||
self.supply.validate_computed_versions(base_version)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_all_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
let mut vecs: Vec<&mut dyn AnyStoredVec> = Vec::new();
|
||||
vecs.extend(self.supply.par_iter_mut().collect::<Vec<_>>());
|
||||
vecs.extend(self.outputs.par_iter_mut().collect::<Vec<_>>());
|
||||
vecs.extend(self.realized.collect_vecs_mut());
|
||||
vecs.extend(self.unrealized.collect_vecs_mut());
|
||||
vecs
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest_part1(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply
|
||||
.compute(prices, starting_indexes.height, exit)?;
|
||||
self.supply
|
||||
.compute_rest_part1(blocks, starting_indexes, exit)?;
|
||||
self.outputs
|
||||
.compute_rest(blocks, starting_indexes, exit)?;
|
||||
self.unrealized
|
||||
.compute_rest(prices, starting_indexes.height, exit)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest_part2(
|
||||
&mut self,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.realized.compute_rest_part2(
|
||||
prices,
|
||||
starting_indexes,
|
||||
&self.supply.total.btc.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.relative.compute(
|
||||
starting_indexes.height,
|
||||
&self.unrealized.supply_in_profit.sats.height,
|
||||
&self.unrealized.supply_in_loss.sats.height,
|
||||
&self.supply.total.sats.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,17 @@
|
||||
mod adjusted;
|
||||
mod all;
|
||||
mod basic;
|
||||
mod complete;
|
||||
mod core;
|
||||
mod extended;
|
||||
mod extended_adjusted;
|
||||
mod minimal;
|
||||
|
||||
pub use adjusted::*;
|
||||
pub use all::*;
|
||||
pub use basic::*;
|
||||
pub use complete::*;
|
||||
pub use core::*;
|
||||
pub use extended::*;
|
||||
pub use extended_adjusted::*;
|
||||
pub use minimal::*;
|
||||
|
||||
@@ -168,7 +168,7 @@ pub trait CohortMetricsBase: Send + Sync {
|
||||
.sent
|
||||
.compute(prices, starting_indexes.height, exit)?;
|
||||
self.activity_mut()
|
||||
.compute_rest_part1(blocks, starting_indexes, exit)?;
|
||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)?;
|
||||
|
||||
self.realized_base_mut()
|
||||
.sent_in_profit
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{
|
||||
BasisPoints32, BasisPointsSigned32, Bitcoin, Cents, CentsSats, CentsSigned,
|
||||
CentsSquaredSats, Dollars, Height, Indexes, Sats, StoredF32, StoredF64, Version,
|
||||
};
|
||||
use vecdb::{
|
||||
AnyStoredVec, AnyVec, BytesVec, Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode,
|
||||
WritableVec,
|
||||
BasisPoints32, Bitcoin, Cents, CentsSats, CentsSquaredSats, Dollars, Height, Indexes, Version,
|
||||
};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use vecdb::{AnyStoredVec, AnyVec, BytesVec, Exit, ReadableVec, Rw, StorageMode, WritableVec};
|
||||
|
||||
use crate::{
|
||||
blocks,
|
||||
distribution::state::RealizedState,
|
||||
internal::{
|
||||
CentsPlus, CentsUnsignedToDollars, ComputedFromHeight, ComputedFromHeightCumulative,
|
||||
ComputedFromHeightRatio, FiatFromHeight, Identity, LazyFromHeight,
|
||||
NegCentsUnsignedToDollars, PercentFromHeight, PercentRollingEmas1w1m,
|
||||
PercentRollingWindows, Price, RatioCents64, RatioCentsBp32,
|
||||
RatioCentsSignedCentsBps32, RatioCentsSignedDollarsBps32, RollingEmas1w1m, RollingEmas2w,
|
||||
RollingWindows, ValueFromHeightCumulative,
|
||||
ComputedFromHeight, ComputedFromHeightCumulative, ComputedFromHeightRatio,
|
||||
PercentFromHeight, PercentRollingEmas1w1m, PercentRollingWindows, Price, RatioCentsBp32,
|
||||
},
|
||||
prices,
|
||||
};
|
||||
|
||||
use crate::distribution::metrics::ImportConfig;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct RealizedBase<M: StorageMode = Rw> {
|
||||
pub realized_cap_cents: ComputedFromHeight<Cents, M>,
|
||||
pub realized_cap: LazyFromHeight<Dollars, Cents>,
|
||||
pub realized_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub realized_price_ratio: ComputedFromHeightRatio<M>,
|
||||
pub realized_cap_change_1m: ComputedFromHeight<CentsSigned, M>,
|
||||
use super::RealizedComplete;
|
||||
|
||||
/// Full realized metrics (Source/Extended tier).
|
||||
///
|
||||
/// Contains all Complete-tier fields (via Deref to RealizedComplete) plus:
|
||||
/// - Source-only: peak_regret, peak_regret_rel_to_realized_cap
|
||||
/// - Extended-only: investor_price, price bands, cap_raw, sell_side_risk_ratio
|
||||
#[derive(Deref, DerefMut, Traversable)]
|
||||
pub struct RealizedBase<M: StorageMode = Rw> {
|
||||
#[deref]
|
||||
#[deref_mut]
|
||||
#[traversable(flatten)]
|
||||
pub complete: RealizedComplete<M>,
|
||||
|
||||
// --- Extended-only fields ---
|
||||
pub investor_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub investor_price_ratio: ComputedFromHeightRatio<M>,
|
||||
|
||||
@@ -42,93 +42,20 @@ pub struct RealizedBase<M: StorageMode = Rw> {
|
||||
pub cap_raw: M::Stored<BytesVec<Height, CentsSats>>,
|
||||
pub investor_cap_raw: M::Stored<BytesVec<Height, CentsSquaredSats>>,
|
||||
|
||||
pub mvrv: LazyFromHeight<StoredF32>,
|
||||
|
||||
pub realized_profit: ComputedFromHeightCumulative<Cents, M>,
|
||||
pub realized_profit_ema_1w: ComputedFromHeight<Cents, M>,
|
||||
pub realized_loss: ComputedFromHeightCumulative<Cents, M>,
|
||||
pub realized_loss_ema_1w: ComputedFromHeight<Cents, M>,
|
||||
pub neg_realized_loss: LazyFromHeight<Dollars, Cents>,
|
||||
pub net_realized_pnl: ComputedFromHeightCumulative<CentsSigned, M>,
|
||||
pub net_realized_pnl_ema_1w: ComputedFromHeight<CentsSigned, M>,
|
||||
pub gross_pnl: FiatFromHeight<Cents, M>,
|
||||
|
||||
pub realized_profit_rel_to_realized_cap: PercentFromHeight<BasisPoints32, M>,
|
||||
pub realized_loss_rel_to_realized_cap: PercentFromHeight<BasisPoints32, M>,
|
||||
pub net_realized_pnl_rel_to_realized_cap: PercentFromHeight<BasisPointsSigned32, M>,
|
||||
|
||||
pub profit_value_created: ComputedFromHeight<Cents, M>,
|
||||
pub profit_value_destroyed: ComputedFromHeight<Cents, M>,
|
||||
pub loss_value_created: ComputedFromHeight<Cents, M>,
|
||||
pub loss_value_destroyed: ComputedFromHeight<Cents, M>,
|
||||
|
||||
pub value_created: ComputedFromHeight<Cents, M>,
|
||||
pub value_destroyed: ComputedFromHeight<Cents, M>,
|
||||
|
||||
pub capitulation_flow: LazyFromHeight<Dollars, Cents>,
|
||||
pub profit_flow: LazyFromHeight<Dollars, Cents>,
|
||||
|
||||
pub value_created_sum: RollingWindows<Cents, M>,
|
||||
pub value_destroyed_sum: RollingWindows<Cents, M>,
|
||||
|
||||
pub sopr: RollingWindows<StoredF64, M>,
|
||||
pub sopr_24h_ema: RollingEmas1w1m<StoredF64, M>,
|
||||
|
||||
pub gross_pnl_sum: RollingWindows<Cents, M>,
|
||||
pub sell_side_risk_ratio: PercentRollingWindows<BasisPoints32, M>,
|
||||
pub sell_side_risk_ratio_24h_ema: PercentRollingEmas1w1m<BasisPoints32, M>,
|
||||
|
||||
pub net_pnl_change_1m: ComputedFromHeight<CentsSigned, M>,
|
||||
pub net_pnl_change_1m_rel_to_realized_cap: PercentFromHeight<BasisPointsSigned32, M>,
|
||||
pub net_pnl_change_1m_rel_to_market_cap: PercentFromHeight<BasisPointsSigned32, M>,
|
||||
|
||||
// --- Source-only fields ---
|
||||
pub peak_regret: ComputedFromHeightCumulative<Cents, M>,
|
||||
pub peak_regret_rel_to_realized_cap: PercentFromHeight<BasisPoints32, M>,
|
||||
|
||||
pub sent_in_profit: ValueFromHeightCumulative<M>,
|
||||
pub sent_in_profit_ema: RollingEmas2w<M>,
|
||||
pub sent_in_loss: ValueFromHeightCumulative<M>,
|
||||
pub sent_in_loss_ema: RollingEmas2w<M>,
|
||||
}
|
||||
|
||||
impl RealizedBase {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let v0 = Version::ZERO;
|
||||
let v1 = Version::ONE;
|
||||
|
||||
let realized_cap_cents = cfg.import_computed("realized_cap_cents", v0)?;
|
||||
let realized_cap = LazyFromHeight::from_computed::<CentsUnsignedToDollars>(
|
||||
&cfg.name("realized_cap"),
|
||||
cfg.version,
|
||||
realized_cap_cents.height.read_only_boxed_clone(),
|
||||
&realized_cap_cents,
|
||||
);
|
||||
let complete = RealizedComplete::forced_import(cfg)?;
|
||||
|
||||
let realized_profit = cfg.import_cumulative("realized_profit", v0)?;
|
||||
let realized_profit_ema_1w = cfg.import_computed("realized_profit_ema_1w", v0)?;
|
||||
let realized_loss = cfg.import_cumulative("realized_loss", v0)?;
|
||||
let realized_loss_ema_1w = cfg.import_computed("realized_loss_ema_1w", v0)?;
|
||||
|
||||
let neg_realized_loss = LazyFromHeight::from_height_source::<NegCentsUnsignedToDollars>(
|
||||
&cfg.name("neg_realized_loss"),
|
||||
cfg.version + Version::ONE,
|
||||
realized_loss.height.read_only_boxed_clone(),
|
||||
cfg.indexes,
|
||||
);
|
||||
|
||||
let net_realized_pnl = cfg.import_cumulative("net_realized_pnl", v0)?;
|
||||
let net_realized_pnl_ema_1w = cfg.import_computed("net_realized_pnl_ema_1w", v0)?;
|
||||
let peak_regret = cfg.import_cumulative("realized_peak_regret", Version::new(2))?;
|
||||
let gross_pnl = cfg.import_fiat("realized_gross_pnl", v0)?;
|
||||
|
||||
let realized_profit_rel_to_realized_cap =
|
||||
cfg.import_percent_bp32("realized_profit_rel_to_realized_cap", Version::new(2))?;
|
||||
let realized_loss_rel_to_realized_cap =
|
||||
cfg.import_percent_bp32("realized_loss_rel_to_realized_cap", Version::new(2))?;
|
||||
let net_realized_pnl_rel_to_realized_cap =
|
||||
cfg.import_percent_bps32("net_realized_pnl_rel_to_realized_cap", Version::new(2))?;
|
||||
|
||||
let realized_price = cfg.import_price("realized_price", v1)?;
|
||||
let investor_price = cfg.import_price("investor_price", v0)?;
|
||||
let investor_price_ratio = cfg.import_ratio("investor_price", v0)?;
|
||||
let lower_price_band = cfg.import_price("lower_price_band", v0)?;
|
||||
@@ -137,132 +64,41 @@ impl RealizedBase {
|
||||
let cap_raw = cfg.import_bytes("cap_raw", v0)?;
|
||||
let investor_cap_raw = cfg.import_bytes("investor_cap_raw", v0)?;
|
||||
|
||||
let profit_value_created = cfg.import_computed("profit_value_created", v0)?;
|
||||
let profit_value_destroyed = cfg.import_computed("profit_value_destroyed", v0)?;
|
||||
let loss_value_created = cfg.import_computed("loss_value_created", v0)?;
|
||||
let loss_value_destroyed = cfg.import_computed("loss_value_destroyed", v0)?;
|
||||
let value_created = cfg.import_computed("value_created", v0)?;
|
||||
let value_destroyed = cfg.import_computed("value_destroyed", v0)?;
|
||||
|
||||
let capitulation_flow = LazyFromHeight::from_computed::<CentsUnsignedToDollars>(
|
||||
&cfg.name("capitulation_flow"),
|
||||
cfg.version,
|
||||
loss_value_destroyed.height.read_only_boxed_clone(),
|
||||
&loss_value_destroyed,
|
||||
);
|
||||
let profit_flow = LazyFromHeight::from_computed::<CentsUnsignedToDollars>(
|
||||
&cfg.name("profit_flow"),
|
||||
cfg.version,
|
||||
profit_value_destroyed.height.read_only_boxed_clone(),
|
||||
&profit_value_destroyed,
|
||||
);
|
||||
|
||||
let realized_price_ratio = cfg.import_ratio("realized_price", v1)?;
|
||||
let mvrv = LazyFromHeight::from_lazy::<Identity<StoredF32>, BasisPoints32>(
|
||||
&cfg.name("mvrv"),
|
||||
cfg.version,
|
||||
&realized_price_ratio.ratio,
|
||||
);
|
||||
|
||||
// Rolling windows
|
||||
let value_created_sum = cfg.import_rolling("value_created", v1)?;
|
||||
let value_destroyed_sum = cfg.import_rolling("value_destroyed", v1)?;
|
||||
let gross_pnl_sum = cfg.import_rolling("gross_pnl_sum", v1)?;
|
||||
let sopr = cfg.import_rolling("sopr", v1)?;
|
||||
let sell_side_risk_ratio = cfg.import_percent_rolling_bp32("sell_side_risk_ratio", Version::new(2))?;
|
||||
|
||||
// EMAs
|
||||
let sopr_24h_ema = cfg.import_emas_1w_1m("sopr_24h", v1)?;
|
||||
let sell_side_risk_ratio =
|
||||
cfg.import_percent_rolling_bp32("sell_side_risk_ratio", Version::new(2))?;
|
||||
let sell_side_risk_ratio_24h_ema =
|
||||
cfg.import_percent_emas_1w_1m_bp32("sell_side_risk_ratio_24h", Version::new(2))?;
|
||||
|
||||
let peak_regret = cfg.import_cumulative("realized_peak_regret", Version::new(2))?;
|
||||
let peak_regret_rel_to_realized_cap =
|
||||
cfg.import_percent_bp32("realized_peak_regret_rel_to_realized_cap", Version::new(2))?;
|
||||
|
||||
Ok(Self {
|
||||
realized_cap_cents,
|
||||
realized_cap,
|
||||
realized_price,
|
||||
realized_price_ratio,
|
||||
realized_cap_change_1m: cfg.import_computed("realized_cap_change_1m", v0)?,
|
||||
complete,
|
||||
investor_price,
|
||||
investor_price_ratio,
|
||||
lower_price_band,
|
||||
upper_price_band,
|
||||
cap_raw,
|
||||
investor_cap_raw,
|
||||
mvrv,
|
||||
realized_profit,
|
||||
realized_profit_ema_1w,
|
||||
realized_loss,
|
||||
realized_loss_ema_1w,
|
||||
neg_realized_loss,
|
||||
net_realized_pnl,
|
||||
net_realized_pnl_ema_1w,
|
||||
gross_pnl,
|
||||
realized_profit_rel_to_realized_cap,
|
||||
realized_loss_rel_to_realized_cap,
|
||||
net_realized_pnl_rel_to_realized_cap,
|
||||
profit_value_created,
|
||||
profit_value_destroyed,
|
||||
loss_value_created,
|
||||
loss_value_destroyed,
|
||||
value_created,
|
||||
value_destroyed,
|
||||
capitulation_flow,
|
||||
profit_flow,
|
||||
value_created_sum,
|
||||
value_destroyed_sum,
|
||||
sopr,
|
||||
sopr_24h_ema,
|
||||
gross_pnl_sum,
|
||||
sell_side_risk_ratio,
|
||||
sell_side_risk_ratio_24h_ema,
|
||||
net_pnl_change_1m: cfg.import_computed("net_pnl_change_1m", Version::new(3))?,
|
||||
net_pnl_change_1m_rel_to_realized_cap: cfg
|
||||
.import_percent_bps32("net_pnl_change_1m_rel_to_realized_cap", Version::new(4))?,
|
||||
net_pnl_change_1m_rel_to_market_cap: cfg
|
||||
.import_percent_bps32("net_pnl_change_1m_rel_to_market_cap", Version::new(4))?,
|
||||
peak_regret,
|
||||
peak_regret_rel_to_realized_cap,
|
||||
sent_in_profit: cfg.import_value_cumulative("sent_in_profit", v0)?,
|
||||
sent_in_profit_ema: cfg.import_emas_2w("sent_in_profit", v0)?,
|
||||
sent_in_loss: cfg.import_value_cumulative("sent_in_loss", v0)?,
|
||||
sent_in_loss_ema: cfg.import_emas_2w("sent_in_loss", v0)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
[
|
||||
self.realized_cap.height.len(),
|
||||
self.realized_profit.height.len(),
|
||||
self.realized_loss.height.len(),
|
||||
self.investor_price.cents.height.len(),
|
||||
self.cap_raw.len(),
|
||||
self.investor_cap_raw.len(),
|
||||
self.profit_value_created.height.len(),
|
||||
self.profit_value_destroyed.height.len(),
|
||||
self.loss_value_created.height.len(),
|
||||
self.loss_value_destroyed.height.len(),
|
||||
self.peak_regret.height.len(),
|
||||
self.sent_in_profit.base.sats.height.len(),
|
||||
self.sent_in_loss.base.sats.height.len(),
|
||||
]
|
||||
.into_iter()
|
||||
.min()
|
||||
.unwrap()
|
||||
self.complete
|
||||
.min_stateful_height_len()
|
||||
.min(self.investor_price.cents.height.len())
|
||||
.min(self.cap_raw.len())
|
||||
.min(self.investor_cap_raw.len())
|
||||
.min(self.peak_regret.height.len())
|
||||
}
|
||||
|
||||
pub(crate) fn truncate_push(&mut self, height: Height, state: &RealizedState) -> Result<()> {
|
||||
self.realized_cap_cents
|
||||
.height
|
||||
.truncate_push(height, state.cap())?;
|
||||
self.realized_profit
|
||||
.height
|
||||
.truncate_push(height, state.profit())?;
|
||||
self.realized_loss
|
||||
.height
|
||||
.truncate_push(height, state.loss())?;
|
||||
self.complete.truncate_push(height, state)?;
|
||||
self.investor_price
|
||||
.cents
|
||||
.height
|
||||
@@ -270,51 +106,20 @@ impl RealizedBase {
|
||||
self.cap_raw.truncate_push(height, state.cap_raw())?;
|
||||
self.investor_cap_raw
|
||||
.truncate_push(height, state.investor_cap_raw())?;
|
||||
self.profit_value_created
|
||||
.height
|
||||
.truncate_push(height, state.profit_value_created())?;
|
||||
self.profit_value_destroyed
|
||||
.height
|
||||
.truncate_push(height, state.profit_value_destroyed())?;
|
||||
self.loss_value_created
|
||||
.height
|
||||
.truncate_push(height, state.loss_value_created())?;
|
||||
self.loss_value_destroyed
|
||||
.height
|
||||
.truncate_push(height, state.loss_value_destroyed())?;
|
||||
self.peak_regret
|
||||
.height
|
||||
.truncate_push(height, state.peak_regret())?;
|
||||
self.sent_in_profit
|
||||
.base
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, state.sent_in_profit())?;
|
||||
self.sent_in_loss
|
||||
.base
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, state.sent_in_loss())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
vec![
|
||||
&mut self.realized_cap_cents.height as &mut dyn AnyStoredVec,
|
||||
&mut self.realized_profit.height,
|
||||
&mut self.realized_loss.height,
|
||||
&mut self.investor_price.cents.height,
|
||||
&mut self.cap_raw as &mut dyn AnyStoredVec,
|
||||
&mut self.investor_cap_raw as &mut dyn AnyStoredVec,
|
||||
&mut self.profit_value_created.height,
|
||||
&mut self.profit_value_destroyed.height,
|
||||
&mut self.loss_value_created.height,
|
||||
&mut self.loss_value_destroyed.height,
|
||||
&mut self.peak_regret.height,
|
||||
&mut self.sent_in_profit.base.sats.height,
|
||||
&mut self.sent_in_loss.base.sats.height,
|
||||
]
|
||||
let mut vecs = self.complete.collect_vecs_mut();
|
||||
vecs.push(&mut self.investor_price.cents.height as &mut dyn AnyStoredVec);
|
||||
vecs.push(&mut self.cap_raw as &mut dyn AnyStoredVec);
|
||||
vecs.push(&mut self.investor_cap_raw as &mut dyn AnyStoredVec);
|
||||
vecs.push(&mut self.peak_regret.height as &mut dyn AnyStoredVec);
|
||||
vecs
|
||||
}
|
||||
|
||||
pub(crate) fn compute_from_stateful(
|
||||
@@ -323,19 +128,11 @@ impl RealizedBase {
|
||||
others: &[&Self],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
macro_rules! sum_others {
|
||||
($($field:tt).+) => {
|
||||
self.$($field).+.compute_sum_of_others(
|
||||
starting_indexes.height,
|
||||
&others.iter().map(|v| &v.$($field).+).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?
|
||||
};
|
||||
}
|
||||
|
||||
sum_others!(realized_cap_cents.height);
|
||||
sum_others!(realized_profit.height);
|
||||
sum_others!(realized_loss.height);
|
||||
// Delegate Complete-tier aggregation
|
||||
let complete_refs: Vec<&RealizedComplete> =
|
||||
others.iter().map(|o| &o.complete).collect();
|
||||
self.complete
|
||||
.compute_from_stateful(starting_indexes, &complete_refs, exit)?;
|
||||
|
||||
// Aggregate raw values for investor_price computation
|
||||
let investor_price_dep_version = others
|
||||
@@ -396,13 +193,15 @@ impl RealizedBase {
|
||||
self.investor_price.cents.height.write()?;
|
||||
}
|
||||
|
||||
sum_others!(profit_value_created.height);
|
||||
sum_others!(profit_value_destroyed.height);
|
||||
sum_others!(loss_value_created.height);
|
||||
sum_others!(loss_value_destroyed.height);
|
||||
sum_others!(peak_regret.height);
|
||||
sum_others!(sent_in_profit.base.sats.height);
|
||||
sum_others!(sent_in_loss.base.sats.height);
|
||||
// Source-only: peak_regret
|
||||
self.peak_regret.height.compute_sum_of_others(
|
||||
starting_indexes.height,
|
||||
&others
|
||||
.iter()
|
||||
.map(|v| &v.peak_regret.height)
|
||||
.collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -412,34 +211,7 @@ impl RealizedBase {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.realized_profit
|
||||
.compute_rest(starting_indexes.height, exit)?;
|
||||
self.realized_loss
|
||||
.compute_rest(starting_indexes.height, exit)?;
|
||||
|
||||
self.net_realized_pnl
|
||||
.compute(starting_indexes.height, exit, |vec| {
|
||||
vec.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.realized_profit.height,
|
||||
&self.realized_loss.height,
|
||||
|(i, profit, loss, ..)| {
|
||||
(
|
||||
i,
|
||||
CentsSigned::new(profit.inner() as i64 - loss.inner() as i64),
|
||||
)
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
self.gross_pnl.cents.height.compute_add(
|
||||
starting_indexes.height,
|
||||
&self.realized_profit.height,
|
||||
&self.realized_loss.height,
|
||||
exit,
|
||||
)?;
|
||||
self.complete.compute_rest_part1(starting_indexes, exit)?;
|
||||
|
||||
self.peak_regret
|
||||
.compute_rest(starting_indexes.height, exit)?;
|
||||
@@ -457,29 +229,17 @@ impl RealizedBase {
|
||||
height_to_market_cap: &impl ReadableVec<Height, Dollars>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.realized_price.cents.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.realized_cap_cents.height,
|
||||
height_to_supply,
|
||||
|(i, cap_cents, supply, ..)| {
|
||||
let cap = cap_cents.as_u128();
|
||||
let supply_sats = Sats::from(supply).as_u128();
|
||||
if supply_sats == 0 {
|
||||
(i, Cents::ZERO)
|
||||
} else {
|
||||
(i, Cents::from(cap * Sats::ONE_BTC_U128 / supply_sats))
|
||||
}
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.realized_price_ratio.compute_ratio(
|
||||
// Compute all Complete-tier fields
|
||||
self.complete.compute_rest_part2(
|
||||
blocks,
|
||||
prices,
|
||||
starting_indexes,
|
||||
&prices.price.cents.height,
|
||||
&self.realized_price.cents.height,
|
||||
height_to_supply,
|
||||
height_to_market_cap,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Extended-only: investor_price ratio and price bands
|
||||
self.investor_price_ratio.compute_ratio(
|
||||
starting_indexes,
|
||||
&prices.price.cents.height,
|
||||
@@ -489,7 +249,7 @@ impl RealizedBase {
|
||||
|
||||
self.lower_price_band.cents.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.realized_price.cents.height,
|
||||
&self.complete.realized_price.cents.height,
|
||||
&self.investor_price.cents.height,
|
||||
|(i, rp, ip, ..)| {
|
||||
let rp = rp.as_u128();
|
||||
@@ -506,7 +266,7 @@ impl RealizedBase {
|
||||
self.upper_price_band.cents.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.investor_price.cents.height,
|
||||
&self.realized_price.cents.height,
|
||||
&self.complete.realized_price.cents.height,
|
||||
|(i, ip, rp, ..)| {
|
||||
let ip = ip.as_u128();
|
||||
let rp = rp.as_u128();
|
||||
@@ -519,126 +279,22 @@ impl RealizedBase {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.realized_cap_change_1m.height.compute_rolling_change(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1m_ago,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Compute value_created/destroyed from stored components
|
||||
self.value_created
|
||||
.compute_binary::<Cents, Cents, CentsPlus>(
|
||||
starting_indexes.height,
|
||||
&self.profit_value_created.height,
|
||||
&self.loss_value_created.height,
|
||||
exit,
|
||||
)?;
|
||||
self.value_destroyed
|
||||
.compute_binary::<Cents, Cents, CentsPlus>(
|
||||
starting_indexes.height,
|
||||
&self.profit_value_destroyed.height,
|
||||
&self.loss_value_destroyed.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
let window_starts = blocks.count.window_starts();
|
||||
self.value_created_sum.compute_rolling_sum(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.value_created.height,
|
||||
exit,
|
||||
)?;
|
||||
self.value_destroyed_sum.compute_rolling_sum(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.value_destroyed.height,
|
||||
exit,
|
||||
)?;
|
||||
self.gross_pnl_sum.compute_rolling_sum(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.gross_pnl.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Compute SOPR from rolling sums
|
||||
for ((sopr, vc), vd) in self
|
||||
.sopr
|
||||
.as_mut_array()
|
||||
.into_iter()
|
||||
.zip(self.value_created_sum.as_array())
|
||||
.zip(self.value_destroyed_sum.as_array())
|
||||
{
|
||||
sopr.compute_binary::<Cents, Cents, RatioCents64>(
|
||||
starting_indexes.height,
|
||||
&vc.height,
|
||||
&vd.height,
|
||||
exit,
|
||||
)?;
|
||||
}
|
||||
|
||||
// Compute sell-side risk ratios
|
||||
// Extended-only: sell-side risk ratios
|
||||
for (ssrr, rv) in self
|
||||
.sell_side_risk_ratio
|
||||
.as_mut_array()
|
||||
.into_iter()
|
||||
.zip(self.gross_pnl_sum.as_array())
|
||||
.zip(self.complete.gross_pnl_sum.as_array())
|
||||
{
|
||||
ssrr.compute_binary::<Cents, Cents, RatioCentsBp32>(
|
||||
starting_indexes.height,
|
||||
&rv.height,
|
||||
&self.realized_cap_cents.height,
|
||||
&self.complete.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
}
|
||||
|
||||
// 7d EMAs
|
||||
self.realized_profit_ema_1w.height.compute_rolling_ema(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1w_ago,
|
||||
&self.realized_profit.height,
|
||||
exit,
|
||||
)?;
|
||||
self.realized_loss_ema_1w.height.compute_rolling_ema(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1w_ago,
|
||||
&self.realized_loss.height,
|
||||
exit,
|
||||
)?;
|
||||
self.net_realized_pnl_ema_1w.height.compute_rolling_ema(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1w_ago,
|
||||
&self.net_realized_pnl.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// 14-day EMA of sent in profit/loss
|
||||
self.sent_in_profit_ema.compute(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_2w_ago,
|
||||
&self.sent_in_profit.base.sats.height,
|
||||
&self.sent_in_profit.base.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
self.sent_in_loss_ema.compute(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_2w_ago,
|
||||
&self.sent_in_loss.base.sats.height,
|
||||
&self.sent_in_loss.base.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// SOPR EMAs (based on 24h window)
|
||||
self.sopr_24h_ema.compute_from_24h(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1w_ago,
|
||||
&blocks.count.height_1m_ago,
|
||||
&self.sopr._24h.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Sell side risk EMAs (based on 24h window)
|
||||
// Extended-only: sell side risk EMAs
|
||||
self.sell_side_risk_ratio_24h_ema.compute_from_24h(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1w_ago,
|
||||
@@ -647,57 +303,12 @@ impl RealizedBase {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Realized profit/loss/net relative to realized cap
|
||||
self.realized_profit_rel_to_realized_cap
|
||||
.compute_binary::<Cents, Cents, RatioCentsBp32>(
|
||||
starting_indexes.height,
|
||||
&self.realized_profit.height,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
self.realized_loss_rel_to_realized_cap
|
||||
.compute_binary::<Cents, Cents, RatioCentsBp32>(
|
||||
starting_indexes.height,
|
||||
&self.realized_loss.height,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
self.net_realized_pnl_rel_to_realized_cap
|
||||
.compute_binary::<CentsSigned, Cents, RatioCentsSignedCentsBps32>(
|
||||
starting_indexes.height,
|
||||
&self.net_realized_pnl.height,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
// Source-only: peak_regret relative to realized cap
|
||||
self.peak_regret_rel_to_realized_cap
|
||||
.compute_binary::<Cents, Cents, RatioCentsBp32>(
|
||||
starting_indexes.height,
|
||||
&self.peak_regret.height,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Net realized PnL cumulative 30d delta
|
||||
self.net_pnl_change_1m.height.compute_rolling_change(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1m_ago,
|
||||
&self.net_realized_pnl.cumulative.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.net_pnl_change_1m_rel_to_realized_cap
|
||||
.compute_binary::<CentsSigned, Cents, RatioCentsSignedCentsBps32>(
|
||||
starting_indexes.height,
|
||||
&self.net_pnl_change_1m.height,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.net_pnl_change_1m_rel_to_market_cap
|
||||
.compute_binary::<CentsSigned, Dollars, RatioCentsSignedDollarsBps32>(
|
||||
starting_indexes.height,
|
||||
&self.net_pnl_change_1m.height,
|
||||
height_to_market_cap,
|
||||
&self.complete.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -0,0 +1,328 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{
|
||||
BasisPointsSigned32, Bitcoin, Cents, CentsSigned, Dollars, Height, Indexes, StoredF64, Version,
|
||||
};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use vecdb::{
|
||||
AnyStoredVec, AnyVec, Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode, WritableVec,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
blocks,
|
||||
distribution::state::RealizedState,
|
||||
internal::{
|
||||
CentsPlus, CentsUnsignedToDollars, ComputedFromHeight, LazyFromHeight, PercentFromHeight,
|
||||
RatioCents64, RatioCentsSignedCentsBps32, RatioCentsSignedDollarsBps32, RollingEmas1w1m,
|
||||
RollingEmas2w, RollingWindows, ValueFromHeightCumulative,
|
||||
},
|
||||
prices,
|
||||
};
|
||||
|
||||
use crate::distribution::metrics::ImportConfig;
|
||||
|
||||
use super::CoreRealized;
|
||||
|
||||
#[derive(Deref, DerefMut, Traversable)]
|
||||
pub struct RealizedComplete<M: StorageMode = Rw> {
|
||||
#[deref]
|
||||
#[deref_mut]
|
||||
#[traversable(flatten)]
|
||||
pub core: CoreRealized<M>,
|
||||
|
||||
pub profit_value_created: ComputedFromHeight<Cents, M>,
|
||||
pub profit_value_destroyed: ComputedFromHeight<Cents, M>,
|
||||
pub loss_value_created: ComputedFromHeight<Cents, M>,
|
||||
pub loss_value_destroyed: ComputedFromHeight<Cents, M>,
|
||||
|
||||
pub value_created: ComputedFromHeight<Cents, M>,
|
||||
pub value_destroyed: ComputedFromHeight<Cents, M>,
|
||||
|
||||
pub capitulation_flow: LazyFromHeight<Dollars, Cents>,
|
||||
pub profit_flow: LazyFromHeight<Dollars, Cents>,
|
||||
|
||||
pub value_created_sum: RollingWindows<Cents, M>,
|
||||
pub value_destroyed_sum: RollingWindows<Cents, M>,
|
||||
|
||||
pub gross_pnl_sum: RollingWindows<Cents, M>,
|
||||
|
||||
pub net_pnl_change_1m: ComputedFromHeight<CentsSigned, M>,
|
||||
pub net_pnl_change_1m_rel_to_realized_cap: PercentFromHeight<BasisPointsSigned32, M>,
|
||||
pub net_pnl_change_1m_rel_to_market_cap: PercentFromHeight<BasisPointsSigned32, M>,
|
||||
|
||||
pub sopr: RollingWindows<StoredF64, M>,
|
||||
pub sopr_24h_ema: RollingEmas1w1m<StoredF64, M>,
|
||||
|
||||
pub sent_in_profit: ValueFromHeightCumulative<M>,
|
||||
pub sent_in_profit_ema: RollingEmas2w<M>,
|
||||
pub sent_in_loss: ValueFromHeightCumulative<M>,
|
||||
pub sent_in_loss_ema: RollingEmas2w<M>,
|
||||
}
|
||||
|
||||
impl RealizedComplete {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let v0 = Version::ZERO;
|
||||
|
||||
let core = CoreRealized::forced_import(cfg)?;
|
||||
|
||||
let profit_value_created = cfg.import_computed("profit_value_created", v0)?;
|
||||
let profit_value_destroyed = cfg.import_computed("profit_value_destroyed", v0)?;
|
||||
let loss_value_created = cfg.import_computed("loss_value_created", v0)?;
|
||||
let loss_value_destroyed = cfg.import_computed("loss_value_destroyed", v0)?;
|
||||
let value_created = cfg.import_computed("value_created", v0)?;
|
||||
let value_destroyed = cfg.import_computed("value_destroyed", v0)?;
|
||||
|
||||
let capitulation_flow = LazyFromHeight::from_computed::<CentsUnsignedToDollars>(
|
||||
&cfg.name("capitulation_flow"),
|
||||
cfg.version,
|
||||
loss_value_destroyed.height.read_only_boxed_clone(),
|
||||
&loss_value_destroyed,
|
||||
);
|
||||
let profit_flow = LazyFromHeight::from_computed::<CentsUnsignedToDollars>(
|
||||
&cfg.name("profit_flow"),
|
||||
cfg.version,
|
||||
profit_value_destroyed.height.read_only_boxed_clone(),
|
||||
&profit_value_destroyed,
|
||||
);
|
||||
|
||||
let value_created_sum = cfg.import_rolling("value_created", Version::ONE)?;
|
||||
let value_destroyed_sum = cfg.import_rolling("value_destroyed", Version::ONE)?;
|
||||
let gross_pnl_sum = cfg.import_rolling("gross_pnl_sum", Version::ONE)?;
|
||||
|
||||
let sopr = cfg.import_rolling("sopr", Version::ONE)?;
|
||||
let sopr_24h_ema = cfg.import_emas_1w_1m("sopr_24h", Version::ONE)?;
|
||||
|
||||
Ok(Self {
|
||||
core,
|
||||
profit_value_created,
|
||||
profit_value_destroyed,
|
||||
loss_value_created,
|
||||
loss_value_destroyed,
|
||||
value_created,
|
||||
value_destroyed,
|
||||
capitulation_flow,
|
||||
profit_flow,
|
||||
value_created_sum,
|
||||
value_destroyed_sum,
|
||||
gross_pnl_sum,
|
||||
sopr,
|
||||
sopr_24h_ema,
|
||||
net_pnl_change_1m: cfg.import_computed("net_pnl_change_1m", Version::new(3))?,
|
||||
net_pnl_change_1m_rel_to_realized_cap: cfg
|
||||
.import_percent_bps32("net_pnl_change_1m_rel_to_realized_cap", Version::new(4))?,
|
||||
net_pnl_change_1m_rel_to_market_cap: cfg
|
||||
.import_percent_bps32("net_pnl_change_1m_rel_to_market_cap", Version::new(4))?,
|
||||
sent_in_profit: cfg.import_value_cumulative("sent_in_profit", v0)?,
|
||||
sent_in_profit_ema: cfg.import_emas_2w("sent_in_profit", v0)?,
|
||||
sent_in_loss: cfg.import_value_cumulative("sent_in_loss", v0)?,
|
||||
sent_in_loss_ema: cfg.import_emas_2w("sent_in_loss", v0)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
self.core
|
||||
.min_stateful_height_len()
|
||||
.min(self.profit_value_created.height.len())
|
||||
.min(self.profit_value_destroyed.height.len())
|
||||
.min(self.loss_value_created.height.len())
|
||||
.min(self.loss_value_destroyed.height.len())
|
||||
.min(self.sent_in_profit.base.sats.height.len())
|
||||
.min(self.sent_in_loss.base.sats.height.len())
|
||||
}
|
||||
|
||||
pub(crate) fn truncate_push(&mut self, height: Height, state: &RealizedState) -> Result<()> {
|
||||
self.core.truncate_push(height, state)?;
|
||||
self.profit_value_created
|
||||
.height
|
||||
.truncate_push(height, state.profit_value_created())?;
|
||||
self.profit_value_destroyed
|
||||
.height
|
||||
.truncate_push(height, state.profit_value_destroyed())?;
|
||||
self.loss_value_created
|
||||
.height
|
||||
.truncate_push(height, state.loss_value_created())?;
|
||||
self.loss_value_destroyed
|
||||
.height
|
||||
.truncate_push(height, state.loss_value_destroyed())?;
|
||||
self.sent_in_profit
|
||||
.base
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, state.sent_in_profit())?;
|
||||
self.sent_in_loss
|
||||
.base
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, state.sent_in_loss())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
let mut vecs = self.core.collect_vecs_mut();
|
||||
vecs.push(&mut self.profit_value_created.height as &mut dyn AnyStoredVec);
|
||||
vecs.push(&mut self.profit_value_destroyed.height);
|
||||
vecs.push(&mut self.loss_value_created.height);
|
||||
vecs.push(&mut self.loss_value_destroyed.height);
|
||||
vecs.push(&mut self.sent_in_profit.base.sats.height);
|
||||
vecs.push(&mut self.sent_in_loss.base.sats.height);
|
||||
vecs
|
||||
}
|
||||
|
||||
pub(crate) fn compute_from_stateful(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
others: &[&Self],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
let core_refs: Vec<&CoreRealized> = others.iter().map(|o| &o.core).collect();
|
||||
self.core
|
||||
.compute_from_stateful(starting_indexes, &core_refs, exit)?;
|
||||
|
||||
macro_rules! sum_others {
|
||||
($($field:tt).+) => {
|
||||
self.$($field).+.compute_sum_of_others(
|
||||
starting_indexes.height,
|
||||
&others.iter().map(|v| &v.$($field).+).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?
|
||||
};
|
||||
}
|
||||
|
||||
sum_others!(profit_value_created.height);
|
||||
sum_others!(profit_value_destroyed.height);
|
||||
sum_others!(loss_value_created.height);
|
||||
sum_others!(loss_value_destroyed.height);
|
||||
sum_others!(sent_in_profit.base.sats.height);
|
||||
sum_others!(sent_in_loss.base.sats.height);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest_part1(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.core.compute_rest_part1(starting_indexes, exit)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn compute_rest_part2(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
height_to_supply: &impl ReadableVec<Height, Bitcoin>,
|
||||
height_to_market_cap: &impl ReadableVec<Height, Dollars>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.core.compute_rest_part2(
|
||||
blocks,
|
||||
prices,
|
||||
starting_indexes,
|
||||
height_to_supply,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.value_created
|
||||
.compute_binary::<Cents, Cents, CentsPlus>(
|
||||
starting_indexes.height,
|
||||
&self.profit_value_created.height,
|
||||
&self.loss_value_created.height,
|
||||
exit,
|
||||
)?;
|
||||
self.value_destroyed
|
||||
.compute_binary::<Cents, Cents, CentsPlus>(
|
||||
starting_indexes.height,
|
||||
&self.profit_value_destroyed.height,
|
||||
&self.loss_value_destroyed.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
let window_starts = blocks.count.window_starts();
|
||||
self.value_created_sum.compute_rolling_sum(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.value_created.height,
|
||||
exit,
|
||||
)?;
|
||||
self.value_destroyed_sum.compute_rolling_sum(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.value_destroyed.height,
|
||||
exit,
|
||||
)?;
|
||||
self.gross_pnl_sum.compute_rolling_sum(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
&self.core.gross_pnl.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
for ((sopr, vc), vd) in self
|
||||
.sopr
|
||||
.as_mut_array()
|
||||
.into_iter()
|
||||
.zip(self.value_created_sum.as_array())
|
||||
.zip(self.value_destroyed_sum.as_array())
|
||||
{
|
||||
sopr.compute_binary::<Cents, Cents, RatioCents64>(
|
||||
starting_indexes.height,
|
||||
&vc.height,
|
||||
&vd.height,
|
||||
exit,
|
||||
)?;
|
||||
}
|
||||
|
||||
self.sopr_24h_ema.compute_from_24h(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1w_ago,
|
||||
&blocks.count.height_1m_ago,
|
||||
&self.sopr._24h.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.sent_in_profit_ema.compute(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_2w_ago,
|
||||
&self.sent_in_profit.base.sats.height,
|
||||
&self.sent_in_profit.base.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
self.sent_in_loss_ema.compute(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_2w_ago,
|
||||
&self.sent_in_loss.base.sats.height,
|
||||
&self.sent_in_loss.base.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.net_pnl_change_1m.height.compute_rolling_change(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1m_ago,
|
||||
&self.core.net_realized_pnl.cumulative.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.net_pnl_change_1m_rel_to_realized_cap
|
||||
.compute_binary::<CentsSigned, Cents, RatioCentsSignedCentsBps32>(
|
||||
starting_indexes.height,
|
||||
&self.net_pnl_change_1m.height,
|
||||
&self.core.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.net_pnl_change_1m_rel_to_market_cap
|
||||
.compute_binary::<CentsSigned, Dollars, RatioCentsSignedDollarsBps32>(
|
||||
starting_indexes.height,
|
||||
&self.net_pnl_change_1m.height,
|
||||
height_to_market_cap,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
287
crates/brk_computer/src/distribution/metrics/realized/core.rs
Normal file
287
crates/brk_computer/src/distribution/metrics/realized/core.rs
Normal file
@@ -0,0 +1,287 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{
|
||||
BasisPoints32, BasisPointsSigned32, Bitcoin, Cents, CentsSigned, Dollars, Height, Indexes,
|
||||
Sats, StoredF32, Version,
|
||||
};
|
||||
use vecdb::{
|
||||
AnyStoredVec, AnyVec, Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode, WritableVec,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
blocks,
|
||||
distribution::state::RealizedState,
|
||||
internal::{
|
||||
CentsUnsignedToDollars, ComputedFromHeight, ComputedFromHeightCumulative,
|
||||
ComputedFromHeightRatio, FiatFromHeight, Identity, LazyFromHeight,
|
||||
NegCentsUnsignedToDollars, PercentFromHeight, Price, RatioCentsBp32,
|
||||
RatioCentsSignedCentsBps32,
|
||||
},
|
||||
prices,
|
||||
};
|
||||
|
||||
use crate::distribution::metrics::ImportConfig;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct CoreRealized<M: StorageMode = Rw> {
|
||||
pub realized_cap_cents: ComputedFromHeight<Cents, M>,
|
||||
pub realized_profit: ComputedFromHeightCumulative<Cents, M>,
|
||||
pub realized_loss: ComputedFromHeightCumulative<Cents, M>,
|
||||
|
||||
pub realized_cap: LazyFromHeight<Dollars, Cents>,
|
||||
pub realized_price: Price<ComputedFromHeight<Cents, M>>,
|
||||
pub realized_price_ratio: ComputedFromHeightRatio<M>,
|
||||
pub realized_cap_change_1m: ComputedFromHeight<CentsSigned, M>,
|
||||
|
||||
pub mvrv: LazyFromHeight<StoredF32>,
|
||||
|
||||
pub neg_realized_loss: LazyFromHeight<Dollars, Cents>,
|
||||
pub net_realized_pnl: ComputedFromHeightCumulative<CentsSigned, M>,
|
||||
pub net_realized_pnl_ema_1w: ComputedFromHeight<CentsSigned, M>,
|
||||
pub gross_pnl: FiatFromHeight<Cents, M>,
|
||||
|
||||
pub realized_profit_ema_1w: ComputedFromHeight<Cents, M>,
|
||||
pub realized_loss_ema_1w: ComputedFromHeight<Cents, M>,
|
||||
|
||||
pub realized_profit_rel_to_realized_cap: PercentFromHeight<BasisPoints32, M>,
|
||||
pub realized_loss_rel_to_realized_cap: PercentFromHeight<BasisPoints32, M>,
|
||||
pub net_realized_pnl_rel_to_realized_cap: PercentFromHeight<BasisPointsSigned32, M>,
|
||||
}
|
||||
|
||||
impl CoreRealized {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let v0 = Version::ZERO;
|
||||
let v1 = Version::ONE;
|
||||
|
||||
let realized_cap_cents = cfg.import_computed("realized_cap_cents", v0)?;
|
||||
let realized_cap = LazyFromHeight::from_computed::<CentsUnsignedToDollars>(
|
||||
&cfg.name("realized_cap"),
|
||||
cfg.version,
|
||||
realized_cap_cents.height.read_only_boxed_clone(),
|
||||
&realized_cap_cents,
|
||||
);
|
||||
|
||||
let realized_profit = cfg.import_cumulative("realized_profit", v0)?;
|
||||
let realized_profit_ema_1w = cfg.import_computed("realized_profit_ema_1w", v0)?;
|
||||
let realized_loss = cfg.import_cumulative("realized_loss", v0)?;
|
||||
let realized_loss_ema_1w = cfg.import_computed("realized_loss_ema_1w", v0)?;
|
||||
|
||||
let neg_realized_loss = LazyFromHeight::from_height_source::<NegCentsUnsignedToDollars>(
|
||||
&cfg.name("neg_realized_loss"),
|
||||
cfg.version + Version::ONE,
|
||||
realized_loss.height.read_only_boxed_clone(),
|
||||
cfg.indexes,
|
||||
);
|
||||
|
||||
let net_realized_pnl = cfg.import_cumulative("net_realized_pnl", v0)?;
|
||||
let net_realized_pnl_ema_1w = cfg.import_computed("net_realized_pnl_ema_1w", v0)?;
|
||||
let gross_pnl = cfg.import_fiat("realized_gross_pnl", v0)?;
|
||||
|
||||
let realized_profit_rel_to_realized_cap =
|
||||
cfg.import_percent_bp32("realized_profit_rel_to_realized_cap", Version::new(2))?;
|
||||
let realized_loss_rel_to_realized_cap =
|
||||
cfg.import_percent_bp32("realized_loss_rel_to_realized_cap", Version::new(2))?;
|
||||
let net_realized_pnl_rel_to_realized_cap =
|
||||
cfg.import_percent_bps32("net_realized_pnl_rel_to_realized_cap", Version::new(2))?;
|
||||
|
||||
let realized_price = cfg.import_price("realized_price", v1)?;
|
||||
|
||||
let realized_price_ratio = cfg.import_ratio("realized_price", v1)?;
|
||||
let mvrv = LazyFromHeight::from_lazy::<Identity<StoredF32>, BasisPoints32>(
|
||||
&cfg.name("mvrv"),
|
||||
cfg.version,
|
||||
&realized_price_ratio.ratio,
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
realized_cap_cents,
|
||||
realized_cap,
|
||||
realized_price,
|
||||
realized_price_ratio,
|
||||
realized_cap_change_1m: cfg.import_computed("realized_cap_change_1m", v0)?,
|
||||
mvrv,
|
||||
realized_profit,
|
||||
realized_profit_ema_1w,
|
||||
realized_loss,
|
||||
realized_loss_ema_1w,
|
||||
neg_realized_loss,
|
||||
net_realized_pnl,
|
||||
net_realized_pnl_ema_1w,
|
||||
gross_pnl,
|
||||
realized_profit_rel_to_realized_cap,
|
||||
realized_loss_rel_to_realized_cap,
|
||||
net_realized_pnl_rel_to_realized_cap,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
self.realized_cap_cents
|
||||
.height
|
||||
.len()
|
||||
.min(self.realized_profit.height.len())
|
||||
.min(self.realized_loss.height.len())
|
||||
}
|
||||
|
||||
pub(crate) fn truncate_push(&mut self, height: Height, state: &RealizedState) -> Result<()> {
|
||||
self.realized_cap_cents
|
||||
.height
|
||||
.truncate_push(height, state.cap())?;
|
||||
self.realized_profit
|
||||
.height
|
||||
.truncate_push(height, state.profit())?;
|
||||
self.realized_loss
|
||||
.height
|
||||
.truncate_push(height, state.loss())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
vec![
|
||||
&mut self.realized_cap_cents.height as &mut dyn AnyStoredVec,
|
||||
&mut self.realized_profit.height,
|
||||
&mut self.realized_loss.height,
|
||||
]
|
||||
}
|
||||
|
||||
pub(crate) fn compute_from_stateful(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
others: &[&Self],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
macro_rules! sum_others {
|
||||
($($field:tt).+) => {
|
||||
self.$($field).+.compute_sum_of_others(
|
||||
starting_indexes.height,
|
||||
&others.iter().map(|v| &v.$($field).+).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?
|
||||
};
|
||||
}
|
||||
|
||||
sum_others!(realized_cap_cents.height);
|
||||
sum_others!(realized_profit.height);
|
||||
sum_others!(realized_loss.height);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest_part1(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.realized_profit
|
||||
.compute_rest(starting_indexes.height, exit)?;
|
||||
self.realized_loss
|
||||
.compute_rest(starting_indexes.height, exit)?;
|
||||
|
||||
self.net_realized_pnl
|
||||
.compute(starting_indexes.height, exit, |vec| {
|
||||
vec.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.realized_profit.height,
|
||||
&self.realized_loss.height,
|
||||
|(i, profit, loss, ..)| {
|
||||
(
|
||||
i,
|
||||
CentsSigned::new(profit.inner() as i64 - loss.inner() as i64),
|
||||
)
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
self.gross_pnl.cents.height.compute_add(
|
||||
starting_indexes.height,
|
||||
&self.realized_profit.height,
|
||||
&self.realized_loss.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest_part2(
|
||||
&mut self,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
height_to_supply: &impl ReadableVec<Height, Bitcoin>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.realized_price.cents.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.realized_cap_cents.height,
|
||||
height_to_supply,
|
||||
|(i, cap_cents, supply, ..)| {
|
||||
let cap = cap_cents.as_u128();
|
||||
let supply_sats = Sats::from(supply).as_u128();
|
||||
if supply_sats == 0 {
|
||||
(i, Cents::ZERO)
|
||||
} else {
|
||||
(i, Cents::from(cap * Sats::ONE_BTC_U128 / supply_sats))
|
||||
}
|
||||
},
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.realized_price_ratio.compute_ratio(
|
||||
starting_indexes,
|
||||
&prices.price.cents.height,
|
||||
&self.realized_price.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.realized_cap_change_1m.height.compute_rolling_change(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1m_ago,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.realized_profit_ema_1w.height.compute_rolling_ema(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1w_ago,
|
||||
&self.realized_profit.height,
|
||||
exit,
|
||||
)?;
|
||||
self.realized_loss_ema_1w.height.compute_rolling_ema(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1w_ago,
|
||||
&self.realized_loss.height,
|
||||
exit,
|
||||
)?;
|
||||
self.net_realized_pnl_ema_1w.height.compute_rolling_ema(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1w_ago,
|
||||
&self.net_realized_pnl.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.realized_profit_rel_to_realized_cap
|
||||
.compute_binary::<Cents, Cents, RatioCentsBp32>(
|
||||
starting_indexes.height,
|
||||
&self.realized_profit.height,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
self.realized_loss_rel_to_realized_cap
|
||||
.compute_binary::<Cents, Cents, RatioCentsBp32>(
|
||||
starting_indexes.height,
|
||||
&self.realized_loss.height,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
self.net_realized_pnl_rel_to_realized_cap
|
||||
.compute_binary::<CentsSigned, Cents, RatioCentsSignedCentsBps32>(
|
||||
starting_indexes.height,
|
||||
&self.net_realized_pnl.height,
|
||||
&self.realized_cap_cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
mod adjusted;
|
||||
mod base;
|
||||
mod complete;
|
||||
mod core;
|
||||
mod extended;
|
||||
|
||||
mod with_adjusted;
|
||||
@@ -8,6 +10,8 @@ mod with_extended_adjusted;
|
||||
|
||||
pub use adjusted::*;
|
||||
pub use base::*;
|
||||
pub use complete::*;
|
||||
pub use core::*;
|
||||
pub use extended::*;
|
||||
|
||||
pub use with_adjusted::*;
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{BasisPoints16, BasisPointsSigned32, Dollars, Height, Sats, StoredF32, Version};
|
||||
use vecdb::{Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode};
|
||||
use brk_types::{BasisPoints16, BasisPointsSigned32, Dollars, Height, Sats, Version};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use vecdb::{Exit, ReadableVec, Rw, StorageMode};
|
||||
|
||||
use crate::internal::{
|
||||
Bps32ToFloat, LazyFromHeight, NegRatioDollarsBps32, PercentFromHeight, RatioDollarsBp16,
|
||||
RatioDollarsBps32, RatioSatsBp16,
|
||||
};
|
||||
use crate::internal::{NegRatioDollarsBps32, PercentFromHeight, RatioDollarsBp16};
|
||||
|
||||
use crate::distribution::metrics::{ImportConfig, RealizedBase, UnrealizedBase};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct RelativeBase<M: StorageMode = Rw> {
|
||||
pub supply_in_profit_rel_to_own_supply: PercentFromHeight<BasisPoints16, M>,
|
||||
pub supply_in_loss_rel_to_own_supply: PercentFromHeight<BasisPoints16, M>,
|
||||
use super::RelativeComplete;
|
||||
|
||||
pub unrealized_profit_rel_to_market_cap: PercentFromHeight<BasisPoints16, M>,
|
||||
pub unrealized_loss_rel_to_market_cap: PercentFromHeight<BasisPoints16, M>,
|
||||
/// Full relative metrics (Source/Extended tier).
|
||||
///
|
||||
/// Contains all Complete-tier fields (via Deref to RelativeComplete) plus:
|
||||
/// - Source-only: neg_unrealized_loss_rel_to_market_cap, invested_capital_in_profit/loss_rel_to_realized_cap
|
||||
#[derive(Deref, DerefMut, Traversable)]
|
||||
pub struct RelativeBase<M: StorageMode = Rw> {
|
||||
#[deref]
|
||||
#[deref_mut]
|
||||
#[traversable(flatten)]
|
||||
pub complete: RelativeComplete<M>,
|
||||
|
||||
// --- Source-only fields ---
|
||||
pub neg_unrealized_loss_rel_to_market_cap: PercentFromHeight<BasisPointsSigned32, M>,
|
||||
pub net_unrealized_pnl_rel_to_market_cap: PercentFromHeight<BasisPointsSigned32, M>,
|
||||
pub nupl: LazyFromHeight<StoredF32, BasisPointsSigned32>,
|
||||
|
||||
pub invested_capital_in_profit_rel_to_realized_cap: PercentFromHeight<BasisPoints16, M>,
|
||||
pub invested_capital_in_loss_rel_to_realized_cap: PercentFromHeight<BasisPoints16, M>,
|
||||
@@ -27,35 +30,12 @@ pub struct RelativeBase<M: StorageMode = Rw> {
|
||||
|
||||
impl RelativeBase {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let v1 = Version::ONE;
|
||||
let v2 = Version::new(2);
|
||||
|
||||
let net_unrealized_pnl_rel_to_market_cap =
|
||||
cfg.import_percent_bps32("net_unrealized_pnl_rel_to_market_cap", Version::new(3))?;
|
||||
|
||||
let nupl = LazyFromHeight::from_computed::<Bps32ToFloat>(
|
||||
&cfg.name("nupl"),
|
||||
cfg.version + Version::new(3),
|
||||
net_unrealized_pnl_rel_to_market_cap
|
||||
.bps
|
||||
.height
|
||||
.read_only_boxed_clone(),
|
||||
&net_unrealized_pnl_rel_to_market_cap.bps,
|
||||
);
|
||||
let complete = RelativeComplete::forced_import(cfg)?;
|
||||
|
||||
Ok(Self {
|
||||
supply_in_profit_rel_to_own_supply: cfg
|
||||
.import_percent_bp16("supply_in_profit_rel_to_own_supply", v1)?,
|
||||
supply_in_loss_rel_to_own_supply: cfg
|
||||
.import_percent_bp16("supply_in_loss_rel_to_own_supply", v1)?,
|
||||
unrealized_profit_rel_to_market_cap: cfg
|
||||
.import_percent_bp16("unrealized_profit_rel_to_market_cap", v2)?,
|
||||
unrealized_loss_rel_to_market_cap: cfg
|
||||
.import_percent_bp16("unrealized_loss_rel_to_market_cap", v2)?,
|
||||
complete,
|
||||
neg_unrealized_loss_rel_to_market_cap: cfg
|
||||
.import_percent_bps32("neg_unrealized_loss_rel_to_market_cap", Version::new(3))?,
|
||||
net_unrealized_pnl_rel_to_market_cap,
|
||||
nupl,
|
||||
invested_capital_in_profit_rel_to_realized_cap: cfg.import_percent_bp16(
|
||||
"invested_capital_in_profit_rel_to_realized_cap",
|
||||
Version::ZERO,
|
||||
@@ -76,34 +56,16 @@ impl RelativeBase {
|
||||
market_cap: &impl ReadableVec<Height, Dollars>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply_in_profit_rel_to_own_supply
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&unrealized.supply_in_profit.sats.height,
|
||||
supply_total_sats,
|
||||
exit,
|
||||
)?;
|
||||
self.supply_in_loss_rel_to_own_supply
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&unrealized.supply_in_loss.sats.height,
|
||||
supply_total_sats,
|
||||
exit,
|
||||
)?;
|
||||
self.unrealized_profit_rel_to_market_cap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
&unrealized.unrealized_profit.usd.height,
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
self.unrealized_loss_rel_to_market_cap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
&unrealized.unrealized_loss.usd.height,
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
// Compute Complete-tier fields
|
||||
self.complete.compute(
|
||||
max_from,
|
||||
&unrealized.complete,
|
||||
supply_total_sats,
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Source-only
|
||||
self.neg_unrealized_loss_rel_to_market_cap
|
||||
.compute_binary::<Dollars, Dollars, NegRatioDollarsBps32>(
|
||||
max_from,
|
||||
@@ -111,13 +73,6 @@ impl RelativeBase {
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
self.net_unrealized_pnl_rel_to_market_cap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBps32>(
|
||||
max_from,
|
||||
&unrealized.net_unrealized_pnl.usd.height,
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
self.invested_capital_in_profit_rel_to_realized_cap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{BasisPoints16, BasisPointsSigned32, Dollars, Height, Sats, StoredF32, Version};
|
||||
use vecdb::{Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode};
|
||||
|
||||
use crate::internal::{
|
||||
Bps32ToFloat, LazyFromHeight, PercentFromHeight, RatioDollarsBp16, RatioDollarsBps32,
|
||||
RatioSatsBp16,
|
||||
};
|
||||
|
||||
use crate::distribution::metrics::{ImportConfig, UnrealizedComplete};
|
||||
|
||||
/// Relative metrics for the Complete tier (~6 fields).
|
||||
///
|
||||
/// Excludes source-only fields (invested_capital_in_profit/loss_rel_to_realized_cap,
|
||||
/// neg_unrealized_loss_rel_to_market_cap).
|
||||
#[derive(Traversable)]
|
||||
pub struct RelativeComplete<M: StorageMode = Rw> {
|
||||
pub supply_in_profit_rel_to_own_supply: PercentFromHeight<BasisPoints16, M>,
|
||||
pub supply_in_loss_rel_to_own_supply: PercentFromHeight<BasisPoints16, M>,
|
||||
|
||||
pub unrealized_profit_rel_to_market_cap: PercentFromHeight<BasisPoints16, M>,
|
||||
pub unrealized_loss_rel_to_market_cap: PercentFromHeight<BasisPoints16, M>,
|
||||
pub net_unrealized_pnl_rel_to_market_cap: PercentFromHeight<BasisPointsSigned32, M>,
|
||||
pub nupl: LazyFromHeight<StoredF32, BasisPointsSigned32>,
|
||||
}
|
||||
|
||||
impl RelativeComplete {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let v1 = Version::ONE;
|
||||
let v2 = Version::new(2);
|
||||
|
||||
let net_unrealized_pnl_rel_to_market_cap =
|
||||
cfg.import_percent_bps32("net_unrealized_pnl_rel_to_market_cap", Version::new(3))?;
|
||||
|
||||
let nupl = LazyFromHeight::from_computed::<Bps32ToFloat>(
|
||||
&cfg.name("nupl"),
|
||||
cfg.version + Version::new(3),
|
||||
net_unrealized_pnl_rel_to_market_cap
|
||||
.bps
|
||||
.height
|
||||
.read_only_boxed_clone(),
|
||||
&net_unrealized_pnl_rel_to_market_cap.bps,
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
supply_in_profit_rel_to_own_supply: cfg
|
||||
.import_percent_bp16("supply_in_profit_rel_to_own_supply", v1)?,
|
||||
supply_in_loss_rel_to_own_supply: cfg
|
||||
.import_percent_bp16("supply_in_loss_rel_to_own_supply", v1)?,
|
||||
unrealized_profit_rel_to_market_cap: cfg
|
||||
.import_percent_bp16("unrealized_profit_rel_to_market_cap", v2)?,
|
||||
unrealized_loss_rel_to_market_cap: cfg
|
||||
.import_percent_bp16("unrealized_loss_rel_to_market_cap", v2)?,
|
||||
net_unrealized_pnl_rel_to_market_cap,
|
||||
nupl,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn compute(
|
||||
&mut self,
|
||||
max_from: Height,
|
||||
unrealized: &UnrealizedComplete,
|
||||
supply_total_sats: &impl ReadableVec<Height, Sats>,
|
||||
market_cap: &impl ReadableVec<Height, Dollars>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply_in_profit_rel_to_own_supply
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&unrealized.supply_in_profit.sats.height,
|
||||
supply_total_sats,
|
||||
exit,
|
||||
)?;
|
||||
self.supply_in_loss_rel_to_own_supply
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&unrealized.supply_in_loss.sats.height,
|
||||
supply_total_sats,
|
||||
exit,
|
||||
)?;
|
||||
self.unrealized_profit_rel_to_market_cap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
&unrealized.unrealized_profit.usd.height,
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
self.unrealized_loss_rel_to_market_cap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
&unrealized.unrealized_loss.usd.height,
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
self.net_unrealized_pnl_rel_to_market_cap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBps32>(
|
||||
max_from,
|
||||
&unrealized.net_unrealized_pnl.usd.height,
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
mod base;
|
||||
mod complete;
|
||||
mod extended_own_market_cap;
|
||||
mod extended_own_pnl;
|
||||
mod for_all;
|
||||
@@ -6,8 +7,10 @@ mod for_all;
|
||||
mod to_all;
|
||||
mod with_extended;
|
||||
mod with_rel_to_all;
|
||||
mod with_rel_to_all_complete;
|
||||
|
||||
pub use base::*;
|
||||
pub use complete::*;
|
||||
pub use extended_own_market_cap::*;
|
||||
pub use extended_own_pnl::*;
|
||||
pub use for_all::*;
|
||||
@@ -15,3 +18,4 @@ pub use for_all::*;
|
||||
pub use to_all::*;
|
||||
pub use with_extended::*;
|
||||
pub use with_rel_to_all::*;
|
||||
pub use with_rel_to_all_complete::*;
|
||||
|
||||
@@ -5,7 +5,7 @@ use vecdb::{Exit, ReadableVec, Rw, StorageMode};
|
||||
|
||||
use crate::internal::{PercentFromHeight, RatioSatsBp16};
|
||||
|
||||
use crate::distribution::metrics::{ImportConfig, UnrealizedBase};
|
||||
use crate::distribution::metrics::ImportConfig;
|
||||
|
||||
/// Relative-to-all metrics (not present for the "all" cohort itself).
|
||||
#[derive(Traversable)]
|
||||
@@ -30,7 +30,8 @@ impl RelativeToAll {
|
||||
pub(crate) fn compute(
|
||||
&mut self,
|
||||
max_from: Height,
|
||||
unrealized: &UnrealizedBase,
|
||||
supply_in_profit_sats: &impl ReadableVec<Height, Sats>,
|
||||
supply_in_loss_sats: &impl ReadableVec<Height, Sats>,
|
||||
supply_total_sats: &impl ReadableVec<Height, Sats>,
|
||||
all_supply_sats: &impl ReadableVec<Height, Sats>,
|
||||
exit: &Exit,
|
||||
@@ -45,14 +46,14 @@ impl RelativeToAll {
|
||||
self.supply_in_profit_rel_to_circulating_supply
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&unrealized.supply_in_profit.sats.height,
|
||||
supply_in_profit_sats,
|
||||
all_supply_sats,
|
||||
exit,
|
||||
)?;
|
||||
self.supply_in_loss_rel_to_circulating_supply
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&unrealized.supply_in_loss.sats.height,
|
||||
supply_in_loss_sats,
|
||||
all_supply_sats,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
@@ -56,7 +56,8 @@ impl RelativeWithExtended {
|
||||
)?;
|
||||
self.rel_to_all.compute(
|
||||
max_from,
|
||||
unrealized,
|
||||
&unrealized.supply_in_profit.sats.height,
|
||||
&unrealized.supply_in_loss.sats.height,
|
||||
supply_total_sats,
|
||||
all_supply_sats,
|
||||
exit,
|
||||
|
||||
@@ -49,7 +49,8 @@ impl RelativeWithRelToAll {
|
||||
)?;
|
||||
self.rel_to_all.compute(
|
||||
max_from,
|
||||
unrealized,
|
||||
&unrealized.supply_in_profit.sats.height,
|
||||
&unrealized.supply_in_loss.sats.height,
|
||||
supply_total_sats,
|
||||
all_supply_sats,
|
||||
exit,
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{Dollars, Height, Sats};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use vecdb::{Exit, ReadableVec, Rw, StorageMode};
|
||||
|
||||
use crate::distribution::metrics::{ImportConfig, UnrealizedComplete};
|
||||
|
||||
use super::{RelativeComplete, RelativeToAll};
|
||||
|
||||
/// Complete relative metrics with rel_to_all.
|
||||
/// Used by CompleteCohortMetrics (epoch, class, min_age, max_age).
|
||||
#[derive(Deref, DerefMut, Traversable)]
|
||||
pub struct RelativeCompleteWithRelToAll<M: StorageMode = Rw> {
|
||||
#[deref]
|
||||
#[deref_mut]
|
||||
#[traversable(flatten)]
|
||||
pub base: RelativeComplete<M>,
|
||||
#[traversable(flatten)]
|
||||
pub rel_to_all: RelativeToAll<M>,
|
||||
}
|
||||
|
||||
impl RelativeCompleteWithRelToAll {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
base: RelativeComplete::forced_import(cfg)?,
|
||||
rel_to_all: RelativeToAll::forced_import(cfg)?,
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn compute(
|
||||
&mut self,
|
||||
max_from: Height,
|
||||
unrealized: &UnrealizedComplete,
|
||||
supply_total_sats: &impl ReadableVec<Height, Sats>,
|
||||
market_cap: &impl ReadableVec<Height, Dollars>,
|
||||
all_supply_sats: &impl ReadableVec<Height, Sats>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.base.compute(
|
||||
max_from,
|
||||
unrealized,
|
||||
supply_total_sats,
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
self.rel_to_all.compute(
|
||||
max_from,
|
||||
&unrealized.supply_in_profit.sats.height,
|
||||
&unrealized.supply_in_loss.sats.height,
|
||||
supply_total_sats,
|
||||
all_supply_sats,
|
||||
exit,
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,32 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{Cents, CentsSats, CentsSigned, CentsSquaredSats, Height, Indexes, Version};
|
||||
use vecdb::{
|
||||
AnyStoredVec, AnyVec, BytesVec, Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode,
|
||||
WritableVec,
|
||||
};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use vecdb::{AnyStoredVec, AnyVec, BytesVec, Exit, ReadableVec, Rw, StorageMode, WritableVec};
|
||||
|
||||
use crate::{
|
||||
distribution::state::UnrealizedState,
|
||||
internal::{
|
||||
CentsSubtractToCentsSigned, FiatFromHeight, LazyFromHeight, NegCentsUnsignedToDollars,
|
||||
ValueFromHeight,
|
||||
},
|
||||
internal::{CentsSubtractToCentsSigned, FiatFromHeight},
|
||||
prices,
|
||||
};
|
||||
|
||||
use brk_types::Dollars;
|
||||
|
||||
use crate::distribution::metrics::ImportConfig;
|
||||
|
||||
#[derive(Traversable)]
|
||||
use super::UnrealizedComplete;
|
||||
|
||||
/// Full unrealized metrics (Source/Extended tier).
|
||||
///
|
||||
/// Contains all Complete-tier fields (via Deref to UnrealizedComplete) plus:
|
||||
/// - Source-only: invested_capital, raw BytesVecs, unrealized_gross_pnl
|
||||
/// - Extended-only: pain_index, greed_index, net_sentiment
|
||||
#[derive(Deref, DerefMut, Traversable)]
|
||||
pub struct UnrealizedBase<M: StorageMode = Rw> {
|
||||
pub supply_in_profit: ValueFromHeight<M>,
|
||||
pub supply_in_loss: ValueFromHeight<M>,
|
||||
|
||||
pub unrealized_profit: FiatFromHeight<Cents, M>,
|
||||
pub unrealized_loss: FiatFromHeight<Cents, M>,
|
||||
#[deref]
|
||||
#[deref_mut]
|
||||
#[traversable(flatten)]
|
||||
pub complete: UnrealizedComplete<M>,
|
||||
|
||||
// --- Source-only fields ---
|
||||
pub invested_capital_in_profit: FiatFromHeight<Cents, M>,
|
||||
pub invested_capital_in_loss: FiatFromHeight<Cents, M>,
|
||||
|
||||
@@ -35,24 +35,19 @@ pub struct UnrealizedBase<M: StorageMode = Rw> {
|
||||
pub investor_cap_in_profit_raw: M::Stored<BytesVec<Height, CentsSquaredSats>>,
|
||||
pub investor_cap_in_loss_raw: M::Stored<BytesVec<Height, CentsSquaredSats>>,
|
||||
|
||||
pub gross_pnl: FiatFromHeight<Cents, M>,
|
||||
|
||||
// --- Extended-only fields ---
|
||||
pub pain_index: FiatFromHeight<Cents, M>,
|
||||
pub greed_index: FiatFromHeight<Cents, M>,
|
||||
pub net_sentiment: FiatFromHeight<CentsSigned, M>,
|
||||
|
||||
pub neg_unrealized_loss: LazyFromHeight<Dollars, Cents>,
|
||||
|
||||
pub net_unrealized_pnl: FiatFromHeight<CentsSigned, M>,
|
||||
pub gross_pnl: FiatFromHeight<Cents, M>,
|
||||
}
|
||||
|
||||
impl UnrealizedBase {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let v0 = Version::ZERO;
|
||||
let supply_in_profit = cfg.import_value("supply_in_profit", v0)?;
|
||||
let supply_in_loss = cfg.import_value("supply_in_loss", v0)?;
|
||||
|
||||
let unrealized_profit = cfg.import_fiat("unrealized_profit", v0)?;
|
||||
let unrealized_loss = cfg.import_fiat("unrealized_loss", v0)?;
|
||||
let complete = UnrealizedComplete::forced_import(cfg)?;
|
||||
|
||||
let invested_capital_in_profit = cfg.import_fiat("invested_capital_in_profit", v0)?;
|
||||
let invested_capital_in_loss = cfg.import_fiat("invested_capital_in_loss", v0)?;
|
||||
@@ -67,21 +62,10 @@ impl UnrealizedBase {
|
||||
let greed_index = cfg.import_fiat("greed_index", v0)?;
|
||||
let net_sentiment = cfg.import_fiat("net_sentiment", Version::ONE)?;
|
||||
|
||||
let neg_unrealized_loss = LazyFromHeight::from_computed::<NegCentsUnsignedToDollars>(
|
||||
&cfg.name("neg_unrealized_loss"),
|
||||
cfg.version,
|
||||
unrealized_loss.cents.height.read_only_boxed_clone(),
|
||||
&unrealized_loss.cents,
|
||||
);
|
||||
|
||||
let net_unrealized_pnl = cfg.import_fiat("net_unrealized_pnl", v0)?;
|
||||
let gross_pnl = cfg.import_fiat("unrealized_gross_pnl", v0)?;
|
||||
|
||||
Ok(Self {
|
||||
supply_in_profit,
|
||||
supply_in_loss,
|
||||
unrealized_profit,
|
||||
unrealized_loss,
|
||||
complete,
|
||||
invested_capital_in_profit,
|
||||
invested_capital_in_loss,
|
||||
invested_capital_in_profit_raw,
|
||||
@@ -91,20 +75,13 @@ impl UnrealizedBase {
|
||||
pain_index,
|
||||
greed_index,
|
||||
net_sentiment,
|
||||
neg_unrealized_loss,
|
||||
net_unrealized_pnl,
|
||||
gross_pnl,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
self.supply_in_profit
|
||||
.sats
|
||||
.height
|
||||
.len()
|
||||
.min(self.supply_in_loss.sats.height.len())
|
||||
.min(self.unrealized_profit.cents.height.len())
|
||||
.min(self.unrealized_loss.cents.height.len())
|
||||
self.complete
|
||||
.min_stateful_height_len()
|
||||
.min(self.invested_capital_in_profit.cents.height.len())
|
||||
.min(self.invested_capital_in_loss.cents.height.len())
|
||||
.min(self.invested_capital_in_profit_raw.len())
|
||||
@@ -118,22 +95,8 @@ impl UnrealizedBase {
|
||||
height: Height,
|
||||
height_state: &UnrealizedState,
|
||||
) -> Result<()> {
|
||||
self.supply_in_profit
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, height_state.supply_in_profit)?;
|
||||
self.supply_in_loss
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, height_state.supply_in_loss)?;
|
||||
self.unrealized_profit
|
||||
.cents
|
||||
.height
|
||||
.truncate_push(height, height_state.unrealized_profit)?;
|
||||
self.unrealized_loss
|
||||
.cents
|
||||
.height
|
||||
.truncate_push(height, height_state.unrealized_loss)?;
|
||||
self.complete.truncate_push(height, height_state)?;
|
||||
|
||||
self.invested_capital_in_profit
|
||||
.cents
|
||||
.height
|
||||
@@ -164,20 +127,14 @@ impl UnrealizedBase {
|
||||
}
|
||||
|
||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
vec![
|
||||
&mut self.supply_in_profit.base.sats.height as &mut dyn AnyStoredVec,
|
||||
&mut self.supply_in_profit.base.cents.height as &mut dyn AnyStoredVec,
|
||||
&mut self.supply_in_loss.base.sats.height as &mut dyn AnyStoredVec,
|
||||
&mut self.supply_in_loss.base.cents.height as &mut dyn AnyStoredVec,
|
||||
&mut self.unrealized_profit.cents.height,
|
||||
&mut self.unrealized_loss.cents.height,
|
||||
&mut self.invested_capital_in_profit.cents.height,
|
||||
&mut self.invested_capital_in_loss.cents.height,
|
||||
&mut self.invested_capital_in_profit_raw as &mut dyn AnyStoredVec,
|
||||
&mut self.invested_capital_in_loss_raw as &mut dyn AnyStoredVec,
|
||||
&mut self.investor_cap_in_profit_raw as &mut dyn AnyStoredVec,
|
||||
&mut self.investor_cap_in_loss_raw as &mut dyn AnyStoredVec,
|
||||
]
|
||||
let mut vecs = self.complete.collect_vecs_mut();
|
||||
vecs.push(&mut self.invested_capital_in_profit.cents.height as &mut dyn AnyStoredVec);
|
||||
vecs.push(&mut self.invested_capital_in_loss.cents.height as &mut dyn AnyStoredVec);
|
||||
vecs.push(&mut self.invested_capital_in_profit_raw as &mut dyn AnyStoredVec);
|
||||
vecs.push(&mut self.invested_capital_in_loss_raw as &mut dyn AnyStoredVec);
|
||||
vecs.push(&mut self.investor_cap_in_profit_raw as &mut dyn AnyStoredVec);
|
||||
vecs.push(&mut self.investor_cap_in_loss_raw as &mut dyn AnyStoredVec);
|
||||
vecs
|
||||
}
|
||||
|
||||
pub(crate) fn compute_from_stateful(
|
||||
@@ -186,6 +143,13 @@ impl UnrealizedBase {
|
||||
others: &[&Self],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
// Delegate Complete-tier aggregation
|
||||
let complete_refs: Vec<&UnrealizedComplete> =
|
||||
others.iter().map(|o| &o.complete).collect();
|
||||
self.complete
|
||||
.compute_from_stateful(starting_indexes, &complete_refs, exit)?;
|
||||
|
||||
// Source-only: invested_capital
|
||||
macro_rules! sum_others {
|
||||
($($field:tt).+) => {
|
||||
self.$($field).+.compute_sum_of_others(
|
||||
@@ -196,14 +160,10 @@ impl UnrealizedBase {
|
||||
};
|
||||
}
|
||||
|
||||
sum_others!(supply_in_profit.sats.height);
|
||||
sum_others!(supply_in_loss.sats.height);
|
||||
sum_others!(unrealized_profit.cents.height);
|
||||
sum_others!(unrealized_loss.cents.height);
|
||||
sum_others!(invested_capital_in_profit.cents.height);
|
||||
sum_others!(invested_capital_in_loss.cents.height);
|
||||
|
||||
// Raw values for aggregation
|
||||
// Source-only: raw BytesVec aggregation
|
||||
let start = self
|
||||
.invested_capital_in_profit_raw
|
||||
.len()
|
||||
@@ -273,7 +233,10 @@ impl UnrealizedBase {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
// Pain index: investor_price_of_losers - spot
|
||||
// Complete-tier: net_unrealized_pnl
|
||||
self.complete.compute_rest(starting_indexes, exit)?;
|
||||
|
||||
// Extended-only: Pain index (investor_price_of_losers - spot)
|
||||
self.pain_index.cents.height.compute_transform3(
|
||||
starting_indexes.height,
|
||||
&self.investor_cap_in_loss_raw,
|
||||
@@ -290,7 +253,7 @@ impl UnrealizedBase {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Greed index: spot - investor_price_of_winners
|
||||
// Extended-only: Greed index (spot - investor_price_of_winners)
|
||||
self.greed_index.cents.height.compute_transform3(
|
||||
starting_indexes.height,
|
||||
&self.investor_cap_in_profit_raw,
|
||||
@@ -307,19 +270,11 @@ impl UnrealizedBase {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.net_unrealized_pnl
|
||||
.cents
|
||||
.height
|
||||
.compute_binary::<Cents, Cents, CentsSubtractToCentsSigned>(
|
||||
starting_indexes.height,
|
||||
&self.unrealized_profit.cents.height,
|
||||
&self.unrealized_loss.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
// Source-only: unrealized gross pnl
|
||||
self.gross_pnl.cents.height.compute_add(
|
||||
starting_indexes.height,
|
||||
&self.unrealized_profit.cents.height,
|
||||
&self.unrealized_loss.cents.height,
|
||||
&self.complete.unrealized_profit.cents.height,
|
||||
&self.complete.unrealized_loss.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
use brk_error::Result;
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{Cents, CentsSigned, Height, Indexes, Version};
|
||||
use vecdb::{AnyStoredVec, AnyVec, Exit, ReadableCloneableVec, Rw, StorageMode, WritableVec};
|
||||
|
||||
use crate::{
|
||||
distribution::state::UnrealizedState,
|
||||
internal::{
|
||||
CentsSubtractToCentsSigned, FiatFromHeight, LazyFromHeight, NegCentsUnsignedToDollars,
|
||||
ValueFromHeight,
|
||||
},
|
||||
};
|
||||
|
||||
use brk_types::Dollars;
|
||||
|
||||
use crate::distribution::metrics::ImportConfig;
|
||||
|
||||
/// Unrealized metrics for the Complete tier (~6 fields).
|
||||
///
|
||||
/// Excludes source-only fields (invested_capital, raw BytesVecs, unrealized_gross_pnl)
|
||||
/// and extended-only fields (pain_index, greed_index, net_sentiment).
|
||||
#[derive(Traversable)]
|
||||
pub struct UnrealizedComplete<M: StorageMode = Rw> {
|
||||
pub supply_in_profit: ValueFromHeight<M>,
|
||||
pub supply_in_loss: ValueFromHeight<M>,
|
||||
|
||||
pub unrealized_profit: FiatFromHeight<Cents, M>,
|
||||
pub unrealized_loss: FiatFromHeight<Cents, M>,
|
||||
|
||||
pub neg_unrealized_loss: LazyFromHeight<Dollars, Cents>,
|
||||
|
||||
pub net_unrealized_pnl: FiatFromHeight<CentsSigned, M>,
|
||||
}
|
||||
|
||||
impl UnrealizedComplete {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let v0 = Version::ZERO;
|
||||
let supply_in_profit = cfg.import_value("supply_in_profit", v0)?;
|
||||
let supply_in_loss = cfg.import_value("supply_in_loss", v0)?;
|
||||
|
||||
let unrealized_profit = cfg.import_fiat("unrealized_profit", v0)?;
|
||||
let unrealized_loss = cfg.import_fiat("unrealized_loss", v0)?;
|
||||
|
||||
let neg_unrealized_loss = LazyFromHeight::from_computed::<NegCentsUnsignedToDollars>(
|
||||
&cfg.name("neg_unrealized_loss"),
|
||||
cfg.version,
|
||||
unrealized_loss.cents.height.read_only_boxed_clone(),
|
||||
&unrealized_loss.cents,
|
||||
);
|
||||
|
||||
let net_unrealized_pnl = cfg.import_fiat("net_unrealized_pnl", v0)?;
|
||||
|
||||
Ok(Self {
|
||||
supply_in_profit,
|
||||
supply_in_loss,
|
||||
unrealized_profit,
|
||||
unrealized_loss,
|
||||
neg_unrealized_loss,
|
||||
net_unrealized_pnl,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_stateful_height_len(&self) -> usize {
|
||||
self.supply_in_profit
|
||||
.sats
|
||||
.height
|
||||
.len()
|
||||
.min(self.supply_in_loss.sats.height.len())
|
||||
.min(self.unrealized_profit.cents.height.len())
|
||||
.min(self.unrealized_loss.cents.height.len())
|
||||
}
|
||||
|
||||
pub(crate) fn truncate_push(
|
||||
&mut self,
|
||||
height: Height,
|
||||
height_state: &UnrealizedState,
|
||||
) -> Result<()> {
|
||||
self.supply_in_profit
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, height_state.supply_in_profit)?;
|
||||
self.supply_in_loss
|
||||
.sats
|
||||
.height
|
||||
.truncate_push(height, height_state.supply_in_loss)?;
|
||||
self.unrealized_profit
|
||||
.cents
|
||||
.height
|
||||
.truncate_push(height, height_state.unrealized_profit)?;
|
||||
self.unrealized_loss
|
||||
.cents
|
||||
.height
|
||||
.truncate_push(height, height_state.unrealized_loss)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
vec![
|
||||
&mut self.supply_in_profit.base.sats.height as &mut dyn AnyStoredVec,
|
||||
&mut self.supply_in_profit.base.cents.height as &mut dyn AnyStoredVec,
|
||||
&mut self.supply_in_loss.base.sats.height as &mut dyn AnyStoredVec,
|
||||
&mut self.supply_in_loss.base.cents.height as &mut dyn AnyStoredVec,
|
||||
&mut self.unrealized_profit.cents.height,
|
||||
&mut self.unrealized_loss.cents.height,
|
||||
]
|
||||
}
|
||||
|
||||
pub(crate) fn compute_from_stateful(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
others: &[&Self],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
macro_rules! sum_others {
|
||||
($($field:tt).+) => {
|
||||
self.$($field).+.compute_sum_of_others(
|
||||
starting_indexes.height,
|
||||
&others.iter().map(|v| &v.$($field).+).collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?
|
||||
};
|
||||
}
|
||||
|
||||
sum_others!(supply_in_profit.sats.height);
|
||||
sum_others!(supply_in_loss.sats.height);
|
||||
sum_others!(unrealized_profit.cents.height);
|
||||
sum_others!(unrealized_loss.cents.height);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Compute derived metrics from stored values.
|
||||
pub(crate) fn compute_rest(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.net_unrealized_pnl
|
||||
.cents
|
||||
.height
|
||||
.compute_binary::<Cents, Cents, CentsSubtractToCentsSigned>(
|
||||
starting_indexes.height,
|
||||
&self.unrealized_profit.cents.height,
|
||||
&self.unrealized_loss.cents.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
mod base;
|
||||
mod complete;
|
||||
|
||||
pub use base::*;
|
||||
pub use complete::*;
|
||||
|
||||
@@ -53,6 +53,9 @@ impl Vecs {
|
||||
+ 2.min(indexer.vecs.outputs.first_txoutindex.len()),
|
||||
);
|
||||
|
||||
let mut outputtypes_buf: Vec<OutputType> = Vec::new();
|
||||
let mut values_buf: Vec<Sats> = Vec::new();
|
||||
|
||||
// Iterate blocks
|
||||
for h in starting_height.to_usize()..=target_height.to_usize() {
|
||||
let height = Height::from(h);
|
||||
@@ -70,25 +73,24 @@ impl Vecs {
|
||||
let out_start = first_txoutindex.to_usize();
|
||||
let out_end = next_first_txoutindex.to_usize();
|
||||
|
||||
// Sum opreturn values — fold over both vecs without allocation
|
||||
let opreturn_value = indexer
|
||||
// Pre-collect both vecs into reusable buffers
|
||||
indexer
|
||||
.vecs
|
||||
.outputs
|
||||
.outputtype
|
||||
.fold_range_at(
|
||||
out_start,
|
||||
out_end,
|
||||
(Sats::ZERO, out_start),
|
||||
|(sum, vi), ot| {
|
||||
let new_sum = if ot == OutputType::OpReturn {
|
||||
sum + indexer.vecs.outputs.value.collect_one_at(vi).unwrap()
|
||||
} else {
|
||||
sum
|
||||
};
|
||||
(new_sum, vi + 1)
|
||||
},
|
||||
)
|
||||
.0;
|
||||
.collect_range_into_at(out_start, out_end, &mut outputtypes_buf);
|
||||
indexer
|
||||
.vecs
|
||||
.outputs
|
||||
.value
|
||||
.collect_range_into_at(out_start, out_end, &mut values_buf);
|
||||
|
||||
let mut opreturn_value = Sats::ZERO;
|
||||
for (ot, val) in outputtypes_buf.iter().zip(values_buf.iter()) {
|
||||
if *ot == OutputType::OpReturn {
|
||||
opreturn_value += *val;
|
||||
}
|
||||
}
|
||||
|
||||
height_vec.truncate_push(height, opreturn_value)?;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2070,7 +2070,7 @@ class AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedS
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.adjusted_sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'adjusted_sopr'))
|
||||
self.adjusted_sopr_ema: _1m1wPattern2 = _1m1wPattern2(client, _m(acc, 'adjusted_sopr_24h_ema'))
|
||||
self.adjusted_sopr_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'adjusted_sopr_24h_ema'))
|
||||
self.adjusted_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created'))
|
||||
self.adjusted_value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'adjusted_value_created'))
|
||||
self.adjusted_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed'))
|
||||
@@ -2118,133 +2118,13 @@ class AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedS
|
||||
self.realized_profit_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'realized_profit'))
|
||||
self.realized_profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'realized_profit_to_loss_ratio'))
|
||||
self.sell_side_risk_ratio: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio'))
|
||||
self.sell_side_risk_ratio_24h_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'sell_side_risk_ratio_24h_ema'))
|
||||
self.sell_side_risk_ratio_24h_ema: _1m1wPattern2 = _1m1wPattern2(client, _m(acc, 'sell_side_risk_ratio_24h_ema'))
|
||||
self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss'))
|
||||
self.sent_in_loss_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_loss_ema_2w'))
|
||||
self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit'))
|
||||
self.sent_in_profit_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_profit_ema_2w'))
|
||||
self.sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr'))
|
||||
self.sopr_24h_ema: _1m1wPattern2 = _1m1wPattern2(client, _m(acc, 'sopr_24h_ema'))
|
||||
self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band'))
|
||||
self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created'))
|
||||
self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_created'))
|
||||
self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed'))
|
||||
self.value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_destroyed'))
|
||||
|
||||
class CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.cap_raw: MetricPattern18[CentsSats] = MetricPattern18(client, _m(acc, 'cap_raw'))
|
||||
self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow'))
|
||||
self.gross_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_gross_pnl'))
|
||||
self.gross_pnl_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'gross_pnl_sum'))
|
||||
self.investor_cap_raw: MetricPattern18[CentsSquaredSats] = MetricPattern18(client, _m(acc, 'investor_cap_raw'))
|
||||
self.investor_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'investor_price'))
|
||||
self.investor_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'investor_price_ratio'))
|
||||
self.investor_price_ratio_percentiles: RatioPattern = RatioPattern(client, _m(acc, 'investor_price_ratio'))
|
||||
self.investor_price_ratio_std_dev: RatioPattern2 = RatioPattern2(client, _m(acc, 'investor_price_ratio'))
|
||||
self.loss_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_created'))
|
||||
self.loss_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_destroyed'))
|
||||
self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_price_band'))
|
||||
self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv'))
|
||||
self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss'))
|
||||
self.net_pnl_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_pnl_change_1m'))
|
||||
self.net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_market_cap'))
|
||||
self.net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_realized_cap'))
|
||||
self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl'))
|
||||
self.net_realized_pnl_ema_1w: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_ema_1w'))
|
||||
self.net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap'))
|
||||
self.peak_regret: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret'))
|
||||
self.peak_regret_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_peak_regret_rel_to_realized_cap'))
|
||||
self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow'))
|
||||
self.profit_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_created'))
|
||||
self.profit_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_destroyed'))
|
||||
self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap'))
|
||||
self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents'))
|
||||
self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m'))
|
||||
self.realized_cap_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_cap_rel_to_own_market_cap'))
|
||||
self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss'))
|
||||
self.realized_loss_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_ema_1w'))
|
||||
self.realized_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap'))
|
||||
self.realized_loss_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'realized_loss'))
|
||||
self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price'))
|
||||
self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio'))
|
||||
self.realized_price_ratio_percentiles: RatioPattern = RatioPattern(client, _m(acc, 'realized_price_ratio'))
|
||||
self.realized_price_ratio_std_dev: RatioPattern2 = RatioPattern2(client, _m(acc, 'realized_price_ratio'))
|
||||
self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit'))
|
||||
self.realized_profit_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_ema_1w'))
|
||||
self.realized_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap'))
|
||||
self.realized_profit_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'realized_profit'))
|
||||
self.realized_profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'realized_profit_to_loss_ratio'))
|
||||
self.sell_side_risk_ratio: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio'))
|
||||
self.sell_side_risk_ratio_24h_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'sell_side_risk_ratio_24h_ema'))
|
||||
self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss'))
|
||||
self.sent_in_loss_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_loss_ema_2w'))
|
||||
self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit'))
|
||||
self.sent_in_profit_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_profit_ema_2w'))
|
||||
self.sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr'))
|
||||
self.sopr_24h_ema: _1m1wPattern2 = _1m1wPattern2(client, _m(acc, 'sopr_24h_ema'))
|
||||
self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band'))
|
||||
self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created'))
|
||||
self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_created'))
|
||||
self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed'))
|
||||
self.value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_destroyed'))
|
||||
|
||||
class AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.adjusted_sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'adjusted_sopr'))
|
||||
self.adjusted_sopr_ema: _1m1wPattern2 = _1m1wPattern2(client, _m(acc, 'adjusted_sopr_24h_ema'))
|
||||
self.adjusted_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_created'))
|
||||
self.adjusted_value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'adjusted_value_created'))
|
||||
self.adjusted_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'adjusted_value_destroyed'))
|
||||
self.adjusted_value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'adjusted_value_destroyed'))
|
||||
self.cap_raw: MetricPattern18[CentsSats] = MetricPattern18(client, _m(acc, 'cap_raw'))
|
||||
self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow'))
|
||||
self.gross_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_gross_pnl'))
|
||||
self.gross_pnl_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'gross_pnl_sum'))
|
||||
self.investor_cap_raw: MetricPattern18[CentsSquaredSats] = MetricPattern18(client, _m(acc, 'investor_cap_raw'))
|
||||
self.investor_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'investor_price'))
|
||||
self.investor_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'investor_price_ratio'))
|
||||
self.loss_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_created'))
|
||||
self.loss_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_destroyed'))
|
||||
self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_price_band'))
|
||||
self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv'))
|
||||
self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss'))
|
||||
self.net_pnl_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_pnl_change_1m'))
|
||||
self.net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_market_cap'))
|
||||
self.net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_realized_cap'))
|
||||
self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl'))
|
||||
self.net_realized_pnl_ema_1w: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_ema_1w'))
|
||||
self.net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap'))
|
||||
self.peak_regret: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_peak_regret'))
|
||||
self.peak_regret_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_peak_regret_rel_to_realized_cap'))
|
||||
self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow'))
|
||||
self.profit_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_created'))
|
||||
self.profit_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_destroyed'))
|
||||
self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap'))
|
||||
self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents'))
|
||||
self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m'))
|
||||
self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss'))
|
||||
self.realized_loss_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_ema_1w'))
|
||||
self.realized_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap'))
|
||||
self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price'))
|
||||
self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio'))
|
||||
self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit'))
|
||||
self.realized_profit_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_ema_1w'))
|
||||
self.realized_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap'))
|
||||
self.sell_side_risk_ratio: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio'))
|
||||
self.sell_side_risk_ratio_24h_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'sell_side_risk_ratio_24h_ema'))
|
||||
self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss'))
|
||||
self.sent_in_loss_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_loss_ema_2w'))
|
||||
self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit'))
|
||||
self.sent_in_profit_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_profit_ema_2w'))
|
||||
self.sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr'))
|
||||
self.sopr_24h_ema: _1m1wPattern2 = _1m1wPattern2(client, _m(acc, 'sopr_24h_ema'))
|
||||
self.sopr_24h_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'sopr_24h_ema'))
|
||||
self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band'))
|
||||
self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created'))
|
||||
self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_created'))
|
||||
@@ -2291,19 +2171,62 @@ class CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentS
|
||||
self.realized_profit_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_ema_1w'))
|
||||
self.realized_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap'))
|
||||
self.sell_side_risk_ratio: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio'))
|
||||
self.sell_side_risk_ratio_24h_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'sell_side_risk_ratio_24h_ema'))
|
||||
self.sell_side_risk_ratio_24h_ema: _1m1wPattern2 = _1m1wPattern2(client, _m(acc, 'sell_side_risk_ratio_24h_ema'))
|
||||
self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss'))
|
||||
self.sent_in_loss_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_loss_ema_2w'))
|
||||
self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit'))
|
||||
self.sent_in_profit_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_profit_ema_2w'))
|
||||
self.sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr'))
|
||||
self.sopr_24h_ema: _1m1wPattern2 = _1m1wPattern2(client, _m(acc, 'sopr_24h_ema'))
|
||||
self.sopr_24h_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'sopr_24h_ema'))
|
||||
self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_price_band'))
|
||||
self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created'))
|
||||
self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_created'))
|
||||
self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed'))
|
||||
self.value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_destroyed'))
|
||||
|
||||
class CapitulationGrossLossMvrvNegNetProfitRealizedSentSoprValuePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow'))
|
||||
self.gross_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_gross_pnl'))
|
||||
self.gross_pnl_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'gross_pnl_sum'))
|
||||
self.loss_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_created'))
|
||||
self.loss_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'loss_value_destroyed'))
|
||||
self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv'))
|
||||
self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss'))
|
||||
self.net_pnl_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_pnl_change_1m'))
|
||||
self.net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_market_cap'))
|
||||
self.net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_pnl_change_1m_rel_to_realized_cap'))
|
||||
self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl'))
|
||||
self.net_realized_pnl_ema_1w: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_ema_1w'))
|
||||
self.net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap'))
|
||||
self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'profit_flow'))
|
||||
self.profit_value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_created'))
|
||||
self.profit_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'profit_value_destroyed'))
|
||||
self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap'))
|
||||
self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents'))
|
||||
self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m'))
|
||||
self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss'))
|
||||
self.realized_loss_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_ema_1w'))
|
||||
self.realized_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap'))
|
||||
self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price'))
|
||||
self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio'))
|
||||
self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit'))
|
||||
self.realized_profit_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_ema_1w'))
|
||||
self.realized_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap'))
|
||||
self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_loss'))
|
||||
self.sent_in_loss_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_loss_ema_2w'))
|
||||
self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent_in_profit'))
|
||||
self.sent_in_profit_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_in_profit_ema_2w'))
|
||||
self.sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr'))
|
||||
self.sopr_24h_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'sopr_24h_ema'))
|
||||
self.value_created: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_created'))
|
||||
self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_created'))
|
||||
self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'value_destroyed'))
|
||||
self.value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, _m(acc, 'value_destroyed'))
|
||||
|
||||
class _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2338,7 +2261,7 @@ class _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern:
|
||||
self.sma: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sma_4y'))
|
||||
self.zscore: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'zscore_4y'))
|
||||
|
||||
class InvestedNegNetNuplSupplyUnrealizedPattern2:
|
||||
class InvestedNegNetNuplSupplyUnrealizedPattern3:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -2364,6 +2287,31 @@ class InvestedNegNetNuplSupplyUnrealizedPattern2:
|
||||
self.unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_gross_pnl'))
|
||||
self.unrealized_profit_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap'))
|
||||
|
||||
class GrossMvrvNegNetRealizedSoprPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.gross_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_gross_pnl'))
|
||||
self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv'))
|
||||
self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss'))
|
||||
self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, _m(acc, 'net_realized_pnl'))
|
||||
self.net_realized_pnl_ema_1w: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'net_realized_pnl_ema_1w'))
|
||||
self.net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_realized_pnl_rel_to_realized_cap'))
|
||||
self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap'))
|
||||
self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents'))
|
||||
self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'realized_cap_change_1m'))
|
||||
self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_loss'))
|
||||
self.realized_loss_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_loss_ema_1w'))
|
||||
self.realized_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_realized_cap'))
|
||||
self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price'))
|
||||
self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio'))
|
||||
self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, _m(acc, 'realized_profit'))
|
||||
self.realized_profit_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_profit_ema_1w'))
|
||||
self.realized_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_realized_cap'))
|
||||
self.sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr'))
|
||||
self.sopr_24h_ema: _1m1wPattern = _1m1wPattern(client, _m(acc, 'sopr_24h_ema'))
|
||||
|
||||
class Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2557,21 +2505,6 @@ class AverageGainsLossesRsiStochPattern:
|
||||
self.stoch_rsi_d: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'stoch_d_24h'))
|
||||
self.stoch_rsi_k: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'stoch_k_24h'))
|
||||
|
||||
class ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.activity: CoinblocksCoindaysSentPattern = CoinblocksCoindaysSentPattern(client, acc)
|
||||
self.addr_count: MetricPattern1[StoredU64] = MetricPattern1(client, _m(acc, 'addr_count'))
|
||||
self.addr_count_change_1m: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'addr_count_change_1m'))
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, _m(acc, 'cost_basis'))
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern = CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern(client, acc)
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc)
|
||||
self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern = GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, acc)
|
||||
|
||||
class AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2617,6 +2550,21 @@ class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern:
|
||||
self.pct90: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'p90'))
|
||||
self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'sum'))
|
||||
|
||||
class NetNuplSupplyUnrealizedPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'net_unrealized_pnl_rel_to_market_cap'))
|
||||
self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'nupl'))
|
||||
self.supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_circulating_supply'))
|
||||
self.supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_loss_rel_to_own_supply'))
|
||||
self.supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_circulating_supply'))
|
||||
self.supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_in_profit_rel_to_own_supply'))
|
||||
self.supply_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'supply_rel_to_circulating_supply'))
|
||||
self.unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_market_cap'))
|
||||
self.unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_profit_rel_to_market_cap'))
|
||||
|
||||
class AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]):
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2646,6 +2594,20 @@ class _1m1w1y24hBtcCentsSatsUsdPattern:
|
||||
self.sats: MetricPattern18[Sats] = MetricPattern18(client, acc)
|
||||
self.usd: MetricPattern18[Dollars] = MetricPattern18(client, _m(acc, 'usd'))
|
||||
|
||||
class ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.activity: SentPattern = SentPattern(client, _m(acc, 'sent'))
|
||||
self.addr_count: MetricPattern1[StoredU64] = MetricPattern1(client, _m(acc, 'addr_count'))
|
||||
self.addr_count_change_1m: MetricPattern1[StoredF64] = MetricPattern1(client, _m(acc, 'addr_count_change_1m'))
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: GrossMvrvNegNetRealizedSoprPattern = GrossMvrvNegNetRealizedSoprPattern(client, acc)
|
||||
self.relative: NetNuplSupplyUnrealizedPattern = NetNuplSupplyUnrealizedPattern(client, acc)
|
||||
self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: NegNetSupplyUnrealizedPattern = NegNetSupplyUnrealizedPattern(client, acc)
|
||||
|
||||
class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]):
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2679,10 +2641,10 @@ class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern:
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.activity: CoinblocksCoindaysSentPattern = CoinblocksCoindaysSentPattern(client, acc)
|
||||
self.cost_basis: InvestedMaxMinPercentilesPattern = InvestedMaxMinPercentilesPattern(client, acc)
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, _m(acc, 'cost_basis'))
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2 = CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2(client, acc)
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern2 = InvestedNegNetNuplSupplyUnrealizedPattern2(client, acc)
|
||||
self.realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern = CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern(client, acc)
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc)
|
||||
self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern = GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, acc)
|
||||
|
||||
@@ -2694,23 +2656,10 @@ class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4:
|
||||
self.activity: CoinblocksCoindaysSentPattern = CoinblocksCoindaysSentPattern(client, acc)
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, _m(acc, 'cost_basis'))
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2 = AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern2(client, acc)
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc)
|
||||
self.realized: CapitulationGrossLossMvrvNegNetProfitRealizedSentSoprValuePattern = CapitulationGrossLossMvrvNegNetProfitRealizedSentSoprValuePattern(client, acc)
|
||||
self.relative: NetNuplSupplyUnrealizedPattern = NetNuplSupplyUnrealizedPattern(client, acc)
|
||||
self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern = GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, acc)
|
||||
|
||||
class ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.activity: CoinblocksCoindaysSentPattern = CoinblocksCoindaysSentPattern(client, acc)
|
||||
self.cost_basis: MaxMinPattern = MaxMinPattern(client, _m(acc, 'cost_basis'))
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern = CapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern(client, acc)
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern = InvestedNegNetNuplSupplyUnrealizedPattern(client, acc)
|
||||
self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern = GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, acc)
|
||||
self.unrealized: NegNetSupplyUnrealizedPattern = NegNetSupplyUnrealizedPattern(client, acc)
|
||||
|
||||
class _1m1w1y24hBaseCumulativePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
@@ -2724,6 +2673,18 @@ class _1m1w1y24hBaseCumulativePattern:
|
||||
self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc)
|
||||
self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative'))
|
||||
|
||||
class ActivityOutputsRealizedRelativeSupplyUnrealizedPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.activity: SentPattern = SentPattern(client, _m(acc, 'sent'))
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: GrossMvrvNegNetRealizedSoprPattern = GrossMvrvNegNetRealizedSoprPattern(client, acc)
|
||||
self.relative: NetNuplSupplyUnrealizedPattern = NetNuplSupplyUnrealizedPattern(client, acc)
|
||||
self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: NegNetSupplyUnrealizedPattern = NegNetSupplyUnrealizedPattern(client, acc)
|
||||
|
||||
class BalanceBothReactivatedReceivingSendingPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2736,6 +2697,18 @@ class BalanceBothReactivatedReceivingSendingPattern:
|
||||
self.receiving: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'receiving'))
|
||||
self.sending: AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern[StoredU32] = AverageHeightMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, 'sending'))
|
||||
|
||||
class NegNetSupplyUnrealizedPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.neg_unrealized_loss: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss'))
|
||||
self.net_unrealized_pnl: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'net_unrealized_pnl'))
|
||||
self.supply_in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_loss'))
|
||||
self.supply_in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'supply_in_profit'))
|
||||
self.unrealized_loss: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_loss'))
|
||||
self.unrealized_profit: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'unrealized_profit'))
|
||||
|
||||
class EmaHistogramLineSignalPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2747,6 +2720,28 @@ class EmaHistogramLineSignalPattern:
|
||||
self.line: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'line_24h'))
|
||||
self.signal: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'signal_24h'))
|
||||
|
||||
class MvrvRealizedPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'mvrv'))
|
||||
self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'realized_cap'))
|
||||
self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'realized_cap_cents'))
|
||||
self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'realized_price'))
|
||||
self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'realized_price_ratio'))
|
||||
|
||||
class OutputsRealizedRelativeSupplyUnrealizedPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: MvrvRealizedPattern = MvrvRealizedPattern(client, acc)
|
||||
self.relative: SupplyPattern = SupplyPattern(client, _m(acc, 'supply_in'))
|
||||
self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: SupplyPattern2 = SupplyPattern2(client, _m(acc, 'supply_in'))
|
||||
|
||||
class _1m1w1y24hPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2908,7 +2903,7 @@ class CumulativeHeightSumPattern(Generic[T]):
|
||||
self.height: MetricPattern18[T] = MetricPattern18(client, acc)
|
||||
self.sum: _1m1w1y24hPattern[T] = _1m1w1y24hPattern(client, acc)
|
||||
|
||||
class _1m1wPattern:
|
||||
class _1m1wPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -2916,7 +2911,7 @@ class _1m1wPattern:
|
||||
self._1m: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1m'))
|
||||
self._1w: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1w'))
|
||||
|
||||
class _1m1wPattern2:
|
||||
class _1m1wPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -2972,6 +2967,30 @@ class SdSmaPattern:
|
||||
self.sd: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sd_1y'))
|
||||
self.sma: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'sma_1y'))
|
||||
|
||||
class SentPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.sent: BaseCumulativePattern = BaseCumulativePattern(client, acc)
|
||||
self.sent_ema: _2wPattern = _2wPattern(client, _m(acc, 'ema_2w'))
|
||||
|
||||
class SupplyPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.supply_in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'loss'))
|
||||
self.supply_in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'profit'))
|
||||
|
||||
class SupplyPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated metric name."""
|
||||
self.supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'loss_rel_to_own_supply'))
|
||||
self.supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'profit_rel_to_own_supply'))
|
||||
|
||||
class UtxoPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -4292,15 +4311,15 @@ class MetricsTree_Distribution_UtxoCohorts_All_Relative:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'neg_unrealized_loss_rel_to_market_cap')
|
||||
self.invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'invested_capital_in_profit_rel_to_realized_cap')
|
||||
self.invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'invested_capital_in_loss_rel_to_realized_cap')
|
||||
self.supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'supply_in_profit_rel_to_own_supply')
|
||||
self.supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'supply_in_loss_rel_to_own_supply')
|
||||
self.unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_profit_rel_to_market_cap')
|
||||
self.unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_loss_rel_to_market_cap')
|
||||
self.neg_unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'neg_unrealized_loss_rel_to_market_cap')
|
||||
self.net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'net_unrealized_pnl_rel_to_market_cap')
|
||||
self.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, 'nupl')
|
||||
self.invested_capital_in_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'invested_capital_in_profit_rel_to_realized_cap')
|
||||
self.invested_capital_in_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'invested_capital_in_loss_rel_to_realized_cap')
|
||||
self.unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_profit_rel_to_own_gross_pnl')
|
||||
self.unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_loss_rel_to_own_gross_pnl')
|
||||
self.neg_unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'neg_unrealized_loss_rel_to_own_gross_pnl')
|
||||
@@ -4328,7 +4347,79 @@ class MetricsTree_Distribution_UtxoCohorts_Sth:
|
||||
self.realized: AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern = AdjustedCapCapitulationGrossInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprUpperValuePattern(client, 'sth')
|
||||
self.cost_basis: InvestedMaxMinPercentilesPattern = InvestedMaxMinPercentilesPattern(client, 'sth')
|
||||
self.unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern = GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, 'sth')
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern2 = InvestedNegNetNuplSupplyUnrealizedPattern2(client, 'sth')
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern3 = InvestedNegNetNuplSupplyUnrealizedPattern3(client, 'sth')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts_Lth_Realized:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.investor_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_investor_price')
|
||||
self.investor_price_ratio: BpsRatioPattern = BpsRatioPattern(client, 'lth_investor_price_ratio')
|
||||
self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_lower_price_band')
|
||||
self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_upper_price_band')
|
||||
self.cap_raw: MetricPattern18[CentsSats] = MetricPattern18(client, 'lth_cap_raw')
|
||||
self.investor_cap_raw: MetricPattern18[CentsSquaredSats] = MetricPattern18(client, 'lth_investor_cap_raw')
|
||||
self.sell_side_risk_ratio: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, 'lth_sell_side_risk_ratio')
|
||||
self.sell_side_risk_ratio_24h_ema: _1m1wPattern2 = _1m1wPattern2(client, 'lth_sell_side_risk_ratio_24h_ema')
|
||||
self.peak_regret: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, 'lth_realized_peak_regret')
|
||||
self.peak_regret_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_realized_peak_regret_rel_to_realized_cap')
|
||||
self.profit_value_created: MetricPattern1[Cents] = MetricPattern1(client, 'lth_profit_value_created')
|
||||
self.profit_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, 'lth_profit_value_destroyed')
|
||||
self.loss_value_created: MetricPattern1[Cents] = MetricPattern1(client, 'lth_loss_value_created')
|
||||
self.loss_value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, 'lth_loss_value_destroyed')
|
||||
self.value_created: MetricPattern1[Cents] = MetricPattern1(client, 'lth_value_created')
|
||||
self.value_destroyed: MetricPattern1[Cents] = MetricPattern1(client, 'lth_value_destroyed')
|
||||
self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_capitulation_flow')
|
||||
self.profit_flow: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_profit_flow')
|
||||
self.value_created_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'lth_value_created')
|
||||
self.value_destroyed_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'lth_value_destroyed')
|
||||
self.gross_pnl_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'lth_gross_pnl_sum')
|
||||
self.net_pnl_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, 'lth_net_pnl_change_1m')
|
||||
self.net_pnl_change_1m_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_net_pnl_change_1m_rel_to_realized_cap')
|
||||
self.net_pnl_change_1m_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_net_pnl_change_1m_rel_to_market_cap')
|
||||
self.sent_in_profit: BaseCumulativePattern = BaseCumulativePattern(client, 'lth_sent_in_profit')
|
||||
self.sent_in_profit_ema: _2wPattern = _2wPattern(client, 'lth_sent_in_profit_ema_2w')
|
||||
self.sent_in_loss: BaseCumulativePattern = BaseCumulativePattern(client, 'lth_sent_in_loss')
|
||||
self.sent_in_loss_ema: _2wPattern = _2wPattern(client, 'lth_sent_in_loss_ema_2w')
|
||||
self.realized_cap_cents: MetricPattern1[Cents] = MetricPattern1(client, 'lth_realized_cap_cents')
|
||||
self.realized_profit: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, 'lth_realized_profit')
|
||||
self.realized_loss: CumulativeHeightPattern[Cents] = CumulativeHeightPattern(client, 'lth_realized_loss')
|
||||
self.realized_cap: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_realized_cap')
|
||||
self.realized_price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_realized_price')
|
||||
self.realized_price_ratio: BpsRatioPattern = BpsRatioPattern(client, 'lth_realized_price_ratio')
|
||||
self.realized_cap_change_1m: MetricPattern1[CentsSigned] = MetricPattern1(client, 'lth_realized_cap_change_1m')
|
||||
self.mvrv: MetricPattern1[StoredF32] = MetricPattern1(client, 'lth_mvrv')
|
||||
self.neg_realized_loss: MetricPattern1[Dollars] = MetricPattern1(client, 'lth_neg_realized_loss')
|
||||
self.net_realized_pnl: CumulativeHeightPattern[CentsSigned] = CumulativeHeightPattern(client, 'lth_net_realized_pnl')
|
||||
self.net_realized_pnl_ema_1w: MetricPattern1[CentsSigned] = MetricPattern1(client, 'lth_net_realized_pnl_ema_1w')
|
||||
self.gross_pnl: CentsUsdPattern = CentsUsdPattern(client, 'lth_realized_gross_pnl')
|
||||
self.realized_profit_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, 'lth_realized_profit_ema_1w')
|
||||
self.realized_loss_ema_1w: MetricPattern1[Cents] = MetricPattern1(client, 'lth_realized_loss_ema_1w')
|
||||
self.sopr: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_sopr')
|
||||
self.sopr_24h_ema: _1m1wPattern = _1m1wPattern(client, 'lth_sopr_24h_ema')
|
||||
self.realized_profit_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_realized_profit_rel_to_realized_cap')
|
||||
self.realized_loss_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_realized_loss_rel_to_realized_cap')
|
||||
self.net_realized_pnl_rel_to_realized_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_net_realized_pnl_rel_to_realized_cap')
|
||||
self.realized_cap_rel_to_own_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_realized_cap_rel_to_own_market_cap')
|
||||
self.realized_profit_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'lth_realized_profit')
|
||||
self.realized_loss_sum: _1m1w1y24hPattern[Cents] = _1m1w1y24hPattern(client, 'lth_realized_loss')
|
||||
self.realized_profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_realized_profit_to_loss_ratio')
|
||||
self.realized_price_ratio_percentiles: RatioPattern = RatioPattern(client, 'lth_realized_price_ratio')
|
||||
self.realized_price_ratio_std_dev: RatioPattern2 = RatioPattern2(client, 'lth_realized_price_ratio')
|
||||
self.investor_price_ratio_percentiles: RatioPattern = RatioPattern(client, 'lth_investor_price_ratio')
|
||||
self.investor_price_ratio_std_dev: RatioPattern2 = RatioPattern2(client, 'lth_investor_price_ratio')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts_Lth:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.supply: ChangeHalvedTotalPattern = ChangeHalvedTotalPattern(client, 'lth_supply')
|
||||
self.outputs: UtxoPattern = UtxoPattern(client, 'lth_utxo_count')
|
||||
self.activity: CoinblocksCoindaysSentPattern = CoinblocksCoindaysSentPattern(client, 'lth')
|
||||
self.realized: MetricsTree_Distribution_UtxoCohorts_Lth_Realized = MetricsTree_Distribution_UtxoCohorts_Lth_Realized(client)
|
||||
self.cost_basis: InvestedMaxMinPercentilesPattern = InvestedMaxMinPercentilesPattern(client, 'lth')
|
||||
self.unrealized: GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern = GreedGrossInvestedInvestorNegNetPainSupplyUnrealizedPattern(client, 'lth')
|
||||
self.relative: InvestedNegNetNuplSupplyUnrealizedPattern3 = InvestedNegNetNuplSupplyUnrealizedPattern3(client, 'lth')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts_AgeRange:
|
||||
"""Metrics tree node."""
|
||||
@@ -4383,129 +4474,129 @@ class MetricsTree_Distribution_UtxoCohorts_MinAge:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_1d_old')
|
||||
self._1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_1w_old')
|
||||
self._1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_1m_old')
|
||||
self._2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_2m_old')
|
||||
self._3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_3m_old')
|
||||
self._4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_4m_old')
|
||||
self._5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_5m_old')
|
||||
self._6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_6m_old')
|
||||
self._1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_1y_old')
|
||||
self._2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_2y_old')
|
||||
self._3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_3y_old')
|
||||
self._4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_4y_old')
|
||||
self._5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_5y_old')
|
||||
self._6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_6y_old')
|
||||
self._7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_7y_old')
|
||||
self._8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_8y_old')
|
||||
self._10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_10y_old')
|
||||
self._12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_12y_old')
|
||||
self._1d: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1d_old')
|
||||
self._1w: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1w_old')
|
||||
self._1m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1m_old')
|
||||
self._2m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_2m_old')
|
||||
self._3m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_3m_old')
|
||||
self._4m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_4m_old')
|
||||
self._5m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_5m_old')
|
||||
self._6m: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_6m_old')
|
||||
self._1y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_1y_old')
|
||||
self._2y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_2y_old')
|
||||
self._3y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_3y_old')
|
||||
self._4y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_4y_old')
|
||||
self._5y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_5y_old')
|
||||
self._6y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_6y_old')
|
||||
self._7y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_7y_old')
|
||||
self._8y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_8y_old')
|
||||
self._10y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_10y_old')
|
||||
self._12y: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4(client, 'utxos_over_12y_old')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts_GeAmount:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._1sat: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_1sat')
|
||||
self._10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_10sats')
|
||||
self._100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_100sats')
|
||||
self._1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_1k_sats')
|
||||
self._10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_10k_sats')
|
||||
self._100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_100k_sats')
|
||||
self._1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_1m_sats')
|
||||
self._10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_10m_sats')
|
||||
self._1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_1btc')
|
||||
self._10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_10btc')
|
||||
self._100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_100btc')
|
||||
self._1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_1k_btc')
|
||||
self._10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_over_10k_btc')
|
||||
self._1sat: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_1sat')
|
||||
self._10sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_10sats')
|
||||
self._100sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_100sats')
|
||||
self._1k_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_1k_sats')
|
||||
self._10k_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_10k_sats')
|
||||
self._100k_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_100k_sats')
|
||||
self._1m_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_1m_sats')
|
||||
self._10m_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_10m_sats')
|
||||
self._1btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_1btc')
|
||||
self._10btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_10btc')
|
||||
self._100btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_100btc')
|
||||
self._1k_btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_1k_btc')
|
||||
self._10k_btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_over_10k_btc')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts_AmountRange:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._0sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_with_0sats')
|
||||
self._1sat_to_10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1sat_under_10sats')
|
||||
self._10sats_to_100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10sats_under_100sats')
|
||||
self._100sats_to_1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_100sats_under_1k_sats')
|
||||
self._1k_sats_to_10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1k_sats_under_10k_sats')
|
||||
self._10k_sats_to_100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10k_sats_under_100k_sats')
|
||||
self._100k_sats_to_1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_100k_sats_under_1m_sats')
|
||||
self._1m_sats_to_10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1m_sats_under_10m_sats')
|
||||
self._10m_sats_to_1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10m_sats_under_1btc')
|
||||
self._1btc_to_10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1btc_under_10btc')
|
||||
self._10btc_to_100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10btc_under_100btc')
|
||||
self._100btc_to_1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_100btc_under_1k_btc')
|
||||
self._1k_btc_to_10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_1k_btc_under_10k_btc')
|
||||
self._10k_btc_to_100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_10k_btc_under_100k_btc')
|
||||
self._100k_btc_or_more: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_above_100k_btc')
|
||||
self._0sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_with_0sats')
|
||||
self._1sat_to_10sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_1sat_under_10sats')
|
||||
self._10sats_to_100sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_10sats_under_100sats')
|
||||
self._100sats_to_1k_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_100sats_under_1k_sats')
|
||||
self._1k_sats_to_10k_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_1k_sats_under_10k_sats')
|
||||
self._10k_sats_to_100k_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_10k_sats_under_100k_sats')
|
||||
self._100k_sats_to_1m_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_100k_sats_under_1m_sats')
|
||||
self._1m_sats_to_10m_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_1m_sats_under_10m_sats')
|
||||
self._10m_sats_to_1btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_10m_sats_under_1btc')
|
||||
self._1btc_to_10btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_1btc_under_10btc')
|
||||
self._10btc_to_100btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_10btc_under_100btc')
|
||||
self._100btc_to_1k_btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_100btc_under_1k_btc')
|
||||
self._1k_btc_to_10k_btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_1k_btc_under_10k_btc')
|
||||
self._10k_btc_to_100k_btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_10k_btc_under_100k_btc')
|
||||
self._100k_btc_or_more: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_above_100k_btc')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts_LtAmount:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._10sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_10sats')
|
||||
self._100sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_100sats')
|
||||
self._1k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_1k_sats')
|
||||
self._10k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_10k_sats')
|
||||
self._100k_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_100k_sats')
|
||||
self._1m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_1m_sats')
|
||||
self._10m_sats: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_10m_sats')
|
||||
self._1btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_1btc')
|
||||
self._10btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_10btc')
|
||||
self._100btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_100btc')
|
||||
self._1k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_1k_btc')
|
||||
self._10k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_10k_btc')
|
||||
self._100k_btc: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'utxos_under_100k_btc')
|
||||
self._10sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_10sats')
|
||||
self._100sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_100sats')
|
||||
self._1k_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_1k_sats')
|
||||
self._10k_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_10k_sats')
|
||||
self._100k_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_100k_sats')
|
||||
self._1m_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_1m_sats')
|
||||
self._10m_sats: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_10m_sats')
|
||||
self._1btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_1btc')
|
||||
self._10btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_10btc')
|
||||
self._100btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_100btc')
|
||||
self._1k_btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_1k_btc')
|
||||
self._10k_btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_10k_btc')
|
||||
self._100k_btc: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'utxos_under_100k_btc')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts_Epoch:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._0: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_0')
|
||||
self._1: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_1')
|
||||
self._2: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_2')
|
||||
self._3: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_3')
|
||||
self._4: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'epoch_4')
|
||||
self._0: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'epoch_0')
|
||||
self._1: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'epoch_1')
|
||||
self._2: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'epoch_2')
|
||||
self._3: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'epoch_3')
|
||||
self._4: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'epoch_4')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts_Class:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._2009: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2009')
|
||||
self._2010: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2010')
|
||||
self._2011: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2011')
|
||||
self._2012: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2012')
|
||||
self._2013: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2013')
|
||||
self._2014: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2014')
|
||||
self._2015: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2015')
|
||||
self._2016: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2016')
|
||||
self._2017: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2017')
|
||||
self._2018: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2018')
|
||||
self._2019: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2019')
|
||||
self._2020: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2020')
|
||||
self._2021: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2021')
|
||||
self._2022: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2022')
|
||||
self._2023: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2023')
|
||||
self._2024: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2024')
|
||||
self._2025: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2025')
|
||||
self._2026: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'class_2026')
|
||||
self._2009: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2009')
|
||||
self._2010: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2010')
|
||||
self._2011: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2011')
|
||||
self._2012: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2012')
|
||||
self._2013: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2013')
|
||||
self._2014: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2014')
|
||||
self._2015: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2015')
|
||||
self._2016: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2016')
|
||||
self._2017: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2017')
|
||||
self._2018: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2018')
|
||||
self._2019: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2019')
|
||||
self._2020: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2020')
|
||||
self._2021: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2021')
|
||||
self._2022: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2022')
|
||||
self._2023: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2023')
|
||||
self._2024: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2024')
|
||||
self._2025: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2025')
|
||||
self._2026: ActivityOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'class_2026')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts_Type:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.p2pk65: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2pk65')
|
||||
self.p2pk33: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2pk33')
|
||||
self.p2pkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2pkh')
|
||||
self.p2ms: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2ms')
|
||||
self.p2sh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2sh')
|
||||
self.p2wpkh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2wpkh')
|
||||
self.p2wsh: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2wsh')
|
||||
self.p2tr: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2tr')
|
||||
self.p2a: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'p2a')
|
||||
self.unknown: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'unknown_outputs')
|
||||
self.empty: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3 = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3(client, 'empty_outputs')
|
||||
self.p2pk65: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'p2pk65')
|
||||
self.p2pk33: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'p2pk33')
|
||||
self.p2pkh: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'p2pkh')
|
||||
self.p2ms: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'p2ms')
|
||||
self.p2sh: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'p2sh')
|
||||
self.p2wpkh: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'p2wpkh')
|
||||
self.p2wsh: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'p2wsh')
|
||||
self.p2tr: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'p2tr')
|
||||
self.p2a: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'p2a')
|
||||
self.unknown: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'unknown_outputs')
|
||||
self.empty: OutputsRealizedRelativeSupplyUnrealizedPattern = OutputsRealizedRelativeSupplyUnrealizedPattern(client, 'empty_outputs')
|
||||
|
||||
class MetricsTree_Distribution_UtxoCohorts:
|
||||
"""Metrics tree node."""
|
||||
@@ -4513,7 +4604,7 @@ class MetricsTree_Distribution_UtxoCohorts:
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.all: MetricsTree_Distribution_UtxoCohorts_All = MetricsTree_Distribution_UtxoCohorts_All(client)
|
||||
self.sth: MetricsTree_Distribution_UtxoCohorts_Sth = MetricsTree_Distribution_UtxoCohorts_Sth(client)
|
||||
self.lth: ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'lth')
|
||||
self.lth: MetricsTree_Distribution_UtxoCohorts_Lth = MetricsTree_Distribution_UtxoCohorts_Lth(client)
|
||||
self.age_range: MetricsTree_Distribution_UtxoCohorts_AgeRange = MetricsTree_Distribution_UtxoCohorts_AgeRange(client)
|
||||
self.max_age: MetricsTree_Distribution_UtxoCohorts_MaxAge = MetricsTree_Distribution_UtxoCohorts_MaxAge(client)
|
||||
self.min_age: MetricsTree_Distribution_UtxoCohorts_MinAge = MetricsTree_Distribution_UtxoCohorts_MinAge(client)
|
||||
@@ -4528,57 +4619,57 @@ class MetricsTree_Distribution_AddressCohorts_GeAmount:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._1sat: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1sat')
|
||||
self._10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10sats')
|
||||
self._100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_100sats')
|
||||
self._1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1k_sats')
|
||||
self._10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10k_sats')
|
||||
self._100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_100k_sats')
|
||||
self._1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1m_sats')
|
||||
self._10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10m_sats')
|
||||
self._1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1btc')
|
||||
self._10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10btc')
|
||||
self._100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_100btc')
|
||||
self._1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1k_btc')
|
||||
self._10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10k_btc')
|
||||
self._1sat: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1sat')
|
||||
self._10sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10sats')
|
||||
self._100sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_100sats')
|
||||
self._1k_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1k_sats')
|
||||
self._10k_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10k_sats')
|
||||
self._100k_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_100k_sats')
|
||||
self._1m_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1m_sats')
|
||||
self._10m_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10m_sats')
|
||||
self._1btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1btc')
|
||||
self._10btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10btc')
|
||||
self._100btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_100btc')
|
||||
self._1k_btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_1k_btc')
|
||||
self._10k_btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_over_10k_btc')
|
||||
|
||||
class MetricsTree_Distribution_AddressCohorts_AmountRange:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._0sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_with_0sats')
|
||||
self._1sat_to_10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1sat_under_10sats')
|
||||
self._10sats_to_100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10sats_under_100sats')
|
||||
self._100sats_to_1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100sats_under_1k_sats')
|
||||
self._1k_sats_to_10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1k_sats_under_10k_sats')
|
||||
self._10k_sats_to_100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10k_sats_under_100k_sats')
|
||||
self._100k_sats_to_1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100k_sats_under_1m_sats')
|
||||
self._1m_sats_to_10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1m_sats_under_10m_sats')
|
||||
self._10m_sats_to_1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10m_sats_under_1btc')
|
||||
self._1btc_to_10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1btc_under_10btc')
|
||||
self._10btc_to_100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10btc_under_100btc')
|
||||
self._100btc_to_1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100btc_under_1k_btc')
|
||||
self._1k_btc_to_10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1k_btc_under_10k_btc')
|
||||
self._10k_btc_to_100k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10k_btc_under_100k_btc')
|
||||
self._100k_btc_or_more: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100k_btc')
|
||||
self._0sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_with_0sats')
|
||||
self._1sat_to_10sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1sat_under_10sats')
|
||||
self._10sats_to_100sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10sats_under_100sats')
|
||||
self._100sats_to_1k_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100sats_under_1k_sats')
|
||||
self._1k_sats_to_10k_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1k_sats_under_10k_sats')
|
||||
self._10k_sats_to_100k_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10k_sats_under_100k_sats')
|
||||
self._100k_sats_to_1m_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100k_sats_under_1m_sats')
|
||||
self._1m_sats_to_10m_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1m_sats_under_10m_sats')
|
||||
self._10m_sats_to_1btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10m_sats_under_1btc')
|
||||
self._1btc_to_10btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1btc_under_10btc')
|
||||
self._10btc_to_100btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10btc_under_100btc')
|
||||
self._100btc_to_1k_btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100btc_under_1k_btc')
|
||||
self._1k_btc_to_10k_btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_1k_btc_under_10k_btc')
|
||||
self._10k_btc_to_100k_btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_10k_btc_under_100k_btc')
|
||||
self._100k_btc_or_more: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_above_100k_btc')
|
||||
|
||||
class MetricsTree_Distribution_AddressCohorts_LtAmount:
|
||||
"""Metrics tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._10sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10sats')
|
||||
self._100sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100sats')
|
||||
self._1k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1k_sats')
|
||||
self._10k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10k_sats')
|
||||
self._100k_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100k_sats')
|
||||
self._1m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1m_sats')
|
||||
self._10m_sats: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10m_sats')
|
||||
self._1btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1btc')
|
||||
self._10btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10btc')
|
||||
self._100btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100btc')
|
||||
self._1k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1k_btc')
|
||||
self._10k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10k_btc')
|
||||
self._100k_btc: ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100k_btc')
|
||||
self._10sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10sats')
|
||||
self._100sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100sats')
|
||||
self._1k_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1k_sats')
|
||||
self._10k_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10k_sats')
|
||||
self._100k_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100k_sats')
|
||||
self._1m_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1m_sats')
|
||||
self._10m_sats: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10m_sats')
|
||||
self._1btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1btc')
|
||||
self._10btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10btc')
|
||||
self._100btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100btc')
|
||||
self._1k_btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_1k_btc')
|
||||
self._10k_btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_10k_btc')
|
||||
self._100k_btc: ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern = ActivityAddrOutputsRealizedRelativeSupplyUnrealizedPattern(client, 'addrs_under_100k_btc')
|
||||
|
||||
class MetricsTree_Distribution_AddressCohorts:
|
||||
"""Metrics tree node."""
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "1.93.1"
|
||||
channel = "1.94.0"
|
||||
|
||||
Reference in New Issue
Block a user