mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
@@ -2021,6 +2021,28 @@ impl BaseBtcCentsSatsUsdPattern {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Pattern struct for repeated tree structure.
|
||||||
|
pub struct CoinblocksCoindaysSentPattern {
|
||||||
|
pub coinblocks_destroyed: CumulativeHeightPattern<StoredF64>,
|
||||||
|
pub coindays_destroyed: CumulativeHeightSumPattern<StoredF64>,
|
||||||
|
pub sent: MetricPattern1<Sats>,
|
||||||
|
pub sent_sum: _24hPattern<Sats>,
|
||||||
|
pub sent_sum_extended: _1m1w1yPattern<Sats>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CoinblocksCoindaysSentPattern {
|
||||||
|
/// Create a new pattern node with accumulated metric name.
|
||||||
|
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||||
|
Self {
|
||||||
|
coinblocks_destroyed: CumulativeHeightPattern::new(client.clone(), _m(&acc, "coinblocks_destroyed")),
|
||||||
|
coindays_destroyed: CumulativeHeightSumPattern::new(client.clone(), _m(&acc, "coindays_destroyed")),
|
||||||
|
sent: MetricPattern1::new(client.clone(), _m(&acc, "sent")),
|
||||||
|
sent_sum: _24hPattern::new(client.clone(), _m(&acc, "sent_24h")),
|
||||||
|
sent_sum_extended: _1m1w1yPattern::new(client.clone(), _m(&acc, "sent")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Pattern struct for repeated tree structure.
|
/// Pattern struct for repeated tree structure.
|
||||||
pub struct EmaHistogramLineSignalPattern {
|
pub struct EmaHistogramLineSignalPattern {
|
||||||
pub ema_fast: MetricPattern1<StoredF32>,
|
pub ema_fast: MetricPattern1<StoredF32>,
|
||||||
@@ -2043,28 +2065,6 @@ impl EmaHistogramLineSignalPattern {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Pattern struct for repeated tree structure.
|
|
||||||
pub struct SupplyPattern2 {
|
|
||||||
pub supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern,
|
|
||||||
pub supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern,
|
|
||||||
pub supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern,
|
|
||||||
pub supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern,
|
|
||||||
pub supply_rel_to_circulating_supply: BpsPercentRatioPattern,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SupplyPattern2 {
|
|
||||||
/// Create a new pattern node with accumulated metric name.
|
|
||||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
|
||||||
Self {
|
|
||||||
supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "in_loss_rel_to_circulating_supply")),
|
|
||||||
supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "in_loss_rel_to_own_supply")),
|
|
||||||
supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "in_profit_rel_to_circulating_supply")),
|
|
||||||
supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "in_profit_rel_to_own_supply")),
|
|
||||||
supply_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating_supply")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pattern struct for repeated tree structure.
|
/// Pattern struct for repeated tree structure.
|
||||||
pub struct _1m1w1y24hHeightPattern<T> {
|
pub struct _1m1w1y24hHeightPattern<T> {
|
||||||
pub _1m: MetricPattern1<T>,
|
pub _1m: MetricPattern1<T>,
|
||||||
@@ -2187,26 +2187,6 @@ impl BtcCentsSatsUsdPattern {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Pattern struct for repeated tree structure.
|
|
||||||
pub struct CoinblocksCoindaysSentPattern {
|
|
||||||
pub coinblocks_destroyed: CumulativeHeightPattern<StoredF64>,
|
|
||||||
pub coindays_destroyed: CumulativeHeightSumPattern<StoredF64>,
|
|
||||||
pub sent: BaseCumulativePattern,
|
|
||||||
pub sent_ema: _2wPattern,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CoinblocksCoindaysSentPattern {
|
|
||||||
/// Create a new pattern node with accumulated metric name.
|
|
||||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
|
||||||
Self {
|
|
||||||
coinblocks_destroyed: CumulativeHeightPattern::new(client.clone(), _m(&acc, "coinblocks_destroyed")),
|
|
||||||
coindays_destroyed: CumulativeHeightSumPattern::new(client.clone(), _m(&acc, "coindays_destroyed")),
|
|
||||||
sent: BaseCumulativePattern::new(client.clone(), _m(&acc, "sent")),
|
|
||||||
sent_ema: _2wPattern::new(client.clone(), _m(&acc, "sent_ema_2w")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pattern struct for repeated tree structure.
|
/// Pattern struct for repeated tree structure.
|
||||||
pub struct InvestedMaxMinPercentilesPattern {
|
pub struct InvestedMaxMinPercentilesPattern {
|
||||||
pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern,
|
pub invested_capital: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern,
|
||||||
@@ -2375,6 +2355,24 @@ impl ChangeHalvedTotalPattern {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Pattern struct for repeated tree structure.
|
||||||
|
pub struct SupplyPattern2 {
|
||||||
|
pub supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern,
|
||||||
|
pub supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern,
|
||||||
|
pub supply_rel_to_circulating_supply: BpsPercentRatioPattern,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SupplyPattern2 {
|
||||||
|
/// Create a new pattern node with accumulated metric name.
|
||||||
|
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||||
|
Self {
|
||||||
|
supply_in_loss_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "in_loss_rel_to_circulating_supply")),
|
||||||
|
supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "in_profit_rel_to_circulating_supply")),
|
||||||
|
supply_rel_to_circulating_supply: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_circulating_supply")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Pattern struct for repeated tree structure.
|
/// Pattern struct for repeated tree structure.
|
||||||
pub struct _1m1w1yPattern<T> {
|
pub struct _1m1w1yPattern<T> {
|
||||||
pub _1m: MetricPattern1<T>,
|
pub _1m: MetricPattern1<T>,
|
||||||
@@ -2575,16 +2573,16 @@ impl SdSmaPattern {
|
|||||||
|
|
||||||
/// Pattern struct for repeated tree structure.
|
/// Pattern struct for repeated tree structure.
|
||||||
pub struct SentPattern {
|
pub struct SentPattern {
|
||||||
pub sent: BaseCumulativePattern,
|
pub sent: MetricPattern1<Sats>,
|
||||||
pub sent_ema: _2wPattern,
|
pub sent_sum: _24hPattern<Sats>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SentPattern {
|
impl SentPattern {
|
||||||
/// Create a new pattern node with accumulated metric name.
|
/// Create a new pattern node with accumulated metric name.
|
||||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
||||||
Self {
|
Self {
|
||||||
sent: BaseCumulativePattern::new(client.clone(), acc.clone()),
|
sent: MetricPattern1::new(client.clone(), acc.clone()),
|
||||||
sent_ema: _2wPattern::new(client.clone(), _m(&acc, "ema_2w")),
|
sent_sum: _24hPattern::new(client.clone(), _m(&acc, "24h")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2637,20 +2635,6 @@ impl<T: DeserializeOwned> CumulativeHeightPattern<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Pattern struct for repeated tree structure.
|
|
||||||
pub struct _2wPattern {
|
|
||||||
pub _2w: BtcCentsSatsUsdPattern,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl _2wPattern {
|
|
||||||
/// Create a new pattern node with accumulated metric name.
|
|
||||||
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
|
|
||||||
Self {
|
|
||||||
_2w: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pattern struct for repeated tree structure.
|
/// Pattern struct for repeated tree structure.
|
||||||
pub struct _24hPattern<T> {
|
pub struct _24hPattern<T> {
|
||||||
pub _24h: MetricPattern1<T>,
|
pub _24h: MetricPattern1<T>,
|
||||||
@@ -5575,12 +5559,12 @@ impl MetricsTree_Distribution_UtxoCohorts_All_Adjusted {
|
|||||||
|
|
||||||
/// Metrics tree node.
|
/// Metrics tree node.
|
||||||
pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative {
|
pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative {
|
||||||
|
pub supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern,
|
||||||
|
pub supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern,
|
||||||
pub unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern,
|
pub unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern,
|
||||||
pub unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern,
|
pub unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern,
|
||||||
pub net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern,
|
pub net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern,
|
||||||
pub nupl: MetricPattern1<StoredF32>,
|
pub nupl: MetricPattern1<StoredF32>,
|
||||||
pub supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern,
|
|
||||||
pub supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern,
|
|
||||||
pub unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern,
|
pub unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern,
|
||||||
pub unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern,
|
pub unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern,
|
||||||
pub net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern,
|
pub net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern,
|
||||||
@@ -5589,12 +5573,12 @@ pub struct MetricsTree_Distribution_UtxoCohorts_All_Relative {
|
|||||||
impl MetricsTree_Distribution_UtxoCohorts_All_Relative {
|
impl MetricsTree_Distribution_UtxoCohorts_All_Relative {
|
||||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), "supply_in_profit_rel_to_own_supply".to_string()),
|
||||||
|
supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), "supply_in_loss_rel_to_own_supply".to_string()),
|
||||||
unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_market_cap".to_string()),
|
unrealized_profit_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_market_cap".to_string()),
|
||||||
unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_market_cap".to_string()),
|
unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_market_cap".to_string()),
|
||||||
net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "net_unrealized_pnl_rel_to_market_cap".to_string()),
|
net_unrealized_pnl_rel_to_market_cap: BpsPercentRatioPattern::new(client.clone(), "net_unrealized_pnl_rel_to_market_cap".to_string()),
|
||||||
nupl: MetricPattern1::new(client.clone(), "nupl".to_string()),
|
nupl: MetricPattern1::new(client.clone(), "nupl".to_string()),
|
||||||
supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), "supply_in_profit_rel_to_own_supply".to_string()),
|
|
||||||
supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern::new(client.clone(), "supply_in_loss_rel_to_own_supply".to_string()),
|
|
||||||
unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_own_gross_pnl".to_string()),
|
unrealized_profit_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "unrealized_profit_rel_to_own_gross_pnl".to_string()),
|
||||||
unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_own_gross_pnl".to_string()),
|
unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "unrealized_loss_rel_to_own_gross_pnl".to_string()),
|
||||||
net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "net_unrealized_pnl_rel_to_own_gross_pnl".to_string()),
|
net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern::new(client.clone(), "net_unrealized_pnl_rel_to_own_gross_pnl".to_string()),
|
||||||
|
|||||||
@@ -3,35 +3,36 @@ use brk_traversable::Traversable;
|
|||||||
use brk_types::{Height, Indexes, Sats, Version};
|
use brk_types::{Height, Indexes, Sats, Version};
|
||||||
use vecdb::{AnyStoredVec, AnyVec, Exit, Rw, StorageMode, WritableVec};
|
use vecdb::{AnyStoredVec, AnyVec, Exit, Rw, StorageMode, WritableVec};
|
||||||
|
|
||||||
use crate::internal::{RollingEmas2w, ValueFromHeightCumulative};
|
use crate::internal::{ComputedFromHeight, RollingWindow24h};
|
||||||
|
|
||||||
use crate::{blocks, distribution::metrics::ImportConfig, prices};
|
use crate::{blocks, distribution::metrics::ImportConfig};
|
||||||
|
|
||||||
#[derive(Traversable)]
|
#[derive(Traversable)]
|
||||||
pub struct ActivityBase<M: StorageMode = Rw> {
|
pub struct ActivityBase<M: StorageMode = Rw> {
|
||||||
pub sent: ValueFromHeightCumulative<M>,
|
pub sent: ComputedFromHeight<Sats, M>,
|
||||||
pub sent_ema: RollingEmas2w<M>,
|
pub sent_sum: RollingWindow24h<Sats, M>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActivityBase {
|
impl ActivityBase {
|
||||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||||
|
let v1 = Version::ONE;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
sent: cfg.import("sent", Version::ZERO)?,
|
sent: cfg.import("sent", v1)?,
|
||||||
sent_ema: cfg.import("sent", Version::ZERO)?,
|
sent_sum: cfg.import("sent", v1)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn min_len(&self) -> usize {
|
pub(crate) fn min_len(&self) -> usize {
|
||||||
self.sent.base.sats.height.len()
|
self.sent.height.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn truncate_push(&mut self, height: Height, sent: Sats) -> Result<()> {
|
pub(crate) fn truncate_push(&mut self, height: Height, sent: Sats) -> Result<()> {
|
||||||
self.sent.base.sats.height.truncate_push(height, sent)?;
|
self.sent.height.truncate_push(height, sent)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||||
vec![&mut self.sent.base.sats.height as &mut dyn AnyStoredVec]
|
vec![&mut self.sent.height as &mut dyn AnyStoredVec]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn validate_computed_versions(&mut self, _base_version: Version) -> Result<()> {
|
pub(crate) fn validate_computed_versions(&mut self, _base_version: Version) -> Result<()> {
|
||||||
@@ -44,11 +45,11 @@ impl ActivityBase {
|
|||||||
others: &[&Self],
|
others: &[&Self],
|
||||||
exit: &Exit,
|
exit: &Exit,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.sent.base.sats.height.compute_sum_of_others(
|
self.sent.height.compute_sum_of_others(
|
||||||
starting_indexes.height,
|
starting_indexes.height,
|
||||||
&others
|
&others
|
||||||
.iter()
|
.iter()
|
||||||
.map(|v| &v.sent.base.sats.height)
|
.map(|v| &v.sent.height)
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
exit,
|
exit,
|
||||||
)?;
|
)?;
|
||||||
@@ -58,21 +59,15 @@ impl ActivityBase {
|
|||||||
pub(crate) fn compute_rest_part1(
|
pub(crate) fn compute_rest_part1(
|
||||||
&mut self,
|
&mut self,
|
||||||
blocks: &blocks::Vecs,
|
blocks: &blocks::Vecs,
|
||||||
prices: &prices::Vecs,
|
|
||||||
starting_indexes: &Indexes,
|
starting_indexes: &Indexes,
|
||||||
exit: &Exit,
|
exit: &Exit,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.sent
|
self.sent_sum.compute_rolling_sum(
|
||||||
.compute(prices, starting_indexes.height, exit)?;
|
|
||||||
|
|
||||||
self.sent_ema.compute(
|
|
||||||
starting_indexes.height,
|
starting_indexes.height,
|
||||||
&blocks.count.height_2w_ago,
|
&blocks.count.height_24h_ago,
|
||||||
&self.sent.base.sats.height,
|
&self.sent.height,
|
||||||
&self.sent.base.cents.height,
|
|
||||||
exit,
|
exit,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ use brk_types::{Bitcoin, Height, Indexes, Sats, StoredF64, Version};
|
|||||||
use derive_more::{Deref, DerefMut};
|
use derive_more::{Deref, DerefMut};
|
||||||
use vecdb::{AnyStoredVec, AnyVec, Exit, Rw, StorageMode, WritableVec};
|
use vecdb::{AnyStoredVec, AnyVec, Exit, Rw, StorageMode, WritableVec};
|
||||||
|
|
||||||
use crate::internal::{ComputedFromHeightCumulative, ComputedFromHeightCumulativeSum};
|
use crate::internal::{
|
||||||
|
ComputedFromHeightCumulative, ComputedFromHeightCumulativeSum, RollingWindowsFrom1w,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{blocks, distribution::metrics::ImportConfig, prices};
|
use crate::{blocks, distribution::metrics::ImportConfig};
|
||||||
|
|
||||||
use super::ActivityBase;
|
use super::ActivityBase;
|
||||||
|
|
||||||
@@ -19,15 +21,19 @@ pub struct ActivityFull<M: StorageMode = Rw> {
|
|||||||
|
|
||||||
pub coinblocks_destroyed: ComputedFromHeightCumulative<StoredF64, M>,
|
pub coinblocks_destroyed: ComputedFromHeightCumulative<StoredF64, M>,
|
||||||
pub coindays_destroyed: ComputedFromHeightCumulativeSum<StoredF64, M>,
|
pub coindays_destroyed: ComputedFromHeightCumulativeSum<StoredF64, M>,
|
||||||
|
|
||||||
|
pub sent_sum_extended: RollingWindowsFrom1w<Sats, M>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActivityFull {
|
impl ActivityFull {
|
||||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||||
|
let v1 = Version::ONE;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
base: ActivityBase::forced_import(cfg)?,
|
base: ActivityBase::forced_import(cfg)?,
|
||||||
coinblocks_destroyed: cfg
|
coinblocks_destroyed: cfg
|
||||||
.import("coinblocks_destroyed", Version::ONE)?,
|
.import("coinblocks_destroyed", v1)?,
|
||||||
coindays_destroyed: cfg.import("coindays_destroyed", Version::ONE)?,
|
coindays_destroyed: cfg.import("coindays_destroyed", v1)?,
|
||||||
|
sent_sum_extended: cfg.import("sent", v1)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +65,7 @@ impl ActivityFull {
|
|||||||
|
|
||||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||||
vec![
|
vec![
|
||||||
&mut self.base.sent.base.sats.height as &mut dyn AnyStoredVec,
|
&mut self.base.sent.height as &mut dyn AnyStoredVec,
|
||||||
&mut self.coinblocks_destroyed.height as &mut dyn AnyStoredVec,
|
&mut self.coinblocks_destroyed.height as &mut dyn AnyStoredVec,
|
||||||
&mut self.coindays_destroyed.height as &mut dyn AnyStoredVec,
|
&mut self.coindays_destroyed.height as &mut dyn AnyStoredVec,
|
||||||
]
|
]
|
||||||
@@ -87,12 +93,11 @@ impl ActivityFull {
|
|||||||
pub(crate) fn compute_rest_part1(
|
pub(crate) fn compute_rest_part1(
|
||||||
&mut self,
|
&mut self,
|
||||||
blocks: &blocks::Vecs,
|
blocks: &blocks::Vecs,
|
||||||
prices: &prices::Vecs,
|
|
||||||
starting_indexes: &Indexes,
|
starting_indexes: &Indexes,
|
||||||
exit: &Exit,
|
exit: &Exit,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.base
|
self.base
|
||||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)?;
|
.compute_rest_part1(blocks, starting_indexes, exit)?;
|
||||||
|
|
||||||
self.coinblocks_destroyed
|
self.coinblocks_destroyed
|
||||||
.compute_rest(starting_indexes.height, exit)?;
|
.compute_rest(starting_indexes.height, exit)?;
|
||||||
@@ -101,6 +106,13 @@ impl ActivityFull {
|
|||||||
self.coindays_destroyed
|
self.coindays_destroyed
|
||||||
.compute_rest(starting_indexes.height, &window_starts, exit)?;
|
.compute_rest(starting_indexes.height, &window_starts, exit)?;
|
||||||
|
|
||||||
|
self.sent_sum_extended.compute_rolling_sum(
|
||||||
|
starting_indexes.height,
|
||||||
|
&window_starts,
|
||||||
|
&self.base.sent.height,
|
||||||
|
exit,
|
||||||
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ impl AllCohortMetrics {
|
|||||||
self.dormancy.height.compute_transform2(
|
self.dormancy.height.compute_transform2(
|
||||||
starting_indexes.height,
|
starting_indexes.height,
|
||||||
&self.activity.coindays_destroyed.height,
|
&self.activity.coindays_destroyed.height,
|
||||||
&self.activity.sent.base.sats.height,
|
&self.activity.sent.height,
|
||||||
|(i, cdd, sent_sats, ..)| {
|
|(i, cdd, sent_sats, ..)| {
|
||||||
let sent_btc = f64::from(Bitcoin::from(sent_sats));
|
let sent_btc = f64::from(Bitcoin::from(sent_sats));
|
||||||
if sent_btc == 0.0 {
|
if sent_btc == 0.0 {
|
||||||
@@ -139,7 +139,7 @@ impl AllCohortMetrics {
|
|||||||
|
|
||||||
self.velocity.height.compute_transform2(
|
self.velocity.height.compute_transform2(
|
||||||
starting_indexes.height,
|
starting_indexes.height,
|
||||||
&self.activity.sent.base.sats.height,
|
&self.activity.sent.height,
|
||||||
&self.supply.total.sats.height,
|
&self.supply.total.sats.height,
|
||||||
|(i, sent_sats, supply_sats, ..)| {
|
|(i, sent_sats, supply_sats, ..)| {
|
||||||
let supply = supply_sats.as_u128() as f64;
|
let supply = supply_sats.as_u128() as f64;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use crate::{blocks, prices};
|
|||||||
|
|
||||||
use crate::distribution::metrics::{
|
use crate::distribution::metrics::{
|
||||||
ActivityFull, CohortMetricsBase, CostBasisBase, ImportConfig, OutputsMetrics, RealizedBase,
|
ActivityFull, CohortMetricsBase, CostBasisBase, ImportConfig, OutputsMetrics, RealizedBase,
|
||||||
RelativeBaseWithRelToAll, SupplyMetrics, UnrealizedBase,
|
RelativeToAll, SupplyMetrics, UnrealizedBase,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Basic cohort metrics: no extensions, with relative (rel_to_all).
|
/// Basic cohort metrics: no extensions, with relative (rel_to_all).
|
||||||
@@ -23,7 +23,7 @@ pub struct BasicCohortMetrics<M: StorageMode = Rw> {
|
|||||||
pub realized: Box<RealizedBase<M>>,
|
pub realized: Box<RealizedBase<M>>,
|
||||||
pub cost_basis: Box<CostBasisBase<M>>,
|
pub cost_basis: Box<CostBasisBase<M>>,
|
||||||
pub unrealized: Box<UnrealizedBase<M>>,
|
pub unrealized: Box<UnrealizedBase<M>>,
|
||||||
pub relative: Box<RelativeBaseWithRelToAll<M>>,
|
pub relative: Box<RelativeToAll<M>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CohortMetricsBase for BasicCohortMetrics {
|
impl CohortMetricsBase for BasicCohortMetrics {
|
||||||
@@ -51,7 +51,7 @@ impl BasicCohortMetrics {
|
|||||||
let unrealized = UnrealizedBase::forced_import(cfg)?;
|
let unrealized = UnrealizedBase::forced_import(cfg)?;
|
||||||
let realized = RealizedBase::forced_import(cfg)?;
|
let realized = RealizedBase::forced_import(cfg)?;
|
||||||
|
|
||||||
let relative = RelativeBaseWithRelToAll::forced_import(cfg)?;
|
let relative = RelativeToAll::forced_import(cfg)?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
filter: cfg.filter.clone(),
|
filter: cfg.filter.clone(),
|
||||||
@@ -83,7 +83,8 @@ impl BasicCohortMetrics {
|
|||||||
|
|
||||||
self.relative.compute(
|
self.relative.compute(
|
||||||
starting_indexes.height,
|
starting_indexes.height,
|
||||||
&self.unrealized.core,
|
&self.unrealized.supply_in_profit.sats.height,
|
||||||
|
&self.unrealized.supply_in_loss.sats.height,
|
||||||
&self.supply.total.sats.height,
|
&self.supply.total.sats.height,
|
||||||
all_supply_sats,
|
all_supply_sats,
|
||||||
exit,
|
exit,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use crate::{blocks, prices};
|
|||||||
|
|
||||||
use crate::distribution::metrics::{
|
use crate::distribution::metrics::{
|
||||||
ActivityBase, CohortMetricsBase, RealizedCore, ImportConfig, OutputsMetrics,
|
ActivityBase, CohortMetricsBase, RealizedCore, ImportConfig, OutputsMetrics,
|
||||||
RelativeBaseWithRelToAll, SupplyMetrics, UnrealizedCore,
|
RelativeToAll, SupplyMetrics, UnrealizedCore,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Traversable)]
|
#[derive(Traversable)]
|
||||||
@@ -20,7 +20,7 @@ pub struct CoreCohortMetrics<M: StorageMode = Rw> {
|
|||||||
pub activity: Box<ActivityBase<M>>,
|
pub activity: Box<ActivityBase<M>>,
|
||||||
pub realized: Box<RealizedCore<M>>,
|
pub realized: Box<RealizedCore<M>>,
|
||||||
pub unrealized: Box<UnrealizedCore<M>>,
|
pub unrealized: Box<UnrealizedCore<M>>,
|
||||||
pub relative: Box<RelativeBaseWithRelToAll<M>>,
|
pub relative: Box<RelativeToAll<M>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CoreCohortMetrics {
|
impl CoreCohortMetrics {
|
||||||
@@ -32,7 +32,7 @@ impl CoreCohortMetrics {
|
|||||||
activity: Box::new(ActivityBase::forced_import(cfg)?),
|
activity: Box::new(ActivityBase::forced_import(cfg)?),
|
||||||
realized: Box::new(RealizedCore::forced_import(cfg)?),
|
realized: Box::new(RealizedCore::forced_import(cfg)?),
|
||||||
unrealized: Box::new(UnrealizedCore::forced_import(cfg)?),
|
unrealized: Box::new(UnrealizedCore::forced_import(cfg)?),
|
||||||
relative: Box::new(RelativeBaseWithRelToAll::forced_import(cfg)?),
|
relative: Box::new(RelativeToAll::forced_import(cfg)?),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ impl CoreCohortMetrics {
|
|||||||
.compute_rest(blocks, starting_indexes, exit)?;
|
.compute_rest(blocks, starting_indexes, exit)?;
|
||||||
|
|
||||||
self.activity
|
self.activity
|
||||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)?;
|
.compute_rest_part1(blocks, starting_indexes, exit)?;
|
||||||
|
|
||||||
self.realized
|
self.realized
|
||||||
.compute_rest_part1(starting_indexes, exit)?;
|
.compute_rest_part1(starting_indexes, exit)?;
|
||||||
@@ -140,7 +140,8 @@ impl CoreCohortMetrics {
|
|||||||
|
|
||||||
self.relative.compute(
|
self.relative.compute(
|
||||||
starting_indexes.height,
|
starting_indexes.height,
|
||||||
&self.unrealized,
|
&self.unrealized.supply_in_profit.sats.height,
|
||||||
|
&self.unrealized.supply_in_loss.sats.height,
|
||||||
&self.supply.total.sats.height,
|
&self.supply.total.sats.height,
|
||||||
all_supply_sats,
|
all_supply_sats,
|
||||||
exit,
|
exit,
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ impl ExtendedCohortMetrics {
|
|||||||
self.dormancy.height.compute_transform2(
|
self.dormancy.height.compute_transform2(
|
||||||
starting_indexes.height,
|
starting_indexes.height,
|
||||||
&self.activity.coindays_destroyed.height,
|
&self.activity.coindays_destroyed.height,
|
||||||
&self.activity.sent.base.sats.height,
|
&self.activity.sent.height,
|
||||||
|(i, cdd, sent_sats, ..)| {
|
|(i, cdd, sent_sats, ..)| {
|
||||||
let sent_btc = f64::from(Bitcoin::from(sent_sats));
|
let sent_btc = f64::from(Bitcoin::from(sent_sats));
|
||||||
if sent_btc == 0.0 {
|
if sent_btc == 0.0 {
|
||||||
@@ -119,7 +119,7 @@ impl ExtendedCohortMetrics {
|
|||||||
|
|
||||||
self.velocity.height.compute_transform2(
|
self.velocity.height.compute_transform2(
|
||||||
starting_indexes.height,
|
starting_indexes.height,
|
||||||
&self.activity.sent.base.sats.height,
|
&self.activity.sent.height,
|
||||||
&self.supply.total.sats.height,
|
&self.supply.total.sats.height,
|
||||||
|(i, sent_sats, supply_sats, ..)| {
|
|(i, sent_sats, supply_sats, ..)| {
|
||||||
let supply = supply_sats.as_u128() as f64;
|
let supply = supply_sats.as_u128() as f64;
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ impl MinimalCohortMetrics {
|
|||||||
self.outputs
|
self.outputs
|
||||||
.compute_rest(blocks, starting_indexes, exit)?;
|
.compute_rest(blocks, starting_indexes, exit)?;
|
||||||
self.activity
|
self.activity
|
||||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)?;
|
.compute_rest_part1(blocks, starting_indexes, exit)?;
|
||||||
self.realized
|
self.realized
|
||||||
.compute_rest_part1(starting_indexes, exit)?;
|
.compute_rest_part1(starting_indexes, exit)?;
|
||||||
self.unrealized
|
self.unrealized
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ pub use realized::{
|
|||||||
RealizedAdjusted, RealizedBase, RealizedCore, RealizedFull, RealizedLike, RealizedMinimal,
|
RealizedAdjusted, RealizedBase, RealizedCore, RealizedFull, RealizedLike, RealizedMinimal,
|
||||||
};
|
};
|
||||||
pub use relative::{
|
pub use relative::{
|
||||||
RelativeBaseWithRelToAll, RelativeForAll, RelativeWithExtended,
|
RelativeForAll, RelativeToAll, RelativeWithExtended,
|
||||||
};
|
};
|
||||||
pub use supply::SupplyMetrics;
|
pub use supply::SupplyMetrics;
|
||||||
pub use unrealized::{UnrealizedBase, UnrealizedCore, UnrealizedFull, UnrealizedLike};
|
pub use unrealized::{UnrealizedBase, UnrealizedCore, UnrealizedFull, UnrealizedLike};
|
||||||
@@ -200,10 +200,7 @@ pub trait CohortMetricsBase: CohortMetricsState<Realized = RealizedState> + Send
|
|||||||
self.outputs_mut()
|
self.outputs_mut()
|
||||||
.compute_rest(blocks, starting_indexes, exit)?;
|
.compute_rest(blocks, starting_indexes, exit)?;
|
||||||
self.activity_mut()
|
self.activity_mut()
|
||||||
.sent
|
.compute_rest_part1(blocks, starting_indexes, exit)?;
|
||||||
.compute(prices, starting_indexes.height, exit)?;
|
|
||||||
self.activity_mut()
|
|
||||||
.compute_rest_part1(blocks, prices, starting_indexes, exit)?;
|
|
||||||
|
|
||||||
self.realized_mut()
|
self.realized_mut()
|
||||||
.compute_rest_part1(starting_indexes, exit)?;
|
.compute_rest_part1(starting_indexes, exit)?;
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
use brk_error::Result;
|
|
||||||
use brk_traversable::Traversable;
|
|
||||||
use brk_types::{BasisPoints16, Height, Sats, Version};
|
|
||||||
use vecdb::{Exit, ReadableVec, Rw, StorageMode};
|
|
||||||
|
|
||||||
use crate::internal::{PercentFromHeight, RatioSatsBp16};
|
|
||||||
|
|
||||||
use crate::distribution::metrics::{ImportConfig, UnrealizedCore};
|
|
||||||
|
|
||||||
/// Relative metrics for the Complete tier.
|
|
||||||
#[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>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RelativeBase {
|
|
||||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
|
||||||
let v1 = Version::ONE;
|
|
||||||
|
|
||||||
Ok(Self {
|
|
||||||
supply_in_profit_rel_to_own_supply: cfg
|
|
||||||
.import("supply_in_profit_rel_to_own_supply", v1)?,
|
|
||||||
supply_in_loss_rel_to_own_supply: cfg
|
|
||||||
.import("supply_in_loss_rel_to_own_supply", v1)?,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn compute(
|
|
||||||
&mut self,
|
|
||||||
max_from: Height,
|
|
||||||
unrealized: &UnrealizedCore,
|
|
||||||
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,
|
|
||||||
&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,
|
|
||||||
)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,24 +3,20 @@ use brk_traversable::Traversable;
|
|||||||
use brk_types::{
|
use brk_types::{
|
||||||
BasisPoints16, BasisPointsSigned32, Dollars, Height, Sats, StoredF32, Version,
|
BasisPoints16, BasisPointsSigned32, Dollars, Height, Sats, StoredF32, Version,
|
||||||
};
|
};
|
||||||
use derive_more::{Deref, DerefMut};
|
|
||||||
use vecdb::{Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode};
|
use vecdb::{Exit, ReadableCloneableVec, ReadableVec, Rw, StorageMode};
|
||||||
|
|
||||||
use crate::internal::{
|
use crate::internal::{
|
||||||
Bps32ToFloat, LazyFromHeight, PercentFromHeight, RatioDollarsBp16, RatioDollarsBps32,
|
Bps32ToFloat, LazyFromHeight, PercentFromHeight, RatioDollarsBp16, RatioDollarsBps32,
|
||||||
|
RatioSatsBp16,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::distribution::metrics::{ImportConfig, UnrealizedCore};
|
use crate::distribution::metrics::{ImportConfig, UnrealizedCore};
|
||||||
|
|
||||||
use super::RelativeBase;
|
/// Full relative metrics (sth/lth/all tier).
|
||||||
|
#[derive(Traversable)]
|
||||||
/// Full relative metrics (Source/Extended tier).
|
|
||||||
#[derive(Deref, DerefMut, Traversable)]
|
|
||||||
pub struct RelativeFull<M: StorageMode = Rw> {
|
pub struct RelativeFull<M: StorageMode = Rw> {
|
||||||
#[deref]
|
pub supply_in_profit_rel_to_own_supply: PercentFromHeight<BasisPoints16, M>,
|
||||||
#[deref_mut]
|
pub supply_in_loss_rel_to_own_supply: PercentFromHeight<BasisPoints16, M>,
|
||||||
#[traversable(flatten)]
|
|
||||||
pub base: RelativeBase<M>,
|
|
||||||
|
|
||||||
pub unrealized_profit_rel_to_market_cap: PercentFromHeight<BasisPoints16, M>,
|
pub unrealized_profit_rel_to_market_cap: PercentFromHeight<BasisPoints16, M>,
|
||||||
pub unrealized_loss_rel_to_market_cap: PercentFromHeight<BasisPoints16, M>,
|
pub unrealized_loss_rel_to_market_cap: PercentFromHeight<BasisPoints16, M>,
|
||||||
@@ -30,8 +26,7 @@ pub struct RelativeFull<M: StorageMode = Rw> {
|
|||||||
|
|
||||||
impl RelativeFull {
|
impl RelativeFull {
|
||||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||||
let base = RelativeBase::forced_import(cfg)?;
|
let v1 = Version::ONE;
|
||||||
|
|
||||||
let v2 = Version::new(2);
|
let v2 = Version::new(2);
|
||||||
let v3 = Version::new(3);
|
let v3 = Version::new(3);
|
||||||
|
|
||||||
@@ -49,7 +44,10 @@ impl RelativeFull {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
base,
|
supply_in_profit_rel_to_own_supply: cfg
|
||||||
|
.import("supply_in_profit_rel_to_own_supply", v1)?,
|
||||||
|
supply_in_loss_rel_to_own_supply: cfg
|
||||||
|
.import("supply_in_loss_rel_to_own_supply", v1)?,
|
||||||
unrealized_profit_rel_to_market_cap: cfg
|
unrealized_profit_rel_to_market_cap: cfg
|
||||||
.import("unrealized_profit_rel_to_market_cap", v2)?,
|
.import("unrealized_profit_rel_to_market_cap", v2)?,
|
||||||
unrealized_loss_rel_to_market_cap: cfg
|
unrealized_loss_rel_to_market_cap: cfg
|
||||||
@@ -67,12 +65,20 @@ impl RelativeFull {
|
|||||||
market_cap: &impl ReadableVec<Height, Dollars>,
|
market_cap: &impl ReadableVec<Height, Dollars>,
|
||||||
exit: &Exit,
|
exit: &Exit,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.base.compute(
|
self.supply_in_profit_rel_to_own_supply
|
||||||
max_from,
|
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||||
unrealized,
|
max_from,
|
||||||
supply_total_sats,
|
&unrealized.supply_in_profit.sats.height,
|
||||||
exit,
|
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
|
self.unrealized_profit_rel_to_market_cap
|
||||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
mod base;
|
|
||||||
mod extended_own_market_cap;
|
mod extended_own_market_cap;
|
||||||
mod extended_own_pnl;
|
mod extended_own_pnl;
|
||||||
mod for_all;
|
mod for_all;
|
||||||
mod full;
|
mod full;
|
||||||
mod to_all;
|
mod to_all;
|
||||||
mod with_extended;
|
mod with_extended;
|
||||||
mod with_rel_to_all;
|
|
||||||
|
|
||||||
pub use base::RelativeBase;
|
|
||||||
pub use extended_own_market_cap::RelativeExtendedOwnMarketCap;
|
pub use extended_own_market_cap::RelativeExtendedOwnMarketCap;
|
||||||
pub use extended_own_pnl::RelativeExtendedOwnPnl;
|
pub use extended_own_pnl::RelativeExtendedOwnPnl;
|
||||||
pub use for_all::RelativeForAll;
|
pub use for_all::RelativeForAll;
|
||||||
pub use full::RelativeFull;
|
pub use full::RelativeFull;
|
||||||
pub use to_all::RelativeToAll;
|
pub use to_all::RelativeToAll;
|
||||||
pub use with_extended::RelativeWithExtended;
|
pub use with_extended::RelativeWithExtended;
|
||||||
pub use with_rel_to_all::RelativeBaseWithRelToAll;
|
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
use brk_error::Result;
|
|
||||||
use brk_traversable::Traversable;
|
|
||||||
use brk_types::{Height, Sats};
|
|
||||||
use derive_more::{Deref, DerefMut};
|
|
||||||
use vecdb::{Exit, ReadableVec, Rw, StorageMode};
|
|
||||||
|
|
||||||
use crate::distribution::metrics::{ImportConfig, UnrealizedCore};
|
|
||||||
|
|
||||||
use super::{RelativeBase, RelativeToAll};
|
|
||||||
|
|
||||||
/// Base relative metrics with rel_to_all.
|
|
||||||
/// Used by: age_range, epoch, class, min_age, max_age cohorts.
|
|
||||||
#[derive(Deref, DerefMut, Traversable)]
|
|
||||||
pub struct RelativeBaseWithRelToAll<M: StorageMode = Rw> {
|
|
||||||
#[deref]
|
|
||||||
#[deref_mut]
|
|
||||||
#[traversable(flatten)]
|
|
||||||
pub base: RelativeBase<M>,
|
|
||||||
#[traversable(flatten)]
|
|
||||||
pub rel_to_all: RelativeToAll<M>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RelativeBaseWithRelToAll {
|
|
||||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
|
||||||
Ok(Self {
|
|
||||||
base: RelativeBase::forced_import(cfg)?,
|
|
||||||
rel_to_all: RelativeToAll::forced_import(cfg)?,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn compute(
|
|
||||||
&mut self,
|
|
||||||
max_from: Height,
|
|
||||||
unrealized: &UnrealizedCore,
|
|
||||||
supply_total_sats: &impl ReadableVec<Height, Sats>,
|
|
||||||
all_supply_sats: &impl ReadableVec<Height, Sats>,
|
|
||||||
exit: &Exit,
|
|
||||||
) -> Result<()> {
|
|
||||||
self.base.compute(
|
|
||||||
max_from,
|
|
||||||
unrealized,
|
|
||||||
supply_total_sats,
|
|
||||||
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(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2745,6 +2745,31 @@ function createBaseBtcCentsSatsUsdPattern(client, acc) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} CoinblocksCoindaysSentPattern
|
||||||
|
* @property {CumulativeHeightPattern<StoredF64>} coinblocksDestroyed
|
||||||
|
* @property {CumulativeHeightSumPattern<StoredF64>} coindaysDestroyed
|
||||||
|
* @property {MetricPattern1<Sats>} sent
|
||||||
|
* @property {_24hPattern<Sats>} sentSum
|
||||||
|
* @property {_1m1w1yPattern<Sats>} sentSumExtended
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a CoinblocksCoindaysSentPattern pattern node
|
||||||
|
* @param {BrkClientBase} client
|
||||||
|
* @param {string} acc - Accumulated metric name
|
||||||
|
* @returns {CoinblocksCoindaysSentPattern}
|
||||||
|
*/
|
||||||
|
function createCoinblocksCoindaysSentPattern(client, acc) {
|
||||||
|
return {
|
||||||
|
coinblocksDestroyed: createCumulativeHeightPattern(client, _m(acc, 'coinblocks_destroyed')),
|
||||||
|
coindaysDestroyed: createCumulativeHeightSumPattern(client, _m(acc, 'coindays_destroyed')),
|
||||||
|
sent: createMetricPattern1(client, _m(acc, 'sent')),
|
||||||
|
sentSum: create_24hPattern(client, _m(acc, 'sent_24h')),
|
||||||
|
sentSumExtended: create_1m1w1yPattern(client, _m(acc, 'sent')),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} EmaHistogramLineSignalPattern
|
* @typedef {Object} EmaHistogramLineSignalPattern
|
||||||
* @property {MetricPattern1<StoredF32>} emaFast
|
* @property {MetricPattern1<StoredF32>} emaFast
|
||||||
@@ -2770,31 +2795,6 @@ function createEmaHistogramLineSignalPattern(client, acc) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} SupplyPattern2
|
|
||||||
* @property {BpsPercentRatioPattern} supplyInLossRelToCirculatingSupply
|
|
||||||
* @property {BpsPercentRatioPattern} supplyInLossRelToOwnSupply
|
|
||||||
* @property {BpsPercentRatioPattern} supplyInProfitRelToCirculatingSupply
|
|
||||||
* @property {BpsPercentRatioPattern} supplyInProfitRelToOwnSupply
|
|
||||||
* @property {BpsPercentRatioPattern} supplyRelToCirculatingSupply
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a SupplyPattern2 pattern node
|
|
||||||
* @param {BrkClientBase} client
|
|
||||||
* @param {string} acc - Accumulated metric name
|
|
||||||
* @returns {SupplyPattern2}
|
|
||||||
*/
|
|
||||||
function createSupplyPattern2(client, acc) {
|
|
||||||
return {
|
|
||||||
supplyInLossRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'in_loss_rel_to_circulating_supply')),
|
|
||||||
supplyInLossRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'in_loss_rel_to_own_supply')),
|
|
||||||
supplyInProfitRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'in_profit_rel_to_circulating_supply')),
|
|
||||||
supplyInProfitRelToOwnSupply: createBpsPercentRatioPattern(client, _m(acc, 'in_profit_rel_to_own_supply')),
|
|
||||||
supplyRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template T
|
* @template T
|
||||||
* @typedef {Object} _1m1w1y24hHeightPattern
|
* @typedef {Object} _1m1w1y24hHeightPattern
|
||||||
@@ -2937,29 +2937,6 @@ function createBtcCentsSatsUsdPattern(client, acc) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} CoinblocksCoindaysSentPattern
|
|
||||||
* @property {CumulativeHeightPattern<StoredF64>} coinblocksDestroyed
|
|
||||||
* @property {CumulativeHeightSumPattern<StoredF64>} coindaysDestroyed
|
|
||||||
* @property {BaseCumulativePattern} sent
|
|
||||||
* @property {_2wPattern} sentEma
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a CoinblocksCoindaysSentPattern pattern node
|
|
||||||
* @param {BrkClientBase} client
|
|
||||||
* @param {string} acc - Accumulated metric name
|
|
||||||
* @returns {CoinblocksCoindaysSentPattern}
|
|
||||||
*/
|
|
||||||
function createCoinblocksCoindaysSentPattern(client, acc) {
|
|
||||||
return {
|
|
||||||
coinblocksDestroyed: createCumulativeHeightPattern(client, _m(acc, 'coinblocks_destroyed')),
|
|
||||||
coindaysDestroyed: createCumulativeHeightSumPattern(client, _m(acc, 'coindays_destroyed')),
|
|
||||||
sent: createBaseCumulativePattern(client, _m(acc, 'sent')),
|
|
||||||
sentEma: create_2wPattern(client, _m(acc, 'sent_ema_2w')),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} InvestedMaxMinPercentilesPattern
|
* @typedef {Object} InvestedMaxMinPercentilesPattern
|
||||||
* @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital
|
* @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} investedCapital
|
||||||
@@ -3157,6 +3134,27 @@ function createChangeHalvedTotalPattern(client, acc) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} SupplyPattern2
|
||||||
|
* @property {BpsPercentRatioPattern} supplyInLossRelToCirculatingSupply
|
||||||
|
* @property {BpsPercentRatioPattern} supplyInProfitRelToCirculatingSupply
|
||||||
|
* @property {BpsPercentRatioPattern} supplyRelToCirculatingSupply
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a SupplyPattern2 pattern node
|
||||||
|
* @param {BrkClientBase} client
|
||||||
|
* @param {string} acc - Accumulated metric name
|
||||||
|
* @returns {SupplyPattern2}
|
||||||
|
*/
|
||||||
|
function createSupplyPattern2(client, acc) {
|
||||||
|
return {
|
||||||
|
supplyInLossRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'in_loss_rel_to_circulating_supply')),
|
||||||
|
supplyInProfitRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'in_profit_rel_to_circulating_supply')),
|
||||||
|
supplyRelToCirculatingSupply: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply')),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template T
|
* @template T
|
||||||
* @typedef {Object} _1m1w1yPattern
|
* @typedef {Object} _1m1w1yPattern
|
||||||
@@ -3399,8 +3397,8 @@ function createSdSmaPattern(client, acc) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} SentPattern
|
* @typedef {Object} SentPattern
|
||||||
* @property {BaseCumulativePattern} sent
|
* @property {MetricPattern1<Sats>} sent
|
||||||
* @property {_2wPattern} sentEma
|
* @property {_24hPattern<Sats>} sentSum
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3411,8 +3409,8 @@ function createSdSmaPattern(client, acc) {
|
|||||||
*/
|
*/
|
||||||
function createSentPattern(client, acc) {
|
function createSentPattern(client, acc) {
|
||||||
return {
|
return {
|
||||||
sent: createBaseCumulativePattern(client, acc),
|
sent: createMetricPattern1(client, acc),
|
||||||
sentEma: create_2wPattern(client, _m(acc, 'ema_2w')),
|
sentSum: create_24hPattern(client, _m(acc, '24h')),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3475,23 +3473,6 @@ function createCumulativeHeightPattern(client, acc) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {Object} _2wPattern
|
|
||||||
* @property {BtcCentsSatsUsdPattern} _2w
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a _2wPattern pattern node
|
|
||||||
* @param {BrkClientBase} client
|
|
||||||
* @param {string} acc - Accumulated metric name
|
|
||||||
* @returns {_2wPattern}
|
|
||||||
*/
|
|
||||||
function create_2wPattern(client, acc) {
|
|
||||||
return {
|
|
||||||
_2w: createBtcCentsSatsUsdPattern(client, acc),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template T
|
* @template T
|
||||||
* @typedef {Object} _24hPattern
|
* @typedef {Object} _24hPattern
|
||||||
@@ -4803,12 +4784,12 @@ function create_24hPattern(client, acc) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All_Relative
|
* @typedef {Object} MetricsTree_Distribution_UtxoCohorts_All_Relative
|
||||||
|
* @property {BpsPercentRatioPattern} supplyInProfitRelToOwnSupply
|
||||||
|
* @property {BpsPercentRatioPattern} supplyInLossRelToOwnSupply
|
||||||
* @property {BpsPercentRatioPattern} unrealizedProfitRelToMarketCap
|
* @property {BpsPercentRatioPattern} unrealizedProfitRelToMarketCap
|
||||||
* @property {BpsPercentRatioPattern} unrealizedLossRelToMarketCap
|
* @property {BpsPercentRatioPattern} unrealizedLossRelToMarketCap
|
||||||
* @property {BpsPercentRatioPattern} netUnrealizedPnlRelToMarketCap
|
* @property {BpsPercentRatioPattern} netUnrealizedPnlRelToMarketCap
|
||||||
* @property {MetricPattern1<StoredF32>} nupl
|
* @property {MetricPattern1<StoredF32>} nupl
|
||||||
* @property {BpsPercentRatioPattern} supplyInProfitRelToOwnSupply
|
|
||||||
* @property {BpsPercentRatioPattern} supplyInLossRelToOwnSupply
|
|
||||||
* @property {BpsPercentRatioPattern} unrealizedProfitRelToOwnGrossPnl
|
* @property {BpsPercentRatioPattern} unrealizedProfitRelToOwnGrossPnl
|
||||||
* @property {BpsPercentRatioPattern} unrealizedLossRelToOwnGrossPnl
|
* @property {BpsPercentRatioPattern} unrealizedLossRelToOwnGrossPnl
|
||||||
* @property {BpsPercentRatioPattern} netUnrealizedPnlRelToOwnGrossPnl
|
* @property {BpsPercentRatioPattern} netUnrealizedPnlRelToOwnGrossPnl
|
||||||
@@ -7014,12 +6995,12 @@ class BrkClient extends BrkClientBase {
|
|||||||
adjustedSoprEma: create_1m1wPattern(this, 'adjusted_sopr_24h_ema'),
|
adjustedSoprEma: create_1m1wPattern(this, 'adjusted_sopr_24h_ema'),
|
||||||
},
|
},
|
||||||
relative: {
|
relative: {
|
||||||
|
supplyInProfitRelToOwnSupply: createBpsPercentRatioPattern(this, 'supply_in_profit_rel_to_own_supply'),
|
||||||
|
supplyInLossRelToOwnSupply: createBpsPercentRatioPattern(this, 'supply_in_loss_rel_to_own_supply'),
|
||||||
unrealizedProfitRelToMarketCap: createBpsPercentRatioPattern(this, 'unrealized_profit_rel_to_market_cap'),
|
unrealizedProfitRelToMarketCap: createBpsPercentRatioPattern(this, 'unrealized_profit_rel_to_market_cap'),
|
||||||
unrealizedLossRelToMarketCap: createBpsPercentRatioPattern(this, 'unrealized_loss_rel_to_market_cap'),
|
unrealizedLossRelToMarketCap: createBpsPercentRatioPattern(this, 'unrealized_loss_rel_to_market_cap'),
|
||||||
netUnrealizedPnlRelToMarketCap: createBpsPercentRatioPattern(this, 'net_unrealized_pnl_rel_to_market_cap'),
|
netUnrealizedPnlRelToMarketCap: createBpsPercentRatioPattern(this, 'net_unrealized_pnl_rel_to_market_cap'),
|
||||||
nupl: createMetricPattern1(this, 'nupl'),
|
nupl: createMetricPattern1(this, 'nupl'),
|
||||||
supplyInProfitRelToOwnSupply: createBpsPercentRatioPattern(this, 'supply_in_profit_rel_to_own_supply'),
|
|
||||||
supplyInLossRelToOwnSupply: createBpsPercentRatioPattern(this, 'supply_in_loss_rel_to_own_supply'),
|
|
||||||
unrealizedProfitRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'unrealized_profit_rel_to_own_gross_pnl'),
|
unrealizedProfitRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'unrealized_profit_rel_to_own_gross_pnl'),
|
||||||
unrealizedLossRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'unrealized_loss_rel_to_own_gross_pnl'),
|
unrealizedLossRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'unrealized_loss_rel_to_own_gross_pnl'),
|
||||||
netUnrealizedPnlRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'net_unrealized_pnl_rel_to_own_gross_pnl'),
|
netUnrealizedPnlRelToOwnGrossPnl: createBpsPercentRatioPattern(this, 'net_unrealized_pnl_rel_to_own_gross_pnl'),
|
||||||
|
|||||||
@@ -2607,6 +2607,17 @@ class BaseBtcCentsSatsUsdPattern:
|
|||||||
self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'rewards_cumulative'))
|
self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'rewards_cumulative'))
|
||||||
self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'rewards_cumulative_usd'))
|
self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'rewards_cumulative_usd'))
|
||||||
|
|
||||||
|
class CoinblocksCoindaysSentPattern:
|
||||||
|
"""Pattern struct for repeated tree structure."""
|
||||||
|
|
||||||
|
def __init__(self, client: BrkClientBase, acc: str):
|
||||||
|
"""Create pattern node with accumulated metric name."""
|
||||||
|
self.coinblocks_destroyed: CumulativeHeightPattern[StoredF64] = CumulativeHeightPattern(client, _m(acc, 'coinblocks_destroyed'))
|
||||||
|
self.coindays_destroyed: CumulativeHeightSumPattern[StoredF64] = CumulativeHeightSumPattern(client, _m(acc, 'coindays_destroyed'))
|
||||||
|
self.sent: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sent'))
|
||||||
|
self.sent_sum: _24hPattern[Sats] = _24hPattern(client, _m(acc, 'sent_24h'))
|
||||||
|
self.sent_sum_extended: _1m1w1yPattern[Sats] = _1m1w1yPattern(client, _m(acc, 'sent'))
|
||||||
|
|
||||||
class EmaHistogramLineSignalPattern:
|
class EmaHistogramLineSignalPattern:
|
||||||
"""Pattern struct for repeated tree structure."""
|
"""Pattern struct for repeated tree structure."""
|
||||||
|
|
||||||
@@ -2618,17 +2629,6 @@ class EmaHistogramLineSignalPattern:
|
|||||||
self.line: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'line_24h'))
|
self.line: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'line_24h'))
|
||||||
self.signal: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'signal_24h'))
|
self.signal: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'signal_24h'))
|
||||||
|
|
||||||
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_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'in_loss_rel_to_circulating_supply'))
|
|
||||||
self.supply_in_loss_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'in_loss_rel_to_own_supply'))
|
|
||||||
self.supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'in_profit_rel_to_circulating_supply'))
|
|
||||||
self.supply_in_profit_rel_to_own_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'in_profit_rel_to_own_supply'))
|
|
||||||
self.supply_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply'))
|
|
||||||
|
|
||||||
class _1m1w1y24hHeightPattern(Generic[T]):
|
class _1m1w1y24hHeightPattern(Generic[T]):
|
||||||
"""Pattern struct for repeated tree structure."""
|
"""Pattern struct for repeated tree structure."""
|
||||||
|
|
||||||
@@ -2690,16 +2690,6 @@ class BtcCentsSatsUsdPattern:
|
|||||||
self.sats: MetricPattern1[Sats] = MetricPattern1(client, acc)
|
self.sats: MetricPattern1[Sats] = MetricPattern1(client, acc)
|
||||||
self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd'))
|
self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd'))
|
||||||
|
|
||||||
class CoinblocksCoindaysSentPattern:
|
|
||||||
"""Pattern struct for repeated tree structure."""
|
|
||||||
|
|
||||||
def __init__(self, client: BrkClientBase, acc: str):
|
|
||||||
"""Create pattern node with accumulated metric name."""
|
|
||||||
self.coinblocks_destroyed: CumulativeHeightPattern[StoredF64] = CumulativeHeightPattern(client, _m(acc, 'coinblocks_destroyed'))
|
|
||||||
self.coindays_destroyed: CumulativeHeightSumPattern[StoredF64] = CumulativeHeightSumPattern(client, _m(acc, 'coindays_destroyed'))
|
|
||||||
self.sent: BaseCumulativePattern = BaseCumulativePattern(client, _m(acc, 'sent'))
|
|
||||||
self.sent_ema: _2wPattern = _2wPattern(client, _m(acc, 'sent_ema_2w'))
|
|
||||||
|
|
||||||
class InvestedMaxMinPercentilesPattern:
|
class InvestedMaxMinPercentilesPattern:
|
||||||
"""Pattern struct for repeated tree structure."""
|
"""Pattern struct for repeated tree structure."""
|
||||||
|
|
||||||
@@ -2784,6 +2774,15 @@ class ChangeHalvedTotalPattern:
|
|||||||
self.halved: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'halved'))
|
self.halved: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'halved'))
|
||||||
self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc)
|
self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc)
|
||||||
|
|
||||||
|
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_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'in_loss_rel_to_circulating_supply'))
|
||||||
|
self.supply_in_profit_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'in_profit_rel_to_circulating_supply'))
|
||||||
|
self.supply_rel_to_circulating_supply: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_circulating_supply'))
|
||||||
|
|
||||||
class _1m1w1yPattern(Generic[T]):
|
class _1m1w1yPattern(Generic[T]):
|
||||||
"""Pattern struct for repeated tree structure."""
|
"""Pattern struct for repeated tree structure."""
|
||||||
|
|
||||||
@@ -2888,8 +2887,8 @@ class SentPattern:
|
|||||||
|
|
||||||
def __init__(self, client: BrkClientBase, acc: str):
|
def __init__(self, client: BrkClientBase, acc: str):
|
||||||
"""Create pattern node with accumulated metric name."""
|
"""Create pattern node with accumulated metric name."""
|
||||||
self.sent: BaseCumulativePattern = BaseCumulativePattern(client, acc)
|
self.sent: MetricPattern1[Sats] = MetricPattern1(client, acc)
|
||||||
self.sent_ema: _2wPattern = _2wPattern(client, _m(acc, 'ema_2w'))
|
self.sent_sum: _24hPattern[Sats] = _24hPattern(client, _m(acc, '24h'))
|
||||||
|
|
||||||
class SupplyPattern:
|
class SupplyPattern:
|
||||||
"""Pattern struct for repeated tree structure."""
|
"""Pattern struct for repeated tree structure."""
|
||||||
@@ -2915,13 +2914,6 @@ class CumulativeHeightPattern(Generic[T]):
|
|||||||
self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative'))
|
self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative'))
|
||||||
self.height: MetricPattern18[T] = MetricPattern18(client, acc)
|
self.height: MetricPattern18[T] = MetricPattern18(client, acc)
|
||||||
|
|
||||||
class _2wPattern:
|
|
||||||
"""Pattern struct for repeated tree structure."""
|
|
||||||
|
|
||||||
def __init__(self, client: BrkClientBase, acc: str):
|
|
||||||
"""Create pattern node with accumulated metric name."""
|
|
||||||
self._2w: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc)
|
|
||||||
|
|
||||||
class _24hPattern(Generic[T]):
|
class _24hPattern(Generic[T]):
|
||||||
"""Pattern struct for repeated tree structure."""
|
"""Pattern struct for repeated tree structure."""
|
||||||
|
|
||||||
@@ -4262,12 +4254,12 @@ class MetricsTree_Distribution_UtxoCohorts_All_Relative:
|
|||||||
"""Metrics tree node."""
|
"""Metrics tree node."""
|
||||||
|
|
||||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||||
|
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_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.unrealized_loss_rel_to_market_cap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, '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.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.nupl: MetricPattern1[StoredF32] = MetricPattern1(client, 'nupl')
|
||||||
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_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_profit_rel_to_own_gross_pnl')
|
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.unrealized_loss_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'unrealized_loss_rel_to_own_gross_pnl')
|
||||||
self.net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'net_unrealized_pnl_rel_to_own_gross_pnl')
|
self.net_unrealized_pnl_rel_to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'net_unrealized_pnl_rel_to_own_gross_pnl')
|
||||||
|
|||||||
Reference in New Issue
Block a user