global: wip

This commit is contained in:
nym21
2025-06-02 18:22:42 +02:00
parent 98a312701f
commit 93ee5e480b
54 changed files with 3914 additions and 1076 deletions

View File

@@ -2,7 +2,7 @@ use std::path::Path;
use brk_core::{CheckedSub, Result, StoredUsize, Version};
use brk_exit::Exit;
use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, EagerVec, StoredIndex, StoredType};
use brk_vec::{AnyCollectableVec, AnyIterableVec, EagerVec, Format, StoredIndex, StoredType};
use color_eyre::eyre::ContextCompat;
use crate::utils::get_percentile;
@@ -40,7 +40,7 @@ where
path: &Path,
name: &str,
version: Version,
compressed: Compressed,
format: Format,
options: StorableVecGeneatorOptions,
) -> color_eyre::Result<Self> {
let only_one_active = options.is_only_one_active();
@@ -72,15 +72,14 @@ where
path,
&maybe_prefix("first"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
}),
last: options.last.then(|| {
Box::new(
EagerVec::forced_import(path, name, version + Version::ZERO, compressed)
.unwrap(),
EagerVec::forced_import(path, name, version + Version::ZERO, format).unwrap(),
)
}),
min: options.min.then(|| {
@@ -89,7 +88,7 @@ where
path,
&maybe_suffix("min"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
@@ -100,7 +99,7 @@ where
path,
&maybe_suffix("max"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
@@ -111,7 +110,7 @@ where
path,
&maybe_suffix("median"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
@@ -122,7 +121,7 @@ where
path,
&maybe_suffix("average"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
@@ -133,7 +132,7 @@ where
path,
&maybe_suffix("sum"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
@@ -144,7 +143,7 @@ where
path,
&prefix("cumulative"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
@@ -155,7 +154,7 @@ where
path,
&maybe_suffix("90p"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
@@ -166,7 +165,7 @@ where
path,
&maybe_suffix("75p"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
@@ -177,7 +176,7 @@ where
path,
&maybe_suffix("25p"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)
@@ -188,7 +187,7 @@ where
path,
&maybe_suffix("10p"),
version + VERSION + Version::ZERO,
compressed,
format,
)
.unwrap(),
)

View File

@@ -5,7 +5,7 @@ use brk_core::{
};
use brk_exit::Exit;
use brk_indexer::Indexer;
use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, EagerVec};
use brk_vec::{AnyCollectableVec, AnyIterableVec, EagerVec, Format};
use crate::vecs::{Indexes, indexes};
@@ -36,19 +36,18 @@ where
name: &str,
compute_source: bool,
version: Version,
compressed: Compressed,
format: Format,
options: StorableVecGeneatorOptions,
) -> color_eyre::Result<Self> {
let dateindex = compute_source.then(|| {
EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, compressed)
.unwrap()
EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, format).unwrap()
});
let dateindex_extra = ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options.copy_self_extra(),
)?;
@@ -61,35 +60,35 @@ where
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
monthindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
quarterindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
yearindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
decadeindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
})

View File

@@ -6,7 +6,7 @@ use brk_core::{
};
use brk_exit::Exit;
use brk_indexer::Indexer;
use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, EagerVec};
use brk_vec::{AnyCollectableVec, AnyIterableVec, EagerVec, Format};
use crate::vecs::{Indexes, indexes};
@@ -41,19 +41,18 @@ where
name: &str,
compute_source: bool,
version: Version,
compressed: Compressed,
format: Format,
options: StorableVecGeneatorOptions,
) -> color_eyre::Result<Self> {
let height = compute_source.then(|| {
EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, compressed)
.unwrap()
EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, format).unwrap()
});
let height_extra = ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options.copy_self_extra(),
)?;
@@ -61,7 +60,7 @@ where
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?;
@@ -75,43 +74,43 @@ where
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
difficultyepoch: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
monthindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
quarterindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
yearindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
// halvingepoch: StorableVecGeneator::forced_import(path, name, version + VERSION + Version::ZERO, compressed, options)?,
// halvingepoch: StorableVecGeneator::forced_import(path, name, version + VERSION + Version::ZERO, format, options)?,
decadeindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
})

View File

@@ -3,7 +3,7 @@ use std::path::Path;
use brk_core::{DifficultyEpoch, Height, Result, Version};
use brk_exit::Exit;
use brk_indexer::Indexer;
use brk_vec::{AnyCollectableVec, Compressed, EagerVec};
use brk_vec::{AnyCollectableVec, EagerVec, Format};
use crate::vecs::{Indexes, indexes};
@@ -31,17 +31,17 @@ where
path: &Path,
name: &str,
version: Version,
compressed: Compressed,
format: Format,
options: StorableVecGeneatorOptions,
) -> color_eyre::Result<Self> {
let height =
EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, compressed)?;
EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, format)?;
let height_extra = ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options.copy_self_extra(),
)?;
@@ -54,10 +54,10 @@ where
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
// halvingepoch: StorableVecGeneator::forced_import(path, name, version + VERSION + Version::ZERO, compressed, options)?,
// halvingepoch: StorableVecGeneator::forced_import(path, name, version + VERSION + Version::ZERO, format, options)?,
})
}

