mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.blocks_before_next.height.compute_transform(
|
||||
self.blocks_to_retarget.height.compute_transform(
|
||||
starting_indexes.height,
|
||||
&indexes.height.identity,
|
||||
|(h, ..)| (h, StoredU32::from(h.left_before_next_diff_adj())),
|
||||
|
||||
@@ -20,25 +20,25 @@ impl Vecs {
|
||||
) -> Result<Self> {
|
||||
let v2 = Version::TWO;
|
||||
|
||||
let as_hash = LazyPerBlock::from_height_source::<DifficultyToHashF64>(
|
||||
"difficulty_as_hash",
|
||||
let hashrate = LazyPerBlock::from_height_source::<DifficultyToHashF64>(
|
||||
"difficulty_hashrate",
|
||||
version,
|
||||
indexer.vecs.blocks.difficulty.read_only_boxed_clone(),
|
||||
indexes,
|
||||
);
|
||||
|
||||
let blocks_before_next = PerBlock::forced_import(
|
||||
let blocks_to_retarget = PerBlock::forced_import(
|
||||
db,
|
||||
"blocks_before_next_difficulty_adjustment",
|
||||
"blocks_to_retarget",
|
||||
version + v2,
|
||||
indexes,
|
||||
)?;
|
||||
|
||||
let days_before_next = LazyPerBlock::from_computed::<BlocksToDaysF32>(
|
||||
"days_before_next_difficulty_adjustment",
|
||||
let days_to_retarget = LazyPerBlock::from_computed::<BlocksToDaysF32>(
|
||||
"days_to_retarget",
|
||||
version + v2,
|
||||
blocks_before_next.height.read_only_boxed_clone(),
|
||||
&blocks_before_next,
|
||||
blocks_to_retarget.height.read_only_boxed_clone(),
|
||||
&blocks_to_retarget,
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
@@ -48,7 +48,7 @@ impl Vecs {
|
||||
version,
|
||||
indexes,
|
||||
),
|
||||
as_hash,
|
||||
hashrate,
|
||||
adjustment: PercentPerBlock::forced_import(
|
||||
db,
|
||||
"difficulty_adjustment",
|
||||
@@ -56,8 +56,8 @@ impl Vecs {
|
||||
indexes,
|
||||
)?,
|
||||
epoch: PerBlock::forced_import(db, "difficulty_epoch", version, indexes)?,
|
||||
blocks_before_next,
|
||||
days_before_next,
|
||||
blocks_to_retarget,
|
||||
days_to_retarget,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ use crate::internal::{LazyPerBlock, PerBlock, Resolutions, PercentPerBlock};
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub value: Resolutions<StoredF64>,
|
||||
pub as_hash: LazyPerBlock<StoredF64>,
|
||||
pub hashrate: LazyPerBlock<StoredF64>,
|
||||
pub adjustment: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
pub epoch: PerBlock<Epoch, M>,
|
||||
pub blocks_before_next: PerBlock<StoredU32, M>,
|
||||
pub days_before_next: LazyPerBlock<StoredF32, StoredU32>,
|
||||
pub blocks_to_retarget: PerBlock<StoredU32, M>,
|
||||
pub days_to_retarget: LazyPerBlock<StoredF32, StoredU32>,
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.blocks_before_next.height.compute_transform(
|
||||
self.blocks_to_halving.height.compute_transform(
|
||||
starting_indexes.height,
|
||||
&indexes.height.identity,
|
||||
|(h, ..)| (h, StoredU32::from(h.left_before_next_halving())),
|
||||
|
||||
@@ -16,21 +16,21 @@ impl Vecs {
|
||||
) -> Result<Self> {
|
||||
let v2 = Version::TWO;
|
||||
|
||||
let blocks_before_next = PerBlock::forced_import(
|
||||
db, "blocks_before_next_halving", version + v2, indexes,
|
||||
let blocks_to_halving = PerBlock::forced_import(
|
||||
db, "blocks_to_halving", version + v2, indexes,
|
||||
)?;
|
||||
|
||||
let days_before_next = LazyPerBlock::from_computed::<BlocksToDaysF32>(
|
||||
"days_before_next_halving",
|
||||
let days_to_halving = LazyPerBlock::from_computed::<BlocksToDaysF32>(
|
||||
"days_to_halving",
|
||||
version + v2,
|
||||
blocks_before_next.height.read_only_boxed_clone(),
|
||||
&blocks_before_next,
|
||||
blocks_to_halving.height.read_only_boxed_clone(),
|
||||
&blocks_to_halving,
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
epoch: PerBlock::forced_import(db, "halving_epoch", version, indexes)?,
|
||||
blocks_before_next,
|
||||
days_before_next,
|
||||
blocks_to_halving,
|
||||
days_to_halving,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ use crate::internal::{LazyPerBlock, PerBlock};
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub epoch: PerBlock<Halving, M>,
|
||||
pub blocks_before_next: PerBlock<StoredU32, M>,
|
||||
pub days_before_next: LazyPerBlock<StoredF32, StoredU32>,
|
||||
pub blocks_to_halving: PerBlock<StoredU32, M>,
|
||||
pub days_to_halving: LazyPerBlock<StoredF32, StoredU32>,
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ impl Vecs {
|
||||
)?,
|
||||
liveliness,
|
||||
vaultedness,
|
||||
ratio: PerBlock::forced_import(db, "activity_to_vaultedness_ratio", version, indexes)?,
|
||||
ratio: PerBlock::forced_import(db, "activity_to_vaultedness", version, indexes)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,5 +15,6 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub terminal: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub delta: PriceWithRatioExtendedPerBlock<M>,
|
||||
|
||||
#[traversable(hidden)]
|
||||
pub cumulative_market_cap: PerBlock<Dollars, M>,
|
||||
}
|
||||
|
||||
@@ -113,39 +113,39 @@ impl ActivityCountVecs {
|
||||
|
||||
pub(crate) fn min_stateful_len(&self) -> usize {
|
||||
self.reactivated
|
||||
.height
|
||||
.base
|
||||
.len()
|
||||
.min(self.sending.height.len())
|
||||
.min(self.receiving.height.len())
|
||||
.min(self.both.height.len())
|
||||
.min(self.sending.base.len())
|
||||
.min(self.receiving.base.len())
|
||||
.min(self.both.base.len())
|
||||
}
|
||||
|
||||
pub(crate) fn par_iter_height_mut(
|
||||
&mut self,
|
||||
) -> impl ParallelIterator<Item = &mut dyn AnyStoredVec> {
|
||||
[
|
||||
&mut self.reactivated.height as &mut dyn AnyStoredVec,
|
||||
&mut self.sending.height as &mut dyn AnyStoredVec,
|
||||
&mut self.receiving.height as &mut dyn AnyStoredVec,
|
||||
&mut self.both.height as &mut dyn AnyStoredVec,
|
||||
&mut self.reactivated.base as &mut dyn AnyStoredVec,
|
||||
&mut self.sending.base as &mut dyn AnyStoredVec,
|
||||
&mut self.receiving.base as &mut dyn AnyStoredVec,
|
||||
&mut self.both.base as &mut dyn AnyStoredVec,
|
||||
]
|
||||
.into_par_iter()
|
||||
}
|
||||
|
||||
pub(crate) fn reset_height(&mut self) -> Result<()> {
|
||||
self.reactivated.height.reset()?;
|
||||
self.sending.height.reset()?;
|
||||
self.receiving.height.reset()?;
|
||||
self.both.height.reset()?;
|
||||
self.reactivated.base.reset()?;
|
||||
self.sending.base.reset()?;
|
||||
self.receiving.base.reset()?;
|
||||
self.both.base.reset()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn push_height(&mut self, counts: &BlockActivityCounts) {
|
||||
self.reactivated.height.push(counts.reactivated.into());
|
||||
self.sending.height.push(counts.sending.into());
|
||||
self.receiving.height.push(counts.receiving.into());
|
||||
self.both.height.push(counts.both.into());
|
||||
self.reactivated.base.push(counts.reactivated.into());
|
||||
self.sending.base.push(counts.sending.into());
|
||||
self.receiving.base.push(counts.receiving.into());
|
||||
self.both.base.push(counts.both.into());
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rest(
|
||||
@@ -206,10 +206,10 @@ impl AddressTypeToActivityCountVecs {
|
||||
) -> impl ParallelIterator<Item = &mut dyn AnyStoredVec> {
|
||||
let mut vecs: Vec<&mut dyn AnyStoredVec> = Vec::new();
|
||||
for type_vecs in self.0.values_mut() {
|
||||
vecs.push(&mut type_vecs.reactivated.height);
|
||||
vecs.push(&mut type_vecs.sending.height);
|
||||
vecs.push(&mut type_vecs.receiving.height);
|
||||
vecs.push(&mut type_vecs.both.height);
|
||||
vecs.push(&mut type_vecs.reactivated.base);
|
||||
vecs.push(&mut type_vecs.sending.base);
|
||||
vecs.push(&mut type_vecs.receiving.base);
|
||||
vecs.push(&mut type_vecs.both.base);
|
||||
}
|
||||
vecs.into_par_iter()
|
||||
}
|
||||
|
||||
@@ -11,33 +11,33 @@ use crate::{
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct ActivityCore<M: StorageMode = Rw> {
|
||||
pub sent: PerBlockCumulativeWithSums<Sats, Sats, M>,
|
||||
pub transfer_volume: PerBlockCumulativeWithSums<Sats, Sats, M>,
|
||||
pub coindays_destroyed: PerBlockCumulativeWithSums<StoredF64, StoredF64, M>,
|
||||
#[traversable(wrap = "sent", rename = "in_profit")]
|
||||
pub sent_in_profit: AmountPerBlockCumulativeWithSums<M>,
|
||||
#[traversable(wrap = "sent", rename = "in_loss")]
|
||||
pub sent_in_loss: AmountPerBlockCumulativeWithSums<M>,
|
||||
#[traversable(wrap = "transfer_volume", rename = "in_profit")]
|
||||
pub transfer_volume_in_profit: AmountPerBlockCumulativeWithSums<M>,
|
||||
#[traversable(wrap = "transfer_volume", rename = "in_loss")]
|
||||
pub transfer_volume_in_loss: AmountPerBlockCumulativeWithSums<M>,
|
||||
}
|
||||
|
||||
impl ActivityCore {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
let v1 = Version::ONE;
|
||||
Ok(Self {
|
||||
sent: cfg.import("sent", v1)?,
|
||||
transfer_volume: cfg.import("transfer_volume", v1)?,
|
||||
coindays_destroyed: cfg.import("coindays_destroyed", v1)?,
|
||||
sent_in_profit: cfg.import("sent_in_profit", v1)?,
|
||||
sent_in_loss: cfg.import("sent_in_loss", v1)?,
|
||||
transfer_volume_in_profit: cfg.import("transfer_volume_in_profit", v1)?,
|
||||
transfer_volume_in_loss: cfg.import("transfer_volume_in_loss", v1)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn min_len(&self) -> usize {
|
||||
self.sent
|
||||
self.transfer_volume
|
||||
.base
|
||||
.height
|
||||
.len()
|
||||
.min(self.coindays_destroyed.base.height.len())
|
||||
.min(self.sent_in_profit.base.sats.height.len())
|
||||
.min(self.sent_in_loss.base.sats.height.len())
|
||||
.min(self.transfer_volume_in_profit.base.sats.height.len())
|
||||
.min(self.transfer_volume_in_loss.base.sats.height.len())
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -45,16 +45,16 @@ impl ActivityCore {
|
||||
&mut self,
|
||||
state: &CohortState<impl RealizedOps, impl CostBasisOps>,
|
||||
) {
|
||||
self.sent.base.height.push(state.sent);
|
||||
self.transfer_volume.base.height.push(state.sent);
|
||||
self.coindays_destroyed.base.height.push(
|
||||
StoredF64::from(Bitcoin::from(state.satdays_destroyed)),
|
||||
);
|
||||
self.sent_in_profit
|
||||
self.transfer_volume_in_profit
|
||||
.base
|
||||
.sats
|
||||
.height
|
||||
.push(state.realized.sent_in_profit());
|
||||
self.sent_in_loss
|
||||
self.transfer_volume_in_loss
|
||||
.base
|
||||
.sats
|
||||
.height
|
||||
@@ -63,12 +63,12 @@ impl ActivityCore {
|
||||
|
||||
pub(crate) fn collect_vecs_mut(&mut self) -> Vec<&mut dyn AnyStoredVec> {
|
||||
vec![
|
||||
&mut self.sent.base.height as &mut dyn AnyStoredVec,
|
||||
&mut self.transfer_volume.base.height as &mut dyn AnyStoredVec,
|
||||
&mut self.coindays_destroyed.base.height,
|
||||
&mut self.sent_in_profit.base.sats.height,
|
||||
&mut self.sent_in_profit.base.cents.height,
|
||||
&mut self.sent_in_loss.base.sats.height,
|
||||
&mut self.sent_in_loss.base.cents.height,
|
||||
&mut self.transfer_volume_in_profit.base.sats.height,
|
||||
&mut self.transfer_volume_in_profit.base.cents.height,
|
||||
&mut self.transfer_volume_in_loss.base.sats.height,
|
||||
&mut self.transfer_volume_in_loss.base.cents.height,
|
||||
]
|
||||
}
|
||||
|
||||
@@ -82,18 +82,18 @@ impl ActivityCore {
|
||||
others: &[&Self],
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.sent.base.height.compute_sum_of_others(
|
||||
self.transfer_volume.base.height.compute_sum_of_others(
|
||||
starting_indexes.height,
|
||||
&others
|
||||
.iter()
|
||||
.map(|v| &v.sent.base.height)
|
||||
.map(|v| &v.transfer_volume.base.height)
|
||||
.collect::<Vec<_>>(),
|
||||
exit,
|
||||
)?;
|
||||
|
||||
sum_others!(self, starting_indexes, others, exit; coindays_destroyed.base.height);
|
||||
sum_others!(self, starting_indexes, others, exit; sent_in_profit.base.sats.height);
|
||||
sum_others!(self, starting_indexes, others, exit; sent_in_loss.base.sats.height);
|
||||
sum_others!(self, starting_indexes, others, exit; transfer_volume_in_profit.base.sats.height);
|
||||
sum_others!(self, starting_indexes, others, exit; transfer_volume_in_loss.base.sats.height);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -103,7 +103,7 @@ impl ActivityCore {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.sent
|
||||
self.transfer_volume
|
||||
.compute_rest(starting_indexes.height, exit)?;
|
||||
self.coindays_destroyed
|
||||
.compute_rest(starting_indexes.height, exit)?;
|
||||
@@ -116,9 +116,9 @@ impl ActivityCore {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.sent_in_profit
|
||||
self.transfer_volume_in_profit
|
||||
.compute_rest(starting_indexes.height, prices, exit)?;
|
||||
self.sent_in_loss
|
||||
self.transfer_volume_in_loss
|
||||
.compute_rest(starting_indexes.height, prices, exit)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ impl ActivityFull {
|
||||
self.dormancy.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&self.inner.coindays_destroyed.base.height,
|
||||
&self.inner.sent.base.height,
|
||||
&self.inner.transfer_volume.base.height,
|
||||
|(i, cdd, sent_sats, ..)| {
|
||||
let sent_btc = f64::from(Bitcoin::from(sent_sats));
|
||||
if sent_btc == 0.0 {
|
||||
|
||||
@@ -31,7 +31,7 @@ use super::RealizedCore;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct RealizedProfit<M: StorageMode = Rw> {
|
||||
pub rel_to_rcap: PercentPerBlock<BasisPoints32, M>,
|
||||
pub to_rcap: PercentPerBlock<BasisPoints32, M>,
|
||||
pub value_created: PerBlockCumulativeWithSums<Cents, Cents, M>,
|
||||
pub value_destroyed: PerBlockCumulativeWithSums<Cents, Cents, M>,
|
||||
pub distribution_flow: LazyPerBlock<Dollars, Cents>,
|
||||
@@ -39,7 +39,7 @@ pub struct RealizedProfit<M: StorageMode = Rw> {
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct RealizedLoss<M: StorageMode = Rw> {
|
||||
pub rel_to_rcap: PercentPerBlock<BasisPoints32, M>,
|
||||
pub to_rcap: PercentPerBlock<BasisPoints32, M>,
|
||||
pub value_created: PerBlockCumulativeWithSums<Cents, Cents, M>,
|
||||
pub value_destroyed: PerBlockCumulativeWithSums<Cents, Cents, M>,
|
||||
pub capitulation_flow: LazyPerBlock<Dollars, Cents>,
|
||||
@@ -47,11 +47,11 @@ pub struct RealizedLoss<M: StorageMode = Rw> {
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct RealizedNetPnl<M: StorageMode = Rw> {
|
||||
pub rel_to_rcap: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
#[traversable(wrap = "change_1m", rename = "rel_to_rcap")]
|
||||
pub change_1m_rel_to_rcap: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
#[traversable(wrap = "change_1m", rename = "rel_to_mcap")]
|
||||
pub change_1m_rel_to_mcap: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
pub to_rcap: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
#[traversable(wrap = "change_1m", rename = "to_rcap")]
|
||||
pub change_1m_to_rcap: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
#[traversable(wrap = "change_1m", rename = "to_mcap")]
|
||||
pub change_1m_to_mcap: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
}
|
||||
|
||||
#[derive(Traversable)]
|
||||
@@ -64,14 +64,14 @@ pub struct RealizedSopr<M: StorageMode = Rw> {
|
||||
pub struct RealizedPeakRegret<M: StorageMode = Rw> {
|
||||
#[traversable(flatten)]
|
||||
pub value: PerBlockCumulative<Cents, M>,
|
||||
pub rel_to_rcap: PercentPerBlock<BasisPoints32, M>,
|
||||
pub to_rcap: PercentPerBlock<BasisPoints32, M>,
|
||||
}
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct RealizedInvestor<M: StorageMode = Rw> {
|
||||
pub price: PriceWithRatioExtendedPerBlock<M>,
|
||||
pub lower_price_band: Price<PerBlock<Cents, M>>,
|
||||
pub upper_price_band: Price<PerBlock<Cents, M>>,
|
||||
pub investor_lower_band: Price<PerBlock<Cents, M>>,
|
||||
pub investor_upper_band: Price<PerBlock<Cents, M>>,
|
||||
#[traversable(hidden)]
|
||||
pub cap_raw: M::Stored<BytesVec<Height, CentsSquaredSats>>,
|
||||
}
|
||||
@@ -96,8 +96,8 @@ pub struct RealizedFull<M: StorageMode = Rw> {
|
||||
|
||||
#[traversable(hidden)]
|
||||
pub cap_raw: M::Stored<BytesVec<Height, CentsSats>>,
|
||||
#[traversable(wrap = "cap", rename = "rel_to_own_mcap")]
|
||||
pub cap_rel_to_own_mcap: PercentPerBlock<BasisPoints32, M>,
|
||||
#[traversable(wrap = "cap", rename = "to_own_mcap")]
|
||||
pub cap_to_own_mcap: PercentPerBlock<BasisPoints32, M>,
|
||||
|
||||
#[traversable(wrap = "price", rename = "percentiles")]
|
||||
pub price_ratio_percentiles: RatioPerBlockPercentiles<M>,
|
||||
@@ -124,7 +124,7 @@ impl RealizedFull {
|
||||
&profit_value_destroyed.base,
|
||||
);
|
||||
let profit = RealizedProfit {
|
||||
rel_to_rcap: cfg.import("realized_profit_rel_to_rcap", Version::new(2))?,
|
||||
to_rcap: cfg.import("realized_profit_to_rcap", Version::new(2))?,
|
||||
value_created: cfg.import("profit_value_created", v1)?,
|
||||
value_destroyed: profit_value_destroyed,
|
||||
distribution_flow: profit_flow,
|
||||
@@ -140,7 +140,7 @@ impl RealizedFull {
|
||||
&loss_value_destroyed.base,
|
||||
);
|
||||
let loss = RealizedLoss {
|
||||
rel_to_rcap: cfg.import("realized_loss_rel_to_rcap", Version::new(2))?,
|
||||
to_rcap: cfg.import("realized_loss_to_rcap", Version::new(2))?,
|
||||
value_created: cfg.import("loss_value_created", v1)?,
|
||||
value_destroyed: loss_value_destroyed,
|
||||
capitulation_flow,
|
||||
@@ -153,12 +153,12 @@ impl RealizedFull {
|
||||
|
||||
// Net PnL
|
||||
let net_pnl = RealizedNetPnl {
|
||||
rel_to_rcap: cfg
|
||||
.import("net_realized_pnl_rel_to_rcap", Version::new(2))?,
|
||||
change_1m_rel_to_rcap: cfg
|
||||
.import("net_pnl_change_1m_rel_to_rcap", Version::new(4))?,
|
||||
change_1m_rel_to_mcap: cfg
|
||||
.import("net_pnl_change_1m_rel_to_mcap", Version::new(4))?,
|
||||
to_rcap: cfg
|
||||
.import("net_realized_pnl_to_rcap", Version::new(2))?,
|
||||
change_1m_to_rcap: cfg
|
||||
.import("net_pnl_change_1m_to_rcap", Version::new(4))?,
|
||||
change_1m_to_mcap: cfg
|
||||
.import("net_pnl_change_1m_to_mcap", Version::new(4))?,
|
||||
};
|
||||
|
||||
// SOPR
|
||||
@@ -169,15 +169,15 @@ impl RealizedFull {
|
||||
// Peak regret
|
||||
let peak_regret = RealizedPeakRegret {
|
||||
value: cfg.import("realized_peak_regret", Version::new(2))?,
|
||||
rel_to_rcap: cfg
|
||||
.import("realized_peak_regret_rel_to_rcap", Version::new(2))?,
|
||||
to_rcap: cfg
|
||||
.import("realized_peak_regret_to_rcap", Version::new(2))?,
|
||||
};
|
||||
|
||||
// Investor
|
||||
let investor = RealizedInvestor {
|
||||
price: cfg.import("investor_price", v0)?,
|
||||
lower_price_band: cfg.import("lower_price_band", v0)?,
|
||||
upper_price_band: cfg.import("upper_price_band", v0)?,
|
||||
investor_lower_band: cfg.import("investor_lower_band", v0)?,
|
||||
investor_upper_band: cfg.import("investor_upper_band", v0)?,
|
||||
cap_raw: cfg.import("investor_cap_raw", v0)?,
|
||||
};
|
||||
|
||||
@@ -197,7 +197,7 @@ impl RealizedFull {
|
||||
investor,
|
||||
profit_to_loss_ratio: cfg.import("realized_profit_to_loss_ratio", v1)?,
|
||||
cap_raw: cfg.import("cap_raw", v0)?,
|
||||
cap_rel_to_own_mcap: cfg.import("realized_cap_rel_to_own_mcap", v1)?,
|
||||
cap_to_own_mcap: cfg.import("realized_cap_to_own_mcap", v1)?,
|
||||
price_ratio_percentiles: RatioPerBlockPercentiles::forced_import(
|
||||
cfg.db,
|
||||
&realized_price_name,
|
||||
@@ -403,7 +403,7 @@ impl RealizedFull {
|
||||
|
||||
// Profit/loss/net_pnl rel to realized cap
|
||||
self.profit
|
||||
.rel_to_rcap
|
||||
.to_rcap
|
||||
.compute_binary::<Cents, Cents, RatioCentsBp32>(
|
||||
starting_indexes.height,
|
||||
&self.core.minimal.profit.base.cents.height,
|
||||
@@ -411,7 +411,7 @@ impl RealizedFull {
|
||||
exit,
|
||||
)?;
|
||||
self.loss
|
||||
.rel_to_rcap
|
||||
.to_rcap
|
||||
.compute_binary::<Cents, Cents, RatioCentsBp32>(
|
||||
starting_indexes.height,
|
||||
&self.core.minimal.loss.base.cents.height,
|
||||
@@ -419,7 +419,7 @@ impl RealizedFull {
|
||||
exit,
|
||||
)?;
|
||||
self.net_pnl
|
||||
.rel_to_rcap
|
||||
.to_rcap
|
||||
.compute_binary::<CentsSigned, Cents, RatioCentsSignedCentsBps32>(
|
||||
starting_indexes.height,
|
||||
&self.core.net_pnl.base.cents.height,
|
||||
@@ -453,7 +453,7 @@ impl RealizedFull {
|
||||
|
||||
// Net PnL 1m change relative to rcap and mcap
|
||||
self.net_pnl
|
||||
.change_1m_rel_to_rcap
|
||||
.change_1m_to_rcap
|
||||
.compute_binary::<CentsSigned, Cents, RatioCentsSignedCentsBps32>(
|
||||
starting_indexes.height,
|
||||
&self.core.net_pnl.delta.absolute._1m.cents.height,
|
||||
@@ -461,7 +461,7 @@ impl RealizedFull {
|
||||
exit,
|
||||
)?;
|
||||
self.net_pnl
|
||||
.change_1m_rel_to_mcap
|
||||
.change_1m_to_mcap
|
||||
.compute_binary::<CentsSigned, Dollars, RatioCentsSignedDollarsBps32>(
|
||||
starting_indexes.height,
|
||||
&self.core.net_pnl.delta.absolute._1m.cents.height,
|
||||
@@ -471,7 +471,7 @@ impl RealizedFull {
|
||||
|
||||
// Peak regret rel to rcap
|
||||
self.peak_regret
|
||||
.rel_to_rcap
|
||||
.to_rcap
|
||||
.compute_binary::<Cents, Cents, RatioCentsBp32>(
|
||||
starting_indexes.height,
|
||||
&self.peak_regret.value.base.height,
|
||||
@@ -487,7 +487,7 @@ impl RealizedFull {
|
||||
)?;
|
||||
|
||||
self.investor
|
||||
.lower_price_band
|
||||
.investor_lower_band
|
||||
.cents
|
||||
.height
|
||||
.compute_transform2(
|
||||
@@ -507,7 +507,7 @@ impl RealizedFull {
|
||||
)?;
|
||||
|
||||
self.investor
|
||||
.upper_price_band
|
||||
.investor_upper_band
|
||||
.cents
|
||||
.height
|
||||
.compute_transform2(
|
||||
@@ -542,7 +542,7 @@ impl RealizedFull {
|
||||
}
|
||||
|
||||
// Realized cap relative to own market cap
|
||||
self.cap_rel_to_own_mcap
|
||||
self.cap_to_own_mcap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp32>(
|
||||
starting_indexes.height,
|
||||
&self.core.minimal.cap.usd.height,
|
||||
|
||||
@@ -10,12 +10,12 @@ use crate::distribution::metrics::{ImportConfig, UnrealizedCore};
|
||||
/// Extended relative metrics for own market cap (extended && rel_to_all).
|
||||
#[derive(Traversable)]
|
||||
pub struct RelativeExtendedOwnMarketCap<M: StorageMode = Rw> {
|
||||
#[traversable(wrap = "unrealized/profit", rename = "rel_to_own_mcap")]
|
||||
pub unrealized_profit_rel_to_own_mcap: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "unrealized/loss", rename = "rel_to_own_mcap")]
|
||||
pub unrealized_loss_rel_to_own_mcap: PercentPerBlock<BasisPoints32, M>,
|
||||
#[traversable(wrap = "unrealized/net_pnl", rename = "rel_to_own_mcap")]
|
||||
pub net_unrealized_pnl_rel_to_own_mcap: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
#[traversable(wrap = "unrealized/profit", rename = "to_own_mcap")]
|
||||
pub unrealized_profit_to_own_mcap: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "unrealized/loss", rename = "to_own_mcap")]
|
||||
pub unrealized_loss_to_own_mcap: PercentPerBlock<BasisPoints32, M>,
|
||||
#[traversable(wrap = "unrealized/net_pnl", rename = "to_own_mcap")]
|
||||
pub net_unrealized_pnl_to_own_mcap: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
}
|
||||
|
||||
impl RelativeExtendedOwnMarketCap {
|
||||
@@ -23,12 +23,12 @@ impl RelativeExtendedOwnMarketCap {
|
||||
let v2 = Version::new(2);
|
||||
|
||||
Ok(Self {
|
||||
unrealized_profit_rel_to_own_mcap: cfg
|
||||
.import("unrealized_profit_rel_to_own_mcap", v2)?,
|
||||
unrealized_loss_rel_to_own_mcap: cfg
|
||||
.import("unrealized_loss_rel_to_own_mcap", Version::new(3))?,
|
||||
net_unrealized_pnl_rel_to_own_mcap: cfg
|
||||
.import("net_unrealized_pnl_rel_to_own_mcap", Version::new(3))?,
|
||||
unrealized_profit_to_own_mcap: cfg
|
||||
.import("unrealized_profit_to_own_mcap", v2)?,
|
||||
unrealized_loss_to_own_mcap: cfg
|
||||
.import("unrealized_loss_to_own_mcap", Version::new(3))?,
|
||||
net_unrealized_pnl_to_own_mcap: cfg
|
||||
.import("net_unrealized_pnl_to_own_mcap", Version::new(3))?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -39,21 +39,21 @@ impl RelativeExtendedOwnMarketCap {
|
||||
own_market_cap: &impl ReadableVec<Height, Dollars>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.unrealized_profit_rel_to_own_mcap
|
||||
self.unrealized_profit_to_own_mcap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
&unrealized.profit.base.usd.height,
|
||||
own_market_cap,
|
||||
exit,
|
||||
)?;
|
||||
self.unrealized_loss_rel_to_own_mcap
|
||||
self.unrealized_loss_to_own_mcap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp32>(
|
||||
max_from,
|
||||
&unrealized.loss.base.usd.height,
|
||||
own_market_cap,
|
||||
exit,
|
||||
)?;
|
||||
self.net_unrealized_pnl_rel_to_own_mcap
|
||||
self.net_unrealized_pnl_to_own_mcap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBps32>(
|
||||
max_from,
|
||||
&unrealized.net_pnl.usd.height,
|
||||
|
||||
@@ -10,12 +10,12 @@ use crate::distribution::metrics::{ImportConfig, UnrealizedCore};
|
||||
/// Extended relative metrics for own total unrealized PnL (extended only).
|
||||
#[derive(Traversable)]
|
||||
pub struct RelativeExtendedOwnPnl<M: StorageMode = Rw> {
|
||||
#[traversable(wrap = "unrealized/profit", rename = "rel_to_own_gross")]
|
||||
pub unrealized_profit_rel_to_own_gross_pnl: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "unrealized/loss", rename = "rel_to_own_gross")]
|
||||
pub unrealized_loss_rel_to_own_gross_pnl: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "unrealized/net_pnl", rename = "rel_to_own_gross")]
|
||||
pub net_unrealized_pnl_rel_to_own_gross_pnl: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
#[traversable(wrap = "unrealized/profit", rename = "to_own_gross_pnl")]
|
||||
pub unrealized_profit_to_own_gross_pnl: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "unrealized/loss", rename = "to_own_gross_pnl")]
|
||||
pub unrealized_loss_to_own_gross_pnl: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "unrealized/net_pnl", rename = "to_own_gross_pnl")]
|
||||
pub net_unrealized_pnl_to_own_gross_pnl: PercentPerBlock<BasisPointsSigned32, M>,
|
||||
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ impl RelativeExtendedOwnPnl {
|
||||
let v1 = Version::ONE;
|
||||
|
||||
Ok(Self {
|
||||
unrealized_profit_rel_to_own_gross_pnl: cfg
|
||||
.import("unrealized_profit_rel_to_own_gross_pnl", v1)?,
|
||||
unrealized_loss_rel_to_own_gross_pnl: cfg
|
||||
.import("unrealized_loss_rel_to_own_gross_pnl", v1)?,
|
||||
net_unrealized_pnl_rel_to_own_gross_pnl: cfg
|
||||
.import("net_unrealized_pnl_rel_to_own_gross_pnl", Version::new(3))?,
|
||||
unrealized_profit_to_own_gross_pnl: cfg
|
||||
.import("unrealized_profit_to_own_gross_pnl", v1)?,
|
||||
unrealized_loss_to_own_gross_pnl: cfg
|
||||
.import("unrealized_loss_to_own_gross_pnl", v1)?,
|
||||
net_unrealized_pnl_to_own_gross_pnl: cfg
|
||||
.import("net_unrealized_pnl_to_own_gross_pnl", Version::new(3))?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -40,21 +40,21 @@ impl RelativeExtendedOwnPnl {
|
||||
gross_pnl_usd: &impl ReadableVec<Height, Dollars>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.unrealized_profit_rel_to_own_gross_pnl
|
||||
self.unrealized_profit_to_own_gross_pnl
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
&unrealized.profit.base.usd.height,
|
||||
gross_pnl_usd,
|
||||
exit,
|
||||
)?;
|
||||
self.unrealized_loss_rel_to_own_gross_pnl
|
||||
self.unrealized_loss_to_own_gross_pnl
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
&unrealized.loss.base.usd.height,
|
||||
gross_pnl_usd,
|
||||
exit,
|
||||
)?;
|
||||
self.net_unrealized_pnl_rel_to_own_gross_pnl
|
||||
self.net_unrealized_pnl_to_own_gross_pnl
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBps32>(
|
||||
max_from,
|
||||
&unrealized.net_pnl.usd.height,
|
||||
|
||||
@@ -11,15 +11,15 @@ use crate::{
|
||||
/// Full relative metrics (sth/lth/all tier).
|
||||
#[derive(Traversable)]
|
||||
pub struct RelativeFull<M: StorageMode = Rw> {
|
||||
#[traversable(wrap = "supply/in_profit", rename = "rel_to_own")]
|
||||
pub supply_in_profit_rel_to_own: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "supply/in_loss", rename = "rel_to_own")]
|
||||
pub supply_in_loss_rel_to_own: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "supply/in_profit", rename = "to_own")]
|
||||
pub supply_in_profit_to_own: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "supply/in_loss", rename = "to_own")]
|
||||
pub supply_in_loss_to_own: PercentPerBlock<BasisPoints16, M>,
|
||||
|
||||
#[traversable(wrap = "unrealized/profit", rename = "rel_to_mcap")]
|
||||
pub unrealized_profit_rel_to_mcap: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "unrealized/loss", rename = "rel_to_mcap")]
|
||||
pub unrealized_loss_rel_to_mcap: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "unrealized/profit", rename = "to_mcap")]
|
||||
pub unrealized_profit_to_mcap: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "unrealized/loss", rename = "to_mcap")]
|
||||
pub unrealized_loss_to_mcap: PercentPerBlock<BasisPoints16, M>,
|
||||
}
|
||||
|
||||
impl RelativeFull {
|
||||
@@ -28,13 +28,13 @@ impl RelativeFull {
|
||||
let v2 = Version::new(2);
|
||||
|
||||
Ok(Self {
|
||||
supply_in_profit_rel_to_own: cfg
|
||||
.import("supply_in_profit_rel_to_own", v1)?,
|
||||
supply_in_loss_rel_to_own: cfg.import("supply_in_loss_rel_to_own", v1)?,
|
||||
unrealized_profit_rel_to_mcap: cfg
|
||||
.import("unrealized_profit_rel_to_mcap", v2)?,
|
||||
unrealized_loss_rel_to_mcap: cfg
|
||||
.import("unrealized_loss_rel_to_mcap", v2)?,
|
||||
supply_in_profit_to_own: cfg
|
||||
.import("supply_in_profit_to_own", v1)?,
|
||||
supply_in_loss_to_own: cfg.import("supply_in_loss_to_own", v1)?,
|
||||
unrealized_profit_to_mcap: cfg
|
||||
.import("unrealized_profit_to_mcap", v2)?,
|
||||
unrealized_loss_to_mcap: cfg
|
||||
.import("unrealized_loss_to_mcap", v2)?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -46,14 +46,14 @@ impl RelativeFull {
|
||||
market_cap: &impl ReadableVec<Height, Dollars>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply_in_profit_rel_to_own
|
||||
self.supply_in_profit_to_own
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&supply.in_profit.sats.height,
|
||||
&supply.total.sats.height,
|
||||
exit,
|
||||
)?;
|
||||
self.supply_in_loss_rel_to_own
|
||||
self.supply_in_loss_to_own
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&supply.in_loss.sats.height,
|
||||
@@ -61,14 +61,14 @@ impl RelativeFull {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.unrealized_profit_rel_to_mcap
|
||||
self.unrealized_profit_to_mcap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
&unrealized.profit.base.usd.height,
|
||||
market_cap,
|
||||
exit,
|
||||
)?;
|
||||
self.unrealized_loss_rel_to_mcap
|
||||
self.unrealized_loss_to_mcap
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp16>(
|
||||
max_from,
|
||||
&unrealized.loss.base.usd.height,
|
||||
|
||||
@@ -10,23 +10,23 @@ use crate::distribution::metrics::{ImportConfig, SupplyCore};
|
||||
/// Relative-to-all metrics (not present for the "all" cohort itself).
|
||||
#[derive(Traversable)]
|
||||
pub struct RelativeToAll<M: StorageMode = Rw> {
|
||||
#[traversable(wrap = "supply", rename = "rel_to_circulating")]
|
||||
pub supply_rel_to_circulating: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "supply/in_profit", rename = "rel_to_circulating")]
|
||||
pub supply_in_profit_rel_to_circulating: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "supply/in_loss", rename = "rel_to_circulating")]
|
||||
pub supply_in_loss_rel_to_circulating: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "supply", rename = "to_circulating")]
|
||||
pub supply_to_circulating: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "supply/in_profit", rename = "to_circulating")]
|
||||
pub supply_in_profit_to_circulating: PercentPerBlock<BasisPoints16, M>,
|
||||
#[traversable(wrap = "supply/in_loss", rename = "to_circulating")]
|
||||
pub supply_in_loss_to_circulating: PercentPerBlock<BasisPoints16, M>,
|
||||
}
|
||||
|
||||
impl RelativeToAll {
|
||||
pub(crate) fn forced_import(cfg: &ImportConfig) -> Result<Self> {
|
||||
Ok(Self {
|
||||
supply_rel_to_circulating: cfg
|
||||
.import("supply_rel_to_circulating", Version::ONE)?,
|
||||
supply_in_profit_rel_to_circulating: cfg
|
||||
.import("supply_in_profit_rel_to_circulating", Version::ONE)?,
|
||||
supply_in_loss_rel_to_circulating: cfg
|
||||
.import("supply_in_loss_rel_to_circulating", Version::ONE)?,
|
||||
supply_to_circulating: cfg
|
||||
.import("supply_to_circulating", Version::ONE)?,
|
||||
supply_in_profit_to_circulating: cfg
|
||||
.import("supply_in_profit_to_circulating", Version::ONE)?,
|
||||
supply_in_loss_to_circulating: cfg
|
||||
.import("supply_in_loss_to_circulating", Version::ONE)?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -37,21 +37,21 @@ impl RelativeToAll {
|
||||
all_supply_sats: &impl ReadableVec<Height, Sats>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.supply_rel_to_circulating
|
||||
self.supply_to_circulating
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&supply.total.sats.height,
|
||||
all_supply_sats,
|
||||
exit,
|
||||
)?;
|
||||
self.supply_in_profit_rel_to_circulating
|
||||
self.supply_in_profit_to_circulating
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&supply.in_profit.sats.height,
|
||||
all_supply_sats,
|
||||
exit,
|
||||
)?;
|
||||
self.supply_in_loss_rel_to_circulating
|
||||
self.supply_in_loss_to_circulating
|
||||
.compute_binary::<Sats, Sats, RatioSatsBp16>(
|
||||
max_from,
|
||||
&supply.in_loss.sats.height,
|
||||
|
||||
@@ -69,7 +69,7 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub utxo_cohorts: UTXOCohorts<M>,
|
||||
#[traversable(wrap = "cohorts", rename = "address")]
|
||||
pub address_cohorts: AddressCohorts<M>,
|
||||
#[traversable(wrap = "cointime")]
|
||||
#[traversable(wrap = "cointime/activity")]
|
||||
pub coinblocks_destroyed: PerBlockCumulativeWithSums<StoredF64, StoredF64, M>,
|
||||
pub addresses: AddressMetricsVecs<M>,
|
||||
|
||||
|
||||
@@ -69,12 +69,12 @@ impl Vecs {
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp32>(
|
||||
starting_indexes.height,
|
||||
market_cap,
|
||||
&transactions.volume.sent_sum.sum._24h.usd.height,
|
||||
&transactions.volume.transfer_volume.sum._24h.usd.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
// Thermocap Multiple: market_cap / thermo_cap
|
||||
self.thermocap_multiple
|
||||
self.thermo_cap_multiple
|
||||
.bps
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp32>(
|
||||
starting_indexes.height,
|
||||
@@ -178,7 +178,7 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
// Seller Exhaustion Constant: % supply_in_profit × 30d_volatility
|
||||
self.seller_exhaustion_constant
|
||||
self.seller_exhaustion
|
||||
.height
|
||||
.compute_transform3(
|
||||
starting_indexes.height,
|
||||
|
||||
@@ -24,8 +24,8 @@ impl Vecs {
|
||||
let nvt = RatioPerBlock::forced_import_raw(&db, "nvt", v, indexes)?;
|
||||
let gini = PercentPerBlock::forced_import(&db, "gini", v, indexes)?;
|
||||
let rhodl_ratio = RatioPerBlock::forced_import_raw(&db, "rhodl_ratio", v, indexes)?;
|
||||
let thermocap_multiple =
|
||||
RatioPerBlock::forced_import_raw(&db, "thermocap_multiple", v, indexes)?;
|
||||
let thermo_cap_multiple =
|
||||
RatioPerBlock::forced_import_raw(&db, "thermo_cap_multiple", v, indexes)?;
|
||||
let coindays_destroyed_supply_adjusted =
|
||||
PerBlock::forced_import(&db, "coindays_destroyed_supply_adjusted", v, indexes)?;
|
||||
let coinyears_destroyed_supply_adjusted =
|
||||
@@ -35,8 +35,8 @@ impl Vecs {
|
||||
flow: PerBlock::forced_import(&db, "dormancy_flow", v, indexes)?,
|
||||
};
|
||||
let stock_to_flow = PerBlock::forced_import(&db, "stock_to_flow", v, indexes)?;
|
||||
let seller_exhaustion_constant =
|
||||
PerBlock::forced_import(&db, "seller_exhaustion_constant", v, indexes)?;
|
||||
let seller_exhaustion =
|
||||
PerBlock::forced_import(&db, "seller_exhaustion", v, indexes)?;
|
||||
|
||||
let this = Self {
|
||||
db,
|
||||
@@ -44,12 +44,12 @@ impl Vecs {
|
||||
nvt,
|
||||
gini,
|
||||
rhodl_ratio,
|
||||
thermocap_multiple,
|
||||
thermo_cap_multiple,
|
||||
coindays_destroyed_supply_adjusted,
|
||||
coinyears_destroyed_supply_adjusted,
|
||||
dormancy,
|
||||
stock_to_flow,
|
||||
seller_exhaustion_constant,
|
||||
seller_exhaustion,
|
||||
};
|
||||
finalize_db(&this.db, &this)?;
|
||||
Ok(this)
|
||||
|
||||
@@ -18,10 +18,10 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub nvt: RatioPerBlock<BasisPoints32, M>,
|
||||
pub gini: PercentPerBlock<BasisPoints16, M>,
|
||||
pub rhodl_ratio: RatioPerBlock<BasisPoints32, M>,
|
||||
pub thermocap_multiple: RatioPerBlock<BasisPoints32, M>,
|
||||
pub thermo_cap_multiple: RatioPerBlock<BasisPoints32, M>,
|
||||
pub coindays_destroyed_supply_adjusted: PerBlock<StoredF32, M>,
|
||||
pub coinyears_destroyed_supply_adjusted: PerBlock<StoredF32, M>,
|
||||
pub dormancy: DormancyVecs<M>,
|
||||
pub stock_to_flow: PerBlock<StoredF32, M>,
|
||||
pub seller_exhaustion_constant: PerBlock<StoredF32, M>,
|
||||
pub seller_exhaustion: PerBlock<StoredF32, M>,
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ use crate::internal::{ComputedVecValue, algo::compute_aggregations};
|
||||
|
||||
use super::Distribution;
|
||||
|
||||
/// Full stats aggregate: distribution + sum + cumulative
|
||||
/// Full stats aggregate: sum + cumulative + distribution
|
||||
#[derive(Traversable)]
|
||||
pub struct DistributionFull<I: VecIndex, T: ComputedVecValue + JsonSchema, M: StorageMode = Rw> {
|
||||
#[traversable(flatten)]
|
||||
pub distribution: Distribution<I, T, M>,
|
||||
pub sum: M::Stored<EagerVec<PcoVec<I, T>>>,
|
||||
pub cumulative: M::Stored<EagerVec<PcoVec<I, T>>>,
|
||||
#[traversable(flatten)]
|
||||
pub distribution: Distribution<I, T, M>,
|
||||
}
|
||||
|
||||
impl<I: VecIndex, T: ComputedVecValue + JsonSchema> DistributionFull<I, T> {
|
||||
|
||||
@@ -12,75 +12,14 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
/// One window slot: 8 distribution stats, each a AmountPerBlock.
|
||||
/// Rolling distribution across 4 windows, stat-first naming.
|
||||
///
|
||||
/// Tree: `average.sats.height`, `min.sats.height`, etc.
|
||||
#[derive(Traversable)]
|
||||
pub struct RollingDistributionSlot<M: StorageMode = Rw> {
|
||||
#[traversable(flatten)]
|
||||
pub distribution: DistributionStats<AmountPerBlock<M>>,
|
||||
}
|
||||
|
||||
impl RollingDistributionSlot {
|
||||
pub(crate) fn forced_import(
|
||||
db: &Database,
|
||||
name: &str,
|
||||
version: Version,
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
distribution: DistributionStats::try_from_fn(|suffix| {
|
||||
AmountPerBlock::forced_import(db, &format!("{name}_{suffix}"), version, indexes)
|
||||
})?,
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn compute(
|
||||
&mut self,
|
||||
max_from: Height,
|
||||
starts: &impl ReadableVec<Height, Height>,
|
||||
sats_source: &impl ReadableVec<Height, Sats>,
|
||||
cents_source: &impl ReadableVec<Height, Cents>,
|
||||
exit: &Exit,
|
||||
sats_cache: &mut Option<(usize, Vec<f64>)>,
|
||||
cents_cache: &mut Option<(usize, Vec<f64>)>,
|
||||
) -> Result<()> {
|
||||
let d = &mut self.distribution;
|
||||
|
||||
macro_rules! compute_unit {
|
||||
($unit:ident, $source:expr, $cache:expr) => {
|
||||
compute_rolling_distribution_from_starts(
|
||||
max_from,
|
||||
starts,
|
||||
$source,
|
||||
&mut d.average.$unit.height,
|
||||
&mut d.min.$unit.height,
|
||||
&mut d.max.$unit.height,
|
||||
&mut d.pct10.$unit.height,
|
||||
&mut d.pct25.$unit.height,
|
||||
&mut d.median.$unit.height,
|
||||
&mut d.pct75.$unit.height,
|
||||
&mut d.pct90.$unit.height,
|
||||
exit,
|
||||
$cache,
|
||||
)?
|
||||
};
|
||||
}
|
||||
compute_unit!(sats, sats_source, sats_cache);
|
||||
compute_unit!(cents, cents_source, cents_cache);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Rolling distribution across 4 windows, window-first.
|
||||
///
|
||||
/// Tree: `_24h.average.sats.height`, `_24h.min.sats.height`, etc.
|
||||
/// Tree: `average._24h.sats.height`, `max._24h.sats.height`, etc.
|
||||
/// Series: `{name}_average_24h`, `{name}_max_24h`, etc.
|
||||
#[derive(Deref, DerefMut, Traversable)]
|
||||
#[traversable(transparent)]
|
||||
pub struct RollingDistributionAmountPerBlock<M: StorageMode = Rw>(
|
||||
pub Windows<RollingDistributionSlot<M>>,
|
||||
pub DistributionStats<Windows<AmountPerBlock<M>>>,
|
||||
);
|
||||
|
||||
impl RollingDistributionAmountPerBlock {
|
||||
@@ -90,13 +29,15 @@ impl RollingDistributionAmountPerBlock {
|
||||
version: Version,
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self(Windows::try_from_fn(|suffix| {
|
||||
RollingDistributionSlot::forced_import(
|
||||
db,
|
||||
&format!("{name}_{suffix}"),
|
||||
version,
|
||||
indexes,
|
||||
)
|
||||
Ok(Self(DistributionStats::try_from_fn(|stat_suffix| {
|
||||
Windows::try_from_fn(|window_suffix| {
|
||||
AmountPerBlock::forced_import(
|
||||
db,
|
||||
&format!("{name}_{stat_suffix}_{window_suffix}"),
|
||||
version,
|
||||
indexes,
|
||||
)
|
||||
})
|
||||
})?))
|
||||
}
|
||||
|
||||
@@ -110,22 +51,38 @@ impl RollingDistributionAmountPerBlock {
|
||||
) -> Result<()> {
|
||||
let mut sats_cache = None;
|
||||
let mut cents_cache = None;
|
||||
for (slot, starts) in self
|
||||
.0
|
||||
.as_mut_array_largest_first()
|
||||
.into_iter()
|
||||
.zip(windows.as_array_largest_first())
|
||||
{
|
||||
slot.compute(
|
||||
max_from,
|
||||
*starts,
|
||||
sats_source,
|
||||
cents_source,
|
||||
exit,
|
||||
&mut sats_cache,
|
||||
&mut cents_cache,
|
||||
)?;
|
||||
|
||||
macro_rules! compute_window {
|
||||
($w:ident, $starts:expr) => {{
|
||||
macro_rules! compute_unit {
|
||||
($unit:ident, $source:expr, $cache:expr) => {
|
||||
compute_rolling_distribution_from_starts(
|
||||
max_from,
|
||||
$starts,
|
||||
$source,
|
||||
&mut self.0.average.$w.$unit.height,
|
||||
&mut self.0.min.$w.$unit.height,
|
||||
&mut self.0.max.$w.$unit.height,
|
||||
&mut self.0.pct10.$w.$unit.height,
|
||||
&mut self.0.pct25.$w.$unit.height,
|
||||
&mut self.0.median.$w.$unit.height,
|
||||
&mut self.0.pct75.$w.$unit.height,
|
||||
&mut self.0.pct90.$w.$unit.height,
|
||||
exit,
|
||||
$cache,
|
||||
)?
|
||||
};
|
||||
}
|
||||
compute_unit!(sats, sats_source, &mut sats_cache);
|
||||
compute_unit!(cents, cents_source, &mut cents_cache);
|
||||
}};
|
||||
}
|
||||
// Largest window first: its cache covers all smaller windows.
|
||||
compute_window!(_1y, windows._1y);
|
||||
compute_window!(_1m, windows._1m);
|
||||
compute_window!(_1w, windows._1w);
|
||||
compute_window!(_24h, windows._24h);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ pub struct PerBlockRollingAverage<T, M: StorageMode = Rw>
|
||||
where
|
||||
T: NumericValue + JsonSchema,
|
||||
{
|
||||
pub height: M::Stored<EagerVec<PcoVec<Height, T>>>,
|
||||
pub base: M::Stored<EagerVec<PcoVec<Height, T>>>,
|
||||
#[traversable(hidden)]
|
||||
pub cumulative: M::Stored<EagerVec<PcoVec<Height, f64>>>,
|
||||
#[traversable(flatten)]
|
||||
@@ -37,7 +37,7 @@ where
|
||||
indexes: &indexes::Vecs,
|
||||
cached_starts: &CachedWindowStarts,
|
||||
) -> Result<Self> {
|
||||
let height: EagerVec<PcoVec<Height, T>> = EagerVec::forced_import(db, name, version)?;
|
||||
let base: EagerVec<PcoVec<Height, T>> = EagerVec::forced_import(db, name, version)?;
|
||||
let cumulative: EagerVec<PcoVec<Height, f64>> =
|
||||
EagerVec::forced_import(db, &format!("{name}_cumulative"), version)?;
|
||||
let average = LazyRollingAvgsFromHeight::new(
|
||||
@@ -49,7 +49,7 @@ where
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
height,
|
||||
base,
|
||||
cumulative,
|
||||
average,
|
||||
})
|
||||
@@ -62,14 +62,14 @@ where
|
||||
exit: &Exit,
|
||||
compute_height: impl FnOnce(&mut EagerVec<PcoVec<Height, T>>) -> Result<()>,
|
||||
) -> Result<()> {
|
||||
compute_height(&mut self.height)?;
|
||||
compute_height(&mut self.base)?;
|
||||
self.compute_rest(max_from, exit)
|
||||
}
|
||||
|
||||
/// Compute cumulative from already-populated height data. Rolling averages are lazy.
|
||||
pub(crate) fn compute_rest(&mut self, max_from: Height, exit: &Exit) -> Result<()> {
|
||||
self.cumulative
|
||||
.compute_cumulative(max_from, &self.height, exit)?;
|
||||
.compute_cumulative(max_from, &self.base, exit)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@ where
|
||||
{
|
||||
#[deref]
|
||||
#[deref_mut]
|
||||
#[traversable(flatten)]
|
||||
pub inner: PerBlock<S, M>,
|
||||
pub base: PerBlock<S, M>,
|
||||
pub delta: LazyRollingDeltasFromHeight<S, C, B>,
|
||||
}
|
||||
|
||||
@@ -40,16 +39,16 @@ where
|
||||
indexes: &indexes::Vecs,
|
||||
cached_starts: &CachedWindowStarts,
|
||||
) -> Result<Self> {
|
||||
let inner = PerBlock::forced_import(db, name, version, indexes)?;
|
||||
let base = PerBlock::forced_import(db, name, version, indexes)?;
|
||||
|
||||
let delta = LazyRollingDeltasFromHeight::new(
|
||||
&format!("{name}_delta"),
|
||||
version + delta_version_offset,
|
||||
&inner.height,
|
||||
&base.height,
|
||||
cached_starts,
|
||||
indexes,
|
||||
);
|
||||
|
||||
Ok(Self { inner, delta })
|
||||
Ok(Self { base, delta })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@ impl<B: BpsType> PercentPerBlockRollingAverage<B> {
|
||||
let ratio = LazyPerBlock::from_height_source::<B::ToRatio>(
|
||||
&format!("{name}_ratio"),
|
||||
version,
|
||||
bps.height.read_only_boxed_clone(),
|
||||
bps.base.read_only_boxed_clone(),
|
||||
indexes,
|
||||
);
|
||||
|
||||
let percent = LazyPerBlock::from_height_source::<B::ToPercent>(
|
||||
name,
|
||||
version,
|
||||
bps.height.read_only_boxed_clone(),
|
||||
bps.base.read_only_boxed_clone(),
|
||||
indexes,
|
||||
);
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ impl Vecs {
|
||||
}
|
||||
|
||||
// Lump sum by period - stack
|
||||
let lookback_dca = lookback.price_lookback.as_dca_period();
|
||||
let lookback_dca = lookback.price_past.as_dca_period();
|
||||
for (stack, lookback_price, days) in
|
||||
self.period.lump_sum_stack.zip_mut_with_days(&lookback_dca)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ impl Vecs {
|
||||
) -> Result<()> {
|
||||
let price = &prices.spot.cents.height;
|
||||
|
||||
for (price_lookback, days) in self.price_lookback.iter_mut_with_days() {
|
||||
for (price_past, days) in self.price_past.iter_mut_with_days() {
|
||||
let window_starts = blocks.lookback.start_vec(days as usize);
|
||||
price_lookback.cents.height.compute_lookback(
|
||||
price_past.cents.height.compute_lookback(
|
||||
starting_indexes.height,
|
||||
window_starts,
|
||||
price,
|
||||
|
||||
@@ -11,10 +11,10 @@ impl Vecs {
|
||||
version: Version,
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
let price_lookback = ByLookbackPeriod::try_new(|name, _days| {
|
||||
Price::forced_import(db, &format!("price_lookback_{name}"), version, indexes)
|
||||
let price_past = ByLookbackPeriod::try_new(|name, _days| {
|
||||
Price::forced_import(db, &format!("price_past_{name}"), version, indexes)
|
||||
})?;
|
||||
|
||||
Ok(Self { price_lookback })
|
||||
Ok(Self { price_past })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@ use crate::internal::{PerBlock, Price};
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
#[traversable(flatten)]
|
||||
pub price_lookback: ByLookbackPeriod<Price<PerBlock<Cents, M>>>,
|
||||
pub price_past: ByLookbackPeriod<Price<PerBlock<Cents, M>>>,
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ impl Vecs {
|
||||
for ((returns, _), (lookback_price, _)) in self
|
||||
.periods
|
||||
.iter_mut_with_days()
|
||||
.zip(lookback.price_lookback.iter_with_days())
|
||||
.zip(lookback.price_past.iter_with_days())
|
||||
{
|
||||
returns.compute_binary::<Dollars, Dollars, RatioDiffDollarsBps32>(
|
||||
starting_indexes.height,
|
||||
|
||||
@@ -57,19 +57,13 @@ impl Vecs {
|
||||
&returns.periods._1m.ratio.height,
|
||||
&returns.periods._1y.ratio.height,
|
||||
];
|
||||
for ((rsi_chain, ret), &m) in self
|
||||
.rsi
|
||||
.as_mut_array()
|
||||
.into_iter()
|
||||
.zip(return_sources)
|
||||
.zip(&TF_MULTIPLIERS)
|
||||
{
|
||||
for (rsi_chain, ret) in self.rsi.as_mut_array().into_iter().zip(return_sources) {
|
||||
rsi::compute(
|
||||
rsi_chain,
|
||||
blocks,
|
||||
ret,
|
||||
14 * m,
|
||||
3 * m,
|
||||
14,
|
||||
3,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
@@ -106,7 +106,8 @@ impl Vecs {
|
||||
) -> Result<Self> {
|
||||
let v = version + VERSION;
|
||||
|
||||
let rsi = Windows::try_from_fn(|tf| RsiChain::forced_import(db, tf, v, indexes))?;
|
||||
let rsi =
|
||||
Windows::try_from_fn(|tf| RsiChain::forced_import(db, tf, v + Version::ONE, indexes))?;
|
||||
let macd = Windows::try_from_fn(|tf| MacdChain::forced_import(db, tf, v, indexes))?;
|
||||
|
||||
let stoch_k = PercentPerBlock::forced_import(db, "stoch_k", v, indexes)?;
|
||||
|
||||
@@ -23,7 +23,7 @@ impl Vecs {
|
||||
self.rate.base.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&count_vecs.total.sum._24h.height,
|
||||
&difficulty_vecs.as_hash.height,
|
||||
&difficulty_vecs.hashrate.height,
|
||||
|(i, block_count_sum, difficulty_as_hash, ..)| {
|
||||
(
|
||||
i,
|
||||
|
||||
@@ -147,7 +147,7 @@ impl Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.fee_ratio_multiple
|
||||
self.fee_to_subsidy_ratio
|
||||
.compute_binary::<Dollars, Dollars, RatioDollarsBp32, _, _>(
|
||||
starting_indexes.height,
|
||||
self.coinbase.sum.as_array().map(|w| &w.usd.height),
|
||||
|
||||
@@ -55,9 +55,9 @@ impl Vecs {
|
||||
)?,
|
||||
subsidy_dominance_rolling,
|
||||
subsidy_sma_1y: FiatPerBlock::forced_import(db, "subsidy_sma_1y", version, indexes)?,
|
||||
fee_ratio_multiple: RatioRollingWindows::forced_import(
|
||||
fee_to_subsidy_ratio: RatioRollingWindows::forced_import(
|
||||
db,
|
||||
"fee_ratio_multiple",
|
||||
"fee_to_subsidy_ratio",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
|
||||
@@ -24,6 +24,6 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub subsidy_dominance_rolling: LazyPercentRollingWindows<BasisPoints16>,
|
||||
#[traversable(wrap = "subsidy", rename = "sma_1y")]
|
||||
pub subsidy_sma_1y: FiatPerBlock<Cents, M>,
|
||||
#[traversable(wrap = "fees", rename = "ratio_multiple")]
|
||||
pub fee_ratio_multiple: RatioRollingWindows<BasisPoints32, M>,
|
||||
#[traversable(wrap = "fees", rename = "to_subsidy_ratio")]
|
||||
pub fee_to_subsidy_ratio: RatioRollingWindows<BasisPoints32, M>,
|
||||
}
|
||||
|
||||
@@ -61,14 +61,14 @@ impl Vecs {
|
||||
pub(crate) fn compute(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
height_to_pool: &impl ReadableVec<Height, PoolSlug>,
|
||||
pool: &impl ReadableVec<Height, PoolSlug>,
|
||||
blocks: &blocks::Vecs,
|
||||
prices: &prices::Vecs,
|
||||
mining: &mining::Vecs,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.base
|
||||
.compute(starting_indexes, height_to_pool, blocks, exit)?;
|
||||
.compute(starting_indexes, pool, blocks, exit)?;
|
||||
|
||||
for (dom, (mined, total)) in self.dominance_rolling.as_mut_array().into_iter().zip(
|
||||
self.base
|
||||
|
||||
@@ -52,7 +52,7 @@ impl Vecs {
|
||||
pub(crate) fn compute(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
height_to_pool: &impl ReadableVec<Height, PoolSlug>,
|
||||
pool: &impl ReadableVec<Height, PoolSlug>,
|
||||
blocks: &blocks::Vecs,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
@@ -60,7 +60,7 @@ impl Vecs {
|
||||
.compute(starting_indexes.height, exit, |vec| {
|
||||
vec.compute_transform(
|
||||
starting_indexes.height,
|
||||
height_to_pool,
|
||||
pool,
|
||||
|(h, id, ..)| {
|
||||
(
|
||||
h,
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
db: Database,
|
||||
pools: &'static Pools,
|
||||
|
||||
pub height_to_pool: M::Stored<BytesVec<Height, PoolSlug>>,
|
||||
pub pool: M::Stored<BytesVec<Height, PoolSlug>>,
|
||||
pub major: BTreeMap<PoolSlug, major::Vecs<M>>,
|
||||
pub minor: BTreeMap<PoolSlug, minor::Vecs<M>>,
|
||||
}
|
||||
@@ -64,7 +64,7 @@ impl Vecs {
|
||||
}
|
||||
|
||||
let this = Self {
|
||||
height_to_pool: BytesVec::forced_import(&db, "pool", version)?,
|
||||
pool: BytesVec::forced_import(&db, "pool", version)?,
|
||||
major: major_map,
|
||||
minor: minor_map,
|
||||
pools,
|
||||
@@ -86,12 +86,12 @@ impl Vecs {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.compute_height_to_pool(indexer, indexes, starting_indexes, exit)?;
|
||||
self.compute_pool(indexer, indexes, starting_indexes, exit)?;
|
||||
|
||||
self.major.par_iter_mut().try_for_each(|(_, vecs)| {
|
||||
vecs.compute(
|
||||
starting_indexes,
|
||||
&self.height_to_pool,
|
||||
&self.pool,
|
||||
blocks,
|
||||
prices,
|
||||
mining,
|
||||
@@ -100,7 +100,7 @@ impl Vecs {
|
||||
})?;
|
||||
|
||||
self.minor.par_iter_mut().try_for_each(|(_, vecs)| {
|
||||
vecs.compute(starting_indexes, &self.height_to_pool, blocks, exit)
|
||||
vecs.compute(starting_indexes, &self.pool, blocks, exit)
|
||||
})?;
|
||||
|
||||
let _lock = exit.lock();
|
||||
@@ -108,14 +108,14 @@ impl Vecs {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn compute_height_to_pool(
|
||||
fn compute_pool(
|
||||
&mut self,
|
||||
indexer: &Indexer,
|
||||
indexes: &indexes::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.height_to_pool
|
||||
self.pool
|
||||
.validate_computed_version_or_reset(indexer.stores.height_to_coinbase_tag.version())?;
|
||||
|
||||
let first_txout_index = indexer.vecs.transactions.first_txout_index.reader();
|
||||
@@ -135,7 +135,7 @@ impl Vecs {
|
||||
let min = starting_indexes
|
||||
.height
|
||||
.to_usize()
|
||||
.min(self.height_to_pool.len());
|
||||
.min(self.pool.len());
|
||||
|
||||
// Cursors avoid per-height PcoVec page decompression.
|
||||
// Heights are sequential, tx_index values derived from them are monotonically
|
||||
@@ -144,7 +144,7 @@ impl Vecs {
|
||||
first_tx_index_cursor.advance(min);
|
||||
let mut output_count_cursor = indexes.tx_index.output_count.cursor();
|
||||
|
||||
self.height_to_pool.truncate_if_needed_at(min)?;
|
||||
self.pool.truncate_if_needed_at(min)?;
|
||||
|
||||
indexer
|
||||
.stores
|
||||
@@ -181,12 +181,12 @@ impl Vecs {
|
||||
.or_else(|| self.pools.find_from_coinbase_tag(&coinbase_tag))
|
||||
.unwrap_or(unknown);
|
||||
|
||||
self.height_to_pool.push(pool.slug);
|
||||
self.pool.push(pool.slug);
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
let _lock = exit.lock();
|
||||
self.height_to_pool.write()?;
|
||||
self.pool.write()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ impl Vecs {
|
||||
let op_return_height = &scripts.value.op_return.base.sats.height;
|
||||
let unclaimed_height = &mining.rewards.unclaimed.base.sats.height;
|
||||
|
||||
self.unspendable.compute(
|
||||
self.total.compute(
|
||||
starting_indexes.height,
|
||||
prices,
|
||||
exit,
|
||||
|
||||
@@ -13,7 +13,7 @@ impl Vecs {
|
||||
cached_starts: &CachedWindowStarts,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
unspendable: AmountPerBlockCumulativeWithSums::forced_import(
|
||||
total: AmountPerBlockCumulativeWithSums::forced_import(
|
||||
db,
|
||||
"unspendable_supply",
|
||||
version,
|
||||
|
||||
@@ -4,6 +4,7 @@ use vecdb::{Rw, StorageMode};
|
||||
use crate::internal::AmountPerBlockCumulativeWithSums;
|
||||
|
||||
#[derive(Traversable)]
|
||||
#[traversable(transparent)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub unspendable: AmountPerBlockCumulativeWithSums<M>,
|
||||
pub total: AmountPerBlockCumulativeWithSums<M>,
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
let hodled_or_lost =
|
||||
LazyAmountPerBlock::identity("hodled_or_lost_coins", &cointime.supply.vaulted, version);
|
||||
LazyAmountPerBlock::identity("hodled_or_lost_supply", &cointime.supply.vaulted, version);
|
||||
|
||||
let this = Self {
|
||||
db,
|
||||
|
||||
@@ -21,7 +21,7 @@ impl Vecs {
|
||||
self.native.height.compute_rolling_ratio(
|
||||
starting_indexes.height,
|
||||
&blocks.lookback._1y,
|
||||
&transactions.volume.sent_sum.base.sats.height,
|
||||
&transactions.volume.transfer_volume.base.sats.height,
|
||||
&circulating_supply.sats.height,
|
||||
exit,
|
||||
)?;
|
||||
@@ -30,7 +30,7 @@ impl Vecs {
|
||||
self.fiat.height.compute_rolling_ratio(
|
||||
starting_indexes.height,
|
||||
&blocks.lookback._1y,
|
||||
&transactions.volume.sent_sum.base.usd.height,
|
||||
&transactions.volume.transfer_volume.base.usd.height,
|
||||
&circulating_supply.usd.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
@@ -25,7 +25,7 @@ impl Vecs {
|
||||
// sent_sum and received_sum are independent — parallelize
|
||||
let (r1, r2) = rayon::join(
|
||||
|| {
|
||||
self.sent_sum.compute(
|
||||
self.transfer_volume.compute(
|
||||
starting_indexes.height,
|
||||
prices,
|
||||
exit,
|
||||
@@ -42,7 +42,7 @@ impl Vecs {
|
||||
)
|
||||
},
|
||||
|| {
|
||||
self.received_sum.compute(
|
||||
self.output_volume.compute(
|
||||
starting_indexes.height,
|
||||
prices,
|
||||
exit,
|
||||
@@ -66,7 +66,7 @@ impl Vecs {
|
||||
.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&count_vecs.total.base.height,
|
||||
&blocks.interval.height,
|
||||
&blocks.interval.base,
|
||||
exit,
|
||||
)?;
|
||||
self.inputs_per_sec
|
||||
@@ -74,7 +74,7 @@ impl Vecs {
|
||||
.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&inputs_count.full.sum,
|
||||
&blocks.interval.height,
|
||||
&blocks.interval.base,
|
||||
exit,
|
||||
)?;
|
||||
self.outputs_per_sec
|
||||
@@ -82,7 +82,7 @@ impl Vecs {
|
||||
.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&outputs_count.total.full.sum,
|
||||
&blocks.interval.height,
|
||||
&blocks.interval.base,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
|
||||
@@ -17,16 +17,16 @@ impl Vecs {
|
||||
) -> Result<Self> {
|
||||
let v2 = Version::TWO;
|
||||
Ok(Self {
|
||||
sent_sum: AmountPerBlockCumulativeWithSums::forced_import(
|
||||
transfer_volume: AmountPerBlockCumulativeWithSums::forced_import(
|
||||
db,
|
||||
"sent_sum",
|
||||
"exact_transfer_volume",
|
||||
version,
|
||||
indexes,
|
||||
cached_starts,
|
||||
)?,
|
||||
received_sum: AmountPerBlockCumulativeWithSums::forced_import(
|
||||
output_volume: AmountPerBlockCumulativeWithSums::forced_import(
|
||||
db,
|
||||
"received_sum",
|
||||
"output_volume",
|
||||
version,
|
||||
indexes,
|
||||
cached_starts,
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::internal::{AmountPerBlockCumulativeWithSums, PerBlock};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub sent_sum: AmountPerBlockCumulativeWithSums<M>,
|
||||
pub received_sum: AmountPerBlockCumulativeWithSums<M>,
|
||||
pub transfer_volume: AmountPerBlockCumulativeWithSums<M>,
|
||||
pub output_volume: AmountPerBlockCumulativeWithSums<M>,
|
||||
pub tx_per_sec: PerBlock<StoredF32, M>,
|
||||
pub outputs_per_sec: PerBlock<StoredF32, M>,
|
||||
pub inputs_per_sec: PerBlock<StoredF32, M>,
|
||||
|
||||
@@ -16,8 +16,9 @@ pub struct BlocksVecs<M: StorageMode = Rw> {
|
||||
/// Doesn't guarantee continuity due to possible reorgs and more generally the nature of mining
|
||||
#[traversable(wrap = "time")]
|
||||
pub timestamp: M::Stored<PcoVec<Height, Timestamp>>,
|
||||
#[traversable(wrap = "size")]
|
||||
#[traversable(wrap = "size", rename = "base")]
|
||||
pub total: M::Stored<PcoVec<Height, StoredU64>>,
|
||||
#[traversable(wrap = "weight", rename = "base")]
|
||||
pub weight: M::Stored<PcoVec<Height, Weight>>,
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ impl Query {
|
||||
let end = current_height.to_usize();
|
||||
|
||||
// No blocks indexed yet
|
||||
if computer.pools.height_to_pool.len() == 0 {
|
||||
if computer.pools.pool.len() == 0 {
|
||||
return Ok(PoolsSummary {
|
||||
pools: vec![],
|
||||
block_count: 0,
|
||||
|
||||
@@ -112,6 +112,7 @@ All errors return structured JSON with a consistent format:
|
||||
description: Some(
|
||||
"Deprecated — use Series".to_string(),
|
||||
),
|
||||
extensions: [("x-deprecated".to_string(), serde_json::Value::Bool(true))].into(),
|
||||
..Default::default()
|
||||
},
|
||||
Tag {
|
||||
|
||||
@@ -15,7 +15,12 @@ use vecdb::{
|
||||
|
||||
pub trait Traversable {
|
||||
fn to_tree_node(&self) -> TreeNode;
|
||||
/// All vecs including hidden — used for disk writes, flushes, exports.
|
||||
fn iter_any_exportable(&self) -> impl Iterator<Item = &dyn AnyExportableVec>;
|
||||
/// Only non-hidden vecs — used for building the public series list.
|
||||
fn iter_any_visible(&self) -> impl Iterator<Item = &dyn AnyExportableVec> {
|
||||
self.iter_any_exportable()
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper to create a SeriesLeafWithSchema from a vec
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2236,7 +2236,7 @@ class AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern:
|
||||
self.rolling: AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern = AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc)
|
||||
self.sum: SeriesPattern18[StoredU64] = SeriesPattern18(client, _m(acc, 'sum'))
|
||||
|
||||
class AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern:
|
||||
class AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -2253,6 +2253,10 @@ class AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern:
|
||||
self.pct90: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'pct90'))
|
||||
self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'sum'))
|
||||
|
||||
class AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(Generic[T]):
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
pass
|
||||
|
||||
class AverageGainsLossesRsiStochPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2299,21 +2303,7 @@ class AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern:
|
||||
self.pct90: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'pct90'))
|
||||
self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, _m(acc, 'sum'))
|
||||
|
||||
class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.average: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'average'))
|
||||
self.max: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'max'))
|
||||
self.median: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'median'))
|
||||
self.min: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'min'))
|
||||
self.pct10: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'pct10'))
|
||||
self.pct25: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'pct25'))
|
||||
self.pct75: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'pct75'))
|
||||
self.pct90: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'pct90'))
|
||||
|
||||
class BaseCapitulationCumulativeNegativeRelSumValuePattern:
|
||||
class BaseCapitulationCumulativeNegativeSumToValuePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
pass
|
||||
|
||||
@@ -2321,7 +2311,7 @@ class BpsCentsPercentilesRatioSatsSmaStdUsdPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
pass
|
||||
|
||||
class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(Generic[T]):
|
||||
class AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(Generic[T]):
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -2361,11 +2351,11 @@ class _1m1w1y24hBpsPercentRatioPattern:
|
||||
self.percent: SeriesPattern1[StoredF32] = SeriesPattern1(client, acc)
|
||||
self.ratio: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'ratio'))
|
||||
|
||||
class BaseCumulativeDistributionRelSumValuePattern:
|
||||
class BaseCumulativeDistributionSumToValuePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
pass
|
||||
|
||||
class BaseCumulativeNegativeRelSumPattern2:
|
||||
class BaseCumulativeNegativeSumToPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -2373,10 +2363,10 @@ class BaseCumulativeNegativeRelSumPattern2:
|
||||
self.base: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'unrealized_loss'))
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'unrealized_loss_cumulative'))
|
||||
self.negative: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'neg_unrealized_loss'))
|
||||
self.rel_to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'unrealized_loss_rel_to_mcap'))
|
||||
self.rel_to_own_gross: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl'))
|
||||
self.rel_to_own_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'unrealized_loss_rel_to_own_mcap'))
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'unrealized_loss_sum'))
|
||||
self.to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'unrealized_loss_to_mcap'))
|
||||
self.to_own_gross_pnl: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'unrealized_loss_to_own_gross_pnl'))
|
||||
self.to_own_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'unrealized_loss_to_own_mcap'))
|
||||
|
||||
class CapLossMvrvNetPriceProfitSoprPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
@@ -2407,29 +2397,29 @@ class _1m1w1y2y4yAllPattern:
|
||||
self._4y: BpsRatioPattern2 = BpsRatioPattern2(client, _m(acc, '4y'))
|
||||
self.all: BpsRatioPattern2 = BpsRatioPattern2(client, _m(acc, 'all'))
|
||||
|
||||
class BaseChangeCumulativeDeltaRelSumPattern:
|
||||
class BaseChangeCumulativeDeltaSumToPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.base: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_pnl'))
|
||||
self.change_1m: RelPattern = RelPattern(client, _m(acc, 'pnl_change_1m_rel_to'))
|
||||
self.change_1m: ToPattern = ToPattern(client, _m(acc, 'pnl_change_1m_to'))
|
||||
self.cumulative: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_pnl_cumulative'))
|
||||
self.delta: AbsoluteRatePattern2 = AbsoluteRatePattern2(client, _m(acc, 'realized_pnl_delta'))
|
||||
self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_rcap'))
|
||||
self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'realized_pnl_sum'))
|
||||
self.to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_pnl_to_rcap'))
|
||||
|
||||
class BaseCumulativeRelSumPattern2:
|
||||
class BaseCumulativeSumToPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.base: CentsUsdPattern2 = CentsUsdPattern2(client, acc)
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'cumulative'))
|
||||
self.rel_to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_mcap'))
|
||||
self.rel_to_own_gross: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_own_gross_pnl'))
|
||||
self.rel_to_own_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_own_mcap'))
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'sum'))
|
||||
self.to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_mcap'))
|
||||
self.to_own_gross_pnl: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_own_gross_pnl'))
|
||||
self.to_own_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_own_mcap'))
|
||||
|
||||
class BpsCentsPercentilesRatioSatsUsdPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
@@ -2443,16 +2433,16 @@ class BpsCentsPercentilesRatioSatsUsdPattern:
|
||||
self.sats: SeriesPattern1[SatsFract] = SeriesPattern1(client, _m(acc, 'sats'))
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, acc)
|
||||
|
||||
class BtcCentsRelSatsUsdPattern3:
|
||||
class BtcCentsSatsToUsdPattern3:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.btc: SeriesPattern1[Bitcoin] = SeriesPattern1(client, acc)
|
||||
self.cents: SeriesPattern1[Cents] = SeriesPattern1(client, _m(acc, 'cents'))
|
||||
self.rel_to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating'))
|
||||
self.rel_to_own: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_own'))
|
||||
self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats'))
|
||||
self.to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_circulating'))
|
||||
self.to_own: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_own'))
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd'))
|
||||
|
||||
class CapLossMvrvPriceProfitSoprPattern:
|
||||
@@ -2467,28 +2457,28 @@ class CapLossMvrvPriceProfitSoprPattern:
|
||||
self.profit: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, _m(acc, 'realized_profit'))
|
||||
self.sopr: ValuePattern = ValuePattern(client, _m(acc, 'value'))
|
||||
|
||||
class DeltaHalfInRelTotalPattern:
|
||||
class DeltaHalfInToTotalPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta'))
|
||||
self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half'))
|
||||
self.in_loss: BtcCentsRelSatsUsdPattern = BtcCentsRelSatsUsdPattern(client, _m(acc, 'in_loss'))
|
||||
self.in_profit: BtcCentsRelSatsUsdPattern = BtcCentsRelSatsUsdPattern(client, _m(acc, 'in_profit'))
|
||||
self.rel_to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating'))
|
||||
self.in_loss: BtcCentsSatsToUsdPattern = BtcCentsSatsToUsdPattern(client, _m(acc, 'in_loss'))
|
||||
self.in_profit: BtcCentsSatsToUsdPattern = BtcCentsSatsToUsdPattern(client, _m(acc, 'in_profit'))
|
||||
self.to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_circulating'))
|
||||
self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc)
|
||||
|
||||
class DeltaHalfInRelTotalPattern2:
|
||||
class DeltaHalfInToTotalPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta'))
|
||||
self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half'))
|
||||
self.in_loss: BtcCentsRelSatsUsdPattern3 = BtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_loss'))
|
||||
self.in_profit: BtcCentsRelSatsUsdPattern3 = BtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_profit'))
|
||||
self.rel_to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating'))
|
||||
self.in_loss: BtcCentsSatsToUsdPattern3 = BtcCentsSatsToUsdPattern3(client, _m(acc, 'in_loss'))
|
||||
self.in_profit: BtcCentsSatsToUsdPattern3 = BtcCentsSatsToUsdPattern3(client, _m(acc, 'in_profit'))
|
||||
self.to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_circulating'))
|
||||
self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc)
|
||||
|
||||
class Pct1Pct2Pct5Pct95Pct98Pct99Pattern:
|
||||
@@ -2508,10 +2498,10 @@ class ActivityOutputsRealizedSupplyUnrealizedPattern:
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.activity: CoindaysSentPattern = CoindaysSentPattern(client, acc)
|
||||
self.activity: CoindaysTransferPattern = CoindaysTransferPattern(client, acc)
|
||||
self.outputs: UnspentPattern = UnspentPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapLossMvrvNetPriceProfitSoprPattern = CapLossMvrvNetPriceProfitSoprPattern(client, acc)
|
||||
self.supply: DeltaHalfInRelTotalPattern = DeltaHalfInRelTotalPattern(client, _m(acc, 'supply'))
|
||||
self.supply: DeltaHalfInToTotalPattern = DeltaHalfInToTotalPattern(client, _m(acc, 'supply'))
|
||||
self.unrealized: LossNetNuplProfitPattern = LossNetNuplProfitPattern(client, acc)
|
||||
|
||||
class AddressOutputsRealizedSupplyUnrealizedPattern:
|
||||
@@ -2519,7 +2509,7 @@ class AddressOutputsRealizedSupplyUnrealizedPattern:
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.address_count: DeltaInnerPattern = DeltaInnerPattern(client, _m(acc, 'address_count'))
|
||||
self.address_count: BaseDeltaPattern = BaseDeltaPattern(client, _m(acc, 'address_count'))
|
||||
self.outputs: UnspentPattern = UnspentPattern(client, _m(acc, 'utxo_count'))
|
||||
self.realized: CapLossMvrvPriceProfitSoprPattern = CapLossMvrvPriceProfitSoprPattern(client, acc)
|
||||
self.supply: DeltaHalfTotalPattern = DeltaHalfTotalPattern(client, _m(acc, 'supply'))
|
||||
@@ -2558,26 +2548,26 @@ class BtcCentsDeltaSatsUsdPattern:
|
||||
self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats'))
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd'))
|
||||
|
||||
class BtcCentsRelSatsUsdPattern:
|
||||
class BtcCentsSatsToUsdPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.btc: SeriesPattern1[Bitcoin] = SeriesPattern1(client, acc)
|
||||
self.cents: SeriesPattern1[Cents] = SeriesPattern1(client, _m(acc, 'cents'))
|
||||
self.rel_to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating'))
|
||||
self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats'))
|
||||
self.to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_circulating'))
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd'))
|
||||
|
||||
class BtcCentsRelSatsUsdPattern2:
|
||||
class BtcCentsSatsToUsdPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.btc: SeriesPattern1[Bitcoin] = SeriesPattern1(client, acc)
|
||||
self.cents: SeriesPattern1[Cents] = SeriesPattern1(client, _m(acc, 'cents'))
|
||||
self.rel_to_own: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_own'))
|
||||
self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats'))
|
||||
self.to_own: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'to_own'))
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd'))
|
||||
|
||||
class DeltaHalfInTotalPattern2:
|
||||
@@ -2610,7 +2600,7 @@ class PhsReboundThsPattern:
|
||||
self.ths: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'ths'))
|
||||
self.ths_min: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, 'ths_min'))
|
||||
|
||||
class _1m1w1y24hHeightPattern(Generic[T]):
|
||||
class _1m1w1y24hBasePattern(Generic[T]):
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
@@ -2619,7 +2609,7 @@ class _1m1w1y24hHeightPattern(Generic[T]):
|
||||
self._1w: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'average_1w'))
|
||||
self._1y: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'average_1y'))
|
||||
self._24h: SeriesPattern1[T] = SeriesPattern1(client, _m(acc, 'average_24h'))
|
||||
self.height: SeriesPattern18[T] = SeriesPattern18(client, acc)
|
||||
self.base: SeriesPattern18[T] = SeriesPattern18(client, acc)
|
||||
|
||||
class _1m1w1y24hPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
@@ -2714,10 +2704,10 @@ class BothReactivatedReceivingSendingPattern:
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.both: _1m1w1y24hHeightPattern[StoredU32] = _1m1w1y24hHeightPattern(client, _m(acc, 'both'))
|
||||
self.reactivated: _1m1w1y24hHeightPattern[StoredU32] = _1m1w1y24hHeightPattern(client, _m(acc, 'reactivated'))
|
||||
self.receiving: _1m1w1y24hHeightPattern[StoredU32] = _1m1w1y24hHeightPattern(client, _m(acc, 'receiving'))
|
||||
self.sending: _1m1w1y24hHeightPattern[StoredU32] = _1m1w1y24hHeightPattern(client, _m(acc, 'sending'))
|
||||
self.both: _1m1w1y24hBasePattern[StoredU32] = _1m1w1y24hBasePattern(client, _m(acc, 'both'))
|
||||
self.reactivated: _1m1w1y24hBasePattern[StoredU32] = _1m1w1y24hBasePattern(client, _m(acc, 'reactivated'))
|
||||
self.receiving: _1m1w1y24hBasePattern[StoredU32] = _1m1w1y24hBasePattern(client, _m(acc, 'receiving'))
|
||||
self.sending: _1m1w1y24hBasePattern[StoredU32] = _1m1w1y24hBasePattern(client, _m(acc, 'sending'))
|
||||
|
||||
class BtcCentsSatsUsdPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
@@ -2729,27 +2719,27 @@ class BtcCentsSatsUsdPattern:
|
||||
self.sats: SeriesPattern1[Sats] = SeriesPattern1(client, _m(acc, 'sats'))
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'usd'))
|
||||
|
||||
class CentsDeltaRelUsdPattern:
|
||||
class CentsDeltaToUsdPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.cents: SeriesPattern1[Cents] = SeriesPattern1(client, _m(acc, 'cents'))
|
||||
self.delta: AbsoluteRatePattern2 = AbsoluteRatePattern2(client, _m(acc, 'delta'))
|
||||
self.rel_to_own_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_own_mcap'))
|
||||
self.to_own_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'to_own_mcap'))
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, acc)
|
||||
|
||||
class CentsRelUsdPattern2:
|
||||
class CentsToUsdPattern2:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.cents: SeriesPattern1[CentsSigned] = SeriesPattern1(client, _m(acc, 'cents'))
|
||||
self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_gross_pnl'))
|
||||
self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_mcap'))
|
||||
self.to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'to_own_gross_pnl'))
|
||||
self.to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'to_own_mcap'))
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, acc)
|
||||
|
||||
class CoindaysCoinyearsDormancySentPattern:
|
||||
class CoindaysCoinyearsDormancyTransferPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
pass
|
||||
|
||||
@@ -2802,14 +2792,14 @@ class BaseCumulativeSumPattern4:
|
||||
self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative'))
|
||||
self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'sum'))
|
||||
|
||||
class BaseCumulativeRelPattern:
|
||||
class BaseCumulativeToPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.base: SeriesPattern1[Cents] = SeriesPattern1(client, acc)
|
||||
self.cumulative: SeriesPattern1[Cents] = SeriesPattern1(client, _m(acc, 'cumulative'))
|
||||
self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_rcap'))
|
||||
self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'to_rcap'))
|
||||
|
||||
class BaseCumulativeSumPattern3:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
@@ -2923,6 +2913,15 @@ class GreedNetPainPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
pass
|
||||
|
||||
class InvestorPricePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.investor_lower_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'lower_band'))
|
||||
self.investor_upper_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'upper_band'))
|
||||
self.price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, _m(acc, 'price'))
|
||||
|
||||
class LossNuplProfitPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2932,10 +2931,6 @@ class LossNuplProfitPattern:
|
||||
self.nupl: BpsRatioPattern = BpsRatioPattern(client, _m(acc, 'nupl'))
|
||||
self.profit: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, _m(acc, 'unrealized_profit'))
|
||||
|
||||
class LowerPriceUpperPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
pass
|
||||
|
||||
class NuplRealizedSupplyPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -2963,8 +2958,8 @@ class _6bBlockTxPattern(Generic[T]):
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self._6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2[T] = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, _m(acc, '6b'))
|
||||
self.block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2[T] = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, acc)
|
||||
self._6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern[T] = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, '6b'))
|
||||
self.block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern[T] = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc)
|
||||
self.tx_index: SeriesPattern19[T] = SeriesPattern19(client, acc)
|
||||
|
||||
class BaseCumulativeSumPattern(Generic[T]):
|
||||
@@ -3008,6 +3003,14 @@ class AllSthPattern:
|
||||
self.all: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'realized_cap'))
|
||||
self.sth: SeriesPattern1[Dollars] = SeriesPattern1(client, _m(acc, 'sth_realized_cap'))
|
||||
|
||||
class BaseDeltaPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.base: SeriesPattern1[StoredU64] = SeriesPattern1(client, acc)
|
||||
self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta'))
|
||||
|
||||
class BlocksDominancePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
@@ -3048,21 +3051,13 @@ class CentsUsdPattern:
|
||||
self.cents: SeriesPattern1[CentsSigned] = SeriesPattern1(client, _m(acc, 'cents'))
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, acc)
|
||||
|
||||
class CoindaysSentPattern:
|
||||
class CoindaysTransferPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, _m(acc, 'coindays_destroyed'))
|
||||
self.sent: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, _m(acc, 'sent'))
|
||||
|
||||
class DeltaInnerPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, _m(acc, 'delta'))
|
||||
self.inner: SeriesPattern1[StoredU64] = SeriesPattern1(client, acc)
|
||||
self.transfer_volume: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, _m(acc, 'transfer_volume'))
|
||||
|
||||
class InPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
@@ -3080,17 +3075,17 @@ class PriceRatioPattern:
|
||||
self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, disc))
|
||||
self.ratio: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, f'ratio_{disc}'))
|
||||
|
||||
class RelPattern:
|
||||
class SdSmaPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
pass
|
||||
|
||||
class ToPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'mcap'))
|
||||
self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rcap'))
|
||||
|
||||
class SdSmaPattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
pass
|
||||
self.to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'mcap'))
|
||||
self.to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rcap'))
|
||||
|
||||
class ValuePattern:
|
||||
"""Pattern struct for repeated tree structure."""
|
||||
@@ -3119,7 +3114,7 @@ class UnspentPattern:
|
||||
|
||||
def __init__(self, client: BrkClientBase, acc: str):
|
||||
"""Create pattern node with accumulated series name."""
|
||||
self.unspent_count: DeltaInnerPattern = DeltaInnerPattern(client, acc)
|
||||
self.unspent_count: BaseDeltaPattern = BaseDeltaPattern(client, acc)
|
||||
|
||||
# Series tree classes
|
||||
|
||||
@@ -3128,11 +3123,11 @@ class SeriesTree_Blocks_Difficulty:
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.value: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'difficulty')
|
||||
self.as_hash: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'difficulty_as_hash')
|
||||
self.hashrate: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'difficulty_hashrate')
|
||||
self.adjustment: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'difficulty_adjustment')
|
||||
self.epoch: SeriesPattern1[Epoch] = SeriesPattern1(client, 'difficulty_epoch')
|
||||
self.blocks_before_next: SeriesPattern1[StoredU32] = SeriesPattern1(client, 'blocks_before_next_difficulty_adjustment')
|
||||
self.days_before_next: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'days_before_next_difficulty_adjustment')
|
||||
self.blocks_to_retarget: SeriesPattern1[StoredU32] = SeriesPattern1(client, 'blocks_to_retarget')
|
||||
self.days_to_retarget: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'days_to_retarget')
|
||||
|
||||
class SeriesTree_Blocks_Time:
|
||||
"""Series tree node."""
|
||||
@@ -3146,7 +3141,7 @@ class SeriesTree_Blocks_Size:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.total: SeriesPattern18[StoredU64] = SeriesPattern18(client, 'total_size')
|
||||
self.base: SeriesPattern18[StoredU64] = SeriesPattern18(client, 'total_size')
|
||||
self.cumulative: SeriesPattern1[StoredU64] = SeriesPattern1(client, 'block_size_cumulative')
|
||||
self.sum: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_sum')
|
||||
self.average: _1m1w1y24hPattern[StoredU64] = _1m1w1y24hPattern(client, 'block_size_average')
|
||||
@@ -3162,7 +3157,7 @@ class SeriesTree_Blocks_Weight:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.raw: SeriesPattern18[Weight] = SeriesPattern18(client, 'block_weight')
|
||||
self.base: SeriesPattern18[Weight] = SeriesPattern18(client, 'block_weight')
|
||||
self.cumulative: SeriesPattern1[Weight] = SeriesPattern1(client, 'block_weight_cumulative')
|
||||
self.sum: _1m1w1y24hPattern[Weight] = _1m1w1y24hPattern(client, 'block_weight_sum')
|
||||
self.average: _1m1w1y24hPattern[Weight] = _1m1w1y24hPattern(client, 'block_weight_average')
|
||||
@@ -3233,7 +3228,7 @@ class SeriesTree_Blocks_Fullness:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.bps: _1m1w1y24hHeightPattern[BasisPoints16] = _1m1w1y24hHeightPattern(client, 'block_fullness_bps')
|
||||
self.bps: _1m1w1y24hBasePattern[BasisPoints16] = _1m1w1y24hBasePattern(client, 'block_fullness_bps')
|
||||
self.ratio: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'block_fullness_ratio')
|
||||
self.percent: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'block_fullness')
|
||||
|
||||
@@ -3242,8 +3237,8 @@ class SeriesTree_Blocks_Halving:
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.epoch: SeriesPattern1[Halving] = SeriesPattern1(client, 'halving_epoch')
|
||||
self.blocks_before_next: SeriesPattern1[StoredU32] = SeriesPattern1(client, 'blocks_before_next_halving')
|
||||
self.days_before_next: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'days_before_next_halving')
|
||||
self.blocks_to_halving: SeriesPattern1[StoredU32] = SeriesPattern1(client, 'blocks_to_halving')
|
||||
self.days_to_halving: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'days_to_halving')
|
||||
|
||||
class SeriesTree_Blocks:
|
||||
"""Series tree node."""
|
||||
@@ -3256,8 +3251,8 @@ class SeriesTree_Blocks:
|
||||
self.weight: SeriesTree_Blocks_Weight = SeriesTree_Blocks_Weight(client)
|
||||
self.count: SeriesTree_Blocks_Count = SeriesTree_Blocks_Count(client)
|
||||
self.lookback: SeriesTree_Blocks_Lookback = SeriesTree_Blocks_Lookback(client)
|
||||
self.interval: _1m1w1y24hHeightPattern[Timestamp] = _1m1w1y24hHeightPattern(client, 'block_interval')
|
||||
self.vbytes: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, 'block_vbytes')
|
||||
self.interval: _1m1w1y24hBasePattern[Timestamp] = _1m1w1y24hBasePattern(client, 'block_interval')
|
||||
self.vbytes: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'block_vbytes')
|
||||
self.fullness: SeriesTree_Blocks_Fullness = SeriesTree_Blocks_Fullness(client)
|
||||
self.halving: SeriesTree_Blocks_Halving = SeriesTree_Blocks_Halving(client)
|
||||
|
||||
@@ -3280,7 +3275,7 @@ class SeriesTree_Transactions_Count:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.total: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, 'tx_count')
|
||||
self.total: AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2 = AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern2(client, 'tx_count')
|
||||
self.is_coinbase: SeriesPattern19[StoredBool] = SeriesPattern19(client, 'is_coinbase')
|
||||
|
||||
class SeriesTree_Transactions_Size:
|
||||
@@ -3311,8 +3306,8 @@ class SeriesTree_Transactions_Volume:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.sent_sum: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, 'sent_sum')
|
||||
self.received_sum: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, 'received_sum')
|
||||
self.transfer_volume: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, 'exact_transfer_volume')
|
||||
self.output_volume: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, 'output_volume')
|
||||
self.tx_per_sec: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'tx_per_sec')
|
||||
self.outputs_per_sec: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'outputs_per_sec')
|
||||
self.inputs_per_sec: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'inputs_per_sec')
|
||||
@@ -3617,14 +3612,14 @@ class SeriesTree_Mining_Rewards_Subsidy:
|
||||
self.dominance: _1m1w1y24hBpsPercentRatioPattern = _1m1w1y24hBpsPercentRatioPattern(client, 'subsidy_dominance')
|
||||
self.sma_1y: CentsUsdPattern2 = CentsUsdPattern2(client, 'subsidy_sma_1y')
|
||||
|
||||
class SeriesTree_Mining_Rewards_Fees_RatioMultiple:
|
||||
class SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._24h: BpsRatioPattern2 = BpsRatioPattern2(client, 'fee_ratio_multiple_24h')
|
||||
self._1w: BpsRatioPattern2 = BpsRatioPattern2(client, 'fee_ratio_multiple_1w')
|
||||
self._1m: BpsRatioPattern2 = BpsRatioPattern2(client, 'fee_ratio_multiple_1m')
|
||||
self._1y: BpsRatioPattern2 = BpsRatioPattern2(client, 'fee_ratio_multiple_1y')
|
||||
self._24h: BpsRatioPattern2 = BpsRatioPattern2(client, 'fee_to_subsidy_ratio_24h')
|
||||
self._1w: BpsRatioPattern2 = BpsRatioPattern2(client, 'fee_to_subsidy_ratio_1w')
|
||||
self._1m: BpsRatioPattern2 = BpsRatioPattern2(client, 'fee_to_subsidy_ratio_1m')
|
||||
self._1y: BpsRatioPattern2 = BpsRatioPattern2(client, 'fee_to_subsidy_ratio_1y')
|
||||
|
||||
class SeriesTree_Mining_Rewards_Fees:
|
||||
"""Series tree node."""
|
||||
@@ -3633,12 +3628,16 @@ class SeriesTree_Mining_Rewards_Fees:
|
||||
self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'fees')
|
||||
self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'fees_cumulative')
|
||||
self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_sum')
|
||||
self._24h: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'fees_24h')
|
||||
self._1w: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'fees_1w')
|
||||
self._1m: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'fees_1m')
|
||||
self._1y: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'fees_1y')
|
||||
self.average: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_average')
|
||||
self.min: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_min')
|
||||
self.max: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_max')
|
||||
self.pct10: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_pct10')
|
||||
self.pct25: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_pct25')
|
||||
self.median: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_median')
|
||||
self.pct75: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_pct75')
|
||||
self.pct90: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_pct90')
|
||||
self.dominance: _1m1w1y24hBpsPercentRatioPattern = _1m1w1y24hBpsPercentRatioPattern(client, 'fee_dominance')
|
||||
self.ratio_multiple: SeriesTree_Mining_Rewards_Fees_RatioMultiple = SeriesTree_Mining_Rewards_Fees_RatioMultiple(client)
|
||||
self.to_subsidy_ratio: SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio = SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio(client)
|
||||
|
||||
class SeriesTree_Mining_Rewards:
|
||||
"""Series tree node."""
|
||||
@@ -3690,7 +3689,8 @@ class SeriesTree_Cointime_Activity:
|
||||
self.coinblocks_stored: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coinblocks_stored')
|
||||
self.liveliness: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'liveliness')
|
||||
self.vaultedness: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'vaultedness')
|
||||
self.ratio: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'activity_to_vaultedness_ratio')
|
||||
self.ratio: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'activity_to_vaultedness')
|
||||
self.coinblocks_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coinblocks_destroyed')
|
||||
|
||||
class SeriesTree_Cointime_Supply:
|
||||
"""Series tree node."""
|
||||
@@ -3731,7 +3731,6 @@ class SeriesTree_Cointime_Prices:
|
||||
self.balanced: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'balanced_price')
|
||||
self.terminal: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'terminal_price')
|
||||
self.delta: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'delta_price')
|
||||
self.cumulative_market_cap: SeriesPattern1[Dollars] = SeriesPattern1(client, 'cumulative_market_cap')
|
||||
|
||||
class SeriesTree_Cointime_Adjusted:
|
||||
"""Series tree node."""
|
||||
@@ -3760,7 +3759,6 @@ class SeriesTree_Cointime:
|
||||
self.prices: SeriesTree_Cointime_Prices = SeriesTree_Cointime_Prices(client)
|
||||
self.adjusted: SeriesTree_Cointime_Adjusted = SeriesTree_Cointime_Adjusted(client)
|
||||
self.reserve_risk: SeriesTree_Cointime_ReserveRisk = SeriesTree_Cointime_ReserveRisk(client)
|
||||
self.coinblocks_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coinblocks_destroyed')
|
||||
|
||||
class SeriesTree_Constants:
|
||||
"""Series tree node."""
|
||||
@@ -4078,12 +4076,12 @@ class SeriesTree_Indicators:
|
||||
self.nvt: BpsRatioPattern2 = BpsRatioPattern2(client, 'nvt')
|
||||
self.gini: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'gini')
|
||||
self.rhodl_ratio: BpsRatioPattern2 = BpsRatioPattern2(client, 'rhodl_ratio')
|
||||
self.thermocap_multiple: BpsRatioPattern2 = BpsRatioPattern2(client, 'thermocap_multiple')
|
||||
self.thermo_cap_multiple: BpsRatioPattern2 = BpsRatioPattern2(client, 'thermo_cap_multiple')
|
||||
self.coindays_destroyed_supply_adjusted: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'coindays_destroyed_supply_adjusted')
|
||||
self.coinyears_destroyed_supply_adjusted: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'coinyears_destroyed_supply_adjusted')
|
||||
self.dormancy: SeriesTree_Indicators_Dormancy = SeriesTree_Indicators_Dormancy(client)
|
||||
self.stock_to_flow: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'stock_to_flow')
|
||||
self.seller_exhaustion_constant: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'seller_exhaustion_constant')
|
||||
self.seller_exhaustion: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'seller_exhaustion')
|
||||
|
||||
class SeriesTree_Market_Ath:
|
||||
"""Series tree node."""
|
||||
@@ -4100,19 +4098,19 @@ class SeriesTree_Market_Lookback:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self._24h: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_24h')
|
||||
self._1w: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_1w')
|
||||
self._1m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_1m')
|
||||
self._3m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_3m')
|
||||
self._6m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_6m')
|
||||
self._1y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_1y')
|
||||
self._2y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_2y')
|
||||
self._3y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_3y')
|
||||
self._4y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_4y')
|
||||
self._5y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_5y')
|
||||
self._6y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_6y')
|
||||
self._8y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_8y')
|
||||
self._10y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_lookback_10y')
|
||||
self._24h: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_24h')
|
||||
self._1w: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_1w')
|
||||
self._1m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_1m')
|
||||
self._3m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_3m')
|
||||
self._6m: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_6m')
|
||||
self._1y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_1y')
|
||||
self._2y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_2y')
|
||||
self._3y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_3y')
|
||||
self._4y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_4y')
|
||||
self._5y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_5y')
|
||||
self._6y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_6y')
|
||||
self._8y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_8y')
|
||||
self._10y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'price_past_10y')
|
||||
|
||||
class SeriesTree_Market_Returns_Periods:
|
||||
"""Series tree node."""
|
||||
@@ -4611,7 +4609,7 @@ class SeriesTree_Pools:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.height_to_pool: SeriesPattern18[PoolSlug] = SeriesPattern18(client, 'pool')
|
||||
self.pool: SeriesPattern18[PoolSlug] = SeriesPattern18(client, 'pool')
|
||||
self.major: SeriesTree_Pools_Major = SeriesTree_Pools_Major(client)
|
||||
self.minor: SeriesTree_Pools_Minor = SeriesTree_Pools_Minor(client)
|
||||
|
||||
@@ -4648,12 +4646,6 @@ class SeriesTree_Prices:
|
||||
self.ohlc: SeriesTree_Prices_Ohlc = SeriesTree_Prices_Ohlc(client)
|
||||
self.spot: SeriesTree_Prices_Spot = SeriesTree_Prices_Spot(client)
|
||||
|
||||
class SeriesTree_Supply_Burned:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.unspendable: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, 'unspendable_supply')
|
||||
|
||||
class SeriesTree_Supply_Velocity:
|
||||
"""Series tree node."""
|
||||
|
||||
@@ -4667,12 +4659,12 @@ class SeriesTree_Supply:
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.state: SeriesPattern18[SupplyState] = SeriesPattern18(client, 'supply_state')
|
||||
self.circulating: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'circulating_supply')
|
||||
self.burned: SeriesTree_Supply_Burned = SeriesTree_Supply_Burned(client)
|
||||
self.burned: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, 'unspendable_supply')
|
||||
self.inflation_rate: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'inflation_rate')
|
||||
self.velocity: SeriesTree_Supply_Velocity = SeriesTree_Supply_Velocity(client)
|
||||
self.market_cap: CentsDeltaUsdPattern = CentsDeltaUsdPattern(client, 'market_cap')
|
||||
self.market_minus_realized_cap_growth_rate: _1m1w1y24hPattern[BasisPointsSigned32] = _1m1w1y24hPattern(client, 'market_minus_realized_cap_growth_rate')
|
||||
self.hodled_or_lost: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'hodled_or_lost_coins')
|
||||
self.hodled_or_lost: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'hodled_or_lost_supply')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_All_Supply:
|
||||
"""Series tree node."""
|
||||
@@ -4681,14 +4673,14 @@ class SeriesTree_Cohorts_Utxo_All_Supply:
|
||||
self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply')
|
||||
self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply_half')
|
||||
self.delta: AbsoluteRatePattern = AbsoluteRatePattern(client, 'supply_delta')
|
||||
self.in_profit: BtcCentsRelSatsUsdPattern2 = BtcCentsRelSatsUsdPattern2(client, 'supply_in_profit')
|
||||
self.in_loss: BtcCentsRelSatsUsdPattern2 = BtcCentsRelSatsUsdPattern2(client, 'supply_in_loss')
|
||||
self.in_profit: BtcCentsSatsToUsdPattern2 = BtcCentsSatsToUsdPattern2(client, 'supply_in_profit')
|
||||
self.in_loss: BtcCentsSatsToUsdPattern2 = BtcCentsSatsToUsdPattern2(client, 'supply_in_loss')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_All_Activity:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.sent: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'sent')
|
||||
self.transfer_volume: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'transfer_volume')
|
||||
self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coindays_destroyed')
|
||||
self.coinyears_destroyed: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'coinyears_destroyed')
|
||||
self.dormancy: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'dormancy')
|
||||
@@ -4700,7 +4692,7 @@ class SeriesTree_Cohorts_Utxo_All_Realized_Profit:
|
||||
self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'realized_profit')
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'realized_profit_cumulative')
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'realized_profit_sum')
|
||||
self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'realized_profit_rel_to_rcap')
|
||||
self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'realized_profit_to_rcap')
|
||||
self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'profit_value_created')
|
||||
self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'profit_value_destroyed')
|
||||
self.distribution_flow: SeriesPattern1[Dollars] = SeriesPattern1(client, 'distribution_flow')
|
||||
@@ -4713,7 +4705,7 @@ class SeriesTree_Cohorts_Utxo_All_Realized_Loss:
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'realized_loss_cumulative')
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'realized_loss_sum')
|
||||
self.negative: SeriesPattern1[Dollars] = SeriesPattern1(client, 'neg_realized_loss')
|
||||
self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'realized_loss_rel_to_rcap')
|
||||
self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'realized_loss_to_rcap')
|
||||
self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'loss_value_created')
|
||||
self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'loss_value_destroyed')
|
||||
self.capitulation_flow: SeriesPattern1[Dollars] = SeriesPattern1(client, 'capitulation_flow')
|
||||
@@ -4837,29 +4829,21 @@ class SeriesTree_Cohorts_Utxo_All_Realized_Sopr:
|
||||
self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sopr')
|
||||
self.adjusted: SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted = SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted(client)
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_All_Realized_Investor:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'investor_price')
|
||||
self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lower_price_band')
|
||||
self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'upper_price_band')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_All_Realized:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.cap: CentsDeltaRelUsdPattern = CentsDeltaRelUsdPattern(client, 'realized_cap')
|
||||
self.cap: CentsDeltaToUsdPattern = CentsDeltaToUsdPattern(client, 'realized_cap')
|
||||
self.profit: SeriesTree_Cohorts_Utxo_All_Realized_Profit = SeriesTree_Cohorts_Utxo_All_Realized_Profit(client)
|
||||
self.loss: SeriesTree_Cohorts_Utxo_All_Realized_Loss = SeriesTree_Cohorts_Utxo_All_Realized_Loss(client)
|
||||
self.price: SeriesTree_Cohorts_Utxo_All_Realized_Price = SeriesTree_Cohorts_Utxo_All_Realized_Price(client)
|
||||
self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'mvrv')
|
||||
self.sopr: SeriesTree_Cohorts_Utxo_All_Realized_Sopr = SeriesTree_Cohorts_Utxo_All_Realized_Sopr(client)
|
||||
self.net_pnl: BaseChangeCumulativeDeltaRelSumPattern = BaseChangeCumulativeDeltaRelSumPattern(client, 'net')
|
||||
self.net_pnl: BaseChangeCumulativeDeltaSumToPattern = BaseChangeCumulativeDeltaSumToPattern(client, 'net')
|
||||
self.gross_pnl: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'realized_gross_pnl')
|
||||
self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'sell_side_risk_ratio')
|
||||
self.peak_regret: BaseCumulativeRelPattern = BaseCumulativeRelPattern(client, 'realized_peak_regret')
|
||||
self.investor: SeriesTree_Cohorts_Utxo_All_Realized_Investor = SeriesTree_Cohorts_Utxo_All_Realized_Investor(client)
|
||||
self.peak_regret: BaseCumulativeToPattern = BaseCumulativeToPattern(client, 'realized_peak_regret')
|
||||
self.investor: InvestorPricePattern = InvestorPricePattern(client, 'investor')
|
||||
self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'realized_profit_to_loss_ratio')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_All_CostBasis:
|
||||
@@ -4879,8 +4863,8 @@ class SeriesTree_Cohorts_Utxo_All_Unrealized_Profit:
|
||||
self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'unrealized_profit')
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'unrealized_profit_cumulative')
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'unrealized_profit_sum')
|
||||
self.rel_to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_profit_rel_to_mcap')
|
||||
self.rel_to_own_gross: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_profit_rel_to_own_gross_pnl')
|
||||
self.to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_profit_to_mcap')
|
||||
self.to_own_gross_pnl: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_profit_to_own_gross_pnl')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_All_Unrealized_Loss:
|
||||
"""Series tree node."""
|
||||
@@ -4890,8 +4874,8 @@ class SeriesTree_Cohorts_Utxo_All_Unrealized_Loss:
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'unrealized_loss_cumulative')
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'unrealized_loss_sum')
|
||||
self.negative: SeriesPattern1[Dollars] = SeriesPattern1(client, 'neg_unrealized_loss')
|
||||
self.rel_to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_loss_rel_to_mcap')
|
||||
self.rel_to_own_gross: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_loss_rel_to_own_gross_pnl')
|
||||
self.to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_loss_to_mcap')
|
||||
self.to_own_gross_pnl: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_loss_to_own_gross_pnl')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_All_Unrealized_NetPnl:
|
||||
"""Series tree node."""
|
||||
@@ -4899,7 +4883,7 @@ class SeriesTree_Cohorts_Utxo_All_Unrealized_NetPnl:
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, 'net_unrealized_pnl')
|
||||
self.cents: SeriesPattern1[CentsSigned] = SeriesPattern1(client, 'net_unrealized_pnl_cents')
|
||||
self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'net_unrealized_pnl_rel_to_own_gross_pnl')
|
||||
self.to_own_gross_pnl: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'net_unrealized_pnl_to_own_gross_pnl')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_All_Unrealized_Sentiment:
|
||||
"""Series tree node."""
|
||||
@@ -4936,7 +4920,7 @@ class SeriesTree_Cohorts_Utxo_Sth_Activity:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.sent: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'sth_sent')
|
||||
self.transfer_volume: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'sth_transfer_volume')
|
||||
self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'sth_coindays_destroyed')
|
||||
self.coinyears_destroyed: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'sth_coinyears_destroyed')
|
||||
self.dormancy: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'sth_dormancy')
|
||||
@@ -4948,7 +4932,7 @@ class SeriesTree_Cohorts_Utxo_Sth_Realized_Profit:
|
||||
self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_realized_profit')
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_realized_profit_cumulative')
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'sth_realized_profit_sum')
|
||||
self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'sth_realized_profit_rel_to_rcap')
|
||||
self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'sth_realized_profit_to_rcap')
|
||||
self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_profit_value_created')
|
||||
self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_profit_value_destroyed')
|
||||
self.distribution_flow: SeriesPattern1[Dollars] = SeriesPattern1(client, 'sth_distribution_flow')
|
||||
@@ -4961,7 +4945,7 @@ class SeriesTree_Cohorts_Utxo_Sth_Realized_Loss:
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_realized_loss_cumulative')
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'sth_realized_loss_sum')
|
||||
self.negative: SeriesPattern1[Dollars] = SeriesPattern1(client, 'sth_neg_realized_loss')
|
||||
self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'sth_realized_loss_rel_to_rcap')
|
||||
self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'sth_realized_loss_to_rcap')
|
||||
self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_loss_value_created')
|
||||
self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'sth_loss_value_destroyed')
|
||||
self.capitulation_flow: SeriesPattern1[Dollars] = SeriesPattern1(client, 'sth_capitulation_flow')
|
||||
@@ -5085,29 +5069,21 @@ class SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr:
|
||||
self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sth_sopr')
|
||||
self.adjusted: SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted = SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr_Adjusted(client)
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_Sth_Realized_Investor:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'sth_investor_price')
|
||||
self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_lower_price_band')
|
||||
self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'sth_upper_price_band')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_Sth_Realized:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.cap: CentsDeltaRelUsdPattern = CentsDeltaRelUsdPattern(client, 'sth_realized_cap')
|
||||
self.cap: CentsDeltaToUsdPattern = CentsDeltaToUsdPattern(client, 'sth_realized_cap')
|
||||
self.profit: SeriesTree_Cohorts_Utxo_Sth_Realized_Profit = SeriesTree_Cohorts_Utxo_Sth_Realized_Profit(client)
|
||||
self.loss: SeriesTree_Cohorts_Utxo_Sth_Realized_Loss = SeriesTree_Cohorts_Utxo_Sth_Realized_Loss(client)
|
||||
self.price: SeriesTree_Cohorts_Utxo_Sth_Realized_Price = SeriesTree_Cohorts_Utxo_Sth_Realized_Price(client)
|
||||
self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'sth_mvrv')
|
||||
self.sopr: SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr = SeriesTree_Cohorts_Utxo_Sth_Realized_Sopr(client)
|
||||
self.net_pnl: BaseChangeCumulativeDeltaRelSumPattern = BaseChangeCumulativeDeltaRelSumPattern(client, 'sth_net')
|
||||
self.net_pnl: BaseChangeCumulativeDeltaSumToPattern = BaseChangeCumulativeDeltaSumToPattern(client, 'sth_net')
|
||||
self.gross_pnl: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'sth_realized_gross_pnl')
|
||||
self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'sth_sell_side_risk_ratio')
|
||||
self.peak_regret: BaseCumulativeRelPattern = BaseCumulativeRelPattern(client, 'sth_realized_peak_regret')
|
||||
self.investor: SeriesTree_Cohorts_Utxo_Sth_Realized_Investor = SeriesTree_Cohorts_Utxo_Sth_Realized_Investor(client)
|
||||
self.peak_regret: BaseCumulativeToPattern = BaseCumulativeToPattern(client, 'sth_realized_peak_regret')
|
||||
self.investor: InvestorPricePattern = InvestorPricePattern(client, 'sth_investor')
|
||||
self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'sth_realized_profit_to_loss_ratio')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_Sth_CostBasis:
|
||||
@@ -5133,9 +5109,9 @@ class SeriesTree_Cohorts_Utxo_Sth_Unrealized:
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.nupl: BpsRatioPattern = BpsRatioPattern(client, 'sth_nupl')
|
||||
self.profit: BaseCumulativeRelSumPattern2 = BaseCumulativeRelSumPattern2(client, 'sth_unrealized_profit')
|
||||
self.loss: BaseCumulativeNegativeRelSumPattern2 = BaseCumulativeNegativeRelSumPattern2(client, 'sth')
|
||||
self.net_pnl: CentsRelUsdPattern2 = CentsRelUsdPattern2(client, 'sth_net_unrealized_pnl')
|
||||
self.profit: BaseCumulativeSumToPattern2 = BaseCumulativeSumToPattern2(client, 'sth_unrealized_profit')
|
||||
self.loss: BaseCumulativeNegativeSumToPattern2 = BaseCumulativeNegativeSumToPattern2(client, 'sth')
|
||||
self.net_pnl: CentsToUsdPattern2 = CentsToUsdPattern2(client, 'sth_net_unrealized_pnl')
|
||||
self.gross_pnl: CentsUsdPattern2 = CentsUsdPattern2(client, 'sth_unrealized_gross_pnl')
|
||||
self.invested_capital: InPattern = InPattern(client, 'sth_invested_capital_in')
|
||||
self.sentiment: SeriesTree_Cohorts_Utxo_Sth_Unrealized_Sentiment = SeriesTree_Cohorts_Utxo_Sth_Unrealized_Sentiment(client)
|
||||
@@ -5144,7 +5120,7 @@ class SeriesTree_Cohorts_Utxo_Sth:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.supply: DeltaHalfInRelTotalPattern2 = DeltaHalfInRelTotalPattern2(client, 'sth_supply')
|
||||
self.supply: DeltaHalfInToTotalPattern2 = DeltaHalfInToTotalPattern2(client, 'sth_supply')
|
||||
self.outputs: UnspentPattern = UnspentPattern(client, 'sth_utxo_count')
|
||||
self.activity: SeriesTree_Cohorts_Utxo_Sth_Activity = SeriesTree_Cohorts_Utxo_Sth_Activity(client)
|
||||
self.realized: SeriesTree_Cohorts_Utxo_Sth_Realized = SeriesTree_Cohorts_Utxo_Sth_Realized(client)
|
||||
@@ -5155,7 +5131,7 @@ class SeriesTree_Cohorts_Utxo_Lth_Activity:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.sent: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'lth_sent')
|
||||
self.transfer_volume: BaseCumulativeInSumPattern = BaseCumulativeInSumPattern(client, 'lth_transfer_volume')
|
||||
self.coindays_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'lth_coindays_destroyed')
|
||||
self.coinyears_destroyed: SeriesPattern1[StoredF64] = SeriesPattern1(client, 'lth_coinyears_destroyed')
|
||||
self.dormancy: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'lth_dormancy')
|
||||
@@ -5167,7 +5143,7 @@ class SeriesTree_Cohorts_Utxo_Lth_Realized_Profit:
|
||||
self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_realized_profit')
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_realized_profit_cumulative')
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'lth_realized_profit_sum')
|
||||
self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'lth_realized_profit_rel_to_rcap')
|
||||
self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'lth_realized_profit_to_rcap')
|
||||
self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_profit_value_created')
|
||||
self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_profit_value_destroyed')
|
||||
self.distribution_flow: SeriesPattern1[Dollars] = SeriesPattern1(client, 'lth_distribution_flow')
|
||||
@@ -5180,7 +5156,7 @@ class SeriesTree_Cohorts_Utxo_Lth_Realized_Loss:
|
||||
self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_realized_loss_cumulative')
|
||||
self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'lth_realized_loss_sum')
|
||||
self.negative: SeriesPattern1[Dollars] = SeriesPattern1(client, 'lth_neg_realized_loss')
|
||||
self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'lth_realized_loss_rel_to_rcap')
|
||||
self.to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'lth_realized_loss_to_rcap')
|
||||
self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_loss_value_created')
|
||||
self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_loss_value_destroyed')
|
||||
self.capitulation_flow: SeriesPattern1[Dollars] = SeriesPattern1(client, 'lth_capitulation_flow')
|
||||
@@ -5295,29 +5271,21 @@ class SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr:
|
||||
self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, 'lth_value_destroyed')
|
||||
self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_sopr')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_Lth_Realized_Investor:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.price: BpsCentsPercentilesRatioSatsUsdPattern = BpsCentsPercentilesRatioSatsUsdPattern(client, 'lth_investor_price')
|
||||
self.lower_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_lower_price_band')
|
||||
self.upper_price_band: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'lth_upper_price_band')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_Lth_Realized:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.cap: CentsDeltaRelUsdPattern = CentsDeltaRelUsdPattern(client, 'lth_realized_cap')
|
||||
self.cap: CentsDeltaToUsdPattern = CentsDeltaToUsdPattern(client, 'lth_realized_cap')
|
||||
self.profit: SeriesTree_Cohorts_Utxo_Lth_Realized_Profit = SeriesTree_Cohorts_Utxo_Lth_Realized_Profit(client)
|
||||
self.loss: SeriesTree_Cohorts_Utxo_Lth_Realized_Loss = SeriesTree_Cohorts_Utxo_Lth_Realized_Loss(client)
|
||||
self.price: SeriesTree_Cohorts_Utxo_Lth_Realized_Price = SeriesTree_Cohorts_Utxo_Lth_Realized_Price(client)
|
||||
self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'lth_mvrv')
|
||||
self.sopr: SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr = SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr(client)
|
||||
self.net_pnl: BaseChangeCumulativeDeltaRelSumPattern = BaseChangeCumulativeDeltaRelSumPattern(client, 'lth_net')
|
||||
self.net_pnl: BaseChangeCumulativeDeltaSumToPattern = BaseChangeCumulativeDeltaSumToPattern(client, 'lth_net')
|
||||
self.gross_pnl: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'lth_realized_gross_pnl')
|
||||
self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'lth_sell_side_risk_ratio')
|
||||
self.peak_regret: BaseCumulativeRelPattern = BaseCumulativeRelPattern(client, 'lth_realized_peak_regret')
|
||||
self.investor: SeriesTree_Cohorts_Utxo_Lth_Realized_Investor = SeriesTree_Cohorts_Utxo_Lth_Realized_Investor(client)
|
||||
self.peak_regret: BaseCumulativeToPattern = BaseCumulativeToPattern(client, 'lth_realized_peak_regret')
|
||||
self.investor: InvestorPricePattern = InvestorPricePattern(client, 'lth_investor')
|
||||
self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_realized_profit_to_loss_ratio')
|
||||
|
||||
class SeriesTree_Cohorts_Utxo_Lth_CostBasis:
|
||||
@@ -5343,9 +5311,9 @@ class SeriesTree_Cohorts_Utxo_Lth_Unrealized:
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.nupl: BpsRatioPattern = BpsRatioPattern(client, 'lth_nupl')
|
||||
self.profit: BaseCumulativeRelSumPattern2 = BaseCumulativeRelSumPattern2(client, 'lth_unrealized_profit')
|
||||
self.loss: BaseCumulativeNegativeRelSumPattern2 = BaseCumulativeNegativeRelSumPattern2(client, 'lth')
|
||||
self.net_pnl: CentsRelUsdPattern2 = CentsRelUsdPattern2(client, 'lth_net_unrealized_pnl')
|
||||
self.profit: BaseCumulativeSumToPattern2 = BaseCumulativeSumToPattern2(client, 'lth_unrealized_profit')
|
||||
self.loss: BaseCumulativeNegativeSumToPattern2 = BaseCumulativeNegativeSumToPattern2(client, 'lth')
|
||||
self.net_pnl: CentsToUsdPattern2 = CentsToUsdPattern2(client, 'lth_net_unrealized_pnl')
|
||||
self.gross_pnl: CentsUsdPattern2 = CentsUsdPattern2(client, 'lth_unrealized_gross_pnl')
|
||||
self.invested_capital: InPattern = InPattern(client, 'lth_invested_capital_in')
|
||||
self.sentiment: SeriesTree_Cohorts_Utxo_Lth_Unrealized_Sentiment = SeriesTree_Cohorts_Utxo_Lth_Unrealized_Sentiment(client)
|
||||
@@ -5354,7 +5322,7 @@ class SeriesTree_Cohorts_Utxo_Lth:
|
||||
"""Series tree node."""
|
||||
|
||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||
self.supply: DeltaHalfInRelTotalPattern2 = DeltaHalfInRelTotalPattern2(client, 'lth_supply')
|
||||
self.supply: DeltaHalfInToTotalPattern2 = DeltaHalfInToTotalPattern2(client, 'lth_supply')
|
||||
self.outputs: UnspentPattern = UnspentPattern(client, 'lth_utxo_count')
|
||||
self.activity: SeriesTree_Cohorts_Utxo_Lth_Activity = SeriesTree_Cohorts_Utxo_Lth_Activity(client)
|
||||
self.realized: SeriesTree_Cohorts_Utxo_Lth_Realized = SeriesTree_Cohorts_Utxo_Lth_Realized(client)
|
||||
|
||||
@@ -148,24 +148,47 @@ function returnsSubSectionWithCagr(name, periods) {
|
||||
name,
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: `${name} Returns`,
|
||||
bottom: periods.flatMap((p) =>
|
||||
percentRatioBaseline({
|
||||
pattern: p.returns,
|
||||
name: p.id,
|
||||
color: p.color,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...periods.map((p) => ({
|
||||
name: periodIdToName(p.id, true),
|
||||
title: `${periodIdToName(p.id, true)} Returns`,
|
||||
bottom: [
|
||||
...percentRatioBaseline({ pattern: p.returns, name: "Total" }),
|
||||
...percentRatioBaseline({ pattern: p.cagr, name: "annual" }),
|
||||
name: "Total",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: `${name} Total Returns`,
|
||||
bottom: periods.flatMap((p) =>
|
||||
percentRatioBaseline({
|
||||
pattern: p.returns,
|
||||
name: p.id,
|
||||
color: p.color,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...periods.map((p) => ({
|
||||
name: periodIdToName(p.id, true),
|
||||
title: `${periodIdToName(p.id, true)} Total Returns`,
|
||||
bottom: percentRatioBaseline({ pattern: p.returns, name: "Total" }),
|
||||
})),
|
||||
],
|
||||
})),
|
||||
},
|
||||
{
|
||||
name: "CAGR",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: `${name} CAGR`,
|
||||
bottom: periods.flatMap((p) =>
|
||||
percentRatioBaseline({
|
||||
pattern: p.cagr,
|
||||
name: p.id,
|
||||
color: p.color,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...periods.map((p) => ({
|
||||
name: periodIdToName(p.id, true),
|
||||
title: `${periodIdToName(p.id, true)} CAGR`,
|
||||
bottom: percentRatioBaseline({ pattern: p.cagr, name: "CAGR" }),
|
||||
})),
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
@@ -396,20 +419,14 @@ export function createMarketSection() {
|
||||
name: "Capitalization",
|
||||
tree: [
|
||||
{
|
||||
name: "Market Cap",
|
||||
title: "Market Capitalization",
|
||||
name: "Compare",
|
||||
title: "Market vs Realized Capitalization",
|
||||
bottom: [
|
||||
line({
|
||||
series: supply.marketCap.usd,
|
||||
name: "Market Cap",
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Realized Cap",
|
||||
title: "Realized Capitalization",
|
||||
bottom: [
|
||||
line({
|
||||
series: cohorts.utxo.all.realized.cap.usd,
|
||||
name: "Realized Cap",
|
||||
@@ -419,19 +436,168 @@ export function createMarketSection() {
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Growth Rate",
|
||||
title: "Capitalization Growth Rate",
|
||||
bottom: [
|
||||
...percentRatio({
|
||||
pattern: supply.marketCap.delta.rate._24h,
|
||||
name: "Market Cap (24h)",
|
||||
color: colors.bitcoin,
|
||||
}),
|
||||
baseline({
|
||||
series: supply.marketMinusRealizedCapGrowthRate._24h,
|
||||
name: "Market - Realized",
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
name: "Market Cap",
|
||||
tree: [
|
||||
{
|
||||
name: "Value",
|
||||
title: "Market Capitalization",
|
||||
bottom: [
|
||||
line({
|
||||
series: supply.marketCap.usd,
|
||||
name: "Market Cap",
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Absolute",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Market Cap Absolute Change",
|
||||
bottom: ROLLING_WINDOWS.map((w) =>
|
||||
baseline({
|
||||
series: supply.marketCap.delta.absolute[w.key].usd,
|
||||
name: w.name,
|
||||
color: w.color,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...ROLLING_WINDOWS.map((w) => ({
|
||||
name: w.name,
|
||||
title: `Market Cap Absolute Change ${w.name}`,
|
||||
bottom: [
|
||||
baseline({
|
||||
series: supply.marketCap.delta.absolute[w.key].usd,
|
||||
name: w.name,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rate",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Market Cap Growth Rate",
|
||||
bottom: ROLLING_WINDOWS.flatMap((w) =>
|
||||
percentRatio({
|
||||
pattern: supply.marketCap.delta.rate[w.key],
|
||||
name: w.name,
|
||||
color: w.color,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...ROLLING_WINDOWS.map((w) => ({
|
||||
name: w.name,
|
||||
title: `Market Cap Growth Rate ${w.name}`,
|
||||
bottom: percentRatioBaseline({
|
||||
pattern: supply.marketCap.delta.rate[w.key],
|
||||
name: w.name,
|
||||
}),
|
||||
})),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Realized Cap",
|
||||
tree: [
|
||||
{
|
||||
name: "Value",
|
||||
title: "Realized Capitalization",
|
||||
bottom: [
|
||||
line({
|
||||
series: cohorts.utxo.all.realized.cap.usd,
|
||||
name: "Realized Cap",
|
||||
color: colors.realized,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Absolute",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Realized Cap Absolute Change",
|
||||
bottom: ROLLING_WINDOWS.map((w) =>
|
||||
baseline({
|
||||
series: cohorts.utxo.all.realized.cap.delta.absolute[w.key].usd,
|
||||
name: w.name,
|
||||
color: w.color,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...ROLLING_WINDOWS.map((w) => ({
|
||||
name: w.name,
|
||||
title: `Realized Cap Absolute Change ${w.name}`,
|
||||
bottom: [
|
||||
baseline({
|
||||
series: cohorts.utxo.all.realized.cap.delta.absolute[w.key].usd,
|
||||
name: w.name,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rate",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Realized Cap Growth Rate",
|
||||
bottom: ROLLING_WINDOWS.flatMap((w) =>
|
||||
percentRatio({
|
||||
pattern: cohorts.utxo.all.realized.cap.delta.rate[w.key],
|
||||
name: w.name,
|
||||
color: w.color,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...ROLLING_WINDOWS.map((w) => ({
|
||||
name: w.name,
|
||||
title: `Realized Cap Growth Rate ${w.name}`,
|
||||
bottom: percentRatioBaseline({
|
||||
pattern: cohorts.utxo.all.realized.cap.delta.rate[w.key],
|
||||
name: w.name,
|
||||
}),
|
||||
})),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rate Spread",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Capitalization Growth Rate Spread",
|
||||
bottom: ROLLING_WINDOWS.map((w) =>
|
||||
baseline({
|
||||
series: supply.marketMinusRealizedCapGrowthRate[w.key],
|
||||
name: w.name,
|
||||
color: w.color,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...ROLLING_WINDOWS.map((w) => ({
|
||||
name: w.name,
|
||||
title: `Capitalization Growth Rate Spread ${w.name}`,
|
||||
bottom: [
|
||||
baseline({
|
||||
series: supply.marketMinusRealizedCapGrowthRate[w.key],
|
||||
name: w.name,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
],
|
||||
})),
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -681,29 +847,12 @@ export function createMarketSection() {
|
||||
const rsi = technical.rsi[w.key];
|
||||
return {
|
||||
name: w.name,
|
||||
tree: [
|
||||
{
|
||||
name: "Value",
|
||||
title: `RSI (${w.name})`,
|
||||
bottom: [
|
||||
...indexRatio({ pattern: rsi.rsi, name: "RSI", color: colors.indicator.main }),
|
||||
...indexRatio({ pattern: rsi.rsiMax, name: "Max", color: colors.stat.max, defaultActive: false }),
|
||||
...indexRatio({ pattern: rsi.rsiMin, name: "Min", color: colors.stat.min, defaultActive: false }),
|
||||
priceLine({ unit: Unit.index, number: 70 }),
|
||||
priceLine({ unit: Unit.index, number: 50, defaultActive: false }),
|
||||
priceLine({ unit: Unit.index, number: 30 }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Components",
|
||||
title: `RSI Components (${w.name})`,
|
||||
bottom: [
|
||||
line({ series: rsi.averageGain, name: "Avg Gain", color: colors.profit, unit: Unit.usd }),
|
||||
line({ series: rsi.averageLoss, name: "Avg Loss", color: colors.loss, unit: Unit.usd }),
|
||||
line({ series: rsi.gains, name: "Gains", color: colors.profit, defaultActive: false, unit: Unit.usd }),
|
||||
line({ series: rsi.losses, name: "Losses", color: colors.loss, defaultActive: false, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
title: `RSI (${w.name})`,
|
||||
bottom: [
|
||||
...indexRatio({ pattern: rsi.rsi, name: "RSI", color: colors.indicator.main }),
|
||||
priceLine({ unit: Unit.index, number: 70 }),
|
||||
priceLine({ unit: Unit.index, number: 50, defaultActive: false }),
|
||||
priceLine({ unit: Unit.index, number: 30 }),
|
||||
],
|
||||
};
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user