mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-25 13:44:30 -07:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e6464dacb | |||
| 92b1dc0afb | |||
| 7562f51e07 | |||
| 09bba99e68 | |||
| 9d674cd49b | |||
| 88a0c9ea03 |
Generated
+37
-57
@@ -30,15 +30,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.11"
|
||||
version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
||||
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"getrandom 0.2.16",
|
||||
"getrandom 0.3.3",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy 0.7.35",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -381,7 +381,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"brk_cli",
|
||||
"brk_computer",
|
||||
@@ -398,7 +398,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_cli"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"brk_computer",
|
||||
"brk_core",
|
||||
@@ -421,7 +421,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_computer"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"brk_core",
|
||||
"brk_exit",
|
||||
@@ -442,7 +442,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_core"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"bitcoin",
|
||||
"bitcoincore-rpc",
|
||||
@@ -455,13 +455,13 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"serde_derive",
|
||||
"zerocopy 0.8.25",
|
||||
"zerocopy-derive 0.8.25",
|
||||
"zerocopy",
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "brk_exit"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"brk_logger",
|
||||
"ctrlc",
|
||||
@@ -470,7 +470,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_fetcher"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"brk_core",
|
||||
"brk_logger",
|
||||
@@ -483,7 +483,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_indexer"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"bitcoin",
|
||||
"bitcoincore-rpc",
|
||||
@@ -497,12 +497,12 @@ dependencies = [
|
||||
"fjall",
|
||||
"log",
|
||||
"rayon",
|
||||
"zerocopy 0.8.25",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "brk_logger"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"color-eyre",
|
||||
"env_logger",
|
||||
@@ -512,7 +512,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_parser"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"bitcoin",
|
||||
"bitcoincore-rpc",
|
||||
@@ -522,12 +522,12 @@ dependencies = [
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"zerocopy 0.8.25",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "brk_query"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"brk_computer",
|
||||
"brk_indexer",
|
||||
@@ -544,7 +544,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_server"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"brk_computer",
|
||||
@@ -572,7 +572,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "brk_vec"
|
||||
version = "0.0.35"
|
||||
version = "0.0.37"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"brk_core",
|
||||
@@ -584,8 +584,8 @@ dependencies = [
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"zerocopy 0.8.25",
|
||||
"zerocopy-derive 0.8.25",
|
||||
"zerocopy",
|
||||
"zerocopy-derive",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
@@ -679,9 +679,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.21"
|
||||
version = "1.2.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0"
|
||||
checksum = "32db95edf998450acc7881c932f94cd9b05c87b4b2599e8bab064753da4acfd1"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
@@ -1245,9 +1245,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0"
|
||||
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
@@ -1553,7 +1553,7 @@ version = "0.1.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a"
|
||||
dependencies = [
|
||||
"getrandom 0.3.2",
|
||||
"getrandom 0.3.3",
|
||||
"libc",
|
||||
]
|
||||
|
||||
@@ -2080,9 +2080,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "oxc_sourcemap"
|
||||
version = "3.0.0"
|
||||
version = "3.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6665c417b2aa1c426a7b142bcc0d2f47d9fee9e6f88610f054cfa7ce6623001e"
|
||||
checksum = "9cd7bb37974a2684a080d05b9c28460e1610c5ac5ef13f481a45179f458239cb"
|
||||
dependencies = [
|
||||
"base64-simd",
|
||||
"cfg-if",
|
||||
@@ -2311,7 +2311,7 @@ version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||
dependencies = [
|
||||
"zerocopy 0.8.25",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2347,9 +2347,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quick_cache"
|
||||
version = "0.6.13"
|
||||
version = "0.6.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "287e56aac5a2b4fb25a6fb050961d157635924c8696305a5c937a76f29841a0f"
|
||||
checksum = "6b450dad8382b1b95061d5ca1eb792081fb082adf48c678791fe917509596d5f"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.15.3",
|
||||
@@ -2856,12 +2856,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.19.1"
|
||||
version = "3.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf"
|
||||
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"getrandom 0.3.2",
|
||||
"getrandom 0.3.3",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.59.0",
|
||||
@@ -3469,33 +3469,13 @@ dependencies = [
|
||||
"lzma-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||
dependencies = [
|
||||
"zerocopy-derive 0.7.35",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb"
|
||||
dependencies = [
|
||||
"zerocopy-derive 0.8.25",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.101",
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3543,7 +3523,7 @@ dependencies = [
|
||||
"crossbeam-utils",
|
||||
"deflate64",
|
||||
"flate2",
|
||||
"getrandom 0.3.2",
|
||||
"getrandom 0.3.3",
|
||||
"hmac",
|
||||
"indexmap 2.9.0",
|
||||
"lzma-rs",
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ members = ["crates/*"]
|
||||
package.description = "The Bitcoin Research Kit is a suite of tools designed to extract, compute and display data stored on a Bitcoin Core node"
|
||||
package.license = "MIT"
|
||||
package.edition = "2024"
|
||||
package.version = "0.0.35"
|
||||
package.version = "0.0.37"
|
||||
package.repository = "https://github.com/bitcoinresearchkit/brk"
|
||||
|
||||
[profile.release]
|
||||
|
||||
@@ -108,7 +108,7 @@ pub fn run(config: RunConfig) -> color_eyre::Result<()> {
|
||||
};
|
||||
|
||||
thread::Builder::new()
|
||||
.stack_size(64 * 1024 * 1024)
|
||||
.stack_size(128 * 1024 * 1024)
|
||||
.spawn(f)?
|
||||
.join()
|
||||
.unwrap()
|
||||
|
||||
@@ -7,15 +7,17 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
use brk_exit::Exit;
|
||||
use brk_fetcher::Fetcher;
|
||||
use brk_indexer::{Indexer, Indexes};
|
||||
use brk_indexer::Indexer;
|
||||
pub use brk_parser::rpc;
|
||||
|
||||
mod storage;
|
||||
mod utils;
|
||||
|
||||
use brk_vec::{AnyCollectableVec, Compressed, Computation};
|
||||
|
||||
mod stores;
|
||||
mod utils;
|
||||
mod vecs;
|
||||
|
||||
use log::info;
|
||||
use storage::{Stores, Vecs};
|
||||
use stores::Stores;
|
||||
use vecs::Vecs;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Computer {
|
||||
@@ -67,7 +69,7 @@ impl Computer {
|
||||
pub fn compute(
|
||||
&mut self,
|
||||
indexer: &mut Indexer,
|
||||
starting_indexes: Indexes,
|
||||
starting_indexes: brk_indexer::Indexes,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()> {
|
||||
info!("Computing...");
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
mod stores;
|
||||
mod vecs;
|
||||
|
||||
pub use stores::*;
|
||||
pub use vecs::*;
|
||||
@@ -1,610 +0,0 @@
|
||||
use std::{fs, path::Path, thread};
|
||||
|
||||
use brk_core::{Dollars, StoredF64, StoredUsize};
|
||||
use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyCollectableVec, Compressed, Computation, StoredIndex, VecIterator, Version};
|
||||
|
||||
use super::{
|
||||
Indexes, fetched,
|
||||
grouped::{
|
||||
ComputedRatioVecsFromDateIndex, ComputedVecsFromDateIndex, StorableVecGeneatorOptions,
|
||||
},
|
||||
indexes, transactions,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
pub indexes_to_marketcap: ComputedVecsFromDateIndex<Dollars>,
|
||||
pub indexes_to_ath: ComputedVecsFromDateIndex<Dollars>,
|
||||
pub indexes_to_drawdown: ComputedVecsFromDateIndex<StoredF64>,
|
||||
pub indexes_to_days_since_ath: ComputedVecsFromDateIndex<StoredUsize>,
|
||||
pub indexes_to_max_days_between_ath: ComputedVecsFromDateIndex<StoredUsize>,
|
||||
pub indexes_to_max_years_between_ath: ComputedVecsFromDateIndex<StoredF64>,
|
||||
|
||||
pub indexes_to_1w_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_8d_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_13d_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_21d_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_1m_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_34d_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_55d_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_89d_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_144d_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_1y_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_2y_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_200w_sma: ComputedRatioVecsFromDateIndex,
|
||||
pub indexes_to_4y_sma: ComputedRatioVecsFromDateIndex,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
_computation: Computation,
|
||||
compressed: Compressed,
|
||||
) -> color_eyre::Result<Self> {
|
||||
fs::create_dir_all(path)?;
|
||||
|
||||
Ok(Self {
|
||||
indexes_to_marketcap: ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"marketcap",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_ath: ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"ath",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_drawdown: ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"drawdown",
|
||||
Version::ONE,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_days_since_ath: ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"days_since_ath",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_max_days_between_ath: ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"max_days_between_ath",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_max_years_between_ath: ComputedVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"max_years_between_ath",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
|
||||
indexes_to_1w_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"1w_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_8d_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"8d_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_13d_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"13d_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_21d_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"21d_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_1m_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"1m_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_34d_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"34d_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_55d_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"55d_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_89d_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"89d_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_144d_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"144d_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_1y_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"1y_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_2y_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"2y_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_200w_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"200w_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
indexes_to_4y_sma: ComputedRatioVecsFromDateIndex::forced_import(
|
||||
path,
|
||||
"4y_sma",
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn compute(
|
||||
&mut self,
|
||||
indexer: &Indexer,
|
||||
indexes: &indexes::Vecs,
|
||||
fetched: &fetched::Vecs,
|
||||
transactions: &mut transactions::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()> {
|
||||
self.indexes_to_marketcap.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
let mut total_subsidy_in_btc = transactions
|
||||
.indexes_to_subsidy
|
||||
.bitcoin
|
||||
.dateindex
|
||||
.unwrap_total()
|
||||
.into_iter();
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
|(i, close, ..)| {
|
||||
let supply = total_subsidy_in_btc.unwrap_get_inner(i);
|
||||
(i, *close * supply)
|
||||
},
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self.indexes_to_ath.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
let mut prev = None;
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_high.dateindex,
|
||||
|(i, high, slf)| {
|
||||
if prev.is_none() {
|
||||
let i = i.unwrap_to_usize();
|
||||
prev.replace(if i > 0 {
|
||||
slf.into_iter().unwrap_get_inner_(i - 1)
|
||||
} else {
|
||||
Dollars::ZERO
|
||||
});
|
||||
}
|
||||
let ath = prev.unwrap().max(*high);
|
||||
prev.replace(ath);
|
||||
(i, ath)
|
||||
},
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self.indexes_to_drawdown.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
let mut close_iter = fetched.timeindexes_to_close.dateindex.into_iter();
|
||||
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
&self.indexes_to_ath.dateindex,
|
||||
|(i, ath, ..)| {
|
||||
if ath == Dollars::ZERO {
|
||||
return (i, StoredF64::default());
|
||||
}
|
||||
let close = *close_iter.unwrap_get_inner(i);
|
||||
let drawdown = StoredF64::from((*ath - *close) / *ath * -100.0);
|
||||
(i, drawdown)
|
||||
},
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self.indexes_to_days_since_ath.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
let mut high_iter = fetched.timeindexes_to_high.dateindex.into_iter();
|
||||
let mut prev = None;
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
&self.indexes_to_ath.dateindex,
|
||||
|(i, ath, slf)| {
|
||||
if prev.is_none() {
|
||||
let i = i.unwrap_to_usize();
|
||||
prev.replace(if i > 0 {
|
||||
slf.into_iter().unwrap_get_inner_(i - 1)
|
||||
} else {
|
||||
StoredUsize::default()
|
||||
});
|
||||
}
|
||||
let days = if *high_iter.unwrap_get_inner(i) == ath {
|
||||
StoredUsize::default()
|
||||
} else {
|
||||
prev.unwrap() + StoredUsize::from(1)
|
||||
};
|
||||
prev.replace(days);
|
||||
(i, days)
|
||||
},
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self.indexes_to_max_days_between_ath.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
let mut prev = None;
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
&self.indexes_to_days_since_ath.dateindex,
|
||||
|(i, days, slf)| {
|
||||
if prev.is_none() {
|
||||
let i = i.unwrap_to_usize();
|
||||
prev.replace(if i > 0 {
|
||||
slf.into_iter().unwrap_get_inner_(i - 1)
|
||||
} else {
|
||||
StoredUsize::ZERO
|
||||
});
|
||||
}
|
||||
let max = prev.unwrap().max(days);
|
||||
prev.replace(max);
|
||||
(i, max)
|
||||
},
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self.indexes_to_max_years_between_ath.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_transform(
|
||||
starting_indexes.dateindex,
|
||||
&self.indexes_to_max_days_between_ath.dateindex,
|
||||
|(i, max, ..)| (i, StoredF64::from(*max as f64 / 365.0)),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
thread::scope(|s| -> color_eyre::Result<()> {
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_1w_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
7,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_8d_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
8,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_13d_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
13,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_21d_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
21,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_1m_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
30,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_34d_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
34,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_55d_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
55,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_89d_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
89,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_144d_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
144,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_1y_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
365,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_2y_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
2 * 365,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_200w_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
200 * 7,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
s.spawn(|| -> color_eyre::Result<()> {
|
||||
self.indexes_to_4y_sma.compute(
|
||||
indexer,
|
||||
indexes,
|
||||
fetched,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|v, _, _, starting_indexes, exit| {
|
||||
v.compute_sma(
|
||||
starting_indexes.dateindex,
|
||||
&fetched.timeindexes_to_close.dateindex,
|
||||
4 * 365,
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
|
||||
[
|
||||
self.indexes_to_marketcap.vecs(),
|
||||
self.indexes_to_ath.vecs(),
|
||||
self.indexes_to_drawdown.vecs(),
|
||||
self.indexes_to_days_since_ath.vecs(),
|
||||
self.indexes_to_max_days_between_ath.vecs(),
|
||||
self.indexes_to_max_years_between_ath.vecs(),
|
||||
self.indexes_to_1w_sma.vecs(),
|
||||
self.indexes_to_8d_sma.vecs(),
|
||||
self.indexes_to_13d_sma.vecs(),
|
||||
self.indexes_to_21d_sma.vecs(),
|
||||
self.indexes_to_1m_sma.vecs(),
|
||||
self.indexes_to_34d_sma.vecs(),
|
||||
self.indexes_to_55d_sma.vecs(),
|
||||
self.indexes_to_89d_sma.vecs(),
|
||||
self.indexes_to_144d_sma.vecs(),
|
||||
self.indexes_to_1y_sma.vecs(),
|
||||
self.indexes_to_2y_sma.vecs(),
|
||||
self.indexes_to_200w_sma.vecs(),
|
||||
self.indexes_to_4y_sma.vecs(),
|
||||
]
|
||||
.concat()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
use std::{fs, path::Path};
|
||||
|
||||
use brk_core::StoredU8;
|
||||
use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyCollectableVec, AnyVec, Compressed, Computation, Version};
|
||||
|
||||
use super::{
|
||||
Indexes,
|
||||
grouped::{ComputedVecsFromHeight, StorableVecGeneatorOptions},
|
||||
indexes,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
pub _0: ComputedVecsFromHeight<StoredU8>,
|
||||
pub _1: ComputedVecsFromHeight<StoredU8>,
|
||||
pub _50: ComputedVecsFromHeight<StoredU8>,
|
||||
pub _100: ComputedVecsFromHeight<StoredU8>,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
pub fn forced_import(
|
||||
path: &Path,
|
||||
_computation: Computation,
|
||||
compressed: Compressed,
|
||||
) -> color_eyre::Result<Self> {
|
||||
fs::create_dir_all(path)?;
|
||||
|
||||
Ok(Self {
|
||||
_0: ComputedVecsFromHeight::forced_import(
|
||||
path,
|
||||
"0",
|
||||
true,
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
_1: ComputedVecsFromHeight::forced_import(
|
||||
path,
|
||||
"1",
|
||||
true,
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
_50: ComputedVecsFromHeight::forced_import(
|
||||
path,
|
||||
"50",
|
||||
true,
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
_100: ComputedVecsFromHeight::forced_import(
|
||||
path,
|
||||
"100",
|
||||
true,
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn compute(
|
||||
&mut self,
|
||||
indexer: &Indexer,
|
||||
indexes: &indexes::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> color_eyre::Result<()> {
|
||||
self._0.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|vec, _, indexes, starting_indexes, exit| {
|
||||
vec.compute_to(
|
||||
starting_indexes.height,
|
||||
indexes.height_to_date.len(),
|
||||
indexes.height_to_date.version(),
|
||||
|i| (i, StoredU8::new(0)),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self._1.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|vec, _, indexes, starting_indexes, exit| {
|
||||
vec.compute_to(
|
||||
starting_indexes.height,
|
||||
indexes.height_to_date.len(),
|
||||
indexes.height_to_date.version(),
|
||||
|i| (i, StoredU8::new(1)),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self._50.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|vec, _, indexes, starting_indexes, exit| {
|
||||
vec.compute_to(
|
||||
starting_indexes.height,
|
||||
indexes.height_to_date.len(),
|
||||
indexes.height_to_date.version(),
|
||||
|i| (i, StoredU8::new(50)),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
self._100.compute_all(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
exit,
|
||||
|vec, _, indexes, starting_indexes, exit| {
|
||||
vec.compute_to(
|
||||
starting_indexes.height,
|
||||
indexes.height_to_date.len(),
|
||||
indexes.height_to_date.version(),
|
||||
|i| (i, StoredU8::new(100)),
|
||||
exit,
|
||||
)
|
||||
},
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
|
||||
[
|
||||
self._0.vecs(),
|
||||
self._1.vecs(),
|
||||
self._50.vecs(),
|
||||
self._100.vecs(),
|
||||
]
|
||||
.concat()
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyCollectableVec, Compressed, EagerVec, Result, Version};
|
||||
|
||||
use crate::storage::{Indexes, indexes};
|
||||
use crate::vecs::{Indexes, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, EagerVec, Result, Version};
|
||||
|
||||
use crate::storage::{Indexes, indexes};
|
||||
use crate::vecs::{Indexes, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyCollectableVec, Compressed, EagerVec, Result, Version};
|
||||
|
||||
use crate::storage::{Indexes, indexes};
|
||||
use crate::vecs::{Indexes, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ use brk_vec::{
|
||||
AnyCollectableVec, CollectableVec, Compressed, EagerVec, Result, StoredVec, Version,
|
||||
};
|
||||
|
||||
use crate::storage::{Indexes, indexes};
|
||||
use crate::vecs::{Indexes, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
+2
-5
@@ -10,11 +10,8 @@ use brk_vec::{
|
||||
// use rayon::prelude::*;
|
||||
|
||||
use crate::{
|
||||
storage::{
|
||||
fetched,
|
||||
vecs::{Indexes, indexes},
|
||||
},
|
||||
utils::get_percentile,
|
||||
vecs::{Indexes, fetched, indexes},
|
||||
};
|
||||
|
||||
use super::{ComputedVecsFromDateIndex, StorableVecGeneatorOptions};
|
||||
@@ -333,7 +330,7 @@ impl ComputedRatioVecsFromDateIndex {
|
||||
if price == Dollars::ZERO {
|
||||
(i, StoredF32::from(1.0))
|
||||
} else {
|
||||
(i, *close / price)
|
||||
(i, StoredF32::from(*close / price))
|
||||
}
|
||||
},
|
||||
exit,
|
||||
+1
-4
@@ -7,10 +7,7 @@ use brk_vec::{
|
||||
AnyCollectableVec, CollectableVec, Compressed, EagerVec, Result, StoredVec, Version,
|
||||
};
|
||||
|
||||
use crate::storage::{
|
||||
fetched,
|
||||
vecs::{Indexes, indexes},
|
||||
};
|
||||
use crate::vecs::{Indexes, fetched, indexes};
|
||||
|
||||
use super::{ComputedVecsFromHeight, StorableVecGeneatorOptions};
|
||||
|
||||
+1
-4
@@ -8,10 +8,7 @@ use brk_vec::{
|
||||
Computation, ComputedVecFrom3, LazyVecFrom1, StoredIndex, StoredVec, Version,
|
||||
};
|
||||
|
||||
use crate::storage::{
|
||||
fetched,
|
||||
vecs::{Indexes, indexes},
|
||||
};
|
||||
use crate::vecs::{Indexes, fetched, indexes};
|
||||
|
||||
use super::{ComputedVecsFromTxindex, StorableVecGeneatorOptions};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyCollectableVec, Compressed, Computation};
|
||||
|
||||
pub mod blocks;
|
||||
pub mod constants;
|
||||
pub mod fetched;
|
||||
pub mod grouped;
|
||||
pub mod indexes;
|
||||
@@ -18,6 +19,7 @@ pub use indexes::Indexes;
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
pub indexes: indexes::Vecs,
|
||||
pub constants: constants::Vecs,
|
||||
pub blocks: blocks::Vecs,
|
||||
pub mining: mining::Vecs,
|
||||
pub market: market::Vecs,
|
||||
@@ -43,6 +45,7 @@ impl Vecs {
|
||||
Ok(Self {
|
||||
blocks: blocks::Vecs::forced_import(path, computation, compressed)?,
|
||||
mining: mining::Vecs::forced_import(path, computation, compressed)?,
|
||||
constants: constants::Vecs::forced_import(path, computation, compressed)?,
|
||||
market: market::Vecs::forced_import(path, computation, compressed)?,
|
||||
transactions: transactions::Vecs::forced_import(
|
||||
path,
|
||||
@@ -66,6 +69,9 @@ impl Vecs {
|
||||
) -> color_eyre::Result<()> {
|
||||
let starting_indexes = self.indexes.compute(indexer, starting_indexes, exit)?;
|
||||
|
||||
self.constants
|
||||
.compute(indexer, &self.indexes, &starting_indexes, exit)?;
|
||||
|
||||
self.blocks
|
||||
.compute(indexer, &self.indexes, &starting_indexes, exit)?;
|
||||
|
||||
@@ -106,6 +112,7 @@ impl Vecs {
|
||||
|
||||
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
|
||||
[
|
||||
self.constants.vecs(),
|
||||
self.indexes.vecs(),
|
||||
self.blocks.vecs(),
|
||||
self.mining.vecs(),
|
||||
@@ -3,7 +3,7 @@ use std::ops::{Add, Div, Mul};
|
||||
use serde::Serialize;
|
||||
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
|
||||
|
||||
use super::Sats;
|
||||
use super::{Sats, StoredF64};
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
@@ -53,6 +53,12 @@ impl From<f64> for Bitcoin {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<StoredF64> for Bitcoin {
|
||||
fn from(value: StoredF64) -> Self {
|
||||
Self(*value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Bitcoin> for f64 {
|
||||
fn from(value: Bitcoin) -> Self {
|
||||
value.0
|
||||
|
||||
@@ -81,3 +81,10 @@ impl Mul<Cents> for Cents {
|
||||
Self(self.0 * rhs.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul<usize> for Cents {
|
||||
type Output = Cents;
|
||||
fn mul(self, rhs: usize) -> Self::Output {
|
||||
Self(self.0 * rhs as u64)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use derive_deref::Deref;
|
||||
use serde::Serialize;
|
||||
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
|
||||
|
||||
use super::{Bitcoin, Cents, Close, Sats, StoredF32};
|
||||
use super::{Bitcoin, Cents, Close, Sats, StoredF32, StoredF64};
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
@@ -27,6 +27,10 @@ pub struct Dollars(f64);
|
||||
|
||||
impl Dollars {
|
||||
pub const ZERO: Self = Self(0.0);
|
||||
|
||||
pub const fn mint(dollars: f64) -> Self {
|
||||
Self(dollars)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<f32> for Dollars {
|
||||
@@ -79,9 +83,23 @@ impl Add for Dollars {
|
||||
}
|
||||
|
||||
impl Div<Dollars> for Dollars {
|
||||
type Output = StoredF32;
|
||||
type Output = StoredF64;
|
||||
fn div(self, rhs: Dollars) -> Self::Output {
|
||||
StoredF32::from((self.0 / rhs.0) as f32)
|
||||
StoredF64::from(self.0 / rhs.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<Close<Dollars>> for Dollars {
|
||||
type Output = StoredF64;
|
||||
fn div(self, rhs: Close<Dollars>) -> Self::Output {
|
||||
StoredF64::from(self.0 / rhs.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<Dollars> for Close<Dollars> {
|
||||
type Output = StoredF64;
|
||||
fn div(self, rhs: Dollars) -> Self::Output {
|
||||
StoredF64::from(self.0 / rhs.0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +110,13 @@ impl Div<usize> for Dollars {
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<Bitcoin> for Dollars {
|
||||
type Output = Self;
|
||||
fn div(self, rhs: Bitcoin) -> Self::Output {
|
||||
Self(f64::from(self) / f64::from(rhs))
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Dollars {}
|
||||
|
||||
#[allow(clippy::derive_ord_xor_partial_ord)]
|
||||
@@ -121,6 +146,13 @@ impl Mul<StoredF32> for Dollars {
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul<usize> for Dollars {
|
||||
type Output = Self;
|
||||
fn mul(self, rhs: usize) -> Self::Output {
|
||||
Self::from(Cents::from(self) * rhs)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u128> for Dollars {
|
||||
fn from(value: u128) -> Self {
|
||||
Self::from(Cents::from(value))
|
||||
|
||||
@@ -6,7 +6,7 @@ use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
|
||||
|
||||
use crate::CheckedSub;
|
||||
|
||||
use super::Dollars;
|
||||
use super::{Dollars, StoredF64};
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
@@ -36,6 +36,12 @@ impl From<f64> for StoredF32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<StoredF64> for StoredF32 {
|
||||
fn from(value: StoredF64) -> Self {
|
||||
Self(*value as f32)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<usize> for StoredF32 {
|
||||
fn from(value: usize) -> Self {
|
||||
Self(value as f32)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::ops::{Add, Div};
|
||||
use std::ops::{Add, Div, Mul};
|
||||
|
||||
use derive_deref::Deref;
|
||||
use serde::Serialize;
|
||||
@@ -40,6 +40,13 @@ impl CheckedSub<StoredF64> for StoredF64 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul<usize> for StoredF64 {
|
||||
type Output = Self;
|
||||
fn mul(self, rhs: usize) -> Self::Output {
|
||||
Self(self.0 * rhs as f64)
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<usize> for StoredF64 {
|
||||
type Output = Self;
|
||||
fn div(self, rhs: usize) -> Self::Output {
|
||||
@@ -68,3 +75,9 @@ impl Ord for StoredF64 {
|
||||
self.0.partial_cmp(&other.0).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl CheckedSub<usize> for StoredF64 {
|
||||
fn checked_sub(self, rhs: usize) -> Option<Self> {
|
||||
Some(Self(self.0 - rhs as f64))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,14 +79,7 @@ impl DTS for Query<'static> {
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
|
||||
contents += &format!(
|
||||
" {}: [{indexes}],\n",
|
||||
if id.contains("-") {
|
||||
format!("\"{id}\"")
|
||||
} else {
|
||||
id.to_owned()
|
||||
}
|
||||
);
|
||||
contents += &format!(" \"{id}\": [{indexes}],\n");
|
||||
});
|
||||
|
||||
contents += " });\n";
|
||||
|
||||
@@ -3,12 +3,14 @@ use std::{
|
||||
cmp::Ordering,
|
||||
f32,
|
||||
fmt::Debug,
|
||||
ops::{Add, Div},
|
||||
ops::{Add, Div, Mul},
|
||||
path::{Path, PathBuf},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use brk_core::{Bitcoin, CheckedSub, Close, Dollars, Height, Sats, StoredUsize, TxIndex};
|
||||
use brk_core::{
|
||||
Bitcoin, CheckedSub, Close, Date, DateIndex, Dollars, Height, Sats, StoredUsize, TxIndex,
|
||||
};
|
||||
use brk_exit::Exit;
|
||||
use log::info;
|
||||
|
||||
@@ -21,6 +23,7 @@ use crate::{
|
||||
const ONE_KIB: usize = 1024;
|
||||
const ONE_MIB: usize = ONE_KIB * ONE_KIB;
|
||||
const MAX_CACHE_SIZE: usize = 210 * ONE_MIB;
|
||||
const DCA_AMOUNT: Dollars = Dollars::mint(100.0);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EagerVec<I, T> {
|
||||
@@ -176,6 +179,88 @@ where
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
|
||||
pub fn compute_divide<T2, T3, T4>(
|
||||
&mut self,
|
||||
max_from: I,
|
||||
divided: &impl AnyIterableVec<I, T2>,
|
||||
divider: &impl AnyIterableVec<I, T3>,
|
||||
exit: &Exit,
|
||||
) -> Result<()>
|
||||
where
|
||||
T2: StoredType + Div<T3, Output = T4>,
|
||||
T3: StoredType,
|
||||
T4: Mul<usize, Output = T4> + CheckedSub<usize>,
|
||||
T: From<T4>,
|
||||
{
|
||||
self.compute_divide_(max_from, divided, divider, exit, false, false)
|
||||
}
|
||||
|
||||
pub fn compute_percentage<T2, T3, T4>(
|
||||
&mut self,
|
||||
max_from: I,
|
||||
divided: &impl AnyIterableVec<I, T2>,
|
||||
divider: &impl AnyIterableVec<I, T3>,
|
||||
exit: &Exit,
|
||||
) -> Result<()>
|
||||
where
|
||||
T2: StoredType + Div<T3, Output = T4>,
|
||||
T3: StoredType,
|
||||
T4: Mul<usize, Output = T4> + CheckedSub<usize>,
|
||||
T: From<T4>,
|
||||
{
|
||||
self.compute_divide_(max_from, divided, divider, exit, true, false)
|
||||
}
|
||||
|
||||
pub fn compute_percentage_difference<T2, T3, T4>(
|
||||
&mut self,
|
||||
max_from: I,
|
||||
divided: &impl AnyIterableVec<I, T2>,
|
||||
divider: &impl AnyIterableVec<I, T3>,
|
||||
exit: &Exit,
|
||||
) -> Result<()>
|
||||
where
|
||||
T2: StoredType + Div<T3, Output = T4>,
|
||||
T3: StoredType,
|
||||
T4: Mul<usize, Output = T4> + CheckedSub<usize>,
|
||||
T: From<T4>,
|
||||
{
|
||||
self.compute_divide_(max_from, divided, divider, exit, true, true)
|
||||
}
|
||||
|
||||
pub fn compute_divide_<T2, T3, T4>(
|
||||
&mut self,
|
||||
max_from: I,
|
||||
divided: &impl AnyIterableVec<I, T2>,
|
||||
divider: &impl AnyIterableVec<I, T3>,
|
||||
exit: &Exit,
|
||||
as_percentage: bool,
|
||||
as_difference: bool,
|
||||
) -> Result<()>
|
||||
where
|
||||
T2: StoredType + Div<T3, Output = T4>,
|
||||
T3: StoredType,
|
||||
T4: Mul<usize, Output = T4> + CheckedSub<usize>,
|
||||
T: From<T4>,
|
||||
{
|
||||
self.validate_computed_version_or_reset_file(
|
||||
Version::ZERO + self.inner.version() + divided.version() + divider.version(),
|
||||
)?;
|
||||
|
||||
let index = max_from.min(I::from(self.len()));
|
||||
let multiplier = if as_percentage { 100 } else { 1 };
|
||||
let subtract = if as_difference { multiplier } else { 0 };
|
||||
|
||||
let mut divider_iter = divider.iter();
|
||||
divided.iter_at(index).try_for_each(|(i, divided)| {
|
||||
let v = (divided.into_inner() / divider_iter.unwrap_get_inner(i) * multiplier)
|
||||
.checked_sub(subtract)
|
||||
.unwrap();
|
||||
self.forced_push_at(i, T::from(v), exit)
|
||||
})?;
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
|
||||
pub fn compute_inverse_more_to_less(
|
||||
&mut self,
|
||||
max_from: T,
|
||||
@@ -474,6 +559,263 @@ where
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
|
||||
pub fn compute_previous_value<T2>(
|
||||
&mut self,
|
||||
max_from: I,
|
||||
source: &impl AnyIterableVec<I, T2>,
|
||||
len: usize,
|
||||
exit: &Exit,
|
||||
) -> Result<()>
|
||||
where
|
||||
I: CheckedSub,
|
||||
T2: StoredType + Default,
|
||||
f32: From<T2>,
|
||||
T: From<f32>,
|
||||
{
|
||||
self.validate_computed_version_or_reset_file(
|
||||
Version::ZERO + self.inner.version() + source.version(),
|
||||
)?;
|
||||
|
||||
let index = max_from.min(I::from(self.len()));
|
||||
let mut source_iter = source.iter();
|
||||
(index.to_usize()?..source.len()).try_for_each(|i| {
|
||||
let i = I::from(i);
|
||||
|
||||
let previous_value = i
|
||||
.checked_sub(I::from(len))
|
||||
.map(|prev_i| f32::from(source_iter.unwrap_get_inner(prev_i)))
|
||||
.unwrap_or(f32::NAN);
|
||||
|
||||
self.forced_push_at(i, T::from(previous_value), exit)
|
||||
})?;
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
|
||||
pub fn compute_percentage_change<T2>(
|
||||
&mut self,
|
||||
max_from: I,
|
||||
source: &impl AnyIterableVec<I, T2>,
|
||||
len: usize,
|
||||
exit: &Exit,
|
||||
) -> Result<()>
|
||||
where
|
||||
I: CheckedSub,
|
||||
T2: StoredType + Default,
|
||||
f32: From<T2>,
|
||||
T: From<f32>,
|
||||
{
|
||||
self.validate_computed_version_or_reset_file(
|
||||
Version::ZERO + self.inner.version() + source.version(),
|
||||
)?;
|
||||
|
||||
let index = max_from.min(I::from(self.len()));
|
||||
let mut source_iter = source.iter();
|
||||
source.iter_at(index).try_for_each(|(i, b)| {
|
||||
let previous_value = f32::from(
|
||||
i.checked_sub(I::from(len))
|
||||
.map(|prev_i| source_iter.unwrap_get_inner(prev_i))
|
||||
.unwrap_or_default(),
|
||||
);
|
||||
|
||||
let last_value = f32::from(b.into_inner());
|
||||
|
||||
let percentage_change = ((last_value / previous_value) - 1.0) * 100.0;
|
||||
|
||||
self.forced_push_at(i, T::from(percentage_change), exit)
|
||||
})?;
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
|
||||
pub fn compute_cagr<T2>(
|
||||
&mut self,
|
||||
max_from: I,
|
||||
percentage_returns: &impl AnyIterableVec<I, T2>,
|
||||
days: usize,
|
||||
exit: &Exit,
|
||||
) -> Result<()>
|
||||
where
|
||||
I: CheckedSub,
|
||||
T2: StoredType + Default,
|
||||
f32: From<T2>,
|
||||
T: From<f32>,
|
||||
{
|
||||
self.validate_computed_version_or_reset_file(
|
||||
Version::ZERO + self.inner.version() + percentage_returns.version(),
|
||||
)?;
|
||||
|
||||
if days % 365 != 0 {
|
||||
panic!("bad days");
|
||||
}
|
||||
|
||||
let years = days / 365;
|
||||
let index = max_from.min(I::from(self.len()));
|
||||
percentage_returns
|
||||
.iter_at(index)
|
||||
.try_for_each(|(i, percentage)| {
|
||||
let percentage = percentage.into_inner();
|
||||
|
||||
let cagr = (((f32::from(percentage) / 100.0 + 1.0).powf(1.0 / years as f32)) - 1.0)
|
||||
* 100.0;
|
||||
|
||||
self.forced_push_at(i, T::from(cagr), exit)
|
||||
})?;
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
}
|
||||
|
||||
impl EagerVec<DateIndex, Sats> {
|
||||
pub fn compute_dca_stack_via_len(
|
||||
&mut self,
|
||||
max_from: DateIndex,
|
||||
closes: &impl AnyIterableVec<DateIndex, Close<Dollars>>,
|
||||
len: usize,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.validate_computed_version_or_reset_file(
|
||||
Version::new(5) + self.inner.version() + closes.version(),
|
||||
)?;
|
||||
|
||||
let mut other_iter = closes.iter();
|
||||
let mut prev = None;
|
||||
|
||||
let index = max_from.min(DateIndex::from(self.len()));
|
||||
closes.iter_at(index).try_for_each(|(i, closes)| {
|
||||
let price = *closes.into_inner();
|
||||
let i_usize = i.unwrap_to_usize();
|
||||
if prev.is_none() {
|
||||
if i_usize == 0 {
|
||||
prev.replace(Sats::ZERO);
|
||||
} else {
|
||||
prev.replace(self.into_iter().unwrap_get_inner_(i_usize - 1));
|
||||
}
|
||||
}
|
||||
|
||||
let mut stack = Sats::ZERO;
|
||||
|
||||
if price != Dollars::ZERO {
|
||||
stack = prev.unwrap() + Sats::from(Bitcoin::from(DCA_AMOUNT / price));
|
||||
|
||||
if i_usize >= len {
|
||||
let prev_price = *other_iter.unwrap_get_inner_(i_usize - len);
|
||||
if prev_price != Dollars::ZERO {
|
||||
stack = stack
|
||||
.checked_sub(Sats::from(Bitcoin::from(DCA_AMOUNT / prev_price)))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prev.replace(stack);
|
||||
|
||||
self.forced_push_at(i, stack, exit)
|
||||
})?;
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
|
||||
pub fn compute_dca_stack_via_from(
|
||||
&mut self,
|
||||
max_from: DateIndex,
|
||||
closes: &impl AnyIterableVec<DateIndex, Close<Dollars>>,
|
||||
from: DateIndex,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.validate_computed_version_or_reset_file(
|
||||
Version::ZERO + self.inner.version() + closes.version(),
|
||||
)?;
|
||||
|
||||
let mut prev = None;
|
||||
|
||||
let index = max_from.min(DateIndex::from(self.len()));
|
||||
closes.iter_at(index).try_for_each(|(i, closes)| {
|
||||
let price = *closes.into_inner();
|
||||
let i_usize = i.unwrap_to_usize();
|
||||
if prev.is_none() {
|
||||
if i_usize == 0 {
|
||||
prev.replace(Sats::ZERO);
|
||||
} else {
|
||||
prev.replace(self.into_iter().unwrap_get_inner_(i_usize - 1));
|
||||
}
|
||||
}
|
||||
|
||||
let mut stack = Sats::ZERO;
|
||||
|
||||
if price != Dollars::ZERO && i >= from {
|
||||
stack = prev.unwrap() + Sats::from(Bitcoin::from(DCA_AMOUNT / price));
|
||||
}
|
||||
|
||||
prev.replace(stack);
|
||||
|
||||
self.forced_push_at(i, stack, exit)
|
||||
})?;
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
}
|
||||
|
||||
impl EagerVec<DateIndex, Dollars> {
|
||||
pub fn compute_dca_avg_price_via_len(
|
||||
&mut self,
|
||||
max_from: DateIndex,
|
||||
stacks: &impl AnyIterableVec<DateIndex, Sats>,
|
||||
len: usize,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.validate_computed_version_or_reset_file(
|
||||
Version::TWO + self.inner.version() + stacks.version(),
|
||||
)?;
|
||||
|
||||
let index = max_from.min(DateIndex::from(self.len()));
|
||||
|
||||
let first_price_date = DateIndex::try_from(Date::new(2010, 8, 16)).unwrap();
|
||||
|
||||
stacks.iter_at(index).try_for_each(|(i, stack)| {
|
||||
let stack = stack.into_inner();
|
||||
let mut avg_price = Dollars::from(f64::NAN);
|
||||
if i > first_price_date {
|
||||
avg_price = DCA_AMOUNT
|
||||
* len
|
||||
.min(i.unwrap_to_usize() + 1)
|
||||
.min(i.checked_sub(first_price_date).unwrap().unwrap_to_usize() + 1)
|
||||
/ Bitcoin::from(stack);
|
||||
}
|
||||
self.forced_push_at(i, avg_price, exit)
|
||||
})?;
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
|
||||
pub fn compute_dca_avg_price_via_from(
|
||||
&mut self,
|
||||
max_from: DateIndex,
|
||||
stacks: &impl AnyIterableVec<DateIndex, Sats>,
|
||||
from: DateIndex,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.validate_computed_version_or_reset_file(
|
||||
Version::ZERO + self.inner.version() + stacks.version(),
|
||||
)?;
|
||||
|
||||
let index = max_from.min(DateIndex::from(self.len()));
|
||||
|
||||
let from_usize = from.unwrap_to_usize();
|
||||
|
||||
stacks.iter_at(index).try_for_each(|(i, stack)| {
|
||||
let stack = stack.into_inner();
|
||||
let mut avg_price = Dollars::from(f64::NAN);
|
||||
if i >= from {
|
||||
avg_price =
|
||||
DCA_AMOUNT * (i.unwrap_to_usize() + 1 - from_usize) / Bitcoin::from(stack);
|
||||
}
|
||||
self.forced_push_at(i, avg_price, exit)
|
||||
})?;
|
||||
|
||||
self.safe_flush(exit)
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> EagerVec<I, Bitcoin>
|
||||
|
||||
@@ -990,12 +990,8 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.5rem;
|
||||
margin-left: var(--negative-main-padding);
|
||||
margin-right: var(--negative-main-padding);
|
||||
padding-left: var(--main-padding);
|
||||
padding-right: var(--main-padding);
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
margin: -0.5rem var(--negative-main-padding);
|
||||
padding: 1rem var(--main-padding);
|
||||
overflow-x: auto;
|
||||
min-width: 0;
|
||||
font-size: var(--font-size-sm);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @ts-check
|
||||
|
||||
/** @import {IChartApi, ISeriesApi, SeriesDefinition, SingleValueData as _SingleValueData, CandlestickData as _CandlestickData, BaselineData, SeriesType, IPaneApi, LineSeriesOptions} from './v5.0.6-treeshaked/types' */
|
||||
/** @import {IChartApi, ISeriesApi, SeriesDefinition, SingleValueData as _SingleValueData, CandlestickData as _CandlestickData, BaselineData, SeriesType, IPaneApi, BaselineStyleOptions} from './v5.0.6-treeshaked/types' */
|
||||
|
||||
/**
|
||||
* @typedef {[number, number, number, number]} OHLCTuple
|
||||
@@ -76,7 +76,7 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => {
|
||||
signals.createEffect(
|
||||
() => ({
|
||||
defaultColor: colors.default(),
|
||||
offColor: colors.off(),
|
||||
offColor: colors.gray(),
|
||||
borderColor: colors.border(),
|
||||
}),
|
||||
({ defaultColor, offColor, borderColor }) => {
|
||||
@@ -404,7 +404,7 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => {
|
||||
* @param {Color} [args.color]
|
||||
* @param {number} [args.paneIndex]
|
||||
* @param {boolean} [args.defaultActive]
|
||||
* @param {DeepPartial<LineStyleOptions & SeriesOptionsCommon>} [args.options]
|
||||
* @param {DeepPartial<LineStyleOptions & SeriesOptionsCommon & CreatePriceLineOptions>} [args.options]
|
||||
*/
|
||||
addLineSeries({
|
||||
vecId,
|
||||
@@ -434,6 +434,11 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => {
|
||||
paneIndex,
|
||||
);
|
||||
|
||||
const priceLineOptions = options?.createPriceLine;
|
||||
if (priceLineOptions) {
|
||||
createPriceLine(series, priceLineOptions, colors);
|
||||
}
|
||||
|
||||
let url = /** @type {string | undefined} */ (undefined);
|
||||
|
||||
if (vecId) {
|
||||
@@ -485,7 +490,7 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => {
|
||||
* @param {VecId} [args.vecId]
|
||||
* @param {number} [args.paneIndex]
|
||||
* @param {boolean} [args.defaultActive]
|
||||
* @param {DeepPartial<LineStyleOptions & SeriesOptionsCommon>} [args.options]
|
||||
* @param {DeepPartial<BaselineStyleOptions & SeriesOptionsCommon & CreatePriceLineOptions>} [args.options]
|
||||
*/
|
||||
addBaselineSeries({
|
||||
vecId,
|
||||
@@ -507,22 +512,27 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => {
|
||||
{
|
||||
lineWidth: /** @type {any} */ (1.5),
|
||||
visible: defaultActive !== false,
|
||||
topLineColor: colors.green(),
|
||||
bottomLineColor: colors.red(),
|
||||
priceLineVisible: false,
|
||||
// bottomFillColor1: "transparent",
|
||||
// bottomFillColor2: "transparent",
|
||||
// topFillColor1: "transparent",
|
||||
// topFillColor2: "transparent",
|
||||
baseValue: {
|
||||
price: 0,
|
||||
},
|
||||
lineVisible: true,
|
||||
...options,
|
||||
topLineColor: options?.topLineColor ?? colors.green(),
|
||||
bottomLineColor: options?.bottomLineColor ?? colors.red(),
|
||||
priceLineVisible: false,
|
||||
bottomFillColor1: "transparent",
|
||||
bottomFillColor2: "transparent",
|
||||
topFillColor1: "transparent",
|
||||
topFillColor2: "transparent",
|
||||
lineVisible: true,
|
||||
},
|
||||
paneIndex,
|
||||
);
|
||||
|
||||
const priceLineOptions = options?.createPriceLine;
|
||||
if (priceLineOptions) {
|
||||
createPriceLine(series, priceLineOptions, colors);
|
||||
}
|
||||
|
||||
let url = /** @type {string | undefined} */ (undefined);
|
||||
|
||||
if (vecId) {
|
||||
@@ -545,7 +555,10 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => {
|
||||
|
||||
(paneIndex ? legendBottom : legendTop).add({
|
||||
series,
|
||||
colors: [colors.green, colors.red],
|
||||
colors: [
|
||||
() => options?.topLineColor ?? colors.green(),
|
||||
() => options?.bottomLineColor ?? colors.red(),
|
||||
],
|
||||
name,
|
||||
defaultActive,
|
||||
url,
|
||||
@@ -1015,3 +1028,18 @@ function createPaneHeightObserver({ ichart, paneIndex, signals, utils }) {
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {ISeriesApi<SeriesType>} series
|
||||
* @param {DeepPartial<CreatePriceLine>} options
|
||||
* @param {Colors} colors
|
||||
*/
|
||||
function createPriceLine(series, options, colors) {
|
||||
series.createPriceLine({
|
||||
price: options.value || 0,
|
||||
color: colors.gray(),
|
||||
axisLabelVisible: false,
|
||||
lineWidth: 1,
|
||||
lineStyle: 4,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -238,7 +238,11 @@ export function init({
|
||||
unit,
|
||||
defaultActive: blueprint.defaultActive,
|
||||
paneIndex,
|
||||
options: blueprint.options,
|
||||
options: {
|
||||
...blueprint.options,
|
||||
topLineColor: blueprint.colors?.[0](),
|
||||
bottomLineColor: blueprint.colors?.[1](),
|
||||
},
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, AnySeriesBlueprint, ChartableIndex } from "./options"
|
||||
* @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, AnySeriesBlueprint, ChartableIndex,CreatePriceLineOptions, CreatePriceLine } from "./options"
|
||||
* @import {Valued, SingleValueData, CandlestickData, ChartData, OHLCTuple} from "../packages/lightweight-charts/wrapper"
|
||||
* @import * as _ from "../packages/ufuzzy/v1.0.14/types"
|
||||
* @import { createChart as CreateClassicChart, LineStyleOptions, DeepPartial, ChartOptions, IChartApi, IHorzScaleBehavior, WhitespaceData, ISeriesApi, Time, LineData, LogicalRange, BaselineStyleOptions, SeriesOptionsCommon, BaselineData, CandlestickStyleOptions } from "../packages/lightweight-charts/v5.0.6-treeshaked/types"
|
||||
@@ -41,7 +41,10 @@
|
||||
* "Years" |
|
||||
* "Locktime" |
|
||||
* "sat/vB" |
|
||||
* "vB"
|
||||
* "constant" |
|
||||
* "cagr" |
|
||||
* "vB" |
|
||||
* "performance"
|
||||
* } Unit
|
||||
*/
|
||||
|
||||
@@ -686,6 +689,12 @@ function createUtils() {
|
||||
let unit;
|
||||
if (id.includes("index") || id.includes("height") || id.includes("epoch")) {
|
||||
unit = "Index";
|
||||
} else if (id === "0" || id === "1" || id === "50" || id === "100") {
|
||||
unit = "constant";
|
||||
} else if (id.endsWith("cagr")) {
|
||||
unit = "cagr";
|
||||
} else if (id.endsWith("returns")) {
|
||||
unit = "performance";
|
||||
} else if (id === "drawdown" || id.endsWith("oscillator")) {
|
||||
unit = "percentage";
|
||||
} else if (id.endsWith("-as-price")) {
|
||||
@@ -726,7 +735,8 @@ function createUtils() {
|
||||
id.includes("output-value") ||
|
||||
id.includes("fee") ||
|
||||
id.includes("coinbase") ||
|
||||
id.includes("subsidy")
|
||||
id.includes("subsidy") ||
|
||||
id.endsWith("stack")
|
||||
) {
|
||||
unit = "Sats";
|
||||
} else if (
|
||||
@@ -737,7 +747,9 @@ function createUtils() {
|
||||
id.includes("ohlc") ||
|
||||
id.includes("marketcap") ||
|
||||
id.includes("ath") ||
|
||||
id.includes("-sma")
|
||||
id.includes("-sma") ||
|
||||
id.endsWith("-price") ||
|
||||
id.startsWith("price-")
|
||||
) {
|
||||
unit = "USD";
|
||||
} else if (id.includes("count") || id.match(/v[1-3]/g)) {
|
||||
@@ -1554,7 +1566,7 @@ function createColors(dark, elements) {
|
||||
function rose() {
|
||||
return getColor("rose");
|
||||
}
|
||||
function off() {
|
||||
function gray() {
|
||||
return getColor("gray");
|
||||
}
|
||||
|
||||
@@ -1576,7 +1588,7 @@ function createColors(dark, elements) {
|
||||
|
||||
return {
|
||||
default: textColor,
|
||||
off,
|
||||
gray,
|
||||
border: borderColor,
|
||||
lightBitcoin: yellow,
|
||||
bitcoin: orange,
|
||||
@@ -1619,6 +1631,37 @@ function createColors(dark, elements) {
|
||||
_4y: purple,
|
||||
_10y: fuchsia,
|
||||
|
||||
2015: pink,
|
||||
2016: red,
|
||||
2017: orange,
|
||||
2018: amber,
|
||||
2019: yellow,
|
||||
2020: lime,
|
||||
2021: green,
|
||||
2022: emerald,
|
||||
2023: teal,
|
||||
2024: cyan,
|
||||
2025: sky,
|
||||
2026: blue,
|
||||
2027: indigo,
|
||||
2028: violet,
|
||||
2029: purple,
|
||||
2030: fuchsia,
|
||||
|
||||
// r1d: pink,
|
||||
// r1w: red,
|
||||
// r1m: amber,
|
||||
// r3m: yellow,
|
||||
// r6m: lime,
|
||||
// r1y: green,
|
||||
// r2y: emerald,
|
||||
// r3y: teal,
|
||||
// r4y: blue,
|
||||
// r5y: indigo,
|
||||
// r6y: violet,
|
||||
// r8y: purple,
|
||||
// r10y: fuchsia,
|
||||
|
||||
p2pk: lime,
|
||||
p2pkh: violet,
|
||||
p2sh: emerald,
|
||||
|
||||
@@ -16,10 +16,17 @@
|
||||
* @property {string} title
|
||||
* @property {boolean} [defaultActive]
|
||||
*
|
||||
* @typedef {Object} CreatePriceLine
|
||||
* @property {number} value
|
||||
*
|
||||
* @typedef {Object} CreatePriceLineOptions
|
||||
* @property {CreatePriceLine} createPriceLine
|
||||
*
|
||||
* @typedef {Object} BaselineSeriesBlueprintSpecific
|
||||
* @property {"Baseline"} type
|
||||
* @property {Color} [color]
|
||||
* @property {DeepPartial<BaselineStyleOptions & SeriesOptionsCommon>} [options]
|
||||
* @property {[Color, Color]} [colors]
|
||||
* @property {DeepPartial<BaselineStyleOptions & SeriesOptionsCommon & CreatePriceLineOptions>} [options]
|
||||
* @property {Accessor<BaselineData[]>} [data]
|
||||
* @typedef {BaseSeriesBlueprint & BaselineSeriesBlueprintSpecific} BaselineSeriesBlueprint
|
||||
*
|
||||
@@ -33,7 +40,7 @@
|
||||
* @typedef {Object} LineSeriesBlueprintSpecific
|
||||
* @property {"Line"} [type]
|
||||
* @property {Color} [color]
|
||||
* @property {DeepPartial<LineStyleOptions & SeriesOptionsCommon>} [options]
|
||||
* @property {DeepPartial<LineStyleOptions & SeriesOptionsCommon & CreatePriceLineOptions>} [options]
|
||||
* @property {Accessor<LineData[]>} [data]
|
||||
* @typedef {BaseSeriesBlueprint & LineSeriesBlueprintSpecific} LineSeriesBlueprint
|
||||
*
|
||||
@@ -41,10 +48,12 @@
|
||||
*
|
||||
* @typedef {AnySeriesBlueprint["type"]} SeriesType
|
||||
*
|
||||
* @typedef {BaselineSeriesBlueprint & { key: ChartableVecId }} FetchedBaselineSeriesBlueprint
|
||||
* @typedef {CandlestickSeriesBlueprint & { key: ChartableVecId }} FetchedCandlestickSeriesBlueprint
|
||||
* @typedef {LineSeriesBlueprint & { key: ChartableVecId }} FetchedLineSeriesBlueprint
|
||||
* @typedef {AnySeriesBlueprint & { key: ChartableVecId }} AnyFetchedSeriesBlueprint
|
||||
* @typedef {{ key: ChartableVecId }} FetchedAnySeriesOptions
|
||||
*
|
||||
* @typedef {BaselineSeriesBlueprint & FetchedAnySeriesOptions} FetchedBaselineSeriesBlueprint
|
||||
* @typedef {CandlestickSeriesBlueprint & FetchedAnySeriesOptions} FetchedCandlestickSeriesBlueprint
|
||||
* @typedef {LineSeriesBlueprint & FetchedAnySeriesOptions} FetchedLineSeriesBlueprint
|
||||
* @typedef {AnySeriesBlueprint & FetchedAnySeriesOptions} AnyFetchedSeriesBlueprint
|
||||
*
|
||||
* @typedef {Object} PartialOption
|
||||
* @property {string} name
|
||||
@@ -185,6 +194,10 @@ function createPartialOptions(colors) {
|
||||
{ name: "4 Years", key: "4y", days: 4 * 365 },
|
||||
]);
|
||||
|
||||
const dcaClasses = /** @type {const} */ ([
|
||||
2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025,
|
||||
]);
|
||||
|
||||
/**
|
||||
* @param {Object} args
|
||||
* @param {ChartableVecId} args.key
|
||||
@@ -320,6 +333,506 @@ function createPartialOptions(colors) {
|
||||
name: "Price",
|
||||
title: "Bitcoin Price",
|
||||
},
|
||||
{
|
||||
name: "Market",
|
||||
tree: [
|
||||
{
|
||||
name: "Capitalization",
|
||||
title: "Market Capitalization",
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
key: "marketcap",
|
||||
name: "Capitalization",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "All Time High",
|
||||
tree: [
|
||||
{
|
||||
name: "Value",
|
||||
title: "All Time High",
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: "ath",
|
||||
name: "ath",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "drawdown",
|
||||
title: "All Time High Drawdown",
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: "ath",
|
||||
name: "ath",
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
key: "drawdown",
|
||||
name: "Drawdown",
|
||||
color: colors.red,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "days since",
|
||||
title: "Number of days Since All Time High",
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: "ath",
|
||||
name: "ath",
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
key: "days-since-ath",
|
||||
name: "Days",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "max between",
|
||||
title: "Maximum time between All Time Highs",
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: "ath",
|
||||
name: "ath",
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
key: "max-days-between-ath",
|
||||
name: "Days",
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: "max-years-between-ath",
|
||||
name: "Years",
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Average",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Moving Averages",
|
||||
top: averages.map(({ days, key, name }) =>
|
||||
createBaseSeries({
|
||||
key: `${key}-sma`,
|
||||
name: key,
|
||||
color: colors[`_${key}`],
|
||||
}),
|
||||
),
|
||||
},
|
||||
...averages.map(({ key, name }) => ({
|
||||
name,
|
||||
title: `${name} Market Price Moving Average`,
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: `${key}-sma`,
|
||||
name: "Average",
|
||||
color: colors[`_${key}`],
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p1sd-as-price`,
|
||||
name: "+1σ",
|
||||
color: colors.orange,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p2sd-as-price`,
|
||||
name: "+2σ",
|
||||
color: colors.red,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p3sd-as-price`,
|
||||
name: "+3σ",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m1sd-as-price`,
|
||||
name: "−1σ",
|
||||
color: colors.cyan,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m2sd-as-price`,
|
||||
name: "−2σ",
|
||||
color: colors.blue,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m3sd-as-price`,
|
||||
name: "−3σ",
|
||||
color: colors.violet,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-as-price`,
|
||||
name: "p99",
|
||||
color: colors.orange,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-5-as-price`,
|
||||
name: "p99.5",
|
||||
color: colors.red,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-9-as-price`,
|
||||
name: "p99.9",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p1-as-price`,
|
||||
name: "p1",
|
||||
color: colors.cyan,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p0-5-as-price`,
|
||||
name: "p0.5",
|
||||
color: colors.blue,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p0-1-as-price`,
|
||||
name: "p0.1",
|
||||
color: colors.violet,
|
||||
defaultActive: false,
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-sma-ratio`,
|
||||
title: "Ratio",
|
||||
type: "Baseline",
|
||||
options: {
|
||||
baseValue: { price: 1 },
|
||||
createPriceLine: {
|
||||
value: 1,
|
||||
},
|
||||
},
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-sma`,
|
||||
name: "sma",
|
||||
color: colors.yellow,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p1sd`,
|
||||
name: "+1σ",
|
||||
color: colors.orange,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p2sd`,
|
||||
name: "+2σ",
|
||||
color: colors.red,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p3sd`,
|
||||
name: "+3σ",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m1sd`,
|
||||
name: "−1σ",
|
||||
color: colors.cyan,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m2sd`,
|
||||
name: "−2σ",
|
||||
color: colors.blue,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m3sd`,
|
||||
name: "−3σ",
|
||||
color: colors.violet,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99`,
|
||||
name: "p99",
|
||||
color: colors.orange,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-5`,
|
||||
name: "p99.5",
|
||||
color: colors.red,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-9`,
|
||||
name: "p99.9",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p1`,
|
||||
name: "p1",
|
||||
color: colors.cyan,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p0-5`,
|
||||
name: "p0.5",
|
||||
color: colors.blue,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p0-1`,
|
||||
name: "p0.1",
|
||||
color: colors.violet,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-1w-sma`,
|
||||
name: "1w sma",
|
||||
color: colors.fuchsia,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-1m-sma`,
|
||||
name: "1m sma",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-1y-sma`,
|
||||
name: "1y sma",
|
||||
color: colors.rose,
|
||||
defaultActive: false,
|
||||
}),
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-sma-ratio-1y-sma-momentum-oscillator`,
|
||||
title: "1Y Momentum",
|
||||
type: "Baseline",
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Performance",
|
||||
tree: /** @type {const} */ ([
|
||||
{ name: "1 Day", key: "1d" },
|
||||
{ name: "1 Week", key: "1w" },
|
||||
{ name: "1 Month", key: "1m" },
|
||||
{ name: "3 Month", key: "3m" },
|
||||
{ name: "6 Month", key: "6m" },
|
||||
{ name: "1 Year", key: "1y" },
|
||||
{ name: "2 Year", key: "2y" },
|
||||
{ name: "3 Year", key: "3y" },
|
||||
{ name: "4 Year", key: "4y" },
|
||||
{ name: "5 Year", key: "5y" },
|
||||
{ name: "6 Year", key: "6y" },
|
||||
{ name: "8 Year", key: "8y" },
|
||||
{ name: "10 Year", key: "10y" },
|
||||
]).map(({ name, key }) => ({
|
||||
name,
|
||||
title: `${name} Performance`,
|
||||
bottom: [
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-returns`,
|
||||
title: "Returns",
|
||||
type: "Baseline",
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
})),
|
||||
},
|
||||
{
|
||||
name: "DCA vs Lump sum",
|
||||
tree: [
|
||||
.../** @type {const} */ ([
|
||||
{ name: "1 Week", key: "1w" },
|
||||
{ name: "1 Month", key: "1m" },
|
||||
{ name: "3 Month", key: "3m" },
|
||||
{ name: "6 Month", key: "6m" },
|
||||
{ name: "1 Year", key: "1y" },
|
||||
]).map(
|
||||
({ name, key }) =>
|
||||
/** @satisfies {PartialChartOption} */ ({
|
||||
name,
|
||||
title: `${name} DCA vs Lump Sum Returns`,
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: `${key}-dca-avg-price`,
|
||||
name: `dca`,
|
||||
color: colors.orange,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `price-${key}-ago`,
|
||||
name: `lump sum`,
|
||||
color: colors.cyan,
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-dca-returns`,
|
||||
title: "dca",
|
||||
type: "Baseline",
|
||||
colors: [colors.yellow, colors.pink],
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-returns`,
|
||||
title: "lump sum",
|
||||
type: "Baseline",
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
),
|
||||
.../** @type {const} */ ([
|
||||
{ name: "2 Year", key: "2y" },
|
||||
{ name: "3 Year", key: "3y" },
|
||||
{ name: "4 Year", key: "4y" },
|
||||
{ name: "5 Year", key: "5y" },
|
||||
{ name: "6 Year", key: "6y" },
|
||||
{ name: "8 Year", key: "8y" },
|
||||
{ name: "10 Year", key: "10y" },
|
||||
]).map(
|
||||
({ name, key }) =>
|
||||
/** @satisfies {PartialChartOption} */ ({
|
||||
name,
|
||||
title: `${name} DCA vs Lump Sum Returns`,
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: `${key}-dca-avg-price`,
|
||||
name: `dca avg. price`,
|
||||
color: colors.orange,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `price-${key}-ago`,
|
||||
name: `lump sum price`,
|
||||
color: colors.cyan,
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-dca-returns`,
|
||||
title: "dca",
|
||||
type: "Baseline",
|
||||
colors: [colors.yellow, colors.pink],
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-dca-cagr`,
|
||||
title: "dca",
|
||||
type: "Baseline",
|
||||
colors: [colors.yellow, colors.pink],
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-returns`,
|
||||
title: "lump sum",
|
||||
type: "Baseline",
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-cagr`,
|
||||
title: "lump sum",
|
||||
type: "Baseline",
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "DCA Class",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "DCA Classes",
|
||||
top: dcaClasses.map((year) =>
|
||||
createBaseSeries({
|
||||
key: `dca-class-${year}-avg-price`,
|
||||
name: `${year}`,
|
||||
color: colors[year],
|
||||
}),
|
||||
),
|
||||
},
|
||||
...dcaClasses.map(
|
||||
(year) =>
|
||||
/** @satisfies {PartialChartOption} */ ({
|
||||
name: `${year}`,
|
||||
title: `DCA Since ${year}`,
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: `dca-class-${year}-avg-price`,
|
||||
name: `avg. price`,
|
||||
color: colors[year],
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `dca-class-${year}-returns`,
|
||||
title: "dca",
|
||||
type: "Baseline",
|
||||
options: {
|
||||
createPriceLine: {
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Block",
|
||||
tree: [
|
||||
@@ -394,61 +907,6 @@ function createPartialOptions(colors) {
|
||||
name: "Count",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "Subsidy",
|
||||
title: "Subsidy",
|
||||
bottom: [
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "subsidy",
|
||||
name: "Subsidy",
|
||||
}),
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "subsidy-in-btc",
|
||||
name: "Subsidy",
|
||||
}),
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "subsidy-in-usd",
|
||||
name: "Subsidy",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Coinbase",
|
||||
title: "Coinbase",
|
||||
bottom: [
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "coinbase",
|
||||
name: "Coinbase",
|
||||
}),
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "coinbase-in-btc",
|
||||
name: "Coinbase",
|
||||
}),
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "coinbase-in-usd",
|
||||
name: "Coinbase",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fee",
|
||||
title: "Transaction Fee",
|
||||
bottom: [
|
||||
...createAverageSumTotalMinMaxPercentilesSeries("fee"),
|
||||
...createAverageSumTotalMinMaxPercentilesSeries("fee-in-btc"),
|
||||
...createAverageSumTotalMinMaxPercentilesSeries("fee-in-usd"),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Feerate",
|
||||
title: "Transaction Fee Rate",
|
||||
bottom: [
|
||||
createAverageSeries({ concat: "feerate" }),
|
||||
...createMinMaxPercentilesSeries({
|
||||
concat: "feerate",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Weight",
|
||||
title: "Transaction Weight",
|
||||
@@ -766,7 +1224,62 @@ function createPartialOptions(colors) {
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
key: "total-subsidy-in-btc",
|
||||
name: "Supply",
|
||||
name: "Mined",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Coinbase",
|
||||
title: "Coinbase",
|
||||
bottom: [
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "coinbase",
|
||||
name: "Coinbase",
|
||||
}),
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "coinbase-in-btc",
|
||||
name: "Coinbase",
|
||||
}),
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "coinbase-in-usd",
|
||||
name: "Coinbase",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Subsidy",
|
||||
title: "Subsidy",
|
||||
bottom: [
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "subsidy",
|
||||
name: "Subsidy",
|
||||
}),
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "subsidy-in-btc",
|
||||
name: "Subsidy",
|
||||
}),
|
||||
...createBaseAverageSumTotalMinMaxPercentilesSeries({
|
||||
key: "subsidy-in-usd",
|
||||
name: "Subsidy",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fee",
|
||||
title: "Transaction Fee",
|
||||
bottom: [
|
||||
...createAverageSumTotalMinMaxPercentilesSeries("fee"),
|
||||
...createAverageSumTotalMinMaxPercentilesSeries("fee-in-btc"),
|
||||
...createAverageSumTotalMinMaxPercentilesSeries("fee-in-usd"),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Feerate",
|
||||
title: "Transaction Fee Rate",
|
||||
bottom: [
|
||||
createAverageSeries({ concat: "feerate" }),
|
||||
...createMinMaxPercentilesSeries({
|
||||
concat: "feerate",
|
||||
}),
|
||||
],
|
||||
},
|
||||
@@ -802,299 +1315,6 @@ function createPartialOptions(colors) {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Market",
|
||||
tree: [
|
||||
{
|
||||
name: "Capitalization",
|
||||
title: "Market Capitalization",
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
key: "marketcap",
|
||||
name: "Capitalization",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "All Time High",
|
||||
tree: [
|
||||
{
|
||||
name: "Value",
|
||||
title: "All Time High",
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: "ath",
|
||||
name: "ath",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "drawdown",
|
||||
title: "All Time High Drawdown",
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: "ath",
|
||||
name: "ath",
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
key: "drawdown",
|
||||
name: "Drawdown",
|
||||
color: colors.red,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "days since",
|
||||
title: "Number of days Since All Time High",
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: "ath",
|
||||
name: "ath",
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
key: "days-since-ath",
|
||||
name: "Days",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "max between",
|
||||
title: "Maximum time between All Time Highs",
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: "ath",
|
||||
name: "ath",
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
createBaseSeries({
|
||||
key: "max-days-between-ath",
|
||||
name: "Days",
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: "max-years-between-ath",
|
||||
name: "Years",
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Average",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Moving Averages",
|
||||
top: averages.map(({ days, key, name }) =>
|
||||
createBaseSeries({
|
||||
key: `${key}-sma`,
|
||||
name: key,
|
||||
color: colors[`_${key}`],
|
||||
}),
|
||||
),
|
||||
},
|
||||
...averages.map(({ key, name }) => ({
|
||||
name,
|
||||
title: `${name} Market Price Moving Average`,
|
||||
top: [
|
||||
createBaseSeries({
|
||||
key: `${key}-sma`,
|
||||
name: "Average",
|
||||
color: colors[`_${key}`],
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p1sd-as-price`,
|
||||
name: "+1σ",
|
||||
color: colors.orange,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p2sd-as-price`,
|
||||
name: "+2σ",
|
||||
color: colors.red,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p3sd-as-price`,
|
||||
name: "+3σ",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m1sd-as-price`,
|
||||
name: "−1σ",
|
||||
color: colors.cyan,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m2sd-as-price`,
|
||||
name: "−2σ",
|
||||
color: colors.blue,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m3sd-as-price`,
|
||||
name: "−3σ",
|
||||
color: colors.violet,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-as-price`,
|
||||
name: "p99",
|
||||
color: colors.orange,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-5-as-price`,
|
||||
name: "p99.5",
|
||||
color: colors.red,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-9-as-price`,
|
||||
name: "p99.9",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p1-as-price`,
|
||||
name: "p1",
|
||||
color: colors.cyan,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p0-5-as-price`,
|
||||
name: "p0.5",
|
||||
color: colors.blue,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p0-1-as-price`,
|
||||
name: "p0.1",
|
||||
color: colors.violet,
|
||||
defaultActive: false,
|
||||
}),
|
||||
],
|
||||
bottom: [
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-sma-ratio`,
|
||||
title: "Ratio",
|
||||
type: "Baseline",
|
||||
options: {
|
||||
baseValue: { type: "price", price: 1 },
|
||||
},
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-sma`,
|
||||
name: "sma",
|
||||
color: colors.yellow,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p1sd`,
|
||||
name: "+1σ",
|
||||
color: colors.orange,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p2sd`,
|
||||
name: "+2σ",
|
||||
color: colors.red,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p3sd`,
|
||||
name: "+3σ",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m1sd`,
|
||||
name: "−1σ",
|
||||
color: colors.cyan,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m2sd`,
|
||||
name: "−2σ",
|
||||
color: colors.blue,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-m3sd`,
|
||||
name: "−3σ",
|
||||
color: colors.violet,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99`,
|
||||
name: "p99",
|
||||
color: colors.orange,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-5`,
|
||||
name: "p99.5",
|
||||
color: colors.red,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p99-9`,
|
||||
name: "p99.9",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p1`,
|
||||
name: "p1",
|
||||
color: colors.cyan,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p0-5`,
|
||||
name: "p0.5",
|
||||
color: colors.blue,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-p0-1`,
|
||||
name: "p0.1",
|
||||
color: colors.violet,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-1w-sma`,
|
||||
name: "1w sma",
|
||||
color: colors.fuchsia,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-1m-sma`,
|
||||
name: "1m sma",
|
||||
color: colors.pink,
|
||||
defaultActive: false,
|
||||
}),
|
||||
createBaseSeries({
|
||||
key: `${key}-sma-ratio-1y-sma`,
|
||||
name: "1y sma",
|
||||
color: colors.rose,
|
||||
defaultActive: false,
|
||||
}),
|
||||
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
|
||||
key: `${key}-sma-ratio-1y-sma-momentum-oscillator`,
|
||||
title: "1Y Momentum",
|
||||
type: "Baseline",
|
||||
}),
|
||||
],
|
||||
})),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -832,7 +832,7 @@ export function init({
|
||||
owner,
|
||||
config: [
|
||||
{
|
||||
unit: "%",
|
||||
unit: "percentage",
|
||||
blueprints: [
|
||||
{
|
||||
title: "Profitable Days Ratio",
|
||||
|
||||
@@ -56,6 +56,15 @@ export function createVecIdToIndexes() {
|
||||
const YearIndex = /** @satisfies {YearIndex} */ (23);
|
||||
|
||||
return /** @type {const} */ ({
|
||||
"0": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"100": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"10y-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"10y-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"10y-dca-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"10y-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"10y-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"10y-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"13d-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"13d-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"13d-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -120,6 +129,11 @@ export function createVecIdToIndexes() {
|
||||
"144d-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"144d-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"144d-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1d-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1m-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1m-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1m-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1m-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1m-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1m-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -152,6 +166,10 @@ export function createVecIdToIndexes() {
|
||||
"1m-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1m-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1m-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1w-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1w-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1w-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1w-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1w-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1w-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -184,6 +202,10 @@ export function createVecIdToIndexes() {
|
||||
"1w-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1w-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1w-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1y-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1y-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1y-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1y-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1y-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"1y-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -280,6 +302,12 @@ export function createVecIdToIndexes() {
|
||||
"21d-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"21d-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"21d-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"2y-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"2y-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"2y-dca-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"2y-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"2y-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"2y-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"2y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"2y-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"2y-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -344,6 +372,22 @@ export function createVecIdToIndexes() {
|
||||
"34d-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"34d-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"34d-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3m-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3m-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3m-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3m-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3y-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3y-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3y-dca-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3y-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3y-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"3y-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-dca-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -376,6 +420,7 @@ export function createVecIdToIndexes() {
|
||||
"4y-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"4y-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"50": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"55d-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"55d-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"55d-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -408,6 +453,22 @@ export function createVecIdToIndexes() {
|
||||
"55d-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"55d-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"55d-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"5y-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"5y-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"5y-dca-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"5y-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"5y-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"5y-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6m-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6m-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6m-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6m-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6y-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6y-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6y-dca-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6y-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6y-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"6y-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"89d-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"89d-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"89d-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -472,7 +533,13 @@ export function createVecIdToIndexes() {
|
||||
"8d-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"8d-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"8d-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
ath: [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"8y-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"8y-dca-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"8y-dca-cagr": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"8y-dca-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"8y-dca-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"8y-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"ath": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"base-size": [TxIndex],
|
||||
"block-count": [Height],
|
||||
"block-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -487,11 +554,11 @@ export function createVecIdToIndexes() {
|
||||
"block-size-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"block-vbytes-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"block-weight-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
blockhash: [Height],
|
||||
close: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"blockhash": [Height],
|
||||
"close": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"close-in-cents": [DateIndex, Height],
|
||||
"close-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
coinbase: [Height],
|
||||
"coinbase": [Height],
|
||||
"coinbase-10p": [DateIndex],
|
||||
"coinbase-25p": [DateIndex],
|
||||
"coinbase-75p": [DateIndex],
|
||||
@@ -521,15 +588,48 @@ export function createVecIdToIndexes() {
|
||||
"coinbase-median": [DateIndex],
|
||||
"coinbase-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"coinbase-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
date: [DateIndex, Height],
|
||||
"date": [DateIndex, Height],
|
||||
"date-fixed": [Height],
|
||||
dateindex: [DateIndex, Height],
|
||||
"dateindex": [DateIndex, Height],
|
||||
"dateindex-count": [MonthIndex, WeekIndex],
|
||||
"days-since-ath": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
decadeindex: [DecadeIndex, YearIndex],
|
||||
difficulty: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
difficultyepoch: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
drawdown: [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2015-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2015-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2015-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2016-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2016-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2016-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2017-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2017-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2017-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2018-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2018-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2018-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2019-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2019-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2019-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2020-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2020-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2020-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2021-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2021-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2021-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2022-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2022-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2022-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2023-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2023-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2023-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2024-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2024-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2024-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2025-avg-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2025-returns": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"dca-class-2025-stack": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"decadeindex": [DecadeIndex, YearIndex],
|
||||
"difficulty": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"difficultyepoch": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"drawdown": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"emptyoutput-count": [Height],
|
||||
"emptyoutput-count-10p": [DateIndex],
|
||||
"emptyoutput-count-25p": [DateIndex],
|
||||
@@ -540,8 +640,8 @@ export function createVecIdToIndexes() {
|
||||
"emptyoutput-count-median": [DateIndex],
|
||||
"emptyoutput-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"emptyoutput-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
emptyoutputindex: [EmptyOutputIndex],
|
||||
fee: [TxIndex],
|
||||
"emptyoutputindex": [EmptyOutputIndex],
|
||||
"fee": [TxIndex],
|
||||
"fee-10p": [Height],
|
||||
"fee-25p": [Height],
|
||||
"fee-75p": [Height],
|
||||
@@ -569,7 +669,7 @@ export function createVecIdToIndexes() {
|
||||
"fee-median": [Height],
|
||||
"fee-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"fee-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
feerate: [TxIndex],
|
||||
"feerate": [TxIndex],
|
||||
"feerate-10p": [Height],
|
||||
"feerate-25p": [Height],
|
||||
"feerate-75p": [Height],
|
||||
@@ -597,10 +697,10 @@ export function createVecIdToIndexes() {
|
||||
"first-txindex": [Height],
|
||||
"first-unknownoutputindex": [Height],
|
||||
"first-yearindex": [DecadeIndex],
|
||||
halvingepoch: [DateIndex, DecadeIndex, HalvingEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
height: [Height, TxIndex],
|
||||
"halvingepoch": [DateIndex, DecadeIndex, HalvingEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"height": [Height, TxIndex],
|
||||
"height-count": [DateIndex, DifficultyEpoch],
|
||||
high: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"high": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"high-in-cents": [DateIndex, Height],
|
||||
"high-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"input-count": [TxIndex],
|
||||
@@ -614,22 +714,22 @@ export function createVecIdToIndexes() {
|
||||
"input-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"input-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"input-value": [TxIndex],
|
||||
inputindex: [InputIndex],
|
||||
interval: [Height],
|
||||
"inputindex": [InputIndex],
|
||||
"interval": [Height],
|
||||
"is-coinbase": [TxIndex],
|
||||
"is-explicitly-rbf": [TxIndex],
|
||||
low: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"low": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"low-in-cents": [DateIndex, Height],
|
||||
"low-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
marketcap: [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"marketcap": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"max-days-between-ath": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"max-years-between-ath": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
monthindex: [DateIndex, MonthIndex],
|
||||
"monthindex": [DateIndex, MonthIndex],
|
||||
"monthindex-count": [QuarterIndex, YearIndex],
|
||||
ohlc: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"ohlc": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"ohlc-in-cents": [DateIndex, Height],
|
||||
"ohlc-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
open: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"open": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"open-in-cents": [DateIndex, Height],
|
||||
"open-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"opreturn-count": [Height],
|
||||
@@ -642,7 +742,7 @@ export function createVecIdToIndexes() {
|
||||
"opreturn-count-median": [DateIndex],
|
||||
"opreturn-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"opreturn-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
opreturnindex: [OpReturnIndex],
|
||||
"opreturnindex": [OpReturnIndex],
|
||||
"output-count": [TxIndex],
|
||||
"output-count-10p": [Height],
|
||||
"output-count-25p": [Height],
|
||||
@@ -654,9 +754,9 @@ export function createVecIdToIndexes() {
|
||||
"output-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"output-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"output-value": [TxIndex],
|
||||
outputindex: [InputIndex, OutputIndex],
|
||||
outputtype: [OutputIndex],
|
||||
outputtypeindex: [OutputIndex],
|
||||
"outputindex": [InputIndex, OutputIndex],
|
||||
"outputtype": [OutputIndex],
|
||||
"outputtypeindex": [OutputIndex],
|
||||
"p2a-count": [Height],
|
||||
"p2a-count-10p": [DateIndex],
|
||||
"p2a-count-25p": [DateIndex],
|
||||
@@ -667,8 +767,8 @@ export function createVecIdToIndexes() {
|
||||
"p2a-count-median": [DateIndex],
|
||||
"p2a-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"p2a-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
p2abytes: [P2AIndex],
|
||||
p2aindex: [P2AIndex],
|
||||
"p2abytes": [P2AIndex],
|
||||
"p2aindex": [P2AIndex],
|
||||
"p2ms-count": [Height],
|
||||
"p2ms-count-10p": [DateIndex],
|
||||
"p2ms-count-25p": [DateIndex],
|
||||
@@ -679,7 +779,7 @@ export function createVecIdToIndexes() {
|
||||
"p2ms-count-median": [DateIndex],
|
||||
"p2ms-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"p2ms-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
p2msindex: [P2MSIndex],
|
||||
"p2msindex": [P2MSIndex],
|
||||
"p2pk33-count": [Height],
|
||||
"p2pk33-count-10p": [DateIndex],
|
||||
"p2pk33-count-25p": [DateIndex],
|
||||
@@ -690,8 +790,8 @@ export function createVecIdToIndexes() {
|
||||
"p2pk33-count-median": [DateIndex],
|
||||
"p2pk33-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"p2pk33-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
p2pk33bytes: [P2PK33Index],
|
||||
p2pk33index: [P2PK33Index],
|
||||
"p2pk33bytes": [P2PK33Index],
|
||||
"p2pk33index": [P2PK33Index],
|
||||
"p2pk65-count": [Height],
|
||||
"p2pk65-count-10p": [DateIndex],
|
||||
"p2pk65-count-25p": [DateIndex],
|
||||
@@ -702,8 +802,8 @@ export function createVecIdToIndexes() {
|
||||
"p2pk65-count-median": [DateIndex],
|
||||
"p2pk65-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"p2pk65-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
p2pk65bytes: [P2PK65Index],
|
||||
p2pk65index: [P2PK65Index],
|
||||
"p2pk65bytes": [P2PK65Index],
|
||||
"p2pk65index": [P2PK65Index],
|
||||
"p2pkh-count": [Height],
|
||||
"p2pkh-count-10p": [DateIndex],
|
||||
"p2pkh-count-25p": [DateIndex],
|
||||
@@ -714,8 +814,8 @@ export function createVecIdToIndexes() {
|
||||
"p2pkh-count-median": [DateIndex],
|
||||
"p2pkh-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"p2pkh-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
p2pkhbytes: [P2PKHIndex],
|
||||
p2pkhindex: [P2PKHIndex],
|
||||
"p2pkhbytes": [P2PKHIndex],
|
||||
"p2pkhindex": [P2PKHIndex],
|
||||
"p2sh-count": [Height],
|
||||
"p2sh-count-10p": [DateIndex],
|
||||
"p2sh-count-25p": [DateIndex],
|
||||
@@ -726,8 +826,8 @@ export function createVecIdToIndexes() {
|
||||
"p2sh-count-median": [DateIndex],
|
||||
"p2sh-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"p2sh-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
p2shbytes: [P2SHIndex],
|
||||
p2shindex: [P2SHIndex],
|
||||
"p2shbytes": [P2SHIndex],
|
||||
"p2shindex": [P2SHIndex],
|
||||
"p2tr-count": [Height],
|
||||
"p2tr-count-10p": [DateIndex],
|
||||
"p2tr-count-25p": [DateIndex],
|
||||
@@ -738,8 +838,8 @@ export function createVecIdToIndexes() {
|
||||
"p2tr-count-median": [DateIndex],
|
||||
"p2tr-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"p2tr-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
p2trbytes: [P2TRIndex],
|
||||
p2trindex: [P2TRIndex],
|
||||
"p2trbytes": [P2TRIndex],
|
||||
"p2trindex": [P2TRIndex],
|
||||
"p2wpkh-count": [Height],
|
||||
"p2wpkh-count-10p": [DateIndex],
|
||||
"p2wpkh-count-25p": [DateIndex],
|
||||
@@ -750,8 +850,8 @@ export function createVecIdToIndexes() {
|
||||
"p2wpkh-count-median": [DateIndex],
|
||||
"p2wpkh-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"p2wpkh-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
p2wpkhbytes: [P2WPKHIndex],
|
||||
p2wpkhindex: [P2WPKHIndex],
|
||||
"p2wpkhbytes": [P2WPKHIndex],
|
||||
"p2wpkhindex": [P2WPKHIndex],
|
||||
"p2wsh-count": [Height],
|
||||
"p2wsh-count-10p": [DateIndex],
|
||||
"p2wsh-count-25p": [DateIndex],
|
||||
@@ -762,11 +862,24 @@ export function createVecIdToIndexes() {
|
||||
"p2wsh-count-median": [DateIndex],
|
||||
"p2wsh-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"p2wsh-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
p2wshbytes: [P2WSHIndex],
|
||||
p2wshindex: [P2WSHIndex],
|
||||
quarterindex: [MonthIndex, QuarterIndex],
|
||||
rawlocktime: [TxIndex],
|
||||
subsidy: [Height],
|
||||
"p2wshbytes": [P2WSHIndex],
|
||||
"p2wshindex": [P2WSHIndex],
|
||||
"price-10y-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-1d-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-1m-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-1w-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-1y-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-2y-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-3m-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-3y-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-4y-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-5y-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-6m-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-6y-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"price-8y-ago": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"quarterindex": [MonthIndex, QuarterIndex],
|
||||
"rawlocktime": [TxIndex],
|
||||
"subsidy": [Height],
|
||||
"subsidy-10p": [DateIndex],
|
||||
"subsidy-25p": [DateIndex],
|
||||
"subsidy-75p": [DateIndex],
|
||||
@@ -796,7 +909,7 @@ export function createVecIdToIndexes() {
|
||||
"subsidy-median": [DateIndex],
|
||||
"subsidy-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"subsidy-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
timestamp: [DateIndex, DecadeIndex, DifficultyEpoch, HalvingEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"timestamp": [DateIndex, DecadeIndex, DifficultyEpoch, HalvingEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"timestamp-fixed": [Height],
|
||||
"total-block-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"total-block-size": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
@@ -862,10 +975,10 @@ export function createVecIdToIndexes() {
|
||||
"tx-weight-max": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"tx-weight-median": [Height],
|
||||
"tx-weight-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
txid: [TxIndex],
|
||||
txindex: [EmptyOutputIndex, OpReturnIndex, P2MSIndex, TxIndex, UnknownOutputIndex],
|
||||
"txid": [TxIndex],
|
||||
"txindex": [EmptyOutputIndex, OpReturnIndex, P2MSIndex, TxIndex, UnknownOutputIndex],
|
||||
"txindex-count": [Height],
|
||||
txversion: [TxIndex],
|
||||
"txversion": [TxIndex],
|
||||
"unknownoutput-count": [Height],
|
||||
"unknownoutput-count-10p": [DateIndex],
|
||||
"unknownoutput-count-25p": [DateIndex],
|
||||
@@ -876,13 +989,13 @@ export function createVecIdToIndexes() {
|
||||
"unknownoutput-count-median": [DateIndex],
|
||||
"unknownoutput-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
"unknownoutput-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
|
||||
unknownoutputindex: [UnknownOutputIndex],
|
||||
value: [InputIndex, OutputIndex],
|
||||
vbytes: [Height],
|
||||
vsize: [TxIndex],
|
||||
weekindex: [DateIndex, WeekIndex],
|
||||
weight: [Height, TxIndex],
|
||||
yearindex: [MonthIndex, YearIndex],
|
||||
"unknownoutputindex": [UnknownOutputIndex],
|
||||
"value": [InputIndex, OutputIndex],
|
||||
"vbytes": [Height],
|
||||
"vsize": [TxIndex],
|
||||
"weekindex": [DateIndex, WeekIndex],
|
||||
"weight": [Height, TxIndex],
|
||||
"yearindex": [MonthIndex, YearIndex],
|
||||
"yearindex-count": [DecadeIndex],
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user