View File

@@ -7,7 +7,7 @@ use brk_core::{
use brk_exit::Exit;
use brk_indexer::Indexer;
use brk_vec::{
AnyCollectableVec, AnyVec, CollectableVec, Compressed, EagerVec, StoredIndex, VecIterator,
AnyCollectableVec, AnyVec, CollectableVec, EagerVec, Format, StoredIndex, VecIterator,
};
use crate::vecs::{Indexes, fetched, indexes};
@@ -43,12 +43,12 @@ where
name: &str,
compute_source: bool,
version: Version,
compressed: Compressed,
format: Format,
options: StorableVecGeneatorOptions,
) -> color_eyre::Result<Self> {
let txindex = compute_source.then(|| {
Box::new(
EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, compressed)
EagerVec::forced_import(path, name, version + VERSION + Version::ZERO, format)
.unwrap(),
)
});
@@ -57,7 +57,7 @@ where
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?;
@@ -70,50 +70,50 @@ where
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
weekindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
difficultyepoch: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
monthindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
quarterindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
yearindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
// halvingepoch: StorableVecGeneator::forced_import(path, name, version + VERSION + Version::ZERO, compressed, options)?,
// halvingepoch: StorableVecGeneator::forced_import(path, name, version + VERSION + Version::ZERO, format, options)?,
decadeindex: ComputedVecBuilder::forced_import(
path,
name,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
})

View File

