diff --git a/Cargo.lock b/Cargo.lock index 6eb927ab7..b6ff5c430 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4143,9 +4143,9 @@ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" [[package]] name = "seqdb" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f414b042f74d09ee406a7178d4e1ac2f6dfce797b7e305c8d78d8bd92d060b" +checksum = "0068ee8855b29d0251d0277ffb2c2d8872afe0a7124fc9f33a29102af1096f90" dependencies = [ "allocative", "allocative_derive", @@ -5001,9 +5001,9 @@ checksum = "8f54a172d0620933a27a4360d3db3e2ae0dd6cceae9730751a036bbf182c4b23" [[package]] name = "vecdb" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fe0477b8e5824c50d8370775795d288b2f853f5a00e758f105020db0f713f1" +checksum = "9e834cf5275445308e2ab867847d059ac7603de71c35dbe6c197726d1db7c74b" dependencies = [ "allocative", "allocative_derive", @@ -5023,9 +5023,9 @@ dependencies = [ [[package]] name = "vecdb_derive" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c44db4c3f8d08f575daea88915f19f597909fca73c415baa1edccb6cab9a252" +checksum = "2c9acc9a0b85d010ddcd2a4825d2a804520d9c52759bb9b0bc5ef7c4a1e7fce1" dependencies = [ "quote", "syn 2.0.106", diff --git a/Cargo.toml b/Cargo.toml index 431d1674d..78f860e55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,7 @@ serde_derive = "1.0.219" serde_json = { version = "1.0.143", features = ["float_roundtrip"] } tokio = { version = "1.47.1", features = ["rt-multi-thread"] } # vecdb = { path = "../seqdb/crates/vecdb", features = ["derive"]} -vecdb = { version = "0.2.13", features = ["derive"]} +vecdb = { version = "0.2.14", features = ["derive"]} zerocopy = "0.8.27" zerocopy-derive = "0.8.27" diff --git a/crates/brk_computer/src/chain.rs b/crates/brk_computer/src/chain.rs index f17e8cedc..fba64cea3 100644 --- a/crates/brk_computer/src/chain.rs +++ b/crates/brk_computer/src/chain.rs @@ -5,9 +5,9 @@ use brk_error::Result; use brk_indexer::Indexer; use brk_structs::{ Bitcoin, CheckedSub, DateIndex, DecadeIndex, DifficultyEpoch, Dollars, FeeRate, HalvingEpoch, - Height, InputIndex, MonthIndex, OutputIndex, QuarterIndex, Sats, SemesterIndex, StoredBool, - StoredF32, StoredF64, StoredU32, StoredU64, Timestamp, TxIndex, TxVersion, Version, WeekIndex, - Weight, YearIndex, + Height, InputIndex, MonthIndex, ONE_DAY_IN_SEC_F64, OutputIndex, QuarterIndex, Sats, + SemesterIndex, StoredBool, StoredF32, StoredF64, StoredU32, StoredU64, Timestamp, TxIndex, + TxVersion, Version, WeekIndex, Weight, YearIndex, }; use vecdb::{ AnyCloneableIterableVec, AnyCollectableVec, AnyIterableVec, Database, EagerVec, Exit, @@ -136,8 +136,11 @@ pub struct Vecs { pub indexes_to_annualized_volume: ComputedVecsFromDateIndex, pub indexes_to_annualized_volume_btc: ComputedVecsFromDateIndex, pub indexes_to_annualized_volume_usd: ComputedVecsFromDateIndex, - pub indexes_to_velocity_btc: ComputedVecsFromDateIndex, - pub indexes_to_velocity_usd: ComputedVecsFromDateIndex, + pub indexes_to_tx_btc_velocity: ComputedVecsFromDateIndex, + pub indexes_to_tx_usd_velocity: ComputedVecsFromDateIndex, + pub indexes_to_tx_per_sec: ComputedVecsFromDateIndex, + pub indexes_to_outputs_per_sec: ComputedVecsFromDateIndex, + pub indexes_to_inputs_per_sec: ComputedVecsFromDateIndex, } impl Vecs { @@ -1093,22 +1096,46 @@ impl Vecs { indexes, VecBuilderOptions::default().add_last(), )?, - indexes_to_velocity_btc: ComputedVecsFromDateIndex::forced_import( + indexes_to_tx_btc_velocity: ComputedVecsFromDateIndex::forced_import( &db, - "velocity_btc", + "tx_btc_velocity", Source::Compute, version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, - indexes_to_velocity_usd: ComputedVecsFromDateIndex::forced_import( + indexes_to_tx_usd_velocity: ComputedVecsFromDateIndex::forced_import( &db, - "velocity_usd", + "tx_usd_velocity", Source::Compute, version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, + indexes_to_tx_per_sec: ComputedVecsFromDateIndex::forced_import( + &db, + "tx_per_sec", + Source::Compute, + version + Version::TWO, + indexes, + VecBuilderOptions::default().add_last(), + )?, + indexes_to_outputs_per_sec: ComputedVecsFromDateIndex::forced_import( + &db, + "outputs_per_sec", + Source::Compute, + version + Version::TWO, + indexes, + VecBuilderOptions::default().add_last(), + )?, + indexes_to_inputs_per_sec: ComputedVecsFromDateIndex::forced_import( + &db, + "inputs_per_sec", + Source::Compute, + version + Version::TWO, + indexes, + VecBuilderOptions::default().add_last(), + )?, txindex_to_is_coinbase, inputindex_to_value, @@ -2160,7 +2187,7 @@ impl Vecs { Ok(()) })?; - self.indexes_to_velocity_btc + self.indexes_to_tx_btc_velocity .compute_all(starting_indexes, exit, |v| { v.compute_divide( starting_indexes.dateindex, @@ -2189,7 +2216,7 @@ impl Vecs { Ok(()) })?; - self.indexes_to_velocity_usd + self.indexes_to_tx_usd_velocity .compute_all(starting_indexes, exit, |v| { v.compute_divide( starting_indexes.dateindex, @@ -2209,6 +2236,57 @@ impl Vecs { })?; } + self.indexes_to_tx_per_sec + .compute_all(starting_indexes, exit, |v| { + v.compute_transform2( + starting_indexes.dateindex, + self.indexes_to_tx_count.dateindex.unwrap_sum(), + &indexes.dateindex_to_date, + |(i, tx_count, date, ..)| { + ( + i, + (*tx_count as f64 / (date.completion() * ONE_DAY_IN_SEC_F64)).into(), + ) + }, + exit, + )?; + Ok(()) + })?; + + self.indexes_to_inputs_per_sec + .compute_all(starting_indexes, exit, |v| { + v.compute_transform2( + starting_indexes.dateindex, + self.indexes_to_input_count.dateindex.unwrap_sum(), + &indexes.dateindex_to_date, + |(i, tx_count, date, ..)| { + ( + i, + (*tx_count as f64 / (date.completion() * ONE_DAY_IN_SEC_F64)).into(), + ) + }, + exit, + )?; + Ok(()) + })?; + + self.indexes_to_outputs_per_sec + .compute_all(starting_indexes, exit, |v| { + v.compute_transform2( + starting_indexes.dateindex, + self.indexes_to_output_count.dateindex.unwrap_sum(), + &indexes.dateindex_to_date, + |(i, tx_count, date, ..)| { + ( + i, + (*tx_count as f64 / (date.completion() * ONE_DAY_IN_SEC_F64)).into(), + ) + }, + exit, + )?; + Ok(()) + })?; + Ok(()) } @@ -2326,8 +2404,11 @@ impl Vecs { iter = Box::new(iter.chain(self.indexes_to_annualized_volume.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_annualized_volume_btc.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_annualized_volume_usd.iter_any_collectable())); - iter = Box::new(iter.chain(self.indexes_to_velocity_btc.iter_any_collectable())); - iter = Box::new(iter.chain(self.indexes_to_velocity_usd.iter_any_collectable())); + iter = Box::new(iter.chain(self.indexes_to_tx_btc_velocity.iter_any_collectable())); + iter = Box::new(iter.chain(self.indexes_to_tx_usd_velocity.iter_any_collectable())); + iter = Box::new(iter.chain(self.indexes_to_tx_per_sec.iter_any_collectable())); + iter = Box::new(iter.chain(self.indexes_to_outputs_per_sec.iter_any_collectable())); + iter = Box::new(iter.chain(self.indexes_to_inputs_per_sec.iter_any_collectable())); iter = Box::new( iter.chain( self.indexes_to_subsidy_usd_1y_sma diff --git a/crates/brk_computer/src/cointime.rs b/crates/brk_computer/src/cointime.rs index 9ba700483..8ce749bf3 100644 --- a/crates/brk_computer/src/cointime.rs +++ b/crates/brk_computer/src/cointime.rs @@ -1,9 +1,11 @@ use std::path::Path; use brk_error::Result; -use brk_structs::{Bitcoin, CheckedSub, Dollars, StoredF64, Version}; +use brk_structs::{Bitcoin, CheckedSub, Dollars, StoredF32, StoredF64, Version}; use vecdb::{AnyCollectableVec, Database, Exit, PAGE_SIZE, VecIterator}; +use crate::grouped::ComputedVecsFromDateIndex; + use super::{ Indexes, chain, grouped::{ @@ -13,8 +15,6 @@ use super::{ indexes, price, stateful, }; -const VERSION: Version = Version::ZERO; - #[derive(Clone)] pub struct Vecs { db: Database, @@ -42,27 +42,32 @@ pub struct Vecs { pub indexes_to_cointime_price: ComputedVecsFromHeight, pub indexes_to_cointime_cap: ComputedVecsFromHeight, pub indexes_to_cointime_price_ratio: ComputedRatioVecsFromDateIndex, + pub indexes_to_cointime_adj_inflation_rate: ComputedVecsFromDateIndex, + pub indexes_to_cointime_adj_tx_btc_velocity: ComputedVecsFromDateIndex, + pub indexes_to_cointime_adj_tx_usd_velocity: ComputedVecsFromDateIndex, // pub indexes_to_thermo_cap_rel_to_investor_cap: ComputedValueVecsFromHeight, } impl Vecs { pub fn forced_import( - parent: &Path, - version: Version, + parent_path: &Path, + parent_version: Version, indexes: &indexes::Vecs, price: Option<&price::Vecs>, ) -> Result { - let db = Database::open(&parent.join("cointime"))?; + let db = Database::open(&parent_path.join("cointime"))?; db.set_min_len(PAGE_SIZE * 1_000_000)?; let compute_dollars = price.is_some(); + let version = parent_version + Version::ZERO; + let this = Self { indexes_to_coinblocks_created: ComputedVecsFromHeight::forced_import( &db, "coinblocks_created", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, @@ -70,7 +75,7 @@ impl Vecs { &db, "coinblocks_stored", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, @@ -78,7 +83,7 @@ impl Vecs { &db, "liveliness", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, @@ -86,7 +91,7 @@ impl Vecs { &db, "vaultedness", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, @@ -94,7 +99,7 @@ impl Vecs { &db, "activity_to_vaultedness_ratio", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, @@ -102,7 +107,7 @@ impl Vecs { &db, "vaulted_supply", Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, VecBuilderOptions::default().add_last(), compute_dollars, indexes, @@ -111,7 +116,7 @@ impl Vecs { &db, "active_supply", Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, VecBuilderOptions::default().add_last(), compute_dollars, indexes, @@ -120,7 +125,7 @@ impl Vecs { &db, "thermo_cap", Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), )?, @@ -128,7 +133,7 @@ impl Vecs { &db, "investor_cap", Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), )?, @@ -136,7 +141,7 @@ impl Vecs { &db, "vaulted_cap", Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), )?, @@ -144,7 +149,7 @@ impl Vecs { &db, "active_cap", Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), )?, @@ -152,7 +157,7 @@ impl Vecs { &db, "vaulted_price", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, @@ -160,7 +165,7 @@ impl Vecs { &db, "vaulted_price", Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, true, )?, @@ -168,7 +173,7 @@ impl Vecs { &db, "active_price", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, @@ -176,7 +181,7 @@ impl Vecs { &db, "active_price", Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, true, )?, @@ -184,7 +189,7 @@ impl Vecs { &db, "true_market_mean", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, @@ -192,7 +197,7 @@ impl Vecs { &db, "true_market_mean", Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, true, )?, @@ -200,7 +205,7 @@ impl Vecs { &db, "cointime_value_destroyed", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, @@ -208,7 +213,7 @@ impl Vecs { &db, "cointime_value_created", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, @@ -216,7 +221,7 @@ impl Vecs { &db, "cointime_value_stored", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, @@ -224,7 +229,7 @@ impl Vecs { &db, "cointime_price", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, @@ -232,7 +237,7 @@ impl Vecs { &db, "cointime_cap", Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, @@ -240,10 +245,34 @@ impl Vecs { &db, "cointime_price", Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, true, )?, + indexes_to_cointime_adj_inflation_rate: ComputedVecsFromDateIndex::forced_import( + &db, + "cointime_adj_inflation_rate", + Source::Compute, + version + Version::ZERO, + indexes, + VecBuilderOptions::default().add_last(), + )?, + indexes_to_cointime_adj_tx_btc_velocity: ComputedVecsFromDateIndex::forced_import( + &db, + "cointime_adj_tx_btc_velocity", + Source::Compute, + version + Version::ZERO, + indexes, + VecBuilderOptions::default().add_last(), + )?, + indexes_to_cointime_adj_tx_usd_velocity: ComputedVecsFromDateIndex::forced_import( + &db, + "cointime_adj_tx_usd_velocity", + Source::Compute, + version + Version::ZERO, + indexes, + VecBuilderOptions::default().add_last(), + )?, db, }; @@ -392,6 +421,32 @@ impl Vecs { }, )?; + self.indexes_to_cointime_adj_inflation_rate + .compute_all(starting_indexes, exit, |v| { + v.compute_multiply( + starting_indexes.dateindex, + self.indexes_to_activity_to_vaultedness_ratio + .dateindex + .unwrap_last(), + chain.indexes_to_inflation_rate.dateindex.as_ref().unwrap(), + exit, + )?; + Ok(()) + })?; + + self.indexes_to_cointime_adj_tx_btc_velocity + .compute_all(starting_indexes, exit, |v| { + v.compute_multiply( + starting_indexes.dateindex, + self.indexes_to_activity_to_vaultedness_ratio + .dateindex + .unwrap_last(), + chain.indexes_to_tx_btc_velocity.dateindex.as_ref().unwrap(), + exit, + )?; + Ok(()) + })?; + if let Some(price) = price { let realized_cap = stateful .utxo_cohorts @@ -603,6 +658,22 @@ impl Vecs { exit, Some(self.indexes_to_cointime_price.dateindex.unwrap_last()), )?; + + self.indexes_to_cointime_adj_tx_usd_velocity.compute_all( + starting_indexes, + exit, + |v| { + v.compute_multiply( + starting_indexes.dateindex, + self.indexes_to_activity_to_vaultedness_ratio + .dateindex + .unwrap_last(), + chain.indexes_to_tx_usd_velocity.dateindex.as_ref().unwrap(), + exit, + )?; + Ok(()) + }, + )?; } Ok(()) @@ -612,6 +683,24 @@ impl Vecs { let mut iter: Box> = Box::new(std::iter::empty()); + iter = Box::new( + iter.chain( + self.indexes_to_cointime_adj_inflation_rate + .iter_any_collectable(), + ), + ); + iter = Box::new( + iter.chain( + self.indexes_to_cointime_adj_tx_btc_velocity + .iter_any_collectable(), + ), + ); + iter = Box::new( + iter.chain( + self.indexes_to_cointime_adj_tx_usd_velocity + .iter_any_collectable(), + ), + ); iter = Box::new(iter.chain(self.indexes_to_coinblocks_created.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_coinblocks_stored.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_liveliness.iter_any_collectable())); @@ -622,20 +711,16 @@ impl Vecs { .iter_any_collectable(), ), ); - iter = Box::new(iter.chain(self.indexes_to_vaulted_supply.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_active_supply.iter_any_collectable())); - iter = Box::new(iter.chain(self.indexes_to_thermo_cap.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_investor_cap.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_vaulted_cap.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_active_cap.iter_any_collectable())); - iter = Box::new(iter.chain(self.indexes_to_vaulted_price.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_vaulted_price_ratio.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_active_price.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_active_price_ratio.iter_any_collectable())); - iter = Box::new(iter.chain(self.indexes_to_true_market_mean.iter_any_collectable())); iter = Box::new( iter.chain( @@ -643,7 +728,6 @@ impl Vecs { .iter_any_collectable(), ), ); - iter = Box::new(iter.chain(self.indexes_to_cointime_price.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_cointime_cap.iter_any_collectable())); iter = Box::new(iter.chain(self.indexes_to_cointime_price_ratio.iter_any_collectable())); @@ -660,7 +744,6 @@ impl Vecs { ), ); iter = Box::new(iter.chain(self.indexes_to_cointime_value_stored.iter_any_collectable())); - iter } } diff --git a/crates/brk_computer/src/stateful/common.rs b/crates/brk_computer/src/stateful/common.rs index d98a4e231..5c1a75e4d 100644 --- a/crates/brk_computer/src/stateful/common.rs +++ b/crates/brk_computer/src/stateful/common.rs @@ -17,8 +17,6 @@ use crate::{ states::CohortState, }; -const VERSION: Version = Version::ZERO; - #[derive(Clone)] pub struct Vecs { // Cumulative @@ -159,6 +157,7 @@ pub struct Vecs { Option>, pub indexes_to_net_realized_pnl_cumulative_30d_delta_rel_to_market_cap: Option>, + pub dateindex_to_realized_profit_to_loss_ratio: Option>, } impl Vecs { @@ -167,7 +166,7 @@ impl Vecs { db: &Database, cohort_name: Option<&str>, format: Format, - version: Version, + parent_version: Version, indexes: &indexes::Vecs, price: Option<&price::Vecs>, extended: bool, @@ -176,6 +175,8 @@ impl Vecs { ) -> Result { let compute_dollars = price.is_some(); + let version = parent_version + Version::ZERO; + // let prefix = |s: &str| cohort_name.map_or(s.to_string(), |name| format!("{s}_{name}")); let suffix = |s: &str| cohort_name.map_or(s.to_string(), |name| format!("{name}_{s}")); @@ -184,7 +185,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_in_profit"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -194,7 +195,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_breakeven"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -204,7 +205,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_in_loss"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -214,7 +215,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_profit"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -224,7 +225,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_loss"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -235,7 +236,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_in_profit"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -248,7 +249,7 @@ impl Vecs { .as_ref() .map(|v| v.boxed_clone()) .into(), - version + VERSION + Version::ZERO, + version + Version::ZERO, VecBuilderOptions::default().add_last(), compute_dollars, indexes, @@ -260,7 +261,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_breakeven"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -273,7 +274,7 @@ impl Vecs { .as_ref() .map(|v| v.boxed_clone()) .into(), - version + VERSION + Version::ZERO, + version + Version::ZERO, VecBuilderOptions::default().add_last(), compute_dollars, indexes, @@ -285,7 +286,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_in_loss"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -298,7 +299,7 @@ impl Vecs { .as_ref() .map(|v| v.boxed_clone()) .into(), - version + VERSION + Version::ZERO, + version + Version::ZERO, VecBuilderOptions::default().add_last(), compute_dollars, indexes, @@ -310,7 +311,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_profit"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -323,7 +324,7 @@ impl Vecs { .as_ref() .map(|v| v.boxed_clone()) .into(), - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -334,7 +335,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_loss"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -343,7 +344,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("min_price_paid"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -352,7 +353,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("max_price_paid"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -365,7 +366,7 @@ impl Vecs { .as_ref() .map(|v| v.boxed_clone()) .into(), - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -375,7 +376,7 @@ impl Vecs { EagerVec::forced_import_compressed( db, &suffix("total_unrealized_pnl"), - version + VERSION + Version::ZERO, + version + Version::ZERO, ) .unwrap() }), @@ -384,7 +385,7 @@ impl Vecs { db, &suffix("total_unrealized_pnl"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -394,7 +395,7 @@ impl Vecs { EagerVec::forced_import_compressed( db, &suffix("total_realized_pnl"), - version + VERSION + Version::ZERO, + version + Version::ZERO, ) .unwrap() }), @@ -403,7 +404,7 @@ impl Vecs { db, &suffix("total_realized_pnl"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_sum(), ) @@ -414,7 +415,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("realized_cap"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -424,7 +425,7 @@ impl Vecs { db, &suffix("realized_cap"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -435,7 +436,7 @@ impl Vecs { db, &suffix("min_price_paid"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -446,7 +447,7 @@ impl Vecs { db, &suffix("max_price_paid"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -455,14 +456,14 @@ impl Vecs { height_to_supply: EagerVec::forced_import( db, &suffix("supply"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, )?, height_to_supply_value: ComputedHeightValueVecs::forced_import( db, &suffix("supply"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, format, compute_dollars, )?, @@ -470,7 +471,7 @@ impl Vecs { db, &suffix("supply"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, VecBuilderOptions::default().add_last(), compute_dollars, indexes, @@ -478,14 +479,14 @@ impl Vecs { height_to_utxo_count: EagerVec::forced_import( db, &suffix("utxo_count"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, )?, indexes_to_utxo_count: ComputedVecsFromHeight::forced_import( db, &suffix("utxo_count"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), )?, @@ -494,7 +495,7 @@ impl Vecs { db, &suffix("realized_price"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -505,7 +506,7 @@ impl Vecs { db, &suffix("realized_price"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, extended, ) @@ -517,7 +518,7 @@ impl Vecs { db, &suffix("realized_cap_rel_to_own_market_cap"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -528,7 +529,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("realized_profit"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -538,7 +539,7 @@ impl Vecs { db, &suffix("realized_profit"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), ) @@ -548,7 +549,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("realized_loss"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -558,7 +559,7 @@ impl Vecs { db, &suffix("realized_loss"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), ) @@ -569,7 +570,7 @@ impl Vecs { db, &suffix("neg_realized_loss"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), ) @@ -579,7 +580,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("value_created"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -589,7 +590,7 @@ impl Vecs { db, &suffix("value_created"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum(), ) @@ -600,7 +601,7 @@ impl Vecs { db, &suffix("realized_value"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum(), ) @@ -610,7 +611,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("adjusted_value_created"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -620,7 +621,7 @@ impl Vecs { db, &suffix("adjusted_value_created"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum(), ) @@ -630,7 +631,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("value_destroyed"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -640,7 +641,7 @@ impl Vecs { db, &suffix("value_destroyed"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum(), ) @@ -650,7 +651,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("adjusted_value_destroyed"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -660,7 +661,7 @@ impl Vecs { db, &suffix("adjusted_value_destroyed"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum(), ) @@ -671,7 +672,7 @@ impl Vecs { db, &suffix("realized_cap_30d_delta"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -682,7 +683,7 @@ impl Vecs { db, &suffix("net_realized_pnl"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), ) @@ -692,7 +693,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("sell_side_risk_ratio"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -701,7 +702,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("sell_side_risk_ratio_7d_ema"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -710,43 +711,28 @@ impl Vecs { EagerVec::forced_import( db, &suffix("sell_side_risk_ratio_30d_ema"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() }), dateindex_to_sopr: compute_dollars.then(|| { - EagerVec::forced_import( - db, - &suffix("sopr"), - version + VERSION + Version::ONE, - format, - ) - .unwrap() + EagerVec::forced_import(db, &suffix("sopr"), version + Version::ONE, format) + .unwrap() }), dateindex_to_sopr_7d_ema: compute_dollars.then(|| { - EagerVec::forced_import( - db, - &suffix("sopr_7d_ema"), - version + VERSION + Version::ONE, - format, - ) - .unwrap() + EagerVec::forced_import(db, &suffix("sopr_7d_ema"), version + Version::ONE, format) + .unwrap() }), dateindex_to_sopr_30d_ema: compute_dollars.then(|| { - EagerVec::forced_import( - db, - &suffix("sopr_30d_ema"), - version + VERSION + Version::ONE, - format, - ) - .unwrap() + EagerVec::forced_import(db, &suffix("sopr_30d_ema"), version + Version::ONE, format) + .unwrap() }), dateindex_to_adjusted_sopr: (compute_dollars && compute_adjusted).then(|| { EagerVec::forced_import( db, &suffix("adjusted_sopr"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -755,7 +741,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("adjusted_sopr_7d_ema"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -764,7 +750,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("adjusted_sopr_30d_ema"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -773,7 +759,7 @@ impl Vecs { db, &suffix("supply_half"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, format, compute_dollars, )?, @@ -781,7 +767,7 @@ impl Vecs { db, &suffix("supply_half"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, VecBuilderOptions::default().add_last(), compute_dollars, indexes, @@ -790,7 +776,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("neg_unrealized_loss"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -800,7 +786,7 @@ impl Vecs { db, &suffix("neg_unrealized_loss"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -810,7 +796,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("net_unrealized_pnl"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -820,7 +806,7 @@ impl Vecs { db, &suffix("net_unrealized_pnl"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_last(), ) @@ -830,7 +816,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_profit_rel_to_market_cap"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -839,7 +825,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_loss_rel_to_market_cap"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -848,7 +834,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("neg_unrealized_loss_rel_to_market_cap"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -857,7 +843,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("net_unrealized_pnl_rel_to_market_cap"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -867,7 +853,7 @@ impl Vecs { db, &suffix("unrealized_profit_rel_to_market_cap"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -878,7 +864,7 @@ impl Vecs { db, &suffix("unrealized_loss_rel_to_market_cap"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -889,7 +875,7 @@ impl Vecs { db, &suffix("neg_unrealized_loss_rel_to_market_cap"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -900,7 +886,7 @@ impl Vecs { db, &suffix("net_unrealized_pnl_rel_to_market_cap"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -913,7 +899,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_profit_rel_to_own_market_cap"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -925,7 +911,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_loss_rel_to_own_market_cap"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -937,7 +923,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("neg_unrealized_loss_rel_to_own_market_cap"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -949,7 +935,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("net_unrealized_pnl_rel_to_own_market_cap"), - version + VERSION + Version::TWO, + version + Version::TWO, format, ) .unwrap() @@ -962,7 +948,7 @@ impl Vecs { db, &suffix("unrealized_profit_rel_to_own_market_cap"), Source::Compute, - version + VERSION + Version::TWO, + version + Version::TWO, indexes, VecBuilderOptions::default().add_last(), ) @@ -976,7 +962,7 @@ impl Vecs { db, &suffix("unrealized_loss_rel_to_own_market_cap"), Source::Compute, - version + VERSION + Version::TWO, + version + Version::TWO, indexes, VecBuilderOptions::default().add_last(), ) @@ -990,7 +976,7 @@ impl Vecs { db, &suffix("neg_unrealized_loss_rel_to_own_market_cap"), Source::Compute, - version + VERSION + Version::TWO, + version + Version::TWO, indexes, VecBuilderOptions::default().add_last(), ) @@ -1004,7 +990,7 @@ impl Vecs { db, &suffix("net_unrealized_pnl_rel_to_own_market_cap"), Source::Compute, - version + VERSION + Version::TWO, + version + Version::TWO, indexes, VecBuilderOptions::default().add_last(), ) @@ -1016,7 +1002,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_profit_rel_to_own_total_unrealized_pnl"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -1027,7 +1013,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("unrealized_loss_rel_to_own_total_unrealized_pnl"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -1038,7 +1024,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("neg_unrealized_loss_rel_to_own_total_unrealized_pnl"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, ) .unwrap() @@ -1049,7 +1035,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("net_unrealized_pnl_rel_to_own_total_unrealized_pnl"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -1061,7 +1047,7 @@ impl Vecs { db, &suffix("unrealized_profit_rel_to_own_total_unrealized_pnl"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1074,7 +1060,7 @@ impl Vecs { db, &suffix("unrealized_loss_rel_to_own_total_unrealized_pnl"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1087,7 +1073,7 @@ impl Vecs { db, &suffix("neg_unrealized_loss_rel_to_own_total_unrealized_pnl"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1100,7 +1086,7 @@ impl Vecs { db, &suffix("net_unrealized_pnl_rel_to_own_total_unrealized_pnl"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1111,7 +1097,7 @@ impl Vecs { db, &suffix("realized_profit_rel_to_realized_cap"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum(), ) @@ -1122,7 +1108,7 @@ impl Vecs { db, &suffix("realized_loss_rel_to_realized_cap"), Source::Compute, - version + VERSION + Version::ZERO, + version + Version::ZERO, indexes, VecBuilderOptions::default().add_sum(), ) @@ -1133,7 +1119,7 @@ impl Vecs { db, &suffix("net_realized_pnl_rel_to_realized_cap"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_sum(), ) @@ -1144,7 +1130,7 @@ impl Vecs { db, &suffix("supply_breakeven"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, format, compute_dollars, ) @@ -1155,7 +1141,7 @@ impl Vecs { db, &suffix("supply_in_loss"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, format, compute_dollars, ) @@ -1166,7 +1152,7 @@ impl Vecs { db, &suffix("supply_in_profit"), Source::None, - version + VERSION + Version::ZERO, + version + Version::ZERO, format, compute_dollars, ) @@ -1176,7 +1162,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_breakeven_rel_to_own_supply"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -1185,7 +1171,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_in_loss_rel_to_own_supply"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -1194,7 +1180,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_in_profit_rel_to_own_supply"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -1204,7 +1190,7 @@ impl Vecs { db, &suffix("supply_breakeven_rel_to_own_supply"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1215,7 +1201,7 @@ impl Vecs { db, &suffix("supply_in_loss_rel_to_own_supply"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1226,7 +1212,7 @@ impl Vecs { db, &suffix("supply_in_profit_rel_to_own_supply"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1237,7 +1223,7 @@ impl Vecs { db, &suffix("supply_rel_to_circulating_supply"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1249,7 +1235,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_breakeven_rel_to_circulating_supply"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -1260,7 +1246,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_in_loss_rel_to_circulating_supply"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -1271,7 +1257,7 @@ impl Vecs { EagerVec::forced_import( db, &suffix("supply_in_profit_rel_to_circulating_supply"), - version + VERSION + Version::ONE, + version + Version::ONE, format, ) .unwrap() @@ -1283,7 +1269,7 @@ impl Vecs { db, &suffix("supply_breakeven_rel_to_circulating_supply"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1296,7 +1282,7 @@ impl Vecs { db, &suffix("supply_in_loss_rel_to_circulating_supply"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1309,7 +1295,7 @@ impl Vecs { db, &suffix("supply_in_profit_rel_to_circulating_supply"), Source::Compute, - version + VERSION + Version::ONE, + version + Version::ONE, indexes, VecBuilderOptions::default().add_last(), ) @@ -1318,20 +1304,20 @@ impl Vecs { height_to_satblocks_destroyed: EagerVec::forced_import( db, &suffix("satblocks_destroyed"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, )?, height_to_satdays_destroyed: EagerVec::forced_import( db, &suffix("satdays_destroyed"), - version + VERSION + Version::ZERO, + version + Version::ZERO, format, )?, indexes_to_coinblocks_destroyed: ComputedVecsFromHeight::forced_import( db, &suffix("coinblocks_destroyed"), Source::Compute, - version + VERSION + Version::TWO, + version + Version::TWO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, @@ -1339,7 +1325,7 @@ impl Vecs { db, &suffix("coindays_destroyed"), Source::Compute, - version + VERSION + Version::TWO, + version + Version::TWO, indexes, VecBuilderOptions::default().add_sum().add_cumulative(), )?, @@ -1348,7 +1334,7 @@ impl Vecs { db, &suffix("net_realized_pnl_cumulative_30d_delta"), Source::Compute, - version + VERSION + Version::new(3), + version + Version::new(3), indexes, VecBuilderOptions::default().add_last(), ) @@ -1360,7 +1346,7 @@ impl Vecs { db, &suffix("net_realized_pnl_cumulative_30d_delta_rel_to_realized_cap"), Source::Compute, - version + VERSION + Version::new(3), + version + Version::new(3), indexes, VecBuilderOptions::default().add_last(), ) @@ -1372,12 +1358,20 @@ impl Vecs { db, &suffix("net_realized_pnl_cumulative_30d_delta_rel_to_market_cap"), Source::Compute, - version + VERSION + Version::new(3), + version + Version::new(3), indexes, VecBuilderOptions::default().add_last(), ) .unwrap() }), + dateindex_to_realized_profit_to_loss_ratio: (compute_dollars && extended).then(|| { + EagerVec::forced_import_compressed( + db, + &suffix("realized_profit_to_loss_ratio"), + version + Version::ONE, + ) + .unwrap() + }), }) } @@ -3465,6 +3459,25 @@ impl Vecs { } } + if let Some(dateindex_to_realized_profit_to_loss_ratio) = + self.dateindex_to_realized_profit_to_loss_ratio.as_mut() + { + dateindex_to_realized_profit_to_loss_ratio.compute_divide( + starting_indexes.dateindex, + self.indexes_to_realized_profit + .as_ref() + .unwrap() + .dateindex + .unwrap_sum(), + self.indexes_to_realized_loss + .as_ref() + .unwrap() + .dateindex + .unwrap_sum(), + exit, + )?; + } + Ok(()) } @@ -4207,6 +4220,13 @@ impl Vecs { .flat_map(|v| v.iter_any_collectable()), ), ); + iter = Box::new( + iter.chain( + self.dateindex_to_realized_profit_to_loss_ratio + .iter() + .map(|v| v as &dyn AnyCollectableVec), + ), + ); iter } diff --git a/crates/brk_structs/src/structs/date.rs b/crates/brk_structs/src/structs/date.rs index 7fbda2dcd..4b6f8529b 100644 --- a/crates/brk_structs/src/structs/date.rs +++ b/crates/brk_structs/src/structs/date.rs @@ -1,8 +1,10 @@ -use jiff::{Span, civil::Date as Date_, tz::TimeZone}; +use jiff::{Span, Zoned, civil::Date as Date_, tz::TimeZone}; use serde::{Serialize, Serializer}; use vecdb::StoredCompressed; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; +use crate::ONE_DAY_IN_SEC_F64; + use super::{DateIndex, Timestamp}; #[derive( @@ -51,6 +53,21 @@ impl Date { pub fn today() -> Self { Self::from(Timestamp::now()) } + + pub fn completion(&self) -> f64 { + let date = Date_::from(*self); + let now = Zoned::now().with_time_zone(TimeZone::UTC); + let today = now.date(); + + if date < today { + 1.0 + } else if date == today { + let rounded = jiff::Timestamp::from(*self); + now.timestamp().duration_since(rounded).as_secs_f64() / ONE_DAY_IN_SEC_F64 + } else { + 0.0 + } + } } impl Default for Date { @@ -71,6 +88,12 @@ impl From for Date_ { } } +impl From for jiff::Timestamp { + fn from(value: Date) -> Self { + Self::from(Timestamp::from(value)) + } +} + impl From for Date { fn from(value: Timestamp) -> Self { Self::from(Date_::from( diff --git a/crates/brk_structs/src/structs/ohlc.rs b/crates/brk_structs/src/structs/ohlc.rs index 901a6f040..29cf21c48 100644 --- a/crates/brk_structs/src/structs/ohlc.rs +++ b/crates/brk_structs/src/structs/ohlc.rs @@ -9,6 +9,8 @@ use serde::{Serialize, Serializer, ser::SerializeTuple}; use vecdb::StoredCompressed; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; +use crate::StoredF64; + use super::{Cents, Dollars, Sats}; #[derive(Debug, Default, Clone, FromBytes, Immutable, IntoBytes, KnownLayout)] @@ -217,6 +219,15 @@ where } } +impl From> for StoredF64 +where + StoredF64: From, +{ + fn from(value: Open) -> Self { + Self::from(value.0) + } +} + impl From> for Open where T: Copy, @@ -315,6 +326,15 @@ where } } +impl From> for StoredF64 +where + StoredF64: From, +{ + fn from(value: High) -> Self { + Self::from(value.0) + } +} + impl From> for High where T: Copy, @@ -413,6 +433,15 @@ where } } +impl From> for StoredF64 +where + StoredF64: From, +{ + fn from(value: Low) -> Self { + Self::from(value.0) + } +} + impl From> for Low where T: Copy, @@ -530,6 +559,15 @@ where } } +impl From> for StoredF64 +where + StoredF64: From, +{ + fn from(value: Close) -> Self { + Self::from(value.0) + } +} + // impl From> for Close // where // B: From, diff --git a/crates/brk_structs/src/structs/stored_f32.rs b/crates/brk_structs/src/structs/stored_f32.rs index f6be756e1..6f3b4aeb5 100644 --- a/crates/brk_structs/src/structs/stored_f32.rs +++ b/crates/brk_structs/src/structs/stored_f32.rs @@ -153,6 +153,13 @@ impl Mul for StoredF32 { } } +impl Mul for StoredF32 { + type Output = Self; + fn mul(self, rhs: Self) -> Self::Output { + Self(self.0 * rhs.0) + } +} + impl Mul for usize { type Output = StoredF32; fn mul(self, rhs: StoredF32) -> Self::Output { diff --git a/crates/brk_structs/src/structs/stored_f64.rs b/crates/brk_structs/src/structs/stored_f64.rs index bf38181be..60494f7ce 100644 --- a/crates/brk_structs/src/structs/stored_f64.rs +++ b/crates/brk_structs/src/structs/stored_f64.rs @@ -64,6 +64,20 @@ impl Mul for StoredF64 { } } +impl Mul for StoredF64 { + type Output = Self; + fn mul(self, rhs: Self) -> Self::Output { + Self(self.0 * rhs.0) + } +} + +impl Mul for StoredF64 { + type Output = Self; + fn mul(self, rhs: Dollars) -> Self::Output { + Self(self.0 * *rhs) + } +} + impl Div for StoredF64 { type Output = Self; fn div(self, rhs: usize) -> Self::Output { diff --git a/crates/brk_structs/src/structs/timestamp.rs b/crates/brk_structs/src/structs/timestamp.rs index dc1c41829..16cddae15 100644 --- a/crates/brk_structs/src/structs/timestamp.rs +++ b/crates/brk_structs/src/structs/timestamp.rs @@ -28,9 +28,9 @@ use super::Date; )] pub struct Timestamp(u32); -const ONE_HOUR_IN_SEC: u32 = 60 * 60; -const ONE_DAY_IN_SEC: u32 = 24 * 60 * 60; -const ONE_DAY_IN_SEC_F64: f64 = ONE_DAY_IN_SEC as f64; +pub const ONE_HOUR_IN_SEC: u32 = 60 * 60; +pub const ONE_DAY_IN_SEC: u32 = 24 * 60 * 60; +pub const ONE_DAY_IN_SEC_F64: f64 = ONE_DAY_IN_SEC as f64; impl Timestamp { pub const ZERO: Self = Self(0); @@ -75,14 +75,6 @@ impl Timestamp { pub fn now() -> Self { Self::from(jiff::Timestamp::now()) } - - pub fn day_completion(&self) -> f64 { - let rounded = jiff::Timestamp::from(Self::from(Date::from(*self))); - ONE_DAY_IN_SEC_F64 - / jiff::Timestamp::from(*self) - .duration_since(rounded) - .as_secs_f64() - } } impl From for Timestamp { diff --git a/websites/bitview/packages/lightweight-charts/wrapper.js b/websites/bitview/packages/lightweight-charts/wrapper.js index ba8f4bd08..5735b8972 100644 --- a/websites/bitview/packages/lightweight-charts/wrapper.js +++ b/websites/bitview/packages/lightweight-charts/wrapper.js @@ -289,7 +289,7 @@ function createChartElement({ choices: /** @type {const} */ (["lin", "log"]), id: utils.stringToId(`${id} ${paneIndex} ${unit}`), defaultValue: - unit === "USD" && seriesType !== "Baseline" ? "log" : "lin", + unit === "usd" && seriesType !== "Baseline" ? "log" : "lin", key: `${id}-price-scale-${paneIndex}`, signals, }); @@ -681,7 +681,7 @@ function createChartElement({ data, options, }) { - color ||= unit === "USD" ? colors.green : colors.orange; + color ||= unit === "usd" ? colors.green : colors.orange; /** @type {LineISeries} */ const iseries = /** @type {any} */ ( diff --git a/websites/bitview/scripts/main.js b/websites/bitview/scripts/main.js index a0c7ffbb3..474e6d1ba 100644 --- a/websites/bitview/scripts/main.js +++ b/websites/bitview/scripts/main.js @@ -12,57 +12,57 @@ /** * @typedef {"" | - * "BTC" | - * "Cents" | - * "coinblocks" | - * "coindays" | - * "satblocks" | - * "satdays" | - * "Count" | - * "Date" | - * "Difficulty" | - * "ExaHash / Second" | - * "Gigabytes" | - * "Hash" | - * "Index" | - * "percentage" | - * "Ratio" | - * "Sats" | - * "secs" | - * "Timestamp" | - * "tx" | - * "Type" | - * "USD/(TH/s)/day" | - * "USD/(PH/s)/day" | - * "Sats/(TH/s)/day" | - * "Sats/(PH/s)/day" | - * "USD" | - * "Version" | - * "WU" | - * "Bool" | - * "Days" | - * "%mcap" | - * "blocks" | + * "%all" | * "%cmcap" | * "%cp+l" | + * "%mcap" | + * "%pnl" | * "%rcap" | * "%self" | - * "%all" | - * "Years" | - * "H/s" | - * "Locktime" | - * "sat/vB" | - * "%pnl" | - * "constant" | - * "vB" | - * "block" | - * "id" | + * "/sec" | * "address data" | + * "block" | + * "blocks" | + * "bool" | + * "btc" | + * "bytes" | + * "cents" | + * "coinblocks" | + * "coindays" | + * "constant" | + * "count" | + * "date" | + * "days" | + * "difficulty" | + * "epoch" | + * "gigabytes" | + * "h/s" | + * "hash" | + * "height" | + * "id" | + * "index" | + * "locktime" | + * "percentage" | + * "ratio" | + * "sat/vb" | + * "satblocks" | + * "satdays" | + * "sats" | + * "sats/(ph/s)/day" | + * "sats/(th/s)/day" | * "sd" | - * "Epoch" | - * "Height" | - * "Bytes" - * } Unit + * "secs" | + * "timestamp" | + * "tx" | + * "type" | + * "usd" | + * "usd/(ph/s)/day" | + * "usd/(th/s)/day" | + * "vb" | + * "version" | + * "wu" | + * "years" | + * "" } Unit */ const localhost = window.location.hostname === "localhost"; @@ -765,16 +765,16 @@ function createUtils() { id.endsWith("dominance") ))) ) { - setUnit("Sats"); + setUnit("sats"); } if ( (!unit || thoroughUnitCheck) && - !id.startsWith("velocity") && + !id.endsWith("velocity") && ((id.includes("_btc") && !(id.includes("0k_btc") || id.includes("1k_btc"))) || id.endsWith("_btc")) ) { - setUnit("BTC"); + setUnit("btc"); } if ((!unit || thoroughUnitCheck) && id === "chain") { setUnit("block"); @@ -798,7 +798,7 @@ function createUtils() { id === "price_ath" || id === "market_cap" || id.startsWith("price_true_range") || - (id.includes("_usd") && !id.startsWith("velocity")) || + (id.includes("_usd") && !id.endsWith("velocity")) || id.includes("cointime_value") || id.endsWith("_ago") || id.endsWith("price_paid") || @@ -817,10 +817,10 @@ function createUtils() { !id.includes("hash_rate")) || id === "ath") ) { - setUnit("USD"); + setUnit("usd"); } if ((!unit || thoroughUnitCheck) && id.endsWith("cents")) { - setUnit("Cents"); + setUnit("cents"); } if ( ((!unit || thoroughUnitCheck) && @@ -843,15 +843,15 @@ function createUtils() { id.includes("liveliness") || id.includes("vaultedness") || id == "puell_multiple" || - id.startsWith("velocity") + id.endsWith("velocity") ) { - setUnit("Ratio"); + setUnit("ratio"); } if ( (!unit || thoroughUnitCheck) && (id === "price_drawdown" || id === "difficulty_adjustment" || - id.startsWith("inflation_rate") || + id.endsWith("inflation_rate") || id.endsWith("_oscillator") || id.endsWith("_dominance") || id.endsWith("_returns") || @@ -869,25 +869,25 @@ function createUtils() { id.includes("blocks_mined") || (id.includes("tx_v") && !id.includes("vsize"))) ) { - setUnit("Count"); + setUnit("count"); } if ( (!unit || thoroughUnitCheck) && (id.startsWith("hash_rate") || id.endsWith("as_hash")) ) { - setUnit("H/s"); + setUnit("h/s"); } if ((!unit || thoroughUnitCheck) && id === "pool") { setUnit("id"); } if ((!unit || thoroughUnitCheck) && id.includes("fee_rate")) { - setUnit("sat/vB"); + setUnit("sat/vb"); } if ((!unit || thoroughUnitCheck) && id.startsWith("is_")) { - setUnit("Bool"); + setUnit("bool"); } if ((!unit || thoroughUnitCheck) && id.endsWith("type")) { - setUnit("Type"); + setUnit("type"); } if ( (!unit || thoroughUnitCheck) && @@ -895,12 +895,15 @@ function createUtils() { ) { setUnit("secs"); } + if ((!unit || thoroughUnitCheck) && id.endsWith("_per_sec")) { + setUnit("/sec"); + } if ((!unit || thoroughUnitCheck) && id.endsWith("locktime")) { - setUnit("Locktime"); + setUnit("locktime"); } if ((!unit || thoroughUnitCheck) && id.endsWith("version")) { - setUnit("Version"); + setUnit("version"); } if ( (!unit || thoroughUnitCheck) && @@ -910,7 +913,7 @@ function createUtils() { id.endsWith("total_size") || id.includes("block_size")) ) { - setUnit("Bytes"); + setUnit("bytes"); } if ((!unit || thoroughUnitCheck) && id.endsWith("_sd")) { setUnit("sd"); @@ -919,25 +922,25 @@ function createUtils() { (!unit || thoroughUnitCheck) && (id.includes("vsize") || id.includes("vbytes")) ) { - setUnit("vB"); + setUnit("vb"); } if ((!unit || thoroughUnitCheck) && id.includes("weight")) { - setUnit("WU"); + setUnit("wu"); } if ((!unit || thoroughUnitCheck) && id.endsWith("index")) { - setUnit("Index"); + setUnit("index"); } if ( (!unit || thoroughUnitCheck) && (id === "date" || id === "date_fixed") ) { - setUnit("Date"); + setUnit("date"); } if ( (!unit || thoroughUnitCheck) && (id === "timestamp" || id === "timestamp_fixed") ) { - setUnit("Timestamp"); + setUnit("timestamp"); } if ((!unit || thoroughUnitCheck) && id.includes("coinblocks")) { setUnit("coinblocks"); @@ -952,7 +955,7 @@ function createUtils() { setUnit("satdays"); } if ((!unit || thoroughUnitCheck) && id.endsWith("height")) { - setUnit("Height"); + setUnit("height"); } if ((!unit || thoroughUnitCheck) && id.endsWith("rel_to_market_cap")) { setUnit("%mcap"); @@ -986,25 +989,25 @@ function createUtils() { setUnit("%self"); } if ((!unit || thoroughUnitCheck) && id.endsWith("epoch")) { - setUnit("Epoch"); + setUnit("epoch"); } if ((!unit || thoroughUnitCheck) && id === "difficulty") { - setUnit("Difficulty"); + setUnit("difficulty"); } if ((!unit || thoroughUnitCheck) && id === "blockhash") { - setUnit("Hash"); + setUnit("hash"); } if ((!unit || thoroughUnitCheck) && id.startsWith("hash_price_phs")) { - setUnit("USD/(PH/s)/day"); + setUnit("usd/(ph/s)/day"); } if ((!unit || thoroughUnitCheck) && id.startsWith("hash_price_ths")) { - setUnit("USD/(TH/s)/day"); + setUnit("usd/(th/s)/day"); } if ((!unit || thoroughUnitCheck) && id.startsWith("hash_value_phs")) { - setUnit("Sats/(PH/s)/day"); + setUnit("sats/(ph/s)/day"); } if ((!unit || thoroughUnitCheck) && id.startsWith("hash_value_ths")) { - setUnit("Sats/(TH/s)/day"); + setUnit("sats/(th/s)/day"); } if ( @@ -1013,10 +1016,10 @@ function createUtils() { id.includes("days_since") || id.startsWith("days_before")) ) { - setUnit("Days"); + setUnit("days"); } if ((!unit || thoroughUnitCheck) && id.includes("years_between")) { - setUnit("Years"); + setUnit("years"); } if ((!unit || thoroughUnitCheck) && id.startsWith("constant")) { setUnit("constant"); diff --git a/websites/bitview/scripts/options.js b/websites/bitview/scripts/options.js index 015652bfa..3461056c6 100644 --- a/websites/bitview/scripts/options.js +++ b/websites/bitview/scripts/options.js @@ -1468,7 +1468,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { : []), createPriceLine({ number: 1, - unit: "Ratio", + unit: "ratio", }), ], }, @@ -1537,7 +1537,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }), ...createPriceLines({ numbers: [0, 1, 2, 3, 4, -1, -2, -3, -4], - unit: "Ratio", + unit: "ratio", }), ], }, @@ -1653,7 +1653,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }), ...createPriceLines({ numbers: [0, 1, 2, 3, 4, -1, -2, -3, -4], - unit: "Ratio", + unit: "ratio", }), ], })), @@ -2133,7 +2133,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }), ), createPriceLine({ - unit: "Ratio", + unit: "ratio", number: 1, }), ], @@ -2166,7 +2166,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { defaultActive: false, }), createPriceLine({ - unit: "USD", + unit: "usd", defaultActive: false, }), ] @@ -2191,6 +2191,16 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { color: colors.red, defaultActive: false, }), + ...(`${fixKey(args.key)}realized_profit_to_loss_ratio` in + vecIdToIndexes + ? [ + createBaseSeries({ + key: `${fixKey(args.key)}realized_profit_to_loss_ratio`, + name: "proft / loss", + color: colors.yellow, + }), + ] + : []), createBaseSeries({ key: `${fixKey(args.key)}total_realized_pnl`, name: "Total", @@ -2240,7 +2250,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { unit: "%rcap", }), createPriceLine({ - unit: "USD", + unit: "usd", defaultActive: false, }), ], @@ -2297,7 +2307,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { unit: "%rcap", }), createPriceLine({ - unit: "USD", + unit: "usd", }), ]), }, @@ -2392,7 +2402,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { : []), createPriceLine({ number: 1, - unit: "Ratio", + unit: "ratio", }), ]; }), @@ -2420,7 +2430,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { ]); }), createPriceLine({ - unit: "USD", + unit: "usd", }), ], }, @@ -2445,7 +2455,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { ]); }), createPriceLine({ - unit: "USD", + unit: "usd", }), ], }, @@ -2461,6 +2471,16 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { name, color, }), + ...(`${key}realized_profit_to_loss_ratio` in + vecIdToIndexes + ? [ + createBaseSeries({ + key: `${key}realized_profit_to_loss_ratio`, + name, + color, + }), + ] + : []), ]); }), ], @@ -2486,7 +2506,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }), ]), createPriceLine({ - unit: "USD", + unit: "usd", }), createPriceLine({ unit: "%rcap", @@ -2538,7 +2558,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }), ]), createPriceLine({ - unit: "USD", + unit: "usd", }), ], }, @@ -2573,7 +2593,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }), ]), createPriceLine({ - unit: "USD", + unit: "usd", }), createPriceLine({ unit: "%mcap", @@ -2602,7 +2622,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { ]), createPriceLine({ number: 1, - unit: "Ratio", + unit: "ratio", }), ], }, @@ -2633,7 +2653,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { ), createPriceLine({ number: 1, - unit: "Ratio", + unit: "ratio", }), ], }, @@ -2643,7 +2663,6 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { ], }, ]), - { name: "Sell Side Risk", title: `Sell Side Risk Ratio ${title}`, @@ -2675,6 +2694,146 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }), ]), }, + { + name: "value", + tree: [ + ...(!("list" in args) + ? [ + { + name: "created", + title: `value created ${title}`, + bottom: list.flatMap(({ color, name, key }) => { + const normalKey = `${fixKey(key)}value_created`; + const adjKey = `${fixKey(key)}adjusted_value_created`; + return [ + createBaseSeries({ + key: normalKey, + name: "normal", + color: colors.emerald, + }), + ...(adjKey in vecIdToIndexes + ? [ + createBaseSeries({ + key: adjKey, + name: "adjusted", + color: colors.lime, + }), + ] + : []), + ]; + }), + }, + { + name: "destroyed", + title: `value destroyed ${title}`, + bottom: list.flatMap(({ color, name, key }) => { + const normalKey = `${fixKey(key)}value_destroyed`; + const adjKey = `${fixKey(key)}adjusted_value_destroyed`; + return [ + createBaseSeries({ + key: normalKey, + name: "normal", + color: colors.red, + }), + ...(adjKey in vecIdToIndexes + ? [ + createBaseSeries({ + key: adjKey, + name: "adjusted", + color: colors.pink, + }), + ] + : []), + ]; + }), + }, + ] + : [ + { + name: "created", + tree: [ + { + name: "Normal", + title: `Value Created ${title}`, + bottom: list.flatMap(({ color, name, key }) => [ + createBaseSeries({ + key: `${fixKey(key)}value_created`, + name, + color, + }), + ]), + }, + ...(() => { + const reducedList = list + .map(({ color, name, key }) => ({ + color, + name, + key: `${fixKey(key)}adjusted_value_created`, + })) + .filter(({ key }) => key in vecIdToIndexes); + return reducedList.length + ? [ + { + name: "Adjusted", + title: `Adjusted value created ${title}`, + bottom: reducedList.map( + ({ color, name, key }) => + createBaseSeries({ + key, + name, + color, + }), + ), + }, + ] + : []; + })(), + ], + }, + { + name: "destroyed", + tree: [ + { + name: "Normal", + title: `Value destroyed ${title}`, + bottom: list.flatMap(({ color, name, key }) => [ + createBaseSeries({ + key: `${fixKey(key)}value_destroyed`, + name, + color, + }), + ]), + }, + ...(() => { + const reducedList = list + .map(({ color, name, key }) => ({ + color, + name, + key: `${fixKey(key)}adjusted_value_destroyed`, + })) + .filter(({ key }) => key in vecIdToIndexes); + return reducedList.length + ? [ + { + name: "Adjusted", + title: `Adjusted value destroyed ${title}`, + bottom: reducedList.map( + ({ color, name, key }) => + createBaseSeries({ + key, + name, + color, + }), + ), + }, + ] + : []; + })(), + ], + }, + ]), + ], + }, ], }, { @@ -2780,7 +2939,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { ] : []), createPriceLine({ - unit: "USD", + unit: "usd", defaultActive: false, }), createPriceLine({ @@ -2885,7 +3044,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { : []), ]), createPriceLine({ - unit: "USD", + unit: "usd", }), createPriceLine({ unit: "%mcap", @@ -3230,11 +3389,11 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { color: colors.red, }), createPriceLine({ - unit: "Index", + unit: "index", number: 61.8, }), createPriceLine({ - unit: "Index", + unit: "index", number: 38.2, }), ], @@ -3589,19 +3748,29 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }, { name: "Velocity", - title: "Transaction Velocity", + title: "Transactions Velocity", bottom: [ createBaseSeries({ - key: "velocity_btc", + key: "tx_btc_velocity", name: "bitcoin", }), createBaseSeries({ - key: "velocity_usd", + key: "tx_usd_velocity", name: "dollars", color: colors.emerald, }), ], }, + { + name: "Speed", + title: "Transactions Per Second", + bottom: [ + createBaseSeries({ + key: "tx_per_sec", + name: "Transactions", + }), + ], + }, ], }, { @@ -3620,6 +3789,16 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }), ], }, + { + name: "Speed", + title: "Inputs Per Second", + bottom: [ + createBaseSeries({ + key: "inputs_per_sec", + name: "Inputs", + }), + ], + }, // { // name: "Value", // title: "Transaction Input Value", @@ -3639,13 +3818,23 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { bottom: [ createAverageSeries({ concat: "output_count" }), createCumulativeSeries({ - concat: "input_count", + concat: "output_count", }), ...createMinMaxPercentilesSeries({ concat: "output_count", }), ], }, + { + name: "Speed", + title: "Outputs Per Second", + bottom: [ + createBaseSeries({ + key: "outputs_per_sec", + name: "Outputs", + }), + ], + }, // { // name: "Value", // title: "Transaction Output Value", @@ -4453,6 +4642,11 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { name: "Vaultedness", color: colors.lime, }), + createBaseSeries({ + key: "activity_to_vaultedness_ratio", + name: "Liveliness / Vaultedness", + color: colors.purple, + }), ], }, { @@ -4494,6 +4688,53 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) { }), ], }, + { + name: "Adjusted", + tree: [ + { + name: "inflation", + title: "Cointime-Adjusted inflation rate", + bottom: [ + createBaseSeries({ + key: "inflation_rate", + name: "base", + color: colors.orange, + }), + createBaseSeries({ + key: "cointime_adj_inflation_rate", + name: "base", + color: colors.purple, + }), + ], + }, + { + name: "Velocity", + title: "Cointime-Adjusted transactions velocity", + bottom: [ + createBaseSeries({ + key: "tx_btc_velocity", + name: "btc", + color: colors.orange, + }), + createBaseSeries({ + key: "cointime_adj_tx_btc_velocity", + name: "adj. btc", + color: colors.red, + }), + createBaseSeries({ + key: "tx_usd_velocity", + name: "usd", + color: colors.emerald, + }), + createBaseSeries({ + key: "cointime_adj_tx_usd_velocity", + name: "adj. usd", + color: colors.lime, + }), + ], + }, + ], + }, ], }, ],