diff --git a/Cargo.lock b/Cargo.lock index 43abea136..1fefda272 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -435,6 +435,7 @@ dependencies = [ "color-eyre", "fjall", "log", + "rayon", "serde", "serde_json", ] @@ -445,7 +446,7 @@ version = "0.0.34" dependencies = [ "bitcoin", "bitcoincore-rpc", - "byteview", + "byteview 0.7.0", "derive_deref", "jiff", "log", @@ -491,7 +492,7 @@ dependencies = [ "brk_logger", "brk_parser", "brk_vec", - "byteview", + "byteview 0.7.0", "color-eyre", "fjall", "log", @@ -642,6 +643,12 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6236364b88b9b6d0bc181ba374cf1ab55ba3ef97a1cb6f8cddad48a273767fb5" +[[package]] +name = "byteview" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f996a0c883b1ae93c53ffd21857b6eaba768998dbb1f7e2f269d53dd6553256c" + [[package]] name = "bzip2" version = "0.5.2" @@ -718,18 +725,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.37" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" +checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.37" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" +checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120" dependencies = [ "anstream", "anstyle", @@ -937,9 +944,9 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.4.6" +version = "3.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697b5419f348fd5ae2478e8018cb016c00a5881c7f46c717de98ffd135a5651c" +checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73" dependencies = [ "nix", "windows-sys 0.59.0", @@ -1135,7 +1142,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b929b3db7be7d7b4d4df67fb016fc446b8f57507b48a82e69d2a30610e460f28" dependencies = [ "byteorder", - "byteview", + "byteview 0.6.1", "dashmap", "log", "lsm-tree", @@ -1720,9 +1727,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ "bitflags", "cfg-if", @@ -1799,9 +1806,9 @@ checksum = "1036865bb9422d3300cf723f657c2851d0e9ab12567854b1f4eba3d77decf564" [[package]] name = "oxc" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f907527226ea09664a17963b36d3057ddcab280c1dcc19b3a287f40de30c3965" +checksum = "6adee1268a2077efca9b1c1f36fdc9d9be2986b70c26bfc648d686002dfc50dd" dependencies = [ "oxc_allocator", "oxc_ast", @@ -1842,9 +1849,9 @@ dependencies = [ [[package]] name = "oxc_allocator" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3da7bc2d06c0fd029c7817889b1e4d418f4955c25c003d5a9ea4a525db8fce9" +checksum = "d64a116c5711ab4de5f6780627c9a88a61effc7e918db50a5943472ab5697164" dependencies = [ "allocator-api2", "bumpalo", @@ -1856,9 +1863,9 @@ dependencies = [ [[package]] name = "oxc_ast" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a83d102ba84b604cf24be6b943c3347f13740afa97304461d798f2598d4a92e" +checksum = "76a801811f4a51678fcb766049a54cf452033240fc7fbe036d356854c7350c9e" dependencies = [ "bitflags", "cow-utils", @@ -1873,9 +1880,9 @@ dependencies = [ [[package]] name = "oxc_ast_macros" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e03da9a237d05fa378e3398a5a2c28124a387ff666218c1ca4ebfe5f0544d3d" +checksum = "41ce0ae699f31d2b03e251cc54a0226b1e6022bfa2012dc6074d858f23da154c" dependencies = [ "proc-macro2", "quote", @@ -1884,9 +1891,9 @@ dependencies = [ [[package]] name = "oxc_ast_visit" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f97a1716d68a3c9a0c9cf1d906eaeaa3a806052f91d8e4ef14e6afc50d515132" +checksum = "9e96d753425812fb3ff3dee311f8b78a333e60fe235f74b99281f3c8bfbb7cd2" dependencies = [ "oxc_allocator", "oxc_ast", @@ -1896,9 +1903,9 @@ dependencies = [ [[package]] name = "oxc_cfg" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de348366d30393be8eab6591bfa03c63c18e0b239cccf666554769547d94cd39" +checksum = "74e353d71cadac4a92445380e76d511ce95622795e5bf64e0e644b0d71f56621" dependencies = [ "bitflags", "itertools", @@ -1911,9 +1918,9 @@ dependencies = [ [[package]] name = "oxc_codegen" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740de9affaf00644d8122c3e74009c01888747d7233487c387415b298c5f9fd4" +checksum = "f9b63fa7d6b53b7eb5eabb5d6c62146b2e661199e12ddf9b9849c915d502fec1" dependencies = [ "bitflags", "cow-utils", @@ -1932,15 +1939,15 @@ dependencies = [ [[package]] name = "oxc_data_structures" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9603941570dc1dbc111e6312d622d60722395b502aa68e703646beacc45d0d2" +checksum = "48a633d6f98c3e66c4f46a28f2d6d90b826f66464c7ae74c3ad1c084cb5db4af" [[package]] name = "oxc_diagnostics" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01184ff8ddf40a39c5ec4b0979b53e6e3f8e5701e4a0aed8edefd208ae310eb" +checksum = "458d78cc5805fb9496d94b4906afc63a8e4d03cfd293cca8d77c048a1821141f" dependencies = [ "cow-utils", "oxc-miette", @@ -1948,9 +1955,9 @@ dependencies = [ [[package]] name = "oxc_ecmascript" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d549b884069d155eae98207c404b71113dc8fce2bea84dc53e8476a221405a83" +checksum = "4c1190881a073f992e1b420c7fc9bf7fcdc73b7377a5bc188844873d44ec87e7" dependencies = [ "cow-utils", "num-bigint", @@ -1962,9 +1969,9 @@ dependencies = [ [[package]] name = "oxc_estree" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66904246cb3ceef3c7f9dd4b3a79bb104b242d8e442eb94f6097cec241a0eec4" +checksum = "78d6c5726456864b42e2ba570e1aceb4fccaef6c98edd2ed2b44ce9f27432373" [[package]] name = "oxc_index" @@ -1974,9 +1981,9 @@ checksum = "2fa07b0cfa997730afed43705766ef27792873fdf5215b1391949fec678d2392" [[package]] name = "oxc_mangler" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d862ba81d295897e817489c0850b04c41facb927bf760d808778da40cc7ad580" +checksum = "8351243ef6acfe269da935764959443929541b4a681c5061a21ac807715ddd8e" dependencies = [ "fixedbitset", "itertools", @@ -1991,9 +1998,9 @@ dependencies = [ [[package]] name = "oxc_minifier" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465c3ce7241550963b95a7127879e83a5f64094bdf217eb393e209b9eb9bed9c" +checksum = "a11de372cdb1eed5c47ea485511b11d3e492ee321d10eb9c31d14e7398443233" dependencies = [ "cow-utils", "oxc_allocator", @@ -2013,9 +2020,9 @@ dependencies = [ [[package]] name = "oxc_parser" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a662d53b21550ca1a5600f70d033fcec40b2a25ba2b5281ecaf2ecd01cb16559" +checksum = "ec5d7bd6ced861f21f476ef3edca2b2c9b0775696dee4f370614aa06c4d4b767" dependencies = [ "bitflags", "cow-utils", @@ -2036,14 +2043,13 @@ dependencies = [ [[package]] name = "oxc_regular_expression" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53f760363c78764bb28b8e0f8316d9c28adf89a0ddfba625c8a9f465f4e2199" +checksum = "d9a1d0d251aa32bbc1228cf2e67b016ed9cdb97f2144c2b1027f3dd0fa9d662a" dependencies = [ "oxc_allocator", "oxc_ast_macros", "oxc_diagnostics", - "oxc_estree", "oxc_span", "phf", "rustc-hash", @@ -2052,9 +2058,9 @@ dependencies = [ [[package]] name = "oxc_semantic" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942de11616459d462489166eddf7870cfb8589ba3f12b91f61d28e80b77f7fd0" +checksum = "c3c1e25e8ce948cdfb8aef182e487074b931e449e7251d2df8442dde559644b8" dependencies = [ "itertools", "oxc_allocator", @@ -2088,9 +2094,9 @@ dependencies = [ [[package]] name = "oxc_span" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f8e3cd484054ea0ce496e16437d802d4d9126e238deb267796db140a80d91dc" +checksum = "e04ea95e074243c7ee2f48bb8e7164c6b4f53afb6d1b61dd5d1c521c3c173f3e" dependencies = [ "compact_str", "oxc-miette", @@ -2101,9 +2107,9 @@ dependencies = [ [[package]] name = "oxc_syntax" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8933bda357ccc13260bb2fe3a08f02d98ceeb695c9af04d8ec5913edd9bec6d6" +checksum = "71f3943f294bacbd1395143ee7d47f19080e35028bd3eaca829f154bd99e3a51" dependencies = [ "bitflags", "cow-utils", @@ -2122,9 +2128,9 @@ dependencies = [ [[package]] name = "oxc_traverse" -version = "0.68.1" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e318be8193f3c72ab703afbb8941b31ed475168514067337325fa151416301a" +checksum = "afda4da5f89f3b40efe6a6501b3e52cc268508aafc01a0b4c8725c64f58dc492" dependencies = [ "itoa", "oxc_allocator", @@ -3043,9 +3049,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1cfca9ae570b2a6efc764a88e914c29b3dfaa1fafe5f495812ae97ec9bc4d53" +checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e" dependencies = [ "async-compression", "bitflags", @@ -3182,7 +3188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62fc7c4ce161f049607ecea654dca3f2d727da5371ae85e2e4f14ce2b98ed67c" dependencies = [ "byteorder", - "byteview", + "byteview 0.6.1", "interval-heap", "log", "path-absolutize", diff --git a/Cargo.toml b/Cargo.toml index 134d01c87..32f33474f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,8 +30,8 @@ brk_parser = { version = "0", path = "crates/brk_parser" } brk_query = { version = "0", path = "crates/brk_query" } brk_server = { version = "0", path = "crates/brk_server" } brk_vec = { version = "0", path = "crates/brk_vec" } -byteview = "0.6.1" -clap = { version = "4.5.37", features = ["string"] } +byteview = "0.7.0" +clap = { version = "4.5.38", features = ["string"] } clap_derive = "4.5.32" color-eyre = "0.6.4" derive_deref = "1.1.1" diff --git a/crates/brk_cli/src/run.rs b/crates/brk_cli/src/run.rs index 9531ea5aa..d7313b75e 100644 --- a/crates/brk_cli/src/run.rs +++ b/crates/brk_cli/src/run.rs @@ -1,7 +1,7 @@ use std::{ fs, path::{Path, PathBuf}, - thread::sleep, + thread::{self, sleep}, time::Duration, }; @@ -33,77 +33,85 @@ pub fn run(config: RunConfig) -> color_eyre::Result<()> { indexer.import_stores()?; indexer.import_vecs()?; - let mut computer = Computer::new(&config.outputsdir(), config.fetcher(), compressed); - computer.import_stores(&indexer)?; - computer.import_vecs(&indexer, config.computation())?; + let wait_for_synced_node = || -> color_eyre::Result<()> { + let is_synced = || -> color_eyre::Result { + let info = rpc.get_blockchain_info()?; + Ok(info.headers == info.blocks) + }; - tokio::runtime::Builder::new_multi_thread() - .enable_all() - .build()? - .block_on(async { - let server = if config.serve() { - let served_indexer = indexer.clone(); - let served_computer = computer.clone(); + if !is_synced()? { + info!("Waiting for node to be synced..."); + while !is_synced()? { + sleep(Duration::from_secs(1)) + } + } - let server = Server::new(served_indexer, served_computer, config.website())?; + Ok(()) + }; - let opt = Some(tokio::spawn(async move { - server.serve().await.unwrap(); - })); + let f = move || -> color_eyre::Result<()> { + let mut computer = Computer::new(&config.outputsdir(), config.fetcher(), compressed); + computer.import_stores(&indexer)?; + computer.import_vecs(&indexer, config.computation())?; - sleep(Duration::from_secs(1)); + tokio::runtime::Builder::new_multi_thread() + .enable_all() + .build()? + .block_on(async { + let server = if config.serve() { + let served_indexer = indexer.clone(); + let served_computer = computer.clone(); - opt - } else { - None - }; + let server = Server::new(served_indexer, served_computer, config.website())?; - if config.process() { - let wait_for_synced_node = || -> color_eyre::Result<()> { - let is_synced = || -> color_eyre::Result { - let info = rpc.get_blockchain_info()?; - Ok(info.headers == info.blocks) - }; + let opt = Some(tokio::spawn(async move { + server.serve().await.unwrap(); + })); - if !is_synced()? { - info!("Waiting for node to be synced..."); - while !is_synced()? { + sleep(Duration::from_secs(1)); + + opt + } else { + None + }; + + if config.process() { + loop { + wait_for_synced_node()?; + + let block_count = rpc.get_block_count()?; + + info!("{} blocks found.", block_count + 1); + + let starting_indexes = indexer.index(&parser, rpc, &exit)?; + + computer.compute(&mut indexer, starting_indexes, &exit)?; + + if let Some(delay) = config.delay() { + sleep(Duration::from_secs(delay)) + } + + info!("Waiting for new blocks..."); + + while block_count == rpc.get_block_count()? { sleep(Duration::from_secs(1)) } } - - Ok(()) - }; - - loop { - wait_for_synced_node()?; - - let block_count = rpc.get_block_count()?; - - info!("{} blocks found.", block_count + 1); - - let starting_indexes = indexer.index(&parser, rpc, &exit)?; - - computer.compute(&mut indexer, starting_indexes, &exit)?; - - if let Some(delay) = config.delay() { - sleep(Duration::from_secs(delay)) - } - - info!("Waiting for new blocks..."); - - while block_count == rpc.get_block_count()? { - sleep(Duration::from_secs(1)) - } } - } - if let Some(handle) = server { - handle.await.unwrap(); - } + if let Some(handle) = server { + handle.await.unwrap(); + } - Ok(()) - }) + Ok(()) + }) + }; + + thread::Builder::new() + .stack_size(64 * 1024 * 1024) + .spawn(f)? + .join() + .unwrap() } #[derive(Parser, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)] diff --git a/crates/brk_computer/Cargo.toml b/crates/brk_computer/Cargo.toml index 53f658002..96e5a38c9 100644 --- a/crates/brk_computer/Cargo.toml +++ b/crates/brk_computer/Cargo.toml @@ -19,5 +19,6 @@ clap_derive = { workspace = true } color-eyre = { workspace = true } fjall = { workspace = true } log = { workspace = true } +rayon = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/crates/brk_computer/examples/main.rs b/crates/brk_computer/examples/main.rs index e0174ece6..7af68a97a 100644 --- a/crates/brk_computer/examples/main.rs +++ b/crates/brk_computer/examples/main.rs @@ -1,7 +1,7 @@ -use std::path::Path; +use std::{path::Path, thread}; use brk_computer::Computer; -use brk_core::default_bitcoin_path; +use brk_core::{default_bitcoin_path, default_brk_path}; use brk_exit::Exit; use brk_fetcher::Fetcher; use brk_indexer::Indexer; @@ -21,25 +21,34 @@ pub fn main() -> color_eyre::Result<()> { )?)); let exit = Exit::new(); - let parser = Parser::new(bitcoin_dir.join("blocks"), rpc); + // Can't increase main thread's stack programatically, thus we need to use another thread + thread::Builder::new() + .stack_size(32 * 1024 * 1024) + .spawn(move || -> color_eyre::Result<()> { + let parser = Parser::new(bitcoin_dir.join("blocks"), rpc); - let outputs_dir = Path::new("../../_outputs"); + let _outputs_dir = default_brk_path().join("outputs"); + let outputs_dir = _outputs_dir.as_path(); + // let outputs_dir = Path::new("../../_outputs"); - let compressed = false; + let compressed = false; - let mut indexer = Indexer::new(outputs_dir, compressed, true)?; - indexer.import_stores()?; - indexer.import_vecs()?; + let mut indexer = Indexer::new(outputs_dir, compressed, true)?; + indexer.import_stores()?; + indexer.import_vecs()?; - let fetcher = Fetcher::import(None)?; + let fetcher = Fetcher::import(None)?; - let mut computer = Computer::new(outputs_dir, Some(fetcher), compressed); - computer.import_stores(&indexer)?; - computer.import_vecs(&indexer, Computation::Lazy)?; + let mut computer = Computer::new(outputs_dir, Some(fetcher), compressed); + computer.import_stores(&indexer)?; + computer.import_vecs(&indexer, Computation::Lazy)?; - let starting_indexes = indexer.index(&parser, rpc, &exit)?; + let starting_indexes = indexer.index(&parser, rpc, &exit)?; - computer.compute(&mut indexer, starting_indexes, &exit)?; + computer.compute(&mut indexer, starting_indexes, &exit)?; - Ok(()) + Ok(()) + })? + .join() + .unwrap() } diff --git a/crates/brk_computer/src/lib.rs b/crates/brk_computer/src/lib.rs index 19a88d78f..6492f3534 100644 --- a/crates/brk_computer/src/lib.rs +++ b/crates/brk_computer/src/lib.rs @@ -11,6 +11,7 @@ use brk_indexer::{Indexer, Indexes}; pub use brk_parser::rpc; mod storage; +mod utils; use brk_vec::{AnyCollectableVec, Compressed, Computation}; use log::info; diff --git a/crates/brk_computer/src/storage/vecs/blocks.rs b/crates/brk_computer/src/storage/vecs/blocks.rs index 05bcf8b50..78243fac9 100644 --- a/crates/brk_computer/src/storage/vecs/blocks.rs +++ b/crates/brk_computer/src/storage/vecs/blocks.rs @@ -11,7 +11,7 @@ use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, Computation, EagerV use super::{ Indexes, - grouped::{ComputedVecsFromDateindex, ComputedVecsFromHeight, StorableVecGeneatorOptions}, + grouped::{ComputedVecsFromDateIndex, ComputedVecsFromHeight, StorableVecGeneatorOptions}, indexes, }; @@ -21,7 +21,7 @@ pub struct Vecs { pub height_to_vbytes: EagerVec, pub difficultyepoch_to_timestamp: EagerVec, pub halvingepoch_to_timestamp: EagerVec, - pub timeindexes_to_timestamp: ComputedVecsFromDateindex, + pub timeindexes_to_timestamp: ComputedVecsFromDateIndex, pub indexes_to_block_count: ComputedVecsFromHeight, pub indexes_to_block_interval: ComputedVecsFromHeight, pub indexes_to_block_size: ComputedVecsFromHeight, @@ -43,7 +43,7 @@ impl Vecs { Version::ZERO, compressed, )?, - timeindexes_to_timestamp: ComputedVecsFromDateindex::forced_import( + timeindexes_to_timestamp: ComputedVecsFromDateIndex::forced_import( path, "timestamp", Version::ZERO, diff --git a/crates/brk_computer/src/storage/vecs/fetched.rs b/crates/brk_computer/src/storage/vecs/fetched.rs index f7593c97a..b56308e06 100644 --- a/crates/brk_computer/src/storage/vecs/fetched.rs +++ b/crates/brk_computer/src/storage/vecs/fetched.rs @@ -12,7 +12,7 @@ use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, Computation, EagerV use super::{ Indexes, grouped::{ - ComputedVecsFromDateindex, ComputedVecsFromHeightStrict, StorableVecGeneatorOptions, + ComputedVecsFromDateIndex, ComputedVecsFromHeightStrict, StorableVecGeneatorOptions, }, indexes, }; @@ -33,14 +33,14 @@ pub struct Vecs { pub height_to_ohlc_in_sats: EagerVec, pub height_to_ohlc_in_cents: EagerVec, pub height_to_open_in_cents: EagerVec>, - pub timeindexes_to_close: ComputedVecsFromDateindex>, - pub timeindexes_to_high: ComputedVecsFromDateindex>, - pub timeindexes_to_low: ComputedVecsFromDateindex>, - pub timeindexes_to_open: ComputedVecsFromDateindex>, - pub timeindexes_to_open_in_sats: ComputedVecsFromDateindex>, - pub timeindexes_to_high_in_sats: ComputedVecsFromDateindex>, - pub timeindexes_to_low_in_sats: ComputedVecsFromDateindex>, - pub timeindexes_to_close_in_sats: ComputedVecsFromDateindex>, + pub timeindexes_to_close: ComputedVecsFromDateIndex>, + pub timeindexes_to_high: ComputedVecsFromDateIndex>, + pub timeindexes_to_low: ComputedVecsFromDateIndex>, + pub timeindexes_to_open: ComputedVecsFromDateIndex>, + pub timeindexes_to_open_in_sats: ComputedVecsFromDateIndex>, + pub timeindexes_to_high_in_sats: ComputedVecsFromDateIndex>, + pub timeindexes_to_low_in_sats: ComputedVecsFromDateIndex>, + pub timeindexes_to_close_in_sats: ComputedVecsFromDateIndex>, pub chainindexes_to_close: ComputedVecsFromHeightStrict>, pub chainindexes_to_high: ComputedVecsFromHeightStrict>, pub chainindexes_to_low: ComputedVecsFromHeightStrict>, @@ -151,56 +151,56 @@ impl Vecs { Version::ZERO, compressed, )?, - timeindexes_to_open: ComputedVecsFromDateindex::forced_import( + timeindexes_to_open: ComputedVecsFromDateIndex::forced_import( path, "open", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_first(), )?, - timeindexes_to_high: ComputedVecsFromDateindex::forced_import( + timeindexes_to_high: ComputedVecsFromDateIndex::forced_import( path, "high", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_max(), )?, - timeindexes_to_low: ComputedVecsFromDateindex::forced_import( + timeindexes_to_low: ComputedVecsFromDateIndex::forced_import( path, "low", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_min(), )?, - timeindexes_to_close: ComputedVecsFromDateindex::forced_import( + timeindexes_to_close: ComputedVecsFromDateIndex::forced_import( path, "close", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - timeindexes_to_open_in_sats: ComputedVecsFromDateindex::forced_import( + timeindexes_to_open_in_sats: ComputedVecsFromDateIndex::forced_import( path, "open_in_sats", VERSION + VERSION_IN_SATS + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_first(), )?, - timeindexes_to_high_in_sats: ComputedVecsFromDateindex::forced_import( + timeindexes_to_high_in_sats: ComputedVecsFromDateIndex::forced_import( path, "high_in_sats", VERSION + VERSION_IN_SATS + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_max(), )?, - timeindexes_to_low_in_sats: ComputedVecsFromDateindex::forced_import( + timeindexes_to_low_in_sats: ComputedVecsFromDateIndex::forced_import( path, "low_in_sats", VERSION + VERSION_IN_SATS + Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_min(), )?, - timeindexes_to_close_in_sats: ComputedVecsFromDateindex::forced_import( + timeindexes_to_close_in_sats: ComputedVecsFromDateIndex::forced_import( path, "close_in_sats", VERSION + VERSION_IN_SATS + Version::ZERO, diff --git a/crates/brk_computer/src/storage/vecs/grouped/builder.rs b/crates/brk_computer/src/storage/vecs/grouped/builder.rs index 80141ca3d..1e8b3c6b0 100644 --- a/crates/brk_computer/src/storage/vecs/grouped/builder.rs +++ b/crates/brk_computer/src/storage/vecs/grouped/builder.rs @@ -8,6 +8,8 @@ use brk_vec::{ }; use color_eyre::eyre::ContextCompat; +use crate::utils::get_percentile; + use super::ComputedType; #[derive(Clone, Debug)] @@ -269,23 +271,23 @@ where } if let Some(_90p) = self._90p.as_mut() { - _90p.forced_push_at(i, Self::get_percentile(&values, 0.90), exit)?; + _90p.forced_push_at(i, get_percentile(&values, 0.90), exit)?; } if let Some(_75p) = self._75p.as_mut() { - _75p.forced_push_at(i, Self::get_percentile(&values, 0.75), exit)?; + _75p.forced_push_at(i, get_percentile(&values, 0.75), exit)?; } if let Some(median) = self.median.as_mut() { - median.forced_push_at(i, Self::get_percentile(&values, 0.50), exit)?; + median.forced_push_at(i, get_percentile(&values, 0.50), exit)?; } if let Some(_25p) = self._25p.as_mut() { - _25p.forced_push_at(i, Self::get_percentile(&values, 0.25), exit)?; + _25p.forced_push_at(i, get_percentile(&values, 0.25), exit)?; } if let Some(_10p) = self._10p.as_mut() { - _10p.forced_push_at(i, Self::get_percentile(&values, 0.10), exit)?; + _10p.forced_push_at(i, get_percentile(&values, 0.10), exit)?; } if let Some(min) = self.min.as_mut() { @@ -472,28 +474,6 @@ where Ok(()) } - fn get_percentile(sorted: &[T], percentile: f64) -> T { - let len = sorted.len(); - - if len == 0 { - panic!(); - } else if len == 1 { - sorted[0].clone() - } else { - let index = (len - 1) as f64 * percentile; - - let fract = index.fract(); - - if fract != 0.0 { - let left = sorted.get(index as usize).unwrap().clone(); - let right = sorted.get(index.ceil() as usize).unwrap().clone(); - left / 2 + right / 2 - } else { - sorted.get(index as usize).unwrap().clone() - } - } - } - fn starting_index(&self, max_from: I) -> I { max_from.min(I::from( self.vecs().into_iter().map(|v| v.len()).min().unwrap(), diff --git a/crates/brk_computer/src/storage/vecs/grouped/from_dateindex.rs b/crates/brk_computer/src/storage/vecs/grouped/from_dateindex.rs index 168391aed..7016b876f 100644 --- a/crates/brk_computer/src/storage/vecs/grouped/from_dateindex.rs +++ b/crates/brk_computer/src/storage/vecs/grouped/from_dateindex.rs @@ -10,7 +10,7 @@ use crate::storage::{Indexes, indexes}; use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions}; #[derive(Clone)] -pub struct ComputedVecsFromDateindex +pub struct ComputedVecsFromDateIndex where T: ComputedType + PartialOrd, { @@ -25,7 +25,7 @@ where const VERSION: Version = Version::ZERO; -impl ComputedVecsFromDateindex +impl ComputedVecsFromDateIndex where T: ComputedType, { @@ -94,6 +94,15 @@ where exit, )?; + self.compute_rest(indexes, starting_indexes, exit) + } + + pub fn compute_rest( + &mut self, + indexes: &indexes::Vecs, + starting_indexes: &Indexes, + exit: &Exit, + ) -> color_eyre::Result<()> { self.dateindex_extra .extend(starting_indexes.dateindex, &self.dateindex, exit)?; diff --git a/crates/brk_computer/src/storage/vecs/grouped/mod.rs b/crates/brk_computer/src/storage/vecs/grouped/mod.rs index 92df66067..90b281348 100644 --- a/crates/brk_computer/src/storage/vecs/grouped/mod.rs +++ b/crates/brk_computer/src/storage/vecs/grouped/mod.rs @@ -3,6 +3,7 @@ mod from_dateindex; mod from_height; mod from_height_strict; mod from_txindex; +mod ratio_from_dateindex; mod r#type; mod value_from_height; mod value_from_txindex; @@ -12,6 +13,7 @@ pub use from_dateindex::*; pub use from_height::*; pub use from_height_strict::*; pub use from_txindex::*; +pub use ratio_from_dateindex::*; use r#type::*; pub use value_from_height::*; pub use value_from_txindex::*; diff --git a/crates/brk_computer/src/storage/vecs/grouped/ratio_from_dateindex.rs b/crates/brk_computer/src/storage/vecs/grouped/ratio_from_dateindex.rs new file mode 100644 index 000000000..63767fbb7 --- /dev/null +++ b/crates/brk_computer/src/storage/vecs/grouped/ratio_from_dateindex.rs @@ -0,0 +1,875 @@ +use std::{f32, path::Path}; + +use brk_core::{Date, DateIndex, Dollars, StoredF32}; +use brk_exit::Exit; +use brk_indexer::Indexer; +use brk_vec::{ + AnyCollectableVec, AnyIterableVec, AnyVec, CollectableVec, Compressed, EagerVec, Result, + StoredIndex, VecIterator, Version, +}; +// use rayon::prelude::*; + +use crate::{ + storage::{ + fetched, + vecs::{Indexes, indexes}, + }, + utils::get_percentile, +}; + +use super::{ComputedVecsFromDateIndex, StorableVecGeneatorOptions}; + +#[derive(Clone)] +pub struct ComputedRatioVecsFromDateIndex { + pub price: ComputedVecsFromDateIndex, + + pub ratio: ComputedVecsFromDateIndex, + pub ratio_sma: ComputedVecsFromDateIndex, + pub ratio_1w_sma: ComputedVecsFromDateIndex, + pub ratio_1m_sma: ComputedVecsFromDateIndex, + pub ratio_1y_sma: ComputedVecsFromDateIndex, + pub ratio_1y_sma_momentum_oscillator: ComputedVecsFromDateIndex, + pub ratio_standard_deviation: ComputedVecsFromDateIndex, + pub ratio_p99_9: ComputedVecsFromDateIndex, + pub ratio_p99_5: ComputedVecsFromDateIndex, + pub ratio_p99: ComputedVecsFromDateIndex, + pub ratio_p1: ComputedVecsFromDateIndex, + pub ratio_p0_5: ComputedVecsFromDateIndex, + pub ratio_p0_1: ComputedVecsFromDateIndex, + pub ratio_p1sd: ComputedVecsFromDateIndex, + pub ratio_p2sd: ComputedVecsFromDateIndex, + pub ratio_p3sd: ComputedVecsFromDateIndex, + pub ratio_m1sd: ComputedVecsFromDateIndex, + pub ratio_m2sd: ComputedVecsFromDateIndex, + pub ratio_m3sd: ComputedVecsFromDateIndex, + pub ratio_p99_9_as_price: ComputedVecsFromDateIndex, + pub ratio_p99_5_as_price: ComputedVecsFromDateIndex, + pub ratio_p99_as_price: ComputedVecsFromDateIndex, + pub ratio_p1_as_price: ComputedVecsFromDateIndex, + pub ratio_p0_5_as_price: ComputedVecsFromDateIndex, + pub ratio_p0_1_as_price: ComputedVecsFromDateIndex, + pub ratio_p1sd_as_price: ComputedVecsFromDateIndex, + pub ratio_p2sd_as_price: ComputedVecsFromDateIndex, + pub ratio_p3sd_as_price: ComputedVecsFromDateIndex, + pub ratio_m1sd_as_price: ComputedVecsFromDateIndex, + pub ratio_m2sd_as_price: ComputedVecsFromDateIndex, + pub ratio_m3sd_as_price: ComputedVecsFromDateIndex, +} + +const VERSION: Version = Version::ZERO; + +impl ComputedRatioVecsFromDateIndex { + pub fn forced_import( + path: &Path, + name: &str, + // _compute_source: bool, + version: Version, + compressed: Compressed, + options: StorableVecGeneatorOptions, + ) -> color_eyre::Result { + Ok(Self { + price: ComputedVecsFromDateIndex::forced_import( + path, + name, + VERSION + version, + compressed, + options, + )?, + ratio: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_sma: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_sma"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_1w_sma: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_1w_sma"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_1m_sma: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_1m_sma"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_1y_sma: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_1y_sma"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_1y_sma_momentum_oscillator: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_1y_sma_momentum_oscillator"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_standard_deviation: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_standard_deviation"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p99_9: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p99_9"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p99_5: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p99_5"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p99: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p99"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p1: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p1"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p0_5: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p0_5"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p0_1: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p0_1"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p1sd: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p1sd"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p2sd: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p2sd"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p3sd: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p3sd"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_m1sd: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_m1sd"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_m2sd: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_m2sd"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_m3sd: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_m3sd"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p99_9_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p99_9_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p99_5_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p99_5_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p99_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p99_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p1_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p1_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p0_5_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p0_5_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p0_1_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p0_1_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p1sd_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p1sd_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p2sd_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p2sd_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_p3sd_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_p3sd_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_m1sd_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_m1sd_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_m2sd_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_m2sd_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + ratio_m3sd_as_price: ComputedVecsFromDateIndex::forced_import( + path, + &format!("{name}_ratio_m3sd_as_price"), + VERSION + version + Version::TWO, + compressed, + options, + )?, + }) + } + + pub fn compute( + &mut self, + indexer: &Indexer, + indexes: &indexes::Vecs, + fetched: &fetched::Vecs, + starting_indexes: &Indexes, + exit: &Exit, + compute: F, + ) -> color_eyre::Result<()> + where + F: FnMut( + &mut EagerVec, + &Indexer, + &indexes::Vecs, + &Indexes, + &Exit, + ) -> Result<()>, + { + self.price + .compute(indexer, indexes, starting_indexes, exit, compute)?; + + let closes = &fetched.timeindexes_to_close.dateindex; + + self.ratio.compute( + indexer, + indexes, + starting_indexes, + exit, + |v, _, _, starting_indexes, exit| { + let mut price = self.price.dateindex.into_iter(); + v.compute_transform( + starting_indexes.dateindex, + closes, + |(i, close, ..)| { + let price = price.unwrap_get_inner(i); + if price == Dollars::ZERO { + (i, StoredF32::from(1.0)) + } else { + (i, *close / price) + } + }, + exit, + ) + }, + )?; + + let min_ratio_date = DateIndex::try_from(Date::MIN_RATIO).unwrap(); + + self.ratio_sma.compute( + indexer, + indexes, + starting_indexes, + exit, + |v, _, _, starting_indexes, exit| { + v.compute_sma_( + starting_indexes.dateindex, + &self.ratio.dateindex, + usize::MAX, + exit, + Some(min_ratio_date), + ) + }, + )?; + + self.ratio_1w_sma.compute( + indexer, + indexes, + starting_indexes, + exit, + |v, _, _, starting_indexes, exit| { + v.compute_sma_( + starting_indexes.dateindex, + &self.ratio.dateindex, + 7, + exit, + Some(min_ratio_date), + ) + }, + )?; + + self.ratio_1m_sma.compute( + indexer, + indexes, + starting_indexes, + exit, + |v, _, _, starting_indexes, exit| { + v.compute_sma_( + starting_indexes.dateindex, + &self.ratio.dateindex, + 30, + exit, + Some(min_ratio_date), + ) + }, + )?; + + self.ratio_1y_sma.compute( + indexer, + indexes, + starting_indexes, + exit, + |v, _, _, starting_indexes, exit| { + v.compute_sma_( + starting_indexes.dateindex, + &self.ratio.dateindex, + 365, + exit, + Some(min_ratio_date), + ) + }, + )?; + + self.ratio_1y_sma_momentum_oscillator.compute( + indexer, + indexes, + starting_indexes, + exit, + |v, _, _, starting_indexes, exit| { + let mut ratio_1y_sma_iter = self.ratio_1y_sma.dateindex.into_iter(); + v.compute_transform( + starting_indexes.dateindex, + &self.ratio.dateindex, + |(i, ratio, ..)| { + ( + i, + StoredF32::from(*ratio / *ratio_1y_sma_iter.unwrap_get_inner(i) - 1.0), + ) + }, + exit, + ) + }, + )?; + + let ratio_version = self.ratio.dateindex.version(); + + self.mut_ratio_vecs() + .iter_mut() + .try_for_each(|v| -> Result<()> { + v.validate_computed_version_or_reset_file( + Version::ZERO + v.inner_version() + ratio_version, + ) + })?; + + let starting_dateindex = self + .mut_ratio_vecs() + .iter() + .map(|v| DateIndex::from(v.len())) + .min() + .unwrap() + .min(starting_indexes.dateindex); + + let mut sorted = self.ratio.dateindex.collect_range( + Some(min_ratio_date.unwrap_to_usize()), + Some(starting_dateindex.unwrap_to_usize()), + )?; + + sorted.sort_unstable(); + + // if sorted.len() != starting_dateindex.unwrap_to_usize() - min_ratio_date.unwrap_to_usize() { + // unreachable!(); + // } + + let mut sma_iter = self.ratio_sma.dateindex.into_iter(); + + let nan = StoredF32::from(f32::NAN); + self.ratio + .dateindex + .iter_at(starting_dateindex) + .try_for_each(|(index, ratio)| -> Result<()> { + if index < min_ratio_date { + self.ratio_p0_1.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_p0_5.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_p1.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_p99.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_p99_5 + .dateindex + .forced_push_at(index, nan, exit)?; + self.ratio_p99_9 + .dateindex + .forced_push_at(index, nan, exit)?; + self.ratio_standard_deviation + .dateindex + .forced_push_at(index, nan, exit)?; + + self.ratio_p1sd.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_p2sd.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_p3sd.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_m1sd.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_m2sd.dateindex.forced_push_at(index, nan, exit)?; + self.ratio_m3sd.dateindex.forced_push_at(index, nan, exit)?; + } else { + let ratio = ratio.into_inner(); + let pos = sorted.binary_search(&ratio).unwrap_or_else(|pos| pos); + sorted.insert(pos, ratio); + self.ratio_p0_1.dateindex.forced_push_at( + index, + get_percentile(&sorted, 0.001), + exit, + )?; + self.ratio_p0_5.dateindex.forced_push_at( + index, + get_percentile(&sorted, 0.005), + exit, + )?; + self.ratio_p1.dateindex.forced_push_at( + index, + get_percentile(&sorted, 0.01), + exit, + )?; + self.ratio_p99.dateindex.forced_push_at( + index, + get_percentile(&sorted, 0.99), + exit, + )?; + self.ratio_p99_5.dateindex.forced_push_at( + index, + get_percentile(&sorted, 0.995), + exit, + )?; + self.ratio_p99_9.dateindex.forced_push_at( + index, + get_percentile(&sorted, 0.999), + exit, + )?; + + let avg = sma_iter.unwrap_get_inner(index); + + let sd = StoredF32::from( + (sorted.iter().map(|v| (**v - *avg).powi(2)).sum::() + / (index.unwrap_to_usize() + 1) as f32) + .sqrt(), + ); + + self.ratio_standard_deviation + .dateindex + .forced_push_at(index, sd, exit)?; + + self.ratio_p1sd + .dateindex + .forced_push_at(index, avg + sd, exit)?; + self.ratio_p2sd + .dateindex + .forced_push_at(index, avg + 2 * sd, exit)?; + self.ratio_p3sd + .dateindex + .forced_push_at(index, avg + 3 * sd, exit)?; + self.ratio_m1sd + .dateindex + .forced_push_at(index, avg - sd, exit)?; + self.ratio_m2sd + .dateindex + .forced_push_at(index, avg - 2 * sd, exit)?; + self.ratio_m3sd + .dateindex + .forced_push_at(index, avg - 3 * sd, exit)?; + } + + Ok(()) + })?; + + self.mut_ratio_vecs() + .into_iter() + .try_for_each(|v| v.safe_flush(exit))?; + + self.ratio_p99_9 + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_p99_5 + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_p99 + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_p1 + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_p0_5 + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_p0_1 + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_standard_deviation + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_p1sd + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_p2sd + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_p3sd + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_m1sd + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_m2sd + .compute_rest(indexes, starting_indexes, exit)?; + self.ratio_m3sd + .compute_rest(indexes, starting_indexes, exit)?; + + self.ratio_p99_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_p99.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_p99_5_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_p99_5.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_p99_9_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_p99_9.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_p1_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_p1.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_p0_5_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_p0_5.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_p0_1_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_p0_1.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_p1sd_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_p1sd.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_p2sd_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_p2sd.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_p3sd_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_p3sd.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_m1sd_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_m1sd.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_m2sd_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_m2sd.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + self.ratio_m3sd_as_price.compute( + indexer, + indexes, + starting_indexes, + exit, + |vec, _, _, starting_indexes, exit| { + let mut iter = self.ratio_m3sd.dateindex.into_iter(); + vec.compute_transform( + starting_indexes.dateindex, + &self.price.dateindex, + |(i, price, ..)| { + let multiplier = iter.unwrap_get_inner(i); + (i, price * multiplier) + }, + exit, + ) + }, + )?; + + Ok(()) + } + + fn mut_ratio_vecs(&mut self) -> Vec<&mut EagerVec> { + vec![ + &mut self.ratio_standard_deviation.dateindex, + &mut self.ratio_p99_9.dateindex, + &mut self.ratio_p99_5.dateindex, + &mut self.ratio_p99.dateindex, + &mut self.ratio_p1.dateindex, + &mut self.ratio_p0_5.dateindex, + &mut self.ratio_p0_1.dateindex, + &mut self.ratio_p1sd.dateindex, + &mut self.ratio_p2sd.dateindex, + &mut self.ratio_p3sd.dateindex, + &mut self.ratio_m1sd.dateindex, + &mut self.ratio_m2sd.dateindex, + &mut self.ratio_m3sd.dateindex, + ] + } + + pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> { + [ + self.price.vecs(), + self.ratio.vecs(), + self.ratio_sma.vecs(), + self.ratio_1w_sma.vecs(), + self.ratio_1m_sma.vecs(), + self.ratio_1y_sma.vecs(), + self.ratio_1y_sma_momentum_oscillator.vecs(), + self.ratio_standard_deviation.vecs(), + self.ratio_p99_9.vecs(), + self.ratio_p99_5.vecs(), + self.ratio_p99.vecs(), + self.ratio_p1.vecs(), + self.ratio_p0_5.vecs(), + self.ratio_p0_1.vecs(), + self.ratio_p1sd.vecs(), + self.ratio_p2sd.vecs(), + self.ratio_p3sd.vecs(), + self.ratio_m1sd.vecs(), + self.ratio_m2sd.vecs(), + self.ratio_m3sd.vecs(), + self.ratio_p99_9_as_price.vecs(), + self.ratio_p99_5_as_price.vecs(), + self.ratio_p99_as_price.vecs(), + self.ratio_p1_as_price.vecs(), + self.ratio_p0_5_as_price.vecs(), + self.ratio_p0_1_as_price.vecs(), + self.ratio_p1sd_as_price.vecs(), + self.ratio_p2sd_as_price.vecs(), + self.ratio_p3sd_as_price.vecs(), + self.ratio_m1sd_as_price.vecs(), + self.ratio_m2sd_as_price.vecs(), + self.ratio_m3sd_as_price.vecs(), + ] + .concat() + } +} diff --git a/crates/brk_computer/src/storage/vecs/market.rs b/crates/brk_computer/src/storage/vecs/market.rs index dd9f67d0e..76da27a96 100644 --- a/crates/brk_computer/src/storage/vecs/market.rs +++ b/crates/brk_computer/src/storage/vecs/market.rs @@ -1,4 +1,4 @@ -use std::{fs, path::Path}; +use std::{fs, path::Path, thread}; use brk_core::{Dollars, StoredF64, StoredUsize}; use brk_exit::Exit; @@ -7,32 +7,34 @@ use brk_vec::{AnyCollectableVec, Compressed, Computation, StoredIndex, VecIterat use super::{ Indexes, fetched, - grouped::{ComputedVecsFromDateindex, StorableVecGeneatorOptions}, + grouped::{ + ComputedRatioVecsFromDateIndex, ComputedVecsFromDateIndex, StorableVecGeneatorOptions, + }, indexes, transactions, }; #[derive(Clone)] pub struct Vecs { - pub indexes_to_marketcap: ComputedVecsFromDateindex, - pub indexes_to_ath: ComputedVecsFromDateindex, - pub indexes_to_drawdown: ComputedVecsFromDateindex, - pub indexes_to_days_since_ath: ComputedVecsFromDateindex, - pub indexes_to_max_days_between_ath: ComputedVecsFromDateindex, - pub indexes_to_max_years_between_ath: ComputedVecsFromDateindex, + pub indexes_to_marketcap: ComputedVecsFromDateIndex, + pub indexes_to_ath: ComputedVecsFromDateIndex, + pub indexes_to_drawdown: ComputedVecsFromDateIndex, + pub indexes_to_days_since_ath: ComputedVecsFromDateIndex, + pub indexes_to_max_days_between_ath: ComputedVecsFromDateIndex, + pub indexes_to_max_years_between_ath: ComputedVecsFromDateIndex, - pub indexes_to_1w_sma: ComputedVecsFromDateindex, - pub indexes_to_8d_sma: ComputedVecsFromDateindex, - pub indexes_to_13d_sma: ComputedVecsFromDateindex, - pub indexes_to_21d_sma: ComputedVecsFromDateindex, - pub indexes_to_1m_sma: ComputedVecsFromDateindex, - pub indexes_to_34d_sma: ComputedVecsFromDateindex, - pub indexes_to_55d_sma: ComputedVecsFromDateindex, - pub indexes_to_89d_sma: ComputedVecsFromDateindex, - pub indexes_to_144d_sma: ComputedVecsFromDateindex, - pub indexes_to_1y_sma: ComputedVecsFromDateindex, - pub indexes_to_2y_sma: ComputedVecsFromDateindex, - pub indexes_to_200w_sma: ComputedVecsFromDateindex, - pub indexes_to_4y_sma: ComputedVecsFromDateindex, + 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 { @@ -44,42 +46,42 @@ impl Vecs { fs::create_dir_all(path)?; Ok(Self { - indexes_to_marketcap: ComputedVecsFromDateindex::forced_import( + indexes_to_marketcap: ComputedVecsFromDateIndex::forced_import( path, "marketcap", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_ath: ComputedVecsFromDateindex::forced_import( + indexes_to_ath: ComputedVecsFromDateIndex::forced_import( path, "ath", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_drawdown: ComputedVecsFromDateindex::forced_import( + indexes_to_drawdown: ComputedVecsFromDateIndex::forced_import( path, "drawdown", Version::ONE, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_days_since_ath: ComputedVecsFromDateindex::forced_import( + 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( + 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( + indexes_to_max_years_between_ath: ComputedVecsFromDateIndex::forced_import( path, "max_years_between_ath", Version::ZERO, @@ -87,91 +89,91 @@ impl Vecs { StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_1w_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_1w_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "1w_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_8d_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_8d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "8d_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_13d_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_13d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "13d_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_21d_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_21d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "21d_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_1m_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_1m_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "1m_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_34d_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_34d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "34d_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_55d_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_55d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "55d_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_89d_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_89d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "89d_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_144d_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_144d_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "144d_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_1y_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_1y_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "1y_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_2y_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_2y_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "2y_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_200w_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_200w_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "200w_sma", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_4y_sma: ComputedVecsFromDateindex::forced_import( + indexes_to_4y_sma: ComputedRatioVecsFromDateIndex::forced_import( path, "4y_sma", Version::ZERO, @@ -342,202 +344,243 @@ impl Vecs { }, )?; - self.indexes_to_1w_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 7, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_8d_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 8, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_13d_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 13, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_21d_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 21, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_1m_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 30, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_34d_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 34, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_55d_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 55, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_89d_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 89, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_144d_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 144, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_1y_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 365, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_2y_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 2 * 365, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_200w_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 200 * 7, + 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, + ) + }, ) - }, - )?; + }); - self.indexes_to_4y_sma.compute( - indexer, - indexes, - starting_indexes, - exit, - |v, _, _, starting_indexes, exit| { - v.compute_sma( - starting_indexes.dateindex, - &fetched.timeindexes_to_close.dateindex, - 4 * 365, + 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(()) + Ok(()) + }) } pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> { diff --git a/crates/brk_computer/src/storage/vecs/mining.rs b/crates/brk_computer/src/storage/vecs/mining.rs index adbbb76d3..87fa8bb83 100644 --- a/crates/brk_computer/src/storage/vecs/mining.rs +++ b/crates/brk_computer/src/storage/vecs/mining.rs @@ -7,15 +7,15 @@ use brk_vec::{AnyCollectableVec, Compressed, Computation, VecIterator, Version}; use super::{ Indexes, - grouped::{ComputedVecsFromDateindex, ComputedVecsFromHeight, StorableVecGeneatorOptions}, + grouped::{ComputedVecsFromDateIndex, ComputedVecsFromHeight, StorableVecGeneatorOptions}, indexes, }; #[derive(Clone)] pub struct Vecs { pub indexes_to_difficulty: ComputedVecsFromHeight, - pub indexes_to_difficultyepoch: ComputedVecsFromDateindex, - pub indexes_to_halvingepoch: ComputedVecsFromDateindex, + pub indexes_to_difficultyepoch: ComputedVecsFromDateIndex, + pub indexes_to_halvingepoch: ComputedVecsFromDateIndex, } impl Vecs { @@ -35,14 +35,14 @@ impl Vecs { compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_difficultyepoch: ComputedVecsFromDateindex::forced_import( + indexes_to_difficultyepoch: ComputedVecsFromDateIndex::forced_import( path, "difficultyepoch", Version::ZERO, compressed, StorableVecGeneatorOptions::default().add_last(), )?, - indexes_to_halvingepoch: ComputedVecsFromDateindex::forced_import( + indexes_to_halvingepoch: ComputedVecsFromDateIndex::forced_import( path, "halvingepoch", Version::ZERO, diff --git a/crates/brk_computer/src/utils.rs b/crates/brk_computer/src/utils.rs new file mode 100644 index 000000000..574b63aca --- /dev/null +++ b/crates/brk_computer/src/utils.rs @@ -0,0 +1,27 @@ +use std::ops::{Add, Div}; + +pub fn get_percentile(sorted: &[T], percentile: f64) -> T +where + T: Clone + Div + Add, +{ + let len = sorted.len(); + + if len == 0 { + panic!(); + } else if len == 1 { + sorted[0].clone() + } else { + let index = (len - 1) as f64 * percentile; + + let fract = index.fract(); + + if fract != 0.0 { + let left = sorted.get(index as usize).unwrap().clone(); + let right = sorted.get(index.ceil() as usize).unwrap().clone(); + left / 2 + right / 2 + } else { + // dbg!(sorted.len(), index); + sorted.get(index as usize).unwrap().clone() + } + } +} diff --git a/crates/brk_core/src/structs/cents.rs b/crates/brk_core/src/structs/cents.rs index e892790ba..1fa11b77f 100644 --- a/crates/brk_core/src/structs/cents.rs +++ b/crates/brk_core/src/structs/cents.rs @@ -1,4 +1,4 @@ -use std::ops::{Add, Div}; +use std::ops::{Add, Div, Mul}; use serde::Serialize; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; @@ -74,3 +74,10 @@ impl From for u128 { value.0 as u128 } } + +impl Mul for Cents { + type Output = Cents; + fn mul(self, rhs: Cents) -> Self::Output { + Self(self.0 * rhs.0) + } +} diff --git a/crates/brk_core/src/structs/date.rs b/crates/brk_core/src/structs/date.rs index d4e745d9d..e3ed7398c 100644 --- a/crates/brk_core/src/structs/date.rs +++ b/crates/brk_core/src/structs/date.rs @@ -14,6 +14,7 @@ impl Date { pub const INDEX_ZERO_: Date_ = Date_::constant(2009, 1, 3); pub const INDEX_ONE: Self = Self(20090109); pub const INDEX_ONE_: Date_ = Date_::constant(2009, 1, 9); + pub const MIN_RATIO: Self = Self(20120101); pub fn new(year: u16, month: u8, day: u8) -> Self { Self(year as u32 * 1_00_00 + month as u32 * 1_00 + day as u32) diff --git a/crates/brk_core/src/structs/dollars.rs b/crates/brk_core/src/structs/dollars.rs index cca63bdf4..2490ca7a2 100644 --- a/crates/brk_core/src/structs/dollars.rs +++ b/crates/brk_core/src/structs/dollars.rs @@ -1,10 +1,13 @@ -use std::ops::{Add, Div, Mul}; +use std::{ + f64, + ops::{Add, Div, Mul}, +}; use derive_deref::Deref; use serde::Serialize; use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; -use super::{Bitcoin, Cents, Close, Sats}; +use super::{Bitcoin, Cents, Close, Sats, StoredF32}; #[derive( Debug, @@ -75,6 +78,13 @@ impl Add for Dollars { } } +impl Div for Dollars { + type Output = StoredF32; + fn div(self, rhs: Dollars) -> Self::Output { + StoredF32::from((self.0 / rhs.0) as f32) + } +} + impl Div for Dollars { type Output = Self; fn div(self, rhs: usize) -> Self::Output { @@ -100,6 +110,17 @@ impl Mul for Dollars { } } +impl Mul for Dollars { + type Output = Self; + fn mul(self, rhs: StoredF32) -> Self::Output { + if rhs.is_nan() { + Self(f64::NAN) + } else { + Self::from(Cents::from(Self::from(self.0 * *rhs as f64))) + } + } +} + impl From for Dollars { fn from(value: u128) -> Self { Self::from(Cents::from(value)) diff --git a/crates/brk_core/src/structs/mod.rs b/crates/brk_core/src/structs/mod.rs index e03165e23..c7842b0da 100644 --- a/crates/brk_core/src/structs/mod.rs +++ b/crates/brk_core/src/structs/mod.rs @@ -24,6 +24,7 @@ mod outputtypeindex; mod quarterindex; mod rawlocktime; mod sats; +mod stored_f32; mod stored_f64; mod stored_u32; mod stored_u64; @@ -67,6 +68,7 @@ pub use outputtypeindex::*; pub use quarterindex::*; pub use rawlocktime::*; pub use sats::*; +pub use stored_f32::*; pub use stored_f64::*; pub use stored_u8::*; pub use stored_u32::*; @@ -83,3 +85,5 @@ pub use vout::*; pub use weekindex::*; pub use weight::*; pub use yearindex::*; + +pub use rlimit; diff --git a/crates/brk_core/src/structs/stored_f32.rs b/crates/brk_core/src/structs/stored_f32.rs new file mode 100644 index 000000000..3dfdac93c --- /dev/null +++ b/crates/brk_core/src/structs/stored_f32.rs @@ -0,0 +1,106 @@ +use std::ops::{Add, Div, Mul, Sub}; + +use derive_deref::Deref; +use serde::Serialize; +use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout}; + +use crate::CheckedSub; + +use super::Dollars; + +#[derive( + Debug, + Deref, + Default, + Clone, + Copy, + PartialEq, + PartialOrd, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct StoredF32(f32); + +impl From for StoredF32 { + fn from(value: f32) -> Self { + Self(value) + } +} + +impl From for StoredF32 { + fn from(value: f64) -> Self { + Self(value as f32) + } +} + +impl From for StoredF32 { + fn from(value: usize) -> Self { + Self(value as f32) + } +} + +impl CheckedSub for StoredF32 { + fn checked_sub(self, rhs: Self) -> Option { + Some(Self(self.0 - rhs.0)) + } +} + +impl Div for StoredF32 { + type Output = Self; + fn div(self, rhs: usize) -> Self::Output { + Self(self.0 / rhs as f32) + } +} + +impl Add for StoredF32 { + type Output = Self; + fn add(self, rhs: Self) -> Self::Output { + Self(self.0 + rhs.0) + } +} + +impl From for f32 { + fn from(value: StoredF32) -> Self { + value.0 + } +} + +impl Eq for StoredF32 {} + +#[allow(clippy::derive_ord_xor_partial_ord)] +impl Ord for StoredF32 { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.0.partial_cmp(&other.0).unwrap() + } +} + +impl Div for StoredF32 { + type Output = Self; + fn div(self, rhs: Dollars) -> Self::Output { + Self::from(self.0 as f64 / *rhs) + } +} + +impl Mul for StoredF32 { + type Output = Self; + fn mul(self, rhs: usize) -> Self::Output { + Self(self.0 * rhs as f32) + } +} + +impl Mul for usize { + type Output = StoredF32; + fn mul(self, rhs: StoredF32) -> Self::Output { + StoredF32(self as f32 * rhs.0) + } +} + +impl Sub for StoredF32 { + type Output = Self; + fn sub(self, rhs: StoredF32) -> Self::Output { + Self(self.0 - rhs.0) + } +} diff --git a/crates/brk_core/src/utils/rlimit.rs b/crates/brk_core/src/utils/rlimit.rs index 4b5622fa1..6f078c5d1 100644 --- a/crates/brk_core/src/utils/rlimit.rs +++ b/crates/brk_core/src/utils/rlimit.rs @@ -4,7 +4,14 @@ use rlimit::{Resource, getrlimit}; pub fn setrlimit() -> io::Result<()> { let no_file_limit = getrlimit(Resource::NOFILE)?; - rlimit::setrlimit(Resource::NOFILE, no_file_limit.0.max(210_000), no_file_limit.1)?; + rlimit::setrlimit( + Resource::NOFILE, + no_file_limit.0.max(210_000), + no_file_limit.1, + )?; + + // let no_stack = getrlimit(Resource::STACK)?; + // rlimit::setrlimit(Resource::STACK, no_stack.1, no_stack.1)?; Ok(()) } diff --git a/crates/brk_exit/Cargo.toml b/crates/brk_exit/Cargo.toml index 9724a25e8..60aca5464 100644 --- a/crates/brk_exit/Cargo.toml +++ b/crates/brk_exit/Cargo.toml @@ -8,5 +8,5 @@ repository.workspace = true [dependencies] brk_logger = { workspace = true } -ctrlc = { version = "3.4.6", features = ["termination"] } +ctrlc = { version = "3.4.7", features = ["termination"] } log = { workspace = true } diff --git a/crates/brk_fetcher/src/fetchers/kibo.rs b/crates/brk_fetcher/src/fetchers/kibo.rs index dab6dd40f..7dd6cb622 100644 --- a/crates/brk_fetcher/src/fetchers/kibo.rs +++ b/crates/brk_fetcher/src/fetchers/kibo.rs @@ -38,7 +38,7 @@ impl Kibo { .unwrap() .get(usize::from(height.checked_sub(key).unwrap())) .cloned() - .ok_or(color_eyre::eyre::Error::msg("Couldn't find height in kibo")) + .ok_or(eyre!("Couldn't find height in kibo")) } fn fetch_height_prices(height: Height) -> color_eyre::Result> { diff --git a/crates/brk_fetcher/src/lib.rs b/crates/brk_fetcher/src/lib.rs index 3b631108f..54cbc83a6 100644 --- a/crates/brk_fetcher/src/lib.rs +++ b/crates/brk_fetcher/src/lib.rs @@ -35,8 +35,14 @@ impl Fetcher { pub fn get_date(&mut self, date: Date) -> color_eyre::Result { self.kraken .get_from_1d(&date) - .or_else(|_| self.binance.get_from_1d(&date)) - .or_else(|_| self.kibo.get_from_date(&date)) + .or_else(|e| { + eprintln!("{e}"); + self.binance.get_from_1d(&date) + }) + .or_else(|e| { + eprintln!("{e}"); + self.kibo.get_from_date(&date) + }) } pub fn get_height( @@ -56,10 +62,12 @@ impl Fetcher { let ohlc = self .kraken .get_from_1mn(timestamp, previous_timestamp) - .unwrap_or_else(|_| { + .unwrap_or_else(|e| { + eprintln!("{e}"); self.binance .get_from_1mn(timestamp, previous_timestamp) - .unwrap_or_else(|_| { + .unwrap_or_else(|e| { + eprintln!("{e}"); self.kibo.get_from_height(height).unwrap_or_else(|e| { let date = Date::from(timestamp); eprintln!("{e}"); diff --git a/crates/brk_server/Cargo.toml b/crates/brk_server/Cargo.toml index f567850d9..4ce498f5d 100644 --- a/crates/brk_server/Cargo.toml +++ b/crates/brk_server/Cargo.toml @@ -23,9 +23,9 @@ color-eyre = { workspace = true } jiff = { workspace = true } log = { workspace = true } minreq = { workspace = true } -oxc = { version = "0.68.1", features = ["codegen", "minifier"] } +oxc = { version = "0.69.0", features = ["codegen", "minifier"] } serde = { workspace = true } tokio = { version = "1.45.0", features = ["full"] } -tower-http = { version = "0.6.3", features = ["compression-full", "trace"] } +tower-http = { version = "0.6.4", features = ["compression-full", "trace"] } zip = "2.6.1" tracing = "0.1.41" diff --git a/crates/brk_vec/src/structs/version.rs b/crates/brk_vec/src/structs/version.rs index 1939cd9f0..8c332fc6f 100644 --- a/crates/brk_vec/src/structs/version.rs +++ b/crates/brk_vec/src/structs/version.rs @@ -20,6 +20,10 @@ impl Version { pub const ONE: Self = Self(1); pub const TWO: Self = Self(2); + pub const fn new(v: u32) -> Self { + Self(v) + } + pub fn write(&self, path: &Path) -> Result<(), io::Error> { fs::write(path, self.as_bytes()) } diff --git a/crates/brk_vec/src/traits/collectable.rs b/crates/brk_vec/src/traits/collectable.rs index 9bbc94c49..239309753 100644 --- a/crates/brk_vec/src/traits/collectable.rs +++ b/crates/brk_vec/src/traits/collectable.rs @@ -11,7 +11,7 @@ where fn collect_range(&self, from: Option, to: Option) -> Result> { let len = self.len(); let from = from.unwrap_or_default(); - let to = to.map_or(len, |i| i.min(len)); + let to = to.map_or(len, |to| to.min(len)); if from >= len || from >= to { return Ok(vec![]); diff --git a/crates/brk_vec/src/variants/eager.rs b/crates/brk_vec/src/variants/eager.rs index 78e663be4..e3a1703ed 100644 --- a/crates/brk_vec/src/variants/eager.rs +++ b/crates/brk_vec/src/variants/eager.rs @@ -1,6 +1,7 @@ use core::error; use std::{ cmp::Ordering, + f32, fmt::Debug, ops::{Add, Div}, path::{Path, PathBuf}, @@ -88,6 +89,10 @@ where self.inner.path() } + pub fn inner_version(&self) -> Version { + self.inner.version() + } + #[inline] fn path_computed_version(&self) -> PathBuf { self.inner.path().join("computed_version") @@ -411,9 +416,25 @@ where &mut self, max_from: I, source: &impl AnyIterableVec, - len: usize, + sma: usize, exit: &Exit, ) -> Result<()> + where + T: Add + From + Div + From, + T2: StoredType, + f32: From + From, + { + self.compute_sma_(max_from, source, sma, exit, None) + } + + pub fn compute_sma_( + &mut self, + max_from: I, + source: &impl AnyIterableVec, + sma: usize, + exit: &Exit, + min_i: Option, + ) -> Result<()> where T: Add + From + Div + From, T2: StoredType, @@ -425,23 +446,30 @@ where let index = max_from.min(I::from(self.len())); let mut prev = None; + let min_prev_i = min_i.unwrap_or_default().unwrap_to_usize(); source.iter_at(index).try_for_each(|(i, value)| { let value = value.into_inner(); - if prev.is_none() { - let i = i.unwrap_to_usize(); - prev.replace(if i > 0 { - self.into_iter().unwrap_get_inner_(i - 1) - } else { - T::from(0.0) - }); - } - let sma = T::from( - (f32::from(prev.clone().unwrap()) * (len - 1) as f32 + f32::from(value)) - / len as f32, - ); - prev.replace(sma.clone()); - self.forced_push_at(i, sma, exit) + if min_i.is_none() || min_i.is_some_and(|min_i| min_i <= i) { + if prev.is_none() { + let i = i.unwrap_to_usize(); + prev.replace(if i > min_prev_i { + self.into_iter().unwrap_get_inner_(i - 1) + } else { + T::from(0.0) + }); + } + let len = (i.unwrap_to_usize() - min_prev_i + 1).min(sma); + let sma = T::from( + (f32::from(prev.clone().unwrap()) * (len - 1) as f32 + f32::from(value)) + / len as f32, + ); + + prev.replace(sma.clone()); + self.forced_push_at(i, sma, exit) + } else { + self.forced_push_at(i, T::from(f32::NAN), exit) + } })?; self.safe_flush(exit) diff --git a/websites/kibo.money/index.html b/websites/kibo.money/index.html index 47339f1d8..ebe4b5fd1 100644 --- a/websites/kibo.money/index.html +++ b/websites/kibo.money/index.html @@ -994,12 +994,17 @@ margin-right: var(--negative-main-padding); padding-left: var(--main-padding); padding-right: var(--main-padding); - padding-bottom: 1rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; overflow-x: auto; min-width: 0; font-size: var(--font-size-sm); line-height: var(--line-height-sm); - height: 2rem; + scrollbar-width: thin; + + &:empty { + display: none; + } > div { flex: 0; diff --git a/websites/kibo.money/packages/lightweight-charts/wrapper.js b/websites/kibo.money/packages/lightweight-charts/wrapper.js index ede11baea..821568e40 100644 --- a/websites/kibo.money/packages/lightweight-charts/wrapper.js +++ b/websites/kibo.money/packages/lightweight-charts/wrapper.js @@ -50,7 +50,6 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { autoSize: true, layout: { fontFamily: elements.style.fontFamily, - // fontSize: 13, background: { color: "transparent" }, attributionLogo: false, colorSpace: "display-p3", @@ -71,10 +70,6 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { const chart = lc.createChart(element, options); chart.priceScale("right").applyOptions({ - // scaleMargins: { - // top: 0.15, - // bottom: 0.05, - // }, minimumWidth: 80, }); @@ -161,16 +156,24 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { div.classList.add("chart"); parent.append(div); - const legend = createLegend({ + const legendTop = createLegend({ parent: div, utils, signals, + paneIndex: 0, }); const chartDiv = window.document.createElement("div"); chartDiv.classList.add("lightweight-chart"); div.append(chartDiv); + const legendBottom = createLegend({ + parent: div, + utils, + signals, + paneIndex: 1, + }); + let ichart = /** @type {IChartApi | null} */ (null); let timeScaleSet = false; @@ -220,7 +223,12 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { offset += 1; } const v = ohlcs[i]; - if (typeof v === "number") { + if (v === null) { + data[i - offset] = { + time, + value: NaN, + }; + } else if (typeof v === "number") { data[i - offset] = { time, value: v, @@ -363,7 +371,7 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { ); } - legend.add({ + (paneIndex ? legendBottom : legendTop).add({ series, name, defaultActive, @@ -445,7 +453,7 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { ); } - legend.add({ + (paneIndex ? legendBottom : legendTop).add({ series, colors: [color], name, @@ -477,6 +485,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} [args.options] */ addBaselineSeries({ vecId, @@ -485,11 +494,14 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { paneIndex: _paneIndex, defaultActive, data, + options, }) { if (!ichart || !timeResource) throw Error("Chart not fully set"); const paneIndex = _paneIndex ?? 0; + console.log("OPTIONS", options); + const series = ichart.addSeries( /** @type {SeriesDefinition<'Baseline'>} */ (lc.BaselineSeries), { @@ -497,13 +509,16 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { visible: defaultActive !== false, topLineColor: colors.green(), bottomLineColor: colors.red(), + priceLineVisible: false, + // bottomFillColor1: "transparent", + // bottomFillColor2: "transparent", + // topFillColor1: "transparent", + // topFillColor2: "transparent", baseValue: { price: 0, }, - baseLineStyle: 0, - baseLineWidth: 1, - baseLineVisible: true, lineVisible: true, + ...options, }, paneIndex, ); @@ -528,7 +543,7 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { ); } - legend.add({ + (paneIndex ? legendBottom : legendTop).add({ series, colors: [colors.green, colors.red], name, @@ -647,7 +662,8 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { ichart = null; timeScaleSet = false; activeResources.length = 0; - legend.reset(); + legendTop.reset(); + legendBottom.reset(); }, }; @@ -697,9 +713,10 @@ export default import("./v5.0.6-treeshaked/script.js").then((lc) => { * @param {Object} args * @param {Element} args.parent * @param {Signals} args.signals + * @param {number} args.paneIndex * @param {Utilities} args.utils */ -function createLegend({ parent, signals, utils }) { +function createLegend({ parent, signals, utils, paneIndex }) { const legendElement = window.document.createElement("legend"); parent.append(legendElement); @@ -721,7 +738,7 @@ function createLegend({ parent, signals, utils }) { legendElement.append(div); - const nameId = utils.stringToId(name); + const nameId = `${utils.stringToId(name)}-${paneIndex}`; const active = signals.createSignal(defaultActive ?? true, { save: { diff --git a/websites/kibo.money/scripts/chart.js b/websites/kibo.money/scripts/chart.js index 372b1c4c9..a7a913d8c 100644 --- a/websites/kibo.money/scripts/chart.js +++ b/websites/kibo.money/scripts/chart.js @@ -229,14 +229,34 @@ export function init({ vecIdToIndexes[blueprint.key] ); if (indexes.includes(index)) { - chart.addLineSeries({ - vecId: blueprint.key, - color: blueprint.color, - name: blueprint.title, - unit, - defaultActive: blueprint.defaultActive, - paneIndex, - }); + switch (blueprint.type) { + case "Baseline": { + chart.addBaselineSeries({ + vecId: blueprint.key, + // color: blueprint.color, + name: blueprint.title, + unit, + defaultActive: blueprint.defaultActive, + paneIndex, + options: blueprint.options, + }); + break; + } + case "Candlestick": { + throw Error("TODO"); + break; + } + default: + chart.addLineSeries({ + vecId: blueprint.key, + color: blueprint.color, + name: blueprint.title, + unit, + defaultActive: blueprint.defaultActive, + paneIndex, + options: blueprint.options, + }); + } } }); }); diff --git a/websites/kibo.money/scripts/main.js b/websites/kibo.money/scripts/main.js index 498296d56..56e813afd 100644 --- a/websites/kibo.money/scripts/main.js +++ b/websites/kibo.money/scripts/main.js @@ -4,7 +4,7 @@ * @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, AnySeriesBlueprint, ChartableIndex } 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, SeriesType, BaselineStyleOptions, SeriesOptionsCommon, BaselineData, CandlestickStyleOptions } from "../packages/lightweight-charts/v5.0.6-treeshaked/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" * @import { SignalOptions } from "../packages/solid-signals/v0.3.0-treeshaked/types/core/core" * @import {Signal, Signals} from "../packages/solid-signals/types"; * @import { getOwner as GetOwner, onCleanup as OnCleanup, Owner } from "../packages/solid-signals/v0.3.0-treeshaked/types/core/owner" @@ -686,6 +686,10 @@ function createUtils() { let unit; if (id.includes("index") || id.includes("height") || id.includes("epoch")) { unit = "Index"; + } else if (id === "drawdown" || id.endsWith("oscillator")) { + unit = "percentage"; + } else if (id.endsWith("-as-price")) { + unit = "USD"; } else if (id.includes("type")) { unit = "Type"; } else if (id.includes("days-")) { @@ -711,6 +715,8 @@ function createUtils() { unit = "Cents"; } else if (id.includes("in-usd")) { unit = "USD"; + } else if (id.includes("ratio")) { + unit = "Ratio"; } else if (id.includes("in-btc")) { unit = "BTC"; } else if ( @@ -752,8 +758,6 @@ function createUtils() { unit = "Version"; } else if (id === "value") { unit = "Sats"; - } else if (id === "drawdown") { - unit = "percentage"; } else { console.log(); throw Error(`Unit not set for "${id}"`); @@ -1083,7 +1087,13 @@ function createUtils() { * @param {string} s */ function stringToId(s) { - return s.replace(/\W/g, " ").trim().replace(/ +/g, "-").toLowerCase(); + return ( + s + // .replace(/\W/g, " ") + .trim() + .replace(/ +/g, "-") + .toLowerCase() + ); } const api = (() => { @@ -1581,6 +1591,7 @@ function createColors(dark, elements) { red, sky, blue, + emerald, rose, green, amber, diff --git a/websites/kibo.money/scripts/options.js b/websites/kibo.money/scripts/options.js index 0027e7476..4b19601e3 100644 --- a/websites/kibo.money/scripts/options.js +++ b/websites/kibo.money/scripts/options.js @@ -39,6 +39,11 @@ * * @typedef {BaselineSeriesBlueprint | CandlestickSeriesBlueprint | LineSeriesBlueprint} AnySeriesBlueprint * + * @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 {Object} PartialOption @@ -164,14 +169,38 @@ function createPartialOptions(colors) { * @typedef {WithoutSuffix} VecIdMinBase */ + const averages = /** @type {const} */ ([ + { name: "1 Week", key: "1w", days: 7 }, + { name: "8 Days", key: "8d", days: 8 }, + { name: "13 Days", key: "13d", days: 13 }, + { name: "21 Days", key: "21d", days: 21 }, + { name: "1 Month", key: "1m", days: 30 }, + { name: "34 Days", key: "34d", days: 34 }, + { name: "55 Days", key: "55d", days: 55 }, + { name: "89 Days", key: "89d", days: 89 }, + { name: "144 Days", key: "144d", days: 144 }, + { name: "1 Year", key: "1y", days: 365 }, + { name: "2 Years", key: "2y", days: 2 * 365 }, + { name: "200 Weeks", key: "200w", days: 200 * 7 }, + { name: "4 Years", key: "4y", days: 4 * 365 }, + ]); + /** * @param {Object} args * @param {ChartableVecId} args.key * @param {string} args.name * @param {Color} [args.color] + * @param {boolean} [args.defaultActive] + * @param {DeepPartial} [args.options] */ - function createBaseSeries({ key, name, color }) { - return { key, title: name, color }; + function createBaseSeries({ key, name, color, defaultActive, options }) { + return /** @satisfies {AnyFetchedSeriesBlueprint} */ ({ + key, + title: name, + color, + defaultActive, + options, + }); } /** @@ -858,135 +887,210 @@ function createPartialOptions(colors) { name: "Average", tree: [ { - name: "1 week", - title: "1 Week Market Price Moving Average", + 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: "1w-sma", + key: `${key}-sma`, name: "Average", + color: colors[`_${key}`], }), - ], - }, - { - name: "8 days", - title: "8 Days Market Price Moving Average", - top: [ createBaseSeries({ - key: "8d-sma", - name: "Average", + key: `${key}-sma-ratio-p1sd-as-price`, + name: "+1σ", + color: colors.orange, + defaultActive: false, }), - ], - }, - { - name: "13 days", - title: "13 Days Market Price Moving Average", - top: [ createBaseSeries({ - key: "13d-sma", - name: "Average", + key: `${key}-sma-ratio-p2sd-as-price`, + name: "+2σ", + color: colors.red, + defaultActive: false, }), - ], - }, - { - name: "21 days", - title: "21 Days Market Price Moving Average", - top: [ createBaseSeries({ - key: "21d-sma", - name: "Average", + key: `${key}-sma-ratio-p3sd-as-price`, + name: "+3σ", + color: colors.pink, + defaultActive: false, }), - ], - }, - { - name: "1 month", - title: "1 Month Market Price Moving Average", - top: [ createBaseSeries({ - key: "1m-sma", - name: "Average", + key: `${key}-sma-ratio-m1sd-as-price`, + name: "−1σ", + color: colors.cyan, + defaultActive: false, }), - ], - }, - { - name: "34 days", - title: "34 Days Market Price Moving Average", - top: [ createBaseSeries({ - key: "34d-sma", - name: "Average", + key: `${key}-sma-ratio-m2sd-as-price`, + name: "−2σ", + color: colors.blue, + defaultActive: false, }), - ], - }, - { - name: "55 days", - title: "55 Days Market Price Moving Average", - top: [ createBaseSeries({ - key: "55d-sma", - name: "Average", + key: `${key}-sma-ratio-m3sd-as-price`, + name: "−3σ", + color: colors.violet, + defaultActive: false, }), - ], - }, - { - name: "89 days", - title: "89 Days Market Price Moving Average", - top: [ createBaseSeries({ - key: "89d-sma", - name: "Average", + key: `${key}-sma-ratio-p99-as-price`, + name: "p99", + color: colors.orange, + defaultActive: false, }), - ], - }, - { - name: "144 days", - title: "144 Days Market Price Moving Average", - top: [ createBaseSeries({ - key: "144d-sma", - name: "Average", + key: `${key}-sma-ratio-p99-5-as-price`, + name: "p99.5", + color: colors.red, + defaultActive: false, }), - ], - }, - { - name: "1 year", - title: "1 year Market Price Moving Average", - top: [ createBaseSeries({ - key: "1y-sma", - name: "Average", + key: `${key}-sma-ratio-p99-9-as-price`, + name: "p99.9", + color: colors.pink, + defaultActive: false, }), - ], - }, - { - name: "2 year", - title: "2 year Market Price Moving Average", - top: [ createBaseSeries({ - key: "2y-sma", - name: "Average", + key: `${key}-sma-ratio-p1-as-price`, + name: "p1", + color: colors.cyan, + defaultActive: false, }), - ], - }, - { - name: "200 weeks", - title: "200 Weeks Market Price Moving Average", - top: [ createBaseSeries({ - key: "200w-sma", - name: "Average", + key: `${key}-sma-ratio-p0-5-as-price`, + name: "p0.5", + color: colors.blue, + defaultActive: false, }), - ], - }, - { - name: "4 year", - title: "4 year Market Price Moving Average", - top: [ createBaseSeries({ - key: "4y-sma", - name: "Average", + 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", + }), + ], + })), ], }, ], @@ -1828,22 +1932,6 @@ export function initOptions({ // }, // ]); -// const averages = /** @type {const} */ ([ -// { name: "1 Week", key: "1w", days: 7 }, -// { name: "8 Days", key: "8d", days: 8 }, -// { name: "13 Days", key: "13d", days: 13 }, -// { name: "21 Days", key: "21d", days: 21 }, -// { name: "1 Month", key: "1m", days: 30 }, -// { name: "34 Days", key: "34d", days: 34 }, -// { name: "55 Days", key: "55d", days: 55 }, -// { name: "89 Days", key: "89d", days: 89 }, -// { name: "144 Days", key: "144d", days: 144 }, -// { name: "1 Year", key: "1y", days: 365 }, -// { name: "2 Years", key: "2y", days: 2 * 365 }, -// { name: "200 Weeks", key: "200w", days: 200 * 7 }, -// { name: "4 Years", key: "4y", days: 4 * 365 }, -// ]); - // const totalReturns = /** @type {const} */ ([ // { name: "1 Day", key: "1d" }, // { name: "1 Month", key: "1m" }, diff --git a/websites/kibo.money/scripts/vecid-to-indexes.js b/websites/kibo.money/scripts/vecid-to-indexes.js index f2f021356..d85329672 100644 --- a/websites/kibo.money/scripts/vecid-to-indexes.js +++ b/websites/kibo.money/scripts/vecid-to-indexes.js @@ -57,18 +57,421 @@ export function createVecIdToIndexes() { return /** @type {const} */ ({ "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], + "13d-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "13d-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], "144d-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "144d-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "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], "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], + "1m-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1m-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "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-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], + "1w-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1w-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "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-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], + "1y-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "1y-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], "200w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "200w-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], "21d-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "21d-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "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-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], + "2y-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "2y-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], "34d-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "34d-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "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], "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], + "4y-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "4y-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "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], "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], + "55d-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "55d-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "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], "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], + "89d-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-p99-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "89d-sma-ratio-standard-deviation": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], "8d-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-1m-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-1w-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-1y-sma": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-1y-sma-momentum-oscillator": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-m1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-m1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-m2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-m2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-m3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-m3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p0-1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p0-1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p0-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p0-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p1": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p1-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p1sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p1sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p2sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p2sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p3sd": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p3sd-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p99": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p99-5": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p99-5-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p99-9": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "8d-sma-ratio-p99-9-as-price": [DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex], + "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], "base-size": [TxIndex], "block-count": [Height],