mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: works but data is wrong
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -3047,9 +3047,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tower-http"
|
||||
version = "0.6.5"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cc2d9e086a412a451384326f521c8123a99a466b329941a9403696bff9b0da2"
|
||||
checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"bitflags",
|
||||
|
||||
@@ -5,8 +5,10 @@ mod from_height_strict;
|
||||
mod from_txindex;
|
||||
mod ratio_from_dateindex;
|
||||
mod r#type;
|
||||
mod value_from_dateindex;
|
||||
mod value_from_height;
|
||||
mod value_from_txindex;
|
||||
mod value_height;
|
||||
|
||||
pub use builder::*;
|
||||
pub use from_dateindex::*;
|
||||
@@ -15,5 +17,7 @@ pub use from_height_strict::*;
|
||||
pub use from_txindex::*;
|
||||
pub use ratio_from_dateindex::*;
|
||||
use r#type::*;
|
||||
pub use value_from_dateindex::*;
|
||||
pub use value_from_height::*;
|
||||
pub use value_from_txindex::*;
|
||||
pub use value_height::*;
|
||||
|
||||
176
crates/brk_computer/src/vecs/grouped/value_from_dateindex.rs
Normal file
176
crates/brk_computer/src/vecs/grouped/value_from_dateindex.rs
Normal file
@@ -0,0 +1,176 @@
|
||||
use std::path::Path;
|
||||
|
||||
use brk_core::{Bitcoin, DateIndex, Dollars, Sats, Version};
|
||||
use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyCollectableVec, CollectableVec, Format, StoredVec};
|
||||
|
||||
use crate::vecs::{Indexes, fetched, grouped::ComputedVecsFromDateIndex, indexes};
|
||||
|
||||
use super::StorableVecGeneatorOptions;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ComputedValueVecsFromDateIndex {
|
||||
pub sats: ComputedVecsFromDateIndex<Sats>,
|
||||
pub bitcoin: ComputedVecsFromDateIndex<Bitcoin>,
|
||||
pub dollars: Option<ComputedVecsFromDateIndex<Dollars>>,
|
||||
}
|
||||
|
||||
const VERSION: Version = Version::ZERO;
|
||||
|
||||
impl ComputedValueVecsFromDateIndex {
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
name: &str,
|
||||
compute_source: bool,
|
||||
version: Version,
|
||||
format: Format,
|
||||
options: StorableVecGeneatorOptions,
|
||||
compute_dollars: bool,
|
||||
) -> color_eyre::Result<Self> {
|
||||
Ok(Self {
|
||||
sats: ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
name,
|
||||
compute_source,
|
||||
version + VERSION,
|
||||
format,
|
||||
options,
|
||||
)?,
|
||||
bitcoin: ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&format!("{name}_in_btc"),
|
||||
true,
|
||||
version + VERSION,
|
||||
format,
|
||||
options,
|
||||
)?,
|
||||
dollars: compute_dollars.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&format!("{name}_in_usd"),
|
||||
true,
|
||||
version + VERSION,
|
||||
format,
|
||||
options,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
// pub fn compute_all<F>(
|
||||
// &mut self,
|
||||
// indexer: &Indexer,
|
||||
// indexes: &indexes::Vecs,
|
||||
// fetched: Option<&fetched::Vecs>,
|
||||
// starting_indexes: &Indexes,
|
||||
// exit: &Exit,
|
||||
// mut compute: F,
|
||||
// ) -> color_eyre::Result<()>
|
||||
// where
|
||||
// F: FnMut(
|
||||
// &mut EagerVec<DateIndex, Sats>,
|
||||
// &Indexer,
|
||||
// &indexes::Vecs,
|
||||
// &Indexes,
|
||||
// &Exit,
|
||||
// ) -> Result<()>,
|
||||
// {
|
||||
// compute(
|
||||
// self.sats.dateindex.as_mut().unwrap(),
|
||||
// indexer,
|
||||
// indexes,
|
||||
// starting_indexes,
|
||||
// exit,
|
||||
// )?;
|
||||
|
||||
// let dateindex: Option<&StoredVec<DateIndex, Sats>> = None;
|
||||
// self.compute_rest(indexer, indexes, fetched, starting_indexes, exit, dateindex)?;
|
||||
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
pub fn compute_rest(
|
||||
&mut self,
|
||||
indexer: &Indexer,
|
||||
indexes: &indexes::Vecs,
|
||||
fetched: Option<&fetched::Vecs>,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
dateindex: Option<&impl CollectableVec<DateIndex, Sats>>,
|
||||
) -> color_eyre::Result<()> {
|
||||
if let Some(dateindex) = dateindex {
|
||||
self.sats
|
||||
.compute_rest(indexes, starting_indexes, exit, Some(dateindex))?;
|
||||
|
||||
self.bitcoin.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_from_sats(starting_indexes.dateindex, dateindex, exit)
|
||||
},
|
||||
)?;
|
||||
} else {
|
||||
let dateindex: Option<&StoredVec<DateIndex, Sats>> = None;
|
||||
|
||||
self.sats
|
||||
.compute_rest(indexes, starting_indexes, exit, dateindex)?;
|
||||
|
||||
self.bitcoin.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_from_sats(
|
||||
starting_indexes.dateindex,
|
||||
self.sats.dateindex.as_ref().unwrap(),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
}
|
||||
|
||||
let dateindex_to_bitcoin = self.bitcoin.dateindex.as_ref().unwrap();
|
||||
let dateindex_to_close = fetched
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.timeindexes_to_close
|
||||
.dateindex
|
||||
.as_ref()
|
||||
.unwrap();
|
||||
|
||||
if let Some(dollars) = self.dollars.as_mut() {
|
||||
dollars.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_from_bitcoin(
|
||||
starting_indexes.dateindex,
|
||||
dateindex_to_bitcoin,
|
||||
dateindex_to_close,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
|
||||
[
|
||||
self.sats.vecs(),
|
||||
self.bitcoin.vecs(),
|
||||
self.dollars.as_ref().map_or(vec![], |v| v.vecs()),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
}
|
||||
125
crates/brk_computer/src/vecs/grouped/value_height.rs
Normal file
125
crates/brk_computer/src/vecs/grouped/value_height.rs
Normal file
@@ -0,0 +1,125 @@
|
||||
use std::path::Path;
|
||||
|
||||
use brk_core::{Bitcoin, Dollars, Height, Sats, Version};
|
||||
use brk_exit::Exit;
|
||||
use brk_vec::{AnyCollectableVec, CollectableVec, EagerVec, Format};
|
||||
|
||||
use crate::vecs::{Indexes, fetched};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ComputedHeightValueVecs {
|
||||
pub sats: Option<EagerVec<Height, Sats>>,
|
||||
pub bitcoin: EagerVec<Height, Bitcoin>,
|
||||
pub dollars: Option<EagerVec<Height, Dollars>>,
|
||||
}
|
||||
|
||||
const VERSION: Version = Version::ZERO;
|
||||
|
||||
impl ComputedHeightValueVecs {
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
name: &str,
|
||||
compute_source: bool,
|
||||
version: Version,
|
||||
format: Format,
|
||||
compute_dollars: bool,
|
||||
) -> color_eyre::Result<Self> {
|
||||
Ok(Self {
|
||||
sats: compute_source.then(|| {
|
||||
EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, format)
|
||||
.unwrap()
|
||||
}),
|
||||
bitcoin: EagerVec::forced_import(
|
||||
path,
|
||||
&format!("{name}_in_btc"),
|
||||
version + VERSION + Version::ZERO,
|
||||
format,
|
||||
)?,
|
||||
dollars: compute_dollars.then(|| {
|
||||
EagerVec::forced_import(
|
||||
path,
|
||||
&format!("{name}_in_usd"),
|
||||
version + VERSION + Version::ZERO,
|
||||
format,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
// pub fn compute_all<F>(
|
||||
// &mut self,
|
||||
// indexer: &Indexer,
|
||||
// indexes: &indexes::Vecs,
|
||||
// fetched: Option<&fetched::Vecs>,
|
||||
// starting_indexes: &Indexes,
|
||||
// exit: &Exit,
|
||||
// mut compute: F,
|
||||
// ) -> color_eyre::Result<()>
|
||||
// where
|
||||
// F: FnMut(
|
||||
// &mut EagerVec<Height, Sats>,
|
||||
// &Indexer,
|
||||
// &indexes::Vecs,
|
||||
// &Indexes,
|
||||
// &Exit,
|
||||
// ) -> Result<()>,
|
||||
// {
|
||||
// compute(
|
||||
// self.sats.as_mut().unwrap(),
|
||||
// indexer,
|
||||
// indexes,
|
||||
// starting_indexes,
|
||||
// exit,
|
||||
// )?;
|
||||
|
||||
// let height: Option<&StoredVec<Height, Sats>> = None;
|
||||
// self.compute_rest(fetched, starting_indexes, exit, height)?;
|
||||
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
pub fn compute_rest(
|
||||
&mut self,
|
||||
fetched: Option<&fetched::Vecs>,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
height: Option<&impl CollectableVec<Height, Sats>>,
|
||||
) -> color_eyre::Result<()> {
|
||||
if let Some(height) = height {
|
||||
self.bitcoin
|
||||
.compute_from_sats(starting_indexes.height, height, exit)?;
|
||||
} else {
|
||||
self.bitcoin.compute_from_sats(
|
||||
starting_indexes.height,
|
||||
self.sats.as_ref().unwrap(),
|
||||
exit,
|
||||
)?;
|
||||
}
|
||||
|
||||
let height_to_bitcoin = &self.bitcoin;
|
||||
let height_to_close = &fetched.as_ref().unwrap().chainindexes_to_close.height;
|
||||
|
||||
if let Some(dollars) = self.dollars.as_mut() {
|
||||
dollars.compute_from_bitcoin(
|
||||
starting_indexes.height,
|
||||
height_to_bitcoin,
|
||||
height_to_close,
|
||||
exit,
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
|
||||
[
|
||||
vec![&self.bitcoin as &dyn AnyCollectableVec],
|
||||
self.sats.as_ref().map_or(vec![], |v| vec![v]),
|
||||
self.dollars.as_ref().map_or(vec![], |v| vec![v]),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
use std::{fs, path::Path};
|
||||
|
||||
use brk_core::{DateIndex, Dollars, Height, Result, Sats, StoredF32, StoredUsize, Version};
|
||||
use brk_core::{
|
||||
DateIndex, Dollars, Height, Result, Sats, StoredF32, StoredF64, StoredUsize, Version,
|
||||
};
|
||||
use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_state::CohortState;
|
||||
use brk_vec::{AnyCollectableVec, AnyVec, Computation, EagerVec, Format, StoredIndex, VecIterator};
|
||||
use brk_vec::{
|
||||
AnyCollectableVec, AnyIterableVec, AnyVec, Computation, EagerVec, Format, StoredIndex,
|
||||
VecIterator,
|
||||
};
|
||||
use fjall::TransactionalKeyspace;
|
||||
|
||||
use crate::vecs::{
|
||||
Indexes, fetched,
|
||||
grouped::{
|
||||
ComputedRatioVecsFromDateIndex, ComputedValueVecsFromHeight, ComputedVecsFromDateIndex,
|
||||
ComputedVecsFromHeight, StorableVecGeneatorOptions,
|
||||
ComputedHeightValueVecs, ComputedRatioVecsFromDateIndex, ComputedValueVecsFromDateIndex,
|
||||
ComputedValueVecsFromHeight, ComputedVecsFromDateIndex, ComputedVecsFromHeight,
|
||||
StorableVecGeneatorOptions,
|
||||
},
|
||||
indexes, market,
|
||||
};
|
||||
@@ -65,9 +71,6 @@ pub struct Vecs {
|
||||
pub indexes_to_utxo_count: ComputedVecsFromHeight<StoredUsize>,
|
||||
pub indexes_to_value_created: Option<ComputedVecsFromHeight<Dollars>>,
|
||||
pub indexes_to_value_destroyed: Option<ComputedVecsFromHeight<Dollars>>,
|
||||
pub indexes_to_supply_in_profit: Option<ComputedVecsFromDateIndex<Sats>>,
|
||||
pub indexes_to_supply_in_loss: Option<ComputedVecsFromDateIndex<Sats>>,
|
||||
pub indexes_to_supply_even: Option<ComputedVecsFromDateIndex<Sats>>,
|
||||
pub indexes_to_unrealized_profit: Option<ComputedVecsFromDateIndex<Dollars>>,
|
||||
pub indexes_to_unrealized_loss: Option<ComputedVecsFromDateIndex<Dollars>>,
|
||||
pub indexes_to_min_price_paid: Option<ComputedVecsFromHeight<Dollars>>,
|
||||
@@ -78,11 +81,37 @@ pub struct Vecs {
|
||||
pub height_to_net_unrealized_profit_and_loss: Option<EagerVec<Height, Dollars>>,
|
||||
pub indexes_to_net_unrealized_profit_and_loss: Option<ComputedVecsFromDateIndex<Dollars>>,
|
||||
pub height_to_net_unrealized_profit_and_loss_relative_to_market_cap:
|
||||
Option<EagerVec<Height, Dollars>>,
|
||||
Option<EagerVec<Height, StoredF32>>,
|
||||
pub indexes_to_net_unrealized_profit_and_loss_relative_to_market_cap:
|
||||
Option<ComputedVecsFromDateIndex<Dollars>>,
|
||||
// pub indexes_to_net_realized_profit_and_loss_relative_to_realized_cap:
|
||||
// Option<ComputedVecsFromHeight<Dollars>>,
|
||||
Option<ComputedVecsFromDateIndex<StoredF32>>,
|
||||
pub indexes_to_net_realized_profit_and_loss_relative_to_realized_cap:
|
||||
Option<ComputedVecsFromHeight<StoredF32>>,
|
||||
pub height_to_supply_even_value: Option<ComputedHeightValueVecs>,
|
||||
pub height_to_supply_in_loss_value: Option<ComputedHeightValueVecs>,
|
||||
pub height_to_supply_in_profit_value: Option<ComputedHeightValueVecs>,
|
||||
pub indexes_to_supply_even: Option<ComputedValueVecsFromDateIndex>,
|
||||
pub indexes_to_supply_in_loss: Option<ComputedValueVecsFromDateIndex>,
|
||||
pub indexes_to_supply_in_profit: Option<ComputedValueVecsFromDateIndex>,
|
||||
pub height_to_supply_even_relative_to_own_supply: Option<EagerVec<Height, StoredF64>>,
|
||||
pub height_to_supply_in_loss_relative_to_own_supply: Option<EagerVec<Height, StoredF64>>,
|
||||
pub height_to_supply_in_profit_relative_to_own_supply: Option<EagerVec<Height, StoredF64>>,
|
||||
pub indexes_to_supply_even_relative_to_own_supply: Option<ComputedVecsFromDateIndex<StoredF64>>,
|
||||
pub indexes_to_supply_in_loss_relative_to_own_supply:
|
||||
Option<ComputedVecsFromDateIndex<StoredF64>>,
|
||||
pub indexes_to_supply_in_profit_relative_to_own_supply:
|
||||
Option<ComputedVecsFromDateIndex<StoredF64>>,
|
||||
pub indexes_to_supply_relative_to_circulating_supply: Option<ComputedVecsFromHeight<StoredF64>>,
|
||||
pub height_to_supply_even_relative_to_circulating_supply: Option<EagerVec<Height, StoredF64>>,
|
||||
pub height_to_supply_in_loss_relative_to_circulating_supply:
|
||||
Option<EagerVec<Height, StoredF64>>,
|
||||
pub height_to_supply_in_profit_relative_to_circulating_supply:
|
||||
Option<EagerVec<Height, StoredF64>>,
|
||||
pub indexes_to_supply_even_relative_to_circulating_supply:
|
||||
Option<ComputedVecsFromDateIndex<StoredF64>>,
|
||||
pub indexes_to_supply_in_loss_relative_to_circulating_supply:
|
||||
Option<ComputedVecsFromDateIndex<StoredF64>>,
|
||||
pub indexes_to_supply_in_profit_relative_to_circulating_supply:
|
||||
Option<ComputedVecsFromDateIndex<StoredF64>>,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
@@ -96,6 +125,7 @@ impl Vecs {
|
||||
fetched: Option<&fetched::Vecs>,
|
||||
keyspace: &TransactionalKeyspace,
|
||||
stores_path: &Path,
|
||||
compute_relative_to_all: bool,
|
||||
) -> color_eyre::Result<Self> {
|
||||
let compute_dollars = fetched.is_some();
|
||||
|
||||
@@ -136,13 +166,14 @@ impl Vecs {
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_in_profit: compute_dollars.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
ComputedValueVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_profit"),
|
||||
false,
|
||||
version + VERSION + Version::ZERO,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
compute_dollars,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
@@ -165,13 +196,14 @@ impl Vecs {
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_even: compute_dollars.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
ComputedValueVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&suffix("supply_even"),
|
||||
false,
|
||||
version + VERSION + Version::ZERO,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
compute_dollars,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
@@ -194,13 +226,14 @@ impl Vecs {
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_in_loss: compute_dollars.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
ComputedValueVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_loss"),
|
||||
false,
|
||||
version + VERSION + Version::ZERO,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
compute_dollars,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
@@ -636,6 +669,195 @@ impl Vecs {
|
||||
.unwrap()
|
||||
},
|
||||
),
|
||||
indexes_to_net_realized_profit_and_loss_relative_to_realized_cap: compute_dollars.then(
|
||||
|| {
|
||||
ComputedVecsFromHeight::forced_import(
|
||||
path,
|
||||
&suffix("net_realized_profit_and_loss_relative_to_realized_cap"),
|
||||
true,
|
||||
version + VERSION + Version::ZERO,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)
|
||||
.unwrap()
|
||||
},
|
||||
),
|
||||
height_to_supply_even_value: compute_dollars.then(|| {
|
||||
ComputedHeightValueVecs::forced_import(
|
||||
path,
|
||||
&suffix("supply_even"),
|
||||
false,
|
||||
version,
|
||||
format,
|
||||
compute_dollars,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
height_to_supply_in_loss_value: compute_dollars.then(|| {
|
||||
ComputedHeightValueVecs::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_loss"),
|
||||
false,
|
||||
version,
|
||||
format,
|
||||
compute_dollars,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
height_to_supply_in_profit_value: compute_dollars.then(|| {
|
||||
ComputedHeightValueVecs::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_profit"),
|
||||
false,
|
||||
version,
|
||||
format,
|
||||
compute_dollars,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
height_to_supply_even_relative_to_own_supply: compute_dollars.then(|| {
|
||||
EagerVec::forced_import(
|
||||
path,
|
||||
&suffix("supply_even_relative_to_own_supply"),
|
||||
version,
|
||||
format,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
height_to_supply_in_loss_relative_to_own_supply: compute_dollars.then(|| {
|
||||
EagerVec::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_loss_relative_to_own_supply"),
|
||||
version,
|
||||
format,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
height_to_supply_in_profit_relative_to_own_supply: compute_dollars.then(|| {
|
||||
EagerVec::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_profit_relative_to_own_supply"),
|
||||
version,
|
||||
format,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_even_relative_to_own_supply: compute_dollars.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&suffix("supply_even_relative_to_own_supply"),
|
||||
true,
|
||||
version,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_in_loss_relative_to_own_supply: compute_dollars.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_loss_relative_to_own_supply"),
|
||||
true,
|
||||
version,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_in_profit_relative_to_own_supply: compute_dollars.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_profit_relative_to_own_supply"),
|
||||
true,
|
||||
version,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_relative_to_circulating_supply: compute_relative_to_all.then(|| {
|
||||
ComputedVecsFromHeight::forced_import(
|
||||
path,
|
||||
&suffix("supply_relative_to_circulating_supply"),
|
||||
true,
|
||||
version,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
height_to_supply_even_relative_to_circulating_supply: (compute_relative_to_all
|
||||
&& compute_dollars)
|
||||
.then(|| {
|
||||
EagerVec::forced_import(
|
||||
path,
|
||||
&suffix("supply_even_relative_to_circulating_supply"),
|
||||
version,
|
||||
format,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
height_to_supply_in_loss_relative_to_circulating_supply: (compute_relative_to_all
|
||||
&& compute_dollars)
|
||||
.then(|| {
|
||||
EagerVec::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_loss_relative_to_circulating_supply"),
|
||||
version,
|
||||
format,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
height_to_supply_in_profit_relative_to_circulating_supply: (compute_relative_to_all
|
||||
&& compute_dollars)
|
||||
.then(|| {
|
||||
EagerVec::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_profit_relative_to_circulating_supply"),
|
||||
version,
|
||||
format,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_even_relative_to_circulating_supply: (compute_relative_to_all
|
||||
&& compute_dollars)
|
||||
.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&suffix("supply_even_relative_to_circulating_supply"),
|
||||
true,
|
||||
version,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_in_loss_relative_to_circulating_supply: (compute_relative_to_all
|
||||
&& compute_dollars)
|
||||
.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_loss_relative_to_circulating_supply"),
|
||||
true,
|
||||
version,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
indexes_to_supply_in_profit_relative_to_circulating_supply: (compute_relative_to_all
|
||||
&& compute_dollars)
|
||||
.then(|| {
|
||||
ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
&suffix("supply_in_profit_relative_to_circulating_supply"),
|
||||
true,
|
||||
version,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1444,13 +1666,13 @@ impl Vecs {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn compute_rest(
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn compute_rest_part1(
|
||||
&mut self,
|
||||
indexer: &Indexer,
|
||||
indexes: &indexes::Vecs,
|
||||
fetched: Option<&fetched::Vecs>,
|
||||
starting_indexes: &Indexes,
|
||||
market: &market::Vecs,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()> {
|
||||
self.indexes_to_supply.compute_rest(
|
||||
@@ -1485,6 +1707,42 @@ impl Vecs {
|
||||
},
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn compute_rest_part2(
|
||||
&mut self,
|
||||
indexer: &Indexer,
|
||||
indexes: &indexes::Vecs,
|
||||
fetched: Option<&fetched::Vecs>,
|
||||
starting_indexes: &Indexes,
|
||||
market: &market::Vecs,
|
||||
height_to_supply: &impl AnyIterableVec<Height, Sats>,
|
||||
dateindex_to_supply: &impl AnyIterableVec<DateIndex, Sats>,
|
||||
height_to_realized_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()> {
|
||||
if let Some(v) = self
|
||||
.indexes_to_supply_relative_to_circulating_supply
|
||||
.as_mut()
|
||||
{
|
||||
v.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_percentage(
|
||||
starting_indexes.height,
|
||||
&self.height_to_supply,
|
||||
height_to_supply,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
}
|
||||
|
||||
if let Some(indexes_to_realized_cap) = self.indexes_to_realized_cap.as_mut() {
|
||||
indexes_to_realized_cap.compute_rest(
|
||||
indexes,
|
||||
@@ -1715,7 +1973,9 @@ impl Vecs {
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_rest(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
Some(self.dateindex_to_supply_in_profit.as_ref().unwrap()),
|
||||
@@ -1724,13 +1984,17 @@ impl Vecs {
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_rest(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
Some(self.dateindex_to_supply_in_loss.as_ref().unwrap()),
|
||||
)?;
|
||||
self.indexes_to_supply_even.as_mut().unwrap().compute_rest(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
Some(self.dateindex_to_supply_even.as_ref().unwrap()),
|
||||
@@ -1859,6 +2123,216 @@ impl Vecs {
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self.indexes_to_net_realized_profit_and_loss_relative_to_realized_cap
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|vec, _, _, starting_indexes, exit| {
|
||||
vec.compute_percentage(
|
||||
starting_indexes.height,
|
||||
self.indexes_to_net_realized_profit_and_loss
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.height
|
||||
.as_ref()
|
||||
.unwrap(),
|
||||
*height_to_realized_cap.as_ref().unwrap(),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self.height_to_supply_even_value
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_rest(
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
Some(self.height_to_supply_even.as_ref().unwrap()),
|
||||
)?;
|
||||
self.height_to_supply_in_loss_value
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_rest(
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
Some(self.height_to_supply_in_loss.as_ref().unwrap()),
|
||||
)?;
|
||||
self.height_to_supply_in_profit_value
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_rest(
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
Some(self.height_to_supply_in_profit.as_ref().unwrap()),
|
||||
)?;
|
||||
self.height_to_supply_even_relative_to_own_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_percentage(
|
||||
starting_indexes.height,
|
||||
self.height_to_supply_even.as_ref().unwrap(),
|
||||
&self.height_to_supply,
|
||||
exit,
|
||||
)?;
|
||||
self.height_to_supply_in_loss_relative_to_own_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_percentage(
|
||||
starting_indexes.height,
|
||||
self.height_to_supply_in_loss.as_ref().unwrap(),
|
||||
&self.height_to_supply,
|
||||
exit,
|
||||
)?;
|
||||
self.height_to_supply_in_profit_relative_to_own_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_percentage(
|
||||
starting_indexes.height,
|
||||
self.height_to_supply_even.as_ref().unwrap(),
|
||||
&self.height_to_supply,
|
||||
exit,
|
||||
)?;
|
||||
self.indexes_to_supply_even_relative_to_own_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_percentage(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_supply_even.as_ref().unwrap(),
|
||||
self.indexes_to_supply.sats.dateindex.unwrap_last(),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
self.indexes_to_supply_in_loss_relative_to_own_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_percentage(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_supply_even.as_ref().unwrap(),
|
||||
self.indexes_to_supply.sats.dateindex.unwrap_last(),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
self.indexes_to_supply_in_profit_relative_to_own_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_percentage(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_supply_even.as_ref().unwrap(),
|
||||
self.indexes_to_supply.sats.dateindex.unwrap_last(),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
if let Some(height_to_supply_even_relative_to_circulating_supply) = self
|
||||
.height_to_supply_even_relative_to_circulating_supply
|
||||
.as_mut()
|
||||
{
|
||||
height_to_supply_even_relative_to_circulating_supply.compute_percentage(
|
||||
starting_indexes.height,
|
||||
self.height_to_supply_even.as_ref().unwrap(),
|
||||
height_to_supply,
|
||||
exit,
|
||||
)?;
|
||||
self.height_to_supply_in_loss_relative_to_circulating_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_percentage(
|
||||
starting_indexes.height,
|
||||
self.height_to_supply_in_loss.as_ref().unwrap(),
|
||||
height_to_supply,
|
||||
exit,
|
||||
)?;
|
||||
self.height_to_supply_in_profit_relative_to_circulating_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_percentage(
|
||||
starting_indexes.height,
|
||||
self.height_to_supply_in_profit.as_ref().unwrap(),
|
||||
height_to_supply,
|
||||
exit,
|
||||
)?;
|
||||
self.indexes_to_supply_even_relative_to_circulating_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_percentage(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_supply_even.as_ref().unwrap(),
|
||||
dateindex_to_supply,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
self.indexes_to_supply_in_loss_relative_to_circulating_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_percentage(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_supply_in_loss.as_ref().unwrap(),
|
||||
dateindex_to_supply,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
self.indexes_to_supply_in_profit_relative_to_circulating_supply
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_percentage(
|
||||
starting_indexes.dateindex,
|
||||
self.dateindex_to_supply_in_profit.as_ref().unwrap(),
|
||||
dateindex_to_supply,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -2017,6 +2491,57 @@ impl Vecs {
|
||||
self.indexes_to_net_unrealized_profit_and_loss_relative_to_market_cap
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.indexes_to_net_realized_profit_and_loss_relative_to_realized_cap
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.height_to_supply_even_value
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.height_to_supply_in_loss_value
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.height_to_supply_in_profit_value
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.height_to_supply_even_relative_to_own_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| vec![v]),
|
||||
self.height_to_supply_in_loss_relative_to_own_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| vec![v]),
|
||||
self.height_to_supply_in_profit_relative_to_own_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| vec![v]),
|
||||
self.indexes_to_supply_even_relative_to_own_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.indexes_to_supply_in_loss_relative_to_own_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.indexes_to_supply_in_profit_relative_to_own_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.indexes_to_supply_relative_to_circulating_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.height_to_supply_even_relative_to_circulating_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| vec![v]),
|
||||
self.height_to_supply_in_loss_relative_to_circulating_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| vec![v]),
|
||||
self.height_to_supply_in_profit_relative_to_circulating_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| vec![v]),
|
||||
self.indexes_to_supply_even_relative_to_circulating_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.indexes_to_supply_in_loss_relative_to_circulating_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
self.indexes_to_supply_in_profit_relative_to_circulating_supply
|
||||
.as_ref()
|
||||
.map_or(vec![], |v| v.vecs()),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
|
||||
@@ -29,7 +29,7 @@ use super::{
|
||||
pub mod cohort;
|
||||
mod outputs;
|
||||
|
||||
const VERSION: Version = Version::new(21);
|
||||
const VERSION: Version = Version::new(9);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
@@ -40,6 +40,10 @@ pub struct Vecs {
|
||||
pub indexes_to_unspendable_supply: ComputedValueVecsFromHeight,
|
||||
pub height_to_opreturn_supply: EagerVec<Height, Sats>,
|
||||
pub indexes_to_opreturn_supply: ComputedValueVecsFromHeight,
|
||||
// pub height_to_satdays_destroyed: EagerVec<Height, Sats>,
|
||||
// pub indexes_to_satdays_destroyed: ComputedValueVecsFromHeight,
|
||||
// pub height_to_satblocks_destroyed: EagerVec<Height, Sats>,
|
||||
// pub indexes_to_satblocks_destroyed: ComputedValueVecsFromHeight,
|
||||
utxos_vecs: Outputs<(OutputFilter, cohort::Vecs)>,
|
||||
}
|
||||
|
||||
@@ -98,6 +102,36 @@ impl Vecs {
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
compute_dollars,
|
||||
)?,
|
||||
// height_to_satdays_destroyed: EagerVec::forced_import(
|
||||
// path,
|
||||
// "satdays_destroyed",
|
||||
// version,
|
||||
// format,
|
||||
// )?,
|
||||
// indexes_to_satdays_destroyed: ComputedValueVecsFromHeight::forced_import(
|
||||
// path,
|
||||
// "satdays_destroyed",
|
||||
// false,
|
||||
// version + VERSION + Version::ZERO,
|
||||
// format,
|
||||
// StorableVecGeneatorOptions::default().add_last(),
|
||||
// compute_dollars,
|
||||
// )?,
|
||||
// height_to_satblocks_destroyed: EagerVec::forced_import(
|
||||
// path,
|
||||
// "satblocks_destroyed",
|
||||
// version,
|
||||
// format,
|
||||
// )?,
|
||||
// indexes_to_satblocks_destroyed: ComputedValueVecsFromHeight::forced_import(
|
||||
// path,
|
||||
// "satblocks_destroyed",
|
||||
// false,
|
||||
// version + VERSION + Version::ZERO,
|
||||
// format,
|
||||
// StorableVecGeneatorOptions::default().add_last(),
|
||||
// compute_dollars,
|
||||
// )?,
|
||||
utxos_vecs: {
|
||||
Outputs::<(OutputFilter, cohort::Vecs)>::from(Outputs {
|
||||
all: cohort::Vecs::forced_import(
|
||||
@@ -109,6 +143,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
false,
|
||||
)?,
|
||||
by_term: OutputsByTerm {
|
||||
short: cohort::Vecs::forced_import(
|
||||
@@ -120,6 +155,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
long: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -130,6 +166,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
},
|
||||
by_up_to_date: OutputsByUpToDate {
|
||||
@@ -142,6 +179,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1w: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -152,6 +190,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -162,6 +201,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_2m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -172,6 +212,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_3m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -182,6 +223,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_4m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -192,6 +234,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_5m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -202,6 +245,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_6m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -212,6 +256,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -222,6 +267,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_2y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -232,6 +278,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_3y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -242,6 +289,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_4y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -252,6 +300,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_5y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -262,6 +311,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_6y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -272,6 +322,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_7y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -282,6 +333,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_8y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -292,6 +344,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_10y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -302,6 +355,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_15y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -312,6 +366,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
},
|
||||
by_from_date: OutputsByFromDate {
|
||||
@@ -324,6 +379,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1w: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -334,6 +390,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -344,6 +401,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_2m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -354,6 +412,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_3m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -364,6 +423,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_4m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -374,6 +434,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_5m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -384,6 +445,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_6m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -394,6 +456,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -404,6 +467,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_2y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -414,6 +478,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_3y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -424,6 +489,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_4y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -434,6 +500,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_5y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -444,6 +511,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_6y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -454,6 +522,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_7y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -464,6 +533,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_8y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -474,6 +544,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_10y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -484,6 +555,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_15y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -494,6 +566,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
},
|
||||
by_date_range: OutputsByDateRange {
|
||||
@@ -506,6 +579,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1d_to_1w: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -516,6 +590,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1w_to_1m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -526,6 +601,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1m_to_3m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -536,6 +612,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_3m_to_6m: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -546,6 +623,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_6m_to_1y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -556,6 +634,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1y_to_2y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -566,6 +645,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_2y_to_3y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -576,6 +656,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_3y_to_4y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -586,6 +667,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_4y_to_5y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -596,6 +678,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_5y_to_7y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -606,6 +689,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_7y_to_10y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -616,6 +700,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_10y_to_15y: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -626,6 +711,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_15y_to_end: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -636,6 +722,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
},
|
||||
by_epoch: OutputsByEpoch {
|
||||
@@ -648,6 +735,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -658,6 +746,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_2: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -668,6 +757,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_3: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -678,6 +768,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_4: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -688,6 +779,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
},
|
||||
by_size_range: OutputsBySizeRange {
|
||||
@@ -700,6 +792,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_1sat_to_10sats: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -710,6 +803,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_10sats_to_100sats: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -720,6 +814,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_100sats_to_1_000sats: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -730,6 +825,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_1_000sats_to_10_000sats: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -740,6 +836,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_10_000sats_to_100_000sats: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -750,6 +847,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_100_000sats_to_1_000_000sats: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -760,6 +858,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_1_000_000sats_to_10_000_000sats: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -770,6 +869,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_10_000_000sats_to_1btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -780,6 +880,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_1btc_to_10btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -790,6 +891,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_10btc_to_100btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -800,6 +902,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_100btc_to_1_000btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -810,6 +913,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_1_000btc_to_10_000btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -820,6 +924,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_10_000btc_to_100_000btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -830,6 +935,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
from_100_000btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -840,6 +946,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
},
|
||||
by_up_to_size: OutputsByUpToSize {
|
||||
@@ -852,6 +959,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_10_000sats: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -862,6 +970,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -872,6 +981,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_10btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -882,6 +992,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_100btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -892,6 +1003,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
},
|
||||
by_from_size: OutputsByFromSize {
|
||||
@@ -904,6 +1016,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_1btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -914,6 +1027,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_10btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -924,6 +1038,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
_100btc: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -934,6 +1049,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
},
|
||||
// by_value: OutputsByValue {
|
||||
@@ -1039,6 +1155,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
p2pk33: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -1049,6 +1166,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
p2pkh: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -1059,6 +1177,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
p2ms: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -1069,6 +1188,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
p2sh: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -1079,6 +1199,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
// opreturn: cohort::Vecs::forced_import(
|
||||
// path,
|
||||
@@ -1098,6 +1219,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
p2wsh: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -1108,6 +1230,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
p2tr: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -1118,6 +1241,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
p2a: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -1128,6 +1252,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
empty: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -1138,6 +1263,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
unknown: cohort::Vecs::forced_import(
|
||||
path,
|
||||
@@ -1148,6 +1274,7 @@ impl Vecs {
|
||||
fetched,
|
||||
keyspace,
|
||||
&stores_path,
|
||||
true,
|
||||
)?,
|
||||
},
|
||||
})
|
||||
@@ -1250,6 +1377,14 @@ impl Vecs {
|
||||
.validate_computed_version_or_reset_file(
|
||||
base_version + self.height_to_opreturn_supply.inner_version(),
|
||||
)?;
|
||||
// self.height_to_satblocks_destroyed
|
||||
// .validate_computed_version_or_reset_file(
|
||||
// base_version + self.height_to_satblocks_destroyed.inner_version(),
|
||||
// )?;
|
||||
// self.height_to_satdays_destroyed
|
||||
// .validate_computed_version_or_reset_file(
|
||||
// base_version + self.height_to_satdays_destroyed.inner_version(),
|
||||
// )?;
|
||||
|
||||
let mut chain_state: Vec<BlockState>;
|
||||
let mut chain_state_starting_height = Height::from(self.chain_state.len());
|
||||
@@ -1302,6 +1437,8 @@ impl Vecs {
|
||||
.min(stateful_starting_height)
|
||||
.min(Height::from(self.height_to_unspendable_supply.len()))
|
||||
.min(Height::from(self.height_to_opreturn_supply.len()));
|
||||
// .min(Height::from(self.height_to_satblocks_destroyed.len()));
|
||||
// .min(Height::from(self.height_to_satdays_destroyed.len()));
|
||||
|
||||
// ---
|
||||
// INIT
|
||||
@@ -1318,7 +1455,6 @@ impl Vecs {
|
||||
} else {
|
||||
Sats::ZERO
|
||||
};
|
||||
|
||||
let mut opreturn_supply = if let Some(prev_height) = starting_height.decremented() {
|
||||
self.height_to_opreturn_supply
|
||||
.into_iter()
|
||||
@@ -1326,6 +1462,20 @@ impl Vecs {
|
||||
} else {
|
||||
Sats::ZERO
|
||||
};
|
||||
// let mut satblocks_destroyed = if let Some(prev_height) = starting_height.decremented() {
|
||||
// self.height_to_satblocks_destroyed
|
||||
// .into_iter()
|
||||
// .unwrap_get_inner(prev_height)
|
||||
// } else {
|
||||
// Sats::ZERO
|
||||
// };
|
||||
// let mut satdays_destroyed = if let Some(prev_height) = starting_height.decremented() {
|
||||
// self.height_to_satdays_destroyed
|
||||
// .into_iter()
|
||||
// .unwrap_get_inner(prev_height)
|
||||
// } else {
|
||||
// Sats::ZERO
|
||||
// };
|
||||
|
||||
let mut height = starting_height;
|
||||
starting_indexes.update_from_height(height, indexes);
|
||||
@@ -1561,12 +1711,39 @@ impl Vecs {
|
||||
|
||||
info!("Computing rest...");
|
||||
|
||||
// Compute other vecs from height vecs
|
||||
self.utxos_vecs
|
||||
.as_mut_vecs()
|
||||
.par_iter_mut()
|
||||
.try_for_each(|(_, v)| {
|
||||
v.compute_rest(indexer, indexes, fetched, &starting_indexes, market, exit)
|
||||
v.compute_rest_part1(indexer, indexes, fetched, &starting_indexes, exit)
|
||||
})?;
|
||||
let height_to_supply = self.utxos_vecs.all.1.height_to_supply.clone();
|
||||
let dateindex_to_supply = self
|
||||
.utxos_vecs
|
||||
.all
|
||||
.1
|
||||
.indexes_to_supply
|
||||
.sats
|
||||
.dateindex
|
||||
.unwrap_last()
|
||||
.clone();
|
||||
let height_to_realized_cap = self.utxos_vecs.all.1.height_to_realized_cap.clone();
|
||||
let height_to_realized_cap = height_to_realized_cap.as_ref();
|
||||
self.utxos_vecs
|
||||
.as_mut_vecs()
|
||||
.par_iter_mut()
|
||||
.try_for_each(|(_, v)| {
|
||||
v.compute_rest_part2(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
&starting_indexes,
|
||||
market,
|
||||
&height_to_supply,
|
||||
&dateindex_to_supply,
|
||||
height_to_realized_cap,
|
||||
exit,
|
||||
)
|
||||
})?;
|
||||
self.indexes_to_unspendable_supply.compute_rest(
|
||||
indexer,
|
||||
@@ -1584,6 +1761,22 @@ impl Vecs {
|
||||
exit,
|
||||
Some(&self.height_to_opreturn_supply),
|
||||
)?;
|
||||
// self.indexes_to_satblocks_destroyed.compute_rest(
|
||||
// indexer,
|
||||
// indexes,
|
||||
// fetched,
|
||||
// &starting_indexes,
|
||||
// exit,
|
||||
// Some(&self.height_to_satblocks_destroyed),
|
||||
// )?;
|
||||
// self.indexes_to_satdays_destroyed.compute_rest(
|
||||
// indexer,
|
||||
// indexes,
|
||||
// fetched,
|
||||
// &starting_indexes,
|
||||
// exit,
|
||||
// Some(&self.height_to_satdays_destroyed),
|
||||
// )?;
|
||||
|
||||
exit.release();
|
||||
|
||||
@@ -1602,6 +1795,8 @@ impl Vecs {
|
||||
.try_for_each(|(_, v)| v.safe_flush_stateful_vecs(height, exit))?;
|
||||
self.height_to_unspendable_supply.safe_flush(exit)?;
|
||||
self.height_to_opreturn_supply.safe_flush(exit)?;
|
||||
// self.height_to_satblocks_destroyed.safe_flush(exit)?;
|
||||
// self.height_to_satdays_destroyed.safe_flush(exit)?;
|
||||
|
||||
self.chain_state.truncate_if_needed(Height::ZERO)?;
|
||||
chain_state.iter().for_each(|block_state| {
|
||||
@@ -1625,6 +1820,16 @@ impl Vecs {
|
||||
&self.height_to_unspendable_supply,
|
||||
&self.height_to_opreturn_supply,
|
||||
],
|
||||
// self.indexes_to_satblocks_destroyed.vecs(),
|
||||
// vec![
|
||||
// &self.height_to_unspendable_supply,
|
||||
// &self.height_to_satblocks_destroyed,
|
||||
// ],
|
||||
// self.indexes_to_satdays_destroyed.vecs(),
|
||||
// vec![
|
||||
// &self.height_to_unspendable_supply,
|
||||
// &self.height_to_satdays_destroyed,
|
||||
// ],
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
|
||||
@@ -68,6 +68,12 @@ impl CheckedSub<Sats> for Sats {
|
||||
}
|
||||
}
|
||||
|
||||
impl CheckedSub<usize> for Sats {
|
||||
fn checked_sub(self, rhs: usize) -> Option<Self> {
|
||||
self.0.checked_sub(rhs as u64).map(Self::from)
|
||||
}
|
||||
}
|
||||
|
||||
impl SubAssign for Sats {
|
||||
fn sub_assign(&mut self, rhs: Self) {
|
||||
*self = self.checked_sub(rhs).unwrap();
|
||||
@@ -77,21 +83,28 @@ impl SubAssign for Sats {
|
||||
impl Mul<Sats> for Sats {
|
||||
type Output = Self;
|
||||
fn mul(self, rhs: Sats) -> Self::Output {
|
||||
Sats::from(self.0 * rhs.0)
|
||||
Sats::from(self.0.checked_mul(rhs.0).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul<usize> for Sats {
|
||||
type Output = Self;
|
||||
fn mul(self, rhs: usize) -> Self::Output {
|
||||
Sats::from(self.0.checked_mul(rhs as u64).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul<u64> for Sats {
|
||||
type Output = Self;
|
||||
fn mul(self, rhs: u64) -> Self::Output {
|
||||
Sats::from(self.0 * rhs)
|
||||
Sats::from(self.0.checked_mul(rhs).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul<Height> for Sats {
|
||||
type Output = Self;
|
||||
fn mul(self, rhs: Height) -> Self::Output {
|
||||
Sats::from(self.0 * u64::from(rhs))
|
||||
Sats::from(self.0.checked_mul(u64::from(rhs)).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +127,17 @@ impl Div<Dollars> for Sats {
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<Sats> for Sats {
|
||||
type Output = Self;
|
||||
fn div(self, rhs: Sats) -> Self::Output {
|
||||
if rhs.0 == 0 {
|
||||
Self(0)
|
||||
} else {
|
||||
Self(self.0 / rhs.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<usize> for Sats {
|
||||
type Output = Self;
|
||||
fn div(self, rhs: usize) -> Self::Output {
|
||||
|
||||
@@ -7,7 +7,7 @@ use derive_deref::Deref;
|
||||
use serde::Serialize;
|
||||
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
|
||||
|
||||
use crate::CheckedSub;
|
||||
use crate::{CheckedSub, Sats};
|
||||
|
||||
#[derive(
|
||||
Debug, Deref, Default, Clone, Copy, FromBytes, Immutable, IntoBytes, KnownLayout, Serialize,
|
||||
@@ -96,3 +96,9 @@ impl Ord for StoredF64 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Sats> for StoredF64 {
|
||||
fn from(value: Sats) -> Self {
|
||||
Self(u64::from(value) as f64)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ minreq = { workspace = true }
|
||||
oxc = { version = "0.72.2", features = ["codegen", "minifier"] }
|
||||
serde = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tower-http = { version = "0.6.5", features = ["compression-full", "trace"] }
|
||||
tower-http = { version = "0.6.6", features = ["compression-full", "trace"] }
|
||||
zip = "4.0.0"
|
||||
tracing = "0.1.41"
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ impl OutputFilter {
|
||||
OutputFilter::All => false,
|
||||
OutputFilter::To(to2) => to >= to2,
|
||||
OutputFilter::Range(range) => range.end <= *to,
|
||||
OutputFilter::From(_) => true,
|
||||
OutputFilter::From(_) => false,
|
||||
OutputFilter::Epoch(_) => false,
|
||||
OutputFilter::Type(_) => false,
|
||||
},
|
||||
|
||||
@@ -11,8 +11,8 @@ use std::{
|
||||
|
||||
use arc_swap::ArcSwap;
|
||||
use brk_core::{
|
||||
Bitcoin, CheckedSub, Close, Date, DateIndex, Dollars, Error, Height, Result, Sats, StoredF32,
|
||||
StoredUsize, TxIndex, Value, Version,
|
||||
Bitcoin, CheckedSub, Close, Date, DateIndex, Dollars, Error, Result, Sats, StoredF32,
|
||||
StoredUsize, Value, Version,
|
||||
};
|
||||
use brk_exit::Exit;
|
||||
use log::info;
|
||||
@@ -1182,12 +1182,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl EagerVec<Height, Dollars> {
|
||||
impl<I> EagerVec<I, Dollars>
|
||||
where
|
||||
I: StoredIndex,
|
||||
{
|
||||
pub fn compute_from_bitcoin(
|
||||
&mut self,
|
||||
max_from: Height,
|
||||
bitcoin: &impl AnyIterableVec<Height, Bitcoin>,
|
||||
price: &impl AnyIterableVec<Height, Close<Dollars>>,
|
||||
max_from: I,
|
||||
bitcoin: &impl AnyIterableVec<I, Bitcoin>,
|
||||
price: &impl AnyIterableVec<I, Close<Dollars>>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.validate_computed_version_or_reset_file(
|
||||
@@ -1195,7 +1198,7 @@ impl EagerVec<Height, Dollars> {
|
||||
)?;
|
||||
|
||||
let mut price_iter = price.iter();
|
||||
let index = max_from.min(Height::from(self.len()));
|
||||
let index = max_from.min(I::from(self.len()));
|
||||
bitcoin.iter_at(index).try_for_each(|(i, bitcoin)| {
|
||||
let dollars = price_iter.unwrap_get_inner(i);
|
||||
let (i, v) = (i, *dollars * bitcoin.into_inner());
|
||||
@@ -1206,36 +1209,36 @@ impl EagerVec<Height, Dollars> {
|
||||
}
|
||||
}
|
||||
|
||||
impl EagerVec<TxIndex, Dollars> {
|
||||
pub fn compute_from_bitcoin(
|
||||
&mut self,
|
||||
max_from: TxIndex,
|
||||
bitcoin: &impl AnyIterableVec<TxIndex, Bitcoin>,
|
||||
i_to_height: &impl AnyIterableVec<TxIndex, Height>,
|
||||
price: &impl AnyIterableVec<Height, Close<Dollars>>,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.validate_computed_version_or_reset_file(
|
||||
Version::ZERO
|
||||
+ self.inner.version()
|
||||
+ bitcoin.version()
|
||||
+ i_to_height.version()
|
||||
+ price.version(),
|
||||
)?;
|
||||
// impl EagerVec<TxIndex, Dollars> {
|
||||
// pub fn compute_txindex_from_bitcoin(
|
||||
// &mut self,
|
||||
// max_from: TxIndex,
|
||||
// bitcoin: &impl AnyIterableVec<TxIndex, Bitcoin>,
|
||||
// i_to_height: &impl AnyIterableVec<TxIndex, Height>,
|
||||
// price: &impl AnyIterableVec<Height, Close<Dollars>>,
|
||||
// exit: &Exit,
|
||||
// ) -> Result<()> {
|
||||
// self.validate_computed_version_or_reset_file(
|
||||
// Version::ZERO
|
||||
// + self.inner.version()
|
||||
// + bitcoin.version()
|
||||
// + i_to_height.version()
|
||||
// + price.version(),
|
||||
// )?;
|
||||
|
||||
let mut i_to_height_iter = i_to_height.iter();
|
||||
let mut price_iter = price.iter();
|
||||
let index = max_from.min(TxIndex::from(self.len()));
|
||||
bitcoin.iter_at(index).try_for_each(|(i, bitcoin, ..)| {
|
||||
let height = i_to_height_iter.unwrap_get_inner(i);
|
||||
let dollars = price_iter.unwrap_get_inner(height);
|
||||
let (i, v) = (i, *dollars * bitcoin.into_inner());
|
||||
self.forced_push_at(i, v, exit)
|
||||
})?;
|
||||
// let mut i_to_height_iter = i_to_height.iter();
|
||||
// let mut price_iter = price.iter();
|
||||
// let index = max_from.min(TxIndex::from(self.len()));
|
||||
// bitcoin.iter_at(index).try_for_each(|(i, bitcoin, ..)| {
|
||||
// let height = i_to_height_iter.unwrap_get_inner(i);
|
||||
// let dollars = price_iter.unwrap_get_inner(height);
|
||||
// let (i, v) = (i, *dollars * bitcoin.into_inner());
|
||||
// self.forced_push_at(i, v, exit)
|
||||
// })?;
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
}
|
||||
// self.safe_flush(exit)
|
||||
// }
|
||||
// }
|
||||
|
||||
impl<'a, I, T> IntoIterator for &'a EagerVec<I, T>
|
||||
where
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
* "Bool" |
|
||||
* "Days" |
|
||||
* "%mcap" |
|
||||
* "%rcap" |
|
||||
* "%self" |
|
||||
* "%all" |
|
||||
* "Years" |
|
||||
* "Locktime" |
|
||||
* "sat/vB" |
|
||||
@@ -702,7 +705,8 @@ function createUtils() {
|
||||
if (
|
||||
(!unit || thoroughUnitCheck) &&
|
||||
(id.includes("in-sats") ||
|
||||
id.endsWith("supply") ||
|
||||
(id.endsWith("supply") &&
|
||||
!(id.endsWith("circulating-supply") || id.endsWith("-own-supply"))) ||
|
||||
id.endsWith("supply-even") ||
|
||||
id.endsWith("supply-in-profit") ||
|
||||
id.endsWith("supply-in-loss") ||
|
||||
@@ -743,7 +747,7 @@ function createUtils() {
|
||||
!id.includes("ratio") &&
|
||||
!id.includes("relative-to")) ||
|
||||
(id.endsWith("sma") && !id.includes("ratio")) ||
|
||||
id.endsWith("ath"))
|
||||
id === "ath")
|
||||
) {
|
||||
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
|
||||
unit = "USD";
|
||||
@@ -878,6 +882,24 @@ function createUtils() {
|
||||
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
|
||||
unit = "%mcap";
|
||||
}
|
||||
if (
|
||||
(!unit || thoroughUnitCheck) &&
|
||||
id.endsWith("relative-to-realized-cap")
|
||||
) {
|
||||
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
|
||||
unit = "%rcap";
|
||||
}
|
||||
if (
|
||||
(!unit || thoroughUnitCheck) &&
|
||||
id.endsWith("relative-to-circulating-supply")
|
||||
) {
|
||||
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
|
||||
unit = "%all";
|
||||
}
|
||||
if ((!unit || thoroughUnitCheck) && id.endsWith("relative-to-own-supply")) {
|
||||
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
|
||||
unit = "%self";
|
||||
}
|
||||
if ((!unit || thoroughUnitCheck) && id.endsWith("epoch")) {
|
||||
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
|
||||
unit = "Epoch";
|
||||
@@ -890,7 +912,10 @@ function createUtils() {
|
||||
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
|
||||
unit = "Hash";
|
||||
}
|
||||
if ((!unit || thoroughUnitCheck) && id.includes("days-between")) {
|
||||
if (
|
||||
(!unit || thoroughUnitCheck) &&
|
||||
(id.includes("days-between") || id.includes("days-since"))
|
||||
) {
|
||||
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
|
||||
unit = "Days";
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
*
|
||||
* @typedef {AnySeriesBlueprint["type"]} SeriesType
|
||||
*
|
||||
* @typedef {{ key: ChartableVecId }} FetchedAnySeriesOptions
|
||||
* @typedef {{ key: ChartableVecId, unit?: Unit | Unit[] }} FetchedAnySeriesOptions
|
||||
*
|
||||
* @typedef {BaselineSeriesBlueprint & FetchedAnySeriesOptions} FetchedBaselineSeriesBlueprint
|
||||
* @typedef {CandlestickSeriesBlueprint & FetchedAnySeriesOptions} FetchedCandlestickSeriesBlueprint
|
||||
@@ -447,7 +447,7 @@ function createPartialOptions(colors) {
|
||||
|
||||
const range = /** @type {const} */ ([
|
||||
{
|
||||
key: "up-to-1d",
|
||||
key: "start-to-1d",
|
||||
name: "24h",
|
||||
title: "Last 24 hours",
|
||||
color: colors.pink,
|
||||
@@ -525,7 +525,7 @@ function createPartialOptions(colors) {
|
||||
color: colors.pink,
|
||||
},
|
||||
{
|
||||
key: "from-15y",
|
||||
key: "from-15y-to-end",
|
||||
name: "15y+",
|
||||
title: "From 15 Years ago to genesis (2009-01-03)",
|
||||
color: colors.red,
|
||||
@@ -1165,9 +1165,9 @@ function createPartialOptions(colors) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {"-realized-cap"} RealizedCapSuffix
|
||||
* @typedef {EndsWith<RealizedCapSuffix>} VecIdRealizedCap
|
||||
* @typedef {WithoutSuffix<VecIdRealizedCap, RealizedCapSuffix>} VecIdRealizedCapBase
|
||||
* @typedef {"-supply-in-profit"} SupplyInProfitSuffix
|
||||
* @typedef {EndsWith<SupplyInProfitSuffix>} VecIdSupplyInProfit
|
||||
* @typedef {WithoutSuffix<VecIdSupplyInProfit, SupplyInProfitSuffix>} CohortId
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -1175,7 +1175,7 @@ function createPartialOptions(colors) {
|
||||
* @property {string} args.name
|
||||
* @property {string} args.title
|
||||
* @property {Color} args.color
|
||||
* @property {"" | VecIdRealizedCapBase} args.key
|
||||
* @property {"" | CohortId} args.key
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -1190,7 +1190,7 @@ function createPartialOptions(colors) {
|
||||
*/
|
||||
function createUTXOGroupFolder(args) {
|
||||
/**
|
||||
* @template {"" | VecIdRealizedCapBase} T
|
||||
* @template {"" | CohortId} T
|
||||
* @param {T} _key
|
||||
*/
|
||||
const fixKey = (_key) =>
|
||||
@@ -1259,21 +1259,21 @@ function createPartialOptions(colors) {
|
||||
lineStyle: 4,
|
||||
},
|
||||
}),
|
||||
// createBaseSeries({
|
||||
// key: `${key}supply-in-profit-in-btc`,
|
||||
// name: useGroupName ? name : "In Profit",
|
||||
// color: colors.green,
|
||||
// }),
|
||||
// createBaseSeries({
|
||||
// key: `${key}supply-in-loss-in-btc`,
|
||||
// name: useGroupName ? name : "In Loss",
|
||||
// color: colors.red,
|
||||
// }),
|
||||
// createBaseSeries({
|
||||
// key: `${key}supply-even-in-btc`,
|
||||
// name: useGroupName ? name : "Even",
|
||||
// color: colors.yellow,
|
||||
// }),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-in-profit-in-btc`,
|
||||
name: useGroupName ? name : "In Profit",
|
||||
color: colors.green,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-in-loss-in-btc`,
|
||||
name: useGroupName ? name : "In Loss",
|
||||
color: colors.red,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-even-in-btc`,
|
||||
name: useGroupName ? name : "Even",
|
||||
color: colors.yellow,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}halved-supply-in-usd`,
|
||||
name: useGroupName ? name : "Halved",
|
||||
@@ -1282,21 +1282,60 @@ function createPartialOptions(colors) {
|
||||
lineStyle: 4,
|
||||
},
|
||||
}),
|
||||
// createBaseSeries({
|
||||
// key: `${key}supply-in-profit-in-usd`,
|
||||
// name: useGroupName ? name : "In Profit",
|
||||
// color: colors.green,
|
||||
// }),
|
||||
// createBaseSeries({
|
||||
// key: `${key}supply-in-loss-in-usd`,
|
||||
// name: useGroupName ? name : "In Loss",
|
||||
// color: colors.red,
|
||||
// }),
|
||||
// createBaseSeries({
|
||||
// key: `${key}supply-even-in-usd`,
|
||||
// name: useGroupName ? name : "Even",
|
||||
// color: colors.yellow,
|
||||
// }),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-in-profit-in-usd`,
|
||||
name: useGroupName ? name : "In Profit",
|
||||
color: colors.green,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-in-loss-in-usd`,
|
||||
name: useGroupName ? name : "In Loss",
|
||||
color: colors.red,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-even-in-usd`,
|
||||
name: useGroupName ? name : "Even",
|
||||
color: colors.yellow,
|
||||
}),
|
||||
...(key
|
||||
? [
|
||||
createBaseSeries({
|
||||
key: `${key}supply-relative-to-circulating-supply`,
|
||||
name: useGroupName ? name : "Supply",
|
||||
color: colors.default,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-in-profit-relative-to-circulating-supply`,
|
||||
name: useGroupName ? name : "In Profit",
|
||||
color: colors.green,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-in-loss-relative-to-circulating-supply`,
|
||||
name: useGroupName ? name : "In Loss",
|
||||
color: colors.red,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-even-relative-to-circulating-supply`,
|
||||
name: useGroupName ? name : "Even",
|
||||
color: colors.yellow,
|
||||
}),
|
||||
]
|
||||
: []),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-in-profit-relative-to-own-supply`,
|
||||
name: useGroupName ? name : "In Profit",
|
||||
color: colors.green,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-in-loss-relative-to-own-supply`,
|
||||
name: useGroupName ? name : "In Loss",
|
||||
color: colors.red,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}supply-even-relative-to-own-supply`,
|
||||
name: useGroupName ? name : "Even",
|
||||
color: colors.yellow,
|
||||
}),
|
||||
]
|
||||
: []),
|
||||
]);
|
||||
@@ -1370,7 +1409,7 @@ function createPartialOptions(colors) {
|
||||
...(!("list" in args)
|
||||
? [
|
||||
{
|
||||
name: "profit and loss",
|
||||
name: "pnl",
|
||||
title: `${args.title} Realized Profit And Loss`,
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
@@ -1425,20 +1464,30 @@ function createPartialOptions(colors) {
|
||||
{
|
||||
name: "Net pnl",
|
||||
title: `${args.title} Net Realized Profit And Loss`,
|
||||
bottom: list.flatMap(
|
||||
({ color, name, key }) =>
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
type: "Baseline",
|
||||
key: `${fixKey(key)}net-realized-profit-and-loss`,
|
||||
title: useGroupName ? name : "Net",
|
||||
color: useGroupName ? color : undefined,
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
bottom: list.flatMap(({ color, name, key }) => [
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
type: "Baseline",
|
||||
key: `${fixKey(key)}net-realized-profit-and-loss`,
|
||||
title: useGroupName ? name : "Net",
|
||||
color: useGroupName ? color : undefined,
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
}),
|
||||
),
|
||||
},
|
||||
}),
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
type: "Baseline",
|
||||
key: `${fixKey(key)}net-realized-profit-and-loss-relative-to-realized-cap`,
|
||||
title: useGroupName ? name : "Net",
|
||||
color: useGroupName ? color : undefined,
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
]),
|
||||
},
|
||||
{
|
||||
name: "sopr",
|
||||
@@ -1487,7 +1536,7 @@ function createPartialOptions(colors) {
|
||||
...(!("list" in args)
|
||||
? [
|
||||
{
|
||||
name: "profit and loss",
|
||||
name: "pnl",
|
||||
title: `${args.title} Unrealized Profit And Loss`,
|
||||
bottom: [
|
||||
// createBaseSeries({
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user