@@ -4,7 +4,7 @@ use brk_core::{Date, DateIndex, Dollars, Result, StoredF32, Version};
use brk_exit::Exit;
use brk_indexer::Indexer;
use brk_vec::{
AnyCollectableVec, AnyIterableVec, AnyVec, CollectableVec, Compressed, EagerVec, StoredIndex,
AnyCollectableVec, AnyIterableVec, AnyVec, CollectableVec, EagerVec, Format, StoredIndex,
VecIterator,
};
@@ -61,7 +61,7 @@ impl ComputedRatioVecsFromDateIndex {
name: &str,
compute_source: bool,
version: Version,
compressed: Compressed,
format: Format,
options: StorableVecGeneatorOptions,
) -> color_eyre::Result<Self> {
Ok(Self {
@@ -71,7 +71,7 @@ impl ComputedRatioVecsFromDateIndex {
name,
true,
version + VERSION,
compressed,
format,
options,
)
.unwrap()
@@ -81,7 +81,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_sma: ComputedVecsFromDateIndex::forced_import(
@@ -89,7 +89,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_sma"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_1w_sma: ComputedVecsFromDateIndex::forced_import(
@@ -97,7 +97,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_1w_sma"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_1m_sma: ComputedVecsFromDateIndex::forced_import(
@@ -105,7 +105,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_1m_sma"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_1y_sma: ComputedVecsFromDateIndex::forced_import(
@@ -113,7 +113,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_1y_sma"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_1y_sma_momentum_oscillator: ComputedVecsFromDateIndex::forced_import(
@@ -121,7 +121,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_1y_sma_momentum_oscillator"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_standard_deviation: ComputedVecsFromDateIndex::forced_import(
@@ -129,7 +129,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_standard_deviation"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p99_9: ComputedVecsFromDateIndex::forced_import(
@@ -137,7 +137,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p99_9"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p99_5: ComputedVecsFromDateIndex::forced_import(
@@ -145,7 +145,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p99_5"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p99: ComputedVecsFromDateIndex::forced_import(
@@ -153,7 +153,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p99"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p1: ComputedVecsFromDateIndex::forced_import(
@@ -161,7 +161,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p1"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p0_5: ComputedVecsFromDateIndex::forced_import(
@@ -169,7 +169,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p0_5"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p0_1: ComputedVecsFromDateIndex::forced_import(
@@ -177,7 +177,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p0_1"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p1sd: ComputedVecsFromDateIndex::forced_import(
@@ -185,7 +185,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p1sd"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p2sd: ComputedVecsFromDateIndex::forced_import(
@@ -193,7 +193,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p2sd"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p3sd: ComputedVecsFromDateIndex::forced_import(
@@ -201,7 +201,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p3sd"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_m1sd: ComputedVecsFromDateIndex::forced_import(
@@ -209,7 +209,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_m1sd"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_m2sd: ComputedVecsFromDateIndex::forced_import(
@@ -217,7 +217,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_m2sd"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_m3sd: ComputedVecsFromDateIndex::forced_import(
@@ -225,7 +225,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_m3sd"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p99_9_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -233,7 +233,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p99_9_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p99_5_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -241,7 +241,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p99_5_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p99_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -249,7 +249,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p99_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p1_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -257,7 +257,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p1_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p0_5_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -265,7 +265,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p0_5_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p0_1_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -273,7 +273,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p0_1_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p1sd_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -281,7 +281,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p1sd_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p2sd_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -289,7 +289,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p2sd_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_p3sd_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -297,7 +297,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_p3sd_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_m1sd_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -305,7 +305,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_m1sd_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_m2sd_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -313,7 +313,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_m2sd_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_m3sd_as_price: ComputedVecsFromDateIndex::forced_import(
@@ -321,7 +321,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_m3sd_as_price"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
ratio_zscore: ComputedVecsFromDateIndex::forced_import(
@@ -329,7 +329,7 @@ impl ComputedRatioVecsFromDateIndex {
&format!("{name}_ratio_zscore"),
true,
version + VERSION + Version::ZERO,
compressed,
format,
options,
)?,
})

View File

@@ -3,7 +3,7 @@ use std::path::Path;
use brk_core::{Bitcoin, Dollars, Height, Result, Sats, Version};
use brk_exit::Exit;
use brk_indexer::Indexer;
use brk_vec::{AnyCollectableVec, CollectableVec, Compressed, EagerVec, StoredVec};
use brk_vec::{AnyCollectableVec, CollectableVec, EagerVec, Format, StoredVec};
use crate::vecs::{Indexes, fetched, indexes};
@@ -24,7 +24,7 @@ impl ComputedValueVecsFromHeight {
name: &str,
compute_source: bool,
version: Version,
compressed: Compressed,
format: Format,
options: StorableVecGeneatorOptions,
compute_dollars: bool,
) -> color_eyre::Result<Self> {
@@ -34,7 +34,7 @@ impl ComputedValueVecsFromHeight {
name,
compute_source,
version + VERSION,
compressed,
format,
options,
)?,
bitcoin: ComputedVecsFromHeight::forced_import(
@@ -42,7 +42,7 @@ impl ComputedValueVecsFromHeight {
&format!("{name}_in_btc"),
true,
version + VERSION,
compressed,
format,
options,
)?,
dollars: compute_dollars.then(|| {
@@ -51,7 +51,7 @@ impl ComputedValueVecsFromHeight {
&format!("{name}_in_usd"),
true,
version + VERSION,
compressed,
format,
options,
)
.unwrap()

View File

@@ -4,8 +4,8 @@ use brk_core::{Bitcoin, Close, Dollars, Height, Sats, TxIndex, Version};
use brk_exit::Exit;
use brk_indexer::Indexer;
use brk_vec::{
AnyCollectableVec, BoxedAnyIterableVec, CloneableAnyIterableVec, CollectableVec, Compressed,
Computation, ComputedVecFrom3, LazyVecFrom1, StoredIndex, StoredVec,
AnyCollectableVec, BoxedAnyIterableVec, CloneableAnyIterableVec, CollectableVec, Computation,
ComputedVecFrom3, Format, LazyVecFrom1, StoredIndex, StoredVec,
};
use crate::vecs::{Indexes, fetched, indexes};
@@ -44,7 +44,7 @@ impl ComputedValueVecsFromTxindex {
source: Option<BoxedAnyIterableVec<TxIndex, Sats>>,
version: Version,
computation: Computation,
compressed: Compressed,
format: Format,
fetched: Option<&fetched::Vecs>,
options: StorableVecGeneatorOptions,
) -> color_eyre::Result<Self> {
@@ -59,7 +59,7 @@ impl ComputedValueVecsFromTxindex {
name,
compute_source,
version + VERSION,
compressed,
format,
options,
)?;
@@ -80,7 +80,7 @@ impl ComputedValueVecsFromTxindex {
&name_in_btc,
false,
version + VERSION,
compressed,
format,
options,
)?;
@@ -90,7 +90,7 @@ impl ComputedValueVecsFromTxindex {
path,
&name_in_usd,
version + VERSION,
compressed,
format,
bitcoin_txindex.boxed_clone(),
indexes.txindex_to_height.boxed_clone(),
fetched.chainindexes_to_close.height.boxed_clone(),
@@ -126,7 +126,7 @@ impl ComputedValueVecsFromTxindex {
&name_in_usd,
false,
version + VERSION,
compressed,
format,
options,
)
.unwrap()