From c85da92cbcb3b8645b12f2986df719688adb8dff Mon Sep 17 00:00:00 2001 From: nym21 Date: Sun, 14 Jun 2026 00:40:18 +0200 Subject: [PATCH] global: add cohorts by entry --- Cargo.lock | 99 +- Cargo.toml | 4 +- crates/brk_bindgen/src/generate/constants.rs | 7 +- crates/brk_client/src/lib.rs | 621 +- crates/brk_cohort/src/by_entry.rs | 104 + crates/brk_cohort/src/cohort_context.rs | 3 +- crates/brk_cohort/src/filter.rs | 11 +- crates/brk_cohort/src/lib.rs | 2 + crates/brk_cohort/src/utxo.rs | 12 +- .../src/distribution/cohorts/utxo/fenwick.rs | 143 +- .../src/distribution/cohorts/utxo/groups.rs | 84 +- .../distribution/cohorts/utxo/percentiles.rs | 16 + .../src/distribution/cohorts/utxo/receive.rs | 13 +- .../src/distribution/cohorts/utxo/send.rs | 14 +- .../src/distribution/compute/block_loop.rs | 18 +- .../src/distribution/metrics/realized/full.rs | 4 +- .../src/distribution/state/block.rs | 3 + crates/brk_computer/src/distribution/vecs.rs | 46 +- modules/brk-client/index.js | 527 +- packages/brk_client/brk_client/__init__.py | 308 +- website/scripts/modules | 1 + website/scripts/modules/.gitignore | 14 - website/scripts/modules/brk-client/.gitignore | 1 - website/scripts/modules/brk-client/index.js | 12226 ---------------- .../scripts/modules/brk-client/jsconfig.json | 10 - .../scripts/modules/brk-client/package.json | 44 - .../scripts/modules/brk-client/tests/basic.js | 66 - .../modules/brk-client/tests/consistency.js | 132 - .../modules/brk-client/tests/metric_data.js | 248 - .../scripts/modules/brk-client/tests/tree.js | 102 - .../scripts/modules/brk-client/tsconfig.json | 13 - website/scripts/modules/lean-qr/.gitignore | 1 - .../scripts/modules/lean-qr/2.7.1/index.d.ts | 653 - .../scripts/modules/lean-qr/2.7.1/index.mjs | 2 - .../modules/lightweight-charts/.gitignore | 2 - ...ghtweight-charts.standalone.production.mjs | 8 - .../5.2.0/dist/typings.d.ts | 5041 ------- .../modules/quickmatch-js/0.5.0/src/index.js | 433 - website/scripts/modules/tsconfig.json | 15 - website/scripts/modules/unpkg.sh | 410 - website/scripts/options/distribution/data.js | 14 + website/scripts/options/market.js | 2 +- website/scripts/options/partial.js | 15 + website/scripts/panes/chart.js | 2 +- 44 files changed, 1927 insertions(+), 19567 deletions(-) create mode 100644 crates/brk_cohort/src/by_entry.rs create mode 120000 website/scripts/modules delete mode 100644 website/scripts/modules/.gitignore delete mode 100644 website/scripts/modules/brk-client/.gitignore delete mode 100644 website/scripts/modules/brk-client/index.js delete mode 100644 website/scripts/modules/brk-client/jsconfig.json delete mode 100644 website/scripts/modules/brk-client/package.json delete mode 100644 website/scripts/modules/brk-client/tests/basic.js delete mode 100644 website/scripts/modules/brk-client/tests/consistency.js delete mode 100644 website/scripts/modules/brk-client/tests/metric_data.js delete mode 100644 website/scripts/modules/brk-client/tests/tree.js delete mode 100644 website/scripts/modules/brk-client/tsconfig.json delete mode 100644 website/scripts/modules/lean-qr/.gitignore delete mode 100644 website/scripts/modules/lean-qr/2.7.1/index.d.ts delete mode 100644 website/scripts/modules/lean-qr/2.7.1/index.mjs delete mode 100644 website/scripts/modules/lightweight-charts/.gitignore delete mode 100644 website/scripts/modules/lightweight-charts/5.2.0/dist/lightweight-charts.standalone.production.mjs delete mode 100644 website/scripts/modules/lightweight-charts/5.2.0/dist/typings.d.ts delete mode 100644 website/scripts/modules/quickmatch-js/0.5.0/src/index.js delete mode 100644 website/scripts/modules/tsconfig.json delete mode 100755 website/scripts/modules/unpkg.sh diff --git a/Cargo.lock b/Cargo.lock index 7ba76e23c..459b99ebb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -213,7 +213,7 @@ version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ - "bitflags 2.12.1", + "bitflags 2.13.0", "cexpr", "clang-sys", "itertools", @@ -277,9 +277,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d7ced0ae9557296835c32bf1b1e02b44c746701f898460fb000d7eaa84f00a" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" [[package]] name = "blk" @@ -757,9 +757,9 @@ checksum = "1c53ba0f290bfc610084c05582d9c5d421662128fc69f4bf236707af6fd321b9" [[package]] name = "cc" -version = "1.2.63" +version = "1.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f" +checksum = "dad887fd958be91b5098c0248def011f4523ab786cd411be668777e55063501f" dependencies = [ "find-msvc-tools", "jobserver", @@ -1240,9 +1240,9 @@ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fjall" -version = "3.1.4" +version = "3.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62b25b4d815ae178d7d9e4aa32ee59f072efd5431c736abede1e6ee13c8c453" +checksum = "038acd422d607e0eca09e093f299f9eccf9bd097554343d93746afff81a45113" dependencies = [ "byteorder-lite", "byteview", @@ -1292,7 +1292,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c7e611d49285d4c4b2e1727b72cf05353558885cc5252f93707b845dfcaf3d3" dependencies = [ - "bitflags 2.12.1", + "bitflags 2.13.0", "byteorder", "core-foundation", "core-graphics", @@ -1522,9 +1522,9 @@ checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" [[package]] name = "http" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be7462df143984c4598a256ef469b251d7d7f9e271135073e78fc535414f3d0" +checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425" dependencies = [ "bytes", "itoa", @@ -1879,13 +1879,12 @@ checksum = "00810f1d8b74be64b13dbf3db89ac67740615d6c891f0e7b6179326533011a07" [[package]] name = "js-sys" -version = "0.3.99" +version = "0.3.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142bc4740e452c1e57ade0cbc129f139c9093e354346f0872ef985f4f5cf5f11" +checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31" dependencies = [ "cfg-if", "futures-util", - "once_cell", "wasm-bindgen", ] @@ -1999,9 +1998,9 @@ checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" [[package]] name = "lsm-tree" -version = "3.1.4" +version = "3.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e447ac67ff6aef4ec07fc19e507b219336cbba90a697c0dbeb1bf51b91536b67" +checksum = "8ef86c3c797c10eefcc73407c43ae48c19d4df686131a8334b2895a513e91df4" dependencies = [ "byteorder-lite", "byteview", @@ -2036,9 +2035,9 @@ checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "memchr" -version = "2.8.1" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8" +checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" [[package]] name = "memmap2" @@ -2360,9 +2359,9 @@ dependencies = [ [[package]] name = "quick_cache" -version = "0.6.22" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c821816e9b928e20e92ed59bb3ac4aab321d16ca2316871c9fe7ca739cd477" +checksum = "3a3db184a8b66cfe87f0263a1de147a6b554c864d1767c6f7fa4eb0e5497b565" dependencies = [ "equivalent", "hashbrown 0.16.1", @@ -2463,7 +2462,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.12.1", + "bitflags 2.13.0", ] [[package]] @@ -2499,9 +2498,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.3" +version = "1.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" dependencies = [ "aho-corasick", "memchr", @@ -2522,9 +2521,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "ring" @@ -2576,7 +2575,7 @@ version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ - "bitflags 2.12.1", + "bitflags 2.13.0", "errno", "libc", "linux-raw-sys", @@ -2859,9 +2858,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" -version = "1.15.1" +version = "1.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" [[package]] name = "socket2" @@ -3144,7 +3143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" dependencies = [ "async-compression", - "bitflags 2.12.1", + "bitflags 2.13.0", "bytes", "futures-core", "futures-util", @@ -3336,9 +3335,9 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "varint-rs" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f54a172d0620933a27a4360d3db3e2ae0dd6cceae9730751a036bbf182c4b23" +checksum = "bfa6c38708f6257f1ec2ca7e5a11f9bbf58a27d7060078b6b333624968183d96" [[package]] name = "vecdb" @@ -3397,9 +3396,9 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" -version = "1.0.3+wasi-0.2.9" +version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" dependencies = [ "wit-bindgen 0.57.1", ] @@ -3415,9 +3414,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.122" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed04576f974d2b2fba0f38c51dbc5518011e38c36bf1143164be765528fd409" +checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a" dependencies = [ "cfg-if", "once_cell", @@ -3428,9 +3427,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.122" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "916151b09da36bd82f6615cbf3a419e2f0ba23a03c6160e8e92eb6bd4aa1dec6" +checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3438,9 +3437,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.122" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "299047362ccbfce148b67ab7e73349f77748e00c8296f9542adfad2ad82c5c5e" +checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd" dependencies = [ "bumpalo", "proc-macro2", @@ -3451,9 +3450,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.122" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a929b2c61f11ba3e9bc35b50c1f25cb38e0e892c0c231ae2b8cf78d5dad4437" +checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f" dependencies = [ "unicode-ident", ] @@ -3486,7 +3485,7 @@ version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ - "bitflags 2.12.1", + "bitflags 2.13.0", "hashbrown 0.15.5", "indexmap", "semver", @@ -3494,9 +3493,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.99" +version = "0.3.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621441cfc37b84979402712047321980c178f299193a3589d05b99e8763436" +checksum = "a6430a72df5eb332242960fe84b3002a241163998241eb596d4f739b9757061d" dependencies = [ "js-sys", "wasm-bindgen", @@ -3768,7 +3767,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", - "bitflags 2.12.1", + "bitflags 2.13.0", "indexmap", "log", "serde", @@ -3846,18 +3845,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.50" +version = "0.8.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b065d4f0e55f82fae73202e189638116a87c55ab6b8e6c2721e13dd9d854ad1" +checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.50" +version = "0.8.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b631b19d36a892ab55420c92dbc83ccd79274f25be714855d3074aa71cab639" +checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930" dependencies = [ "proc-macro2", "quote", @@ -3887,9 +3886,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.2" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" [[package]] name = "zerotrie" diff --git a/Cargo.toml b/Cargo.toml index edd8de4a4..c39924f89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,7 +64,7 @@ color-eyre = "0.6.5" corepc-jsonrpc = { package = "jsonrpc", version = "0.19.0", features = ["simple_http"], default-features = false } corepc-types = { version = "0.14.0", features = ["std"], default-features = false } derive_more = { version = "2.1.1", features = ["deref", "deref_mut"] } -fjall = "3.1.4" +fjall = "3.1.5" indexmap = { version = "2.14.0", features = ["serde"] } jiff = { version = "0.2.28", features = ["perf-inline", "tz-system"], default-features = false } owo-colors = "4.3.0" @@ -77,7 +77,7 @@ serde = "1.0.228" serde_bytes = "0.11.19" serde_derive = "1.0.228" serde_json = { version = "1.0.150", features = ["float_roundtrip", "preserve_order"] } -smallvec = "1.15.1" +smallvec = "1.15.2" tokio = { version = "1.52.3", features = ["rt-multi-thread"] } tower-http = { version = "0.6.11", features = ["catch-panic", "compression-br", "compression-gzip", "compression-zstd", "cors", "normalize-path", "timeout", "trace"] } tower-layer = "0.3" diff --git a/crates/brk_bindgen/src/generate/constants.rs b/crates/brk_bindgen/src/generate/constants.rs index c76571fc5..6ed5a78e7 100644 --- a/crates/brk_bindgen/src/generate/constants.rs +++ b/crates/brk_bindgen/src/generate/constants.rs @@ -6,9 +6,9 @@ use std::collections::BTreeMap; use brk_cohort::{ - AGE_RANGE_NAMES, AMOUNT_RANGE_NAMES, CLASS_NAMES, EPOCH_NAMES, LOSS_NAMES, OVER_AGE_NAMES, - OVER_AMOUNT_NAMES, PROFIT_NAMES, PROFITABILITY_RANGE_NAMES, SPENDABLE_TYPE_NAMES, TERM_NAMES, - UNDER_AGE_NAMES, UNDER_AMOUNT_NAMES, + AGE_RANGE_NAMES, AMOUNT_RANGE_NAMES, CLASS_NAMES, ENTRY_NAMES, EPOCH_NAMES, LOSS_NAMES, + OVER_AGE_NAMES, OVER_AMOUNT_NAMES, PROFIT_NAMES, PROFITABILITY_RANGE_NAMES, + SPENDABLE_TYPE_NAMES, TERM_NAMES, UNDER_AGE_NAMES, UNDER_AMOUNT_NAMES, }; use brk_types::{Index, pools}; use serde::Serialize; @@ -59,6 +59,7 @@ impl CohortConstants { ("TERM_NAMES", to_value(&TERM_NAMES)), ("EPOCH_NAMES", to_value(&EPOCH_NAMES)), ("CLASS_NAMES", to_value(&CLASS_NAMES)), + ("ENTRY_NAMES", to_value(&ENTRY_NAMES)), ("SPENDABLE_TYPE_NAMES", to_value(&SPENDABLE_TYPE_NAMES)), ("AGE_RANGE_NAMES", to_value(&AGE_RANGE_NAMES)), ("UNDER_AGE_NAMES", to_value(&UNDER_AGE_NAMES)), diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index c47e63a67..8defadabd 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -1191,6 +1191,22 @@ pub struct CapCapitalizedGrossLossMvrvNetPeakPriceProfitSellSoprPattern { pub sopr: AdjustedRatioValuePattern, } +/// Pattern struct for repeated tree structure. +pub struct CapCapitalizedGrossLossMvrvNetPeakPriceProfitSellSoprPattern2 { + pub cap: CentsDeltaToUsdPattern, + pub capitalized: PricePattern, + pub gross_pnl: BlockCumulativeSumPattern, + pub loss: BlockCumulativeNegativeSumPattern, + pub mvrv: SeriesPattern1, + pub net_pnl: BlockChangeCumulativeDeltaSumPattern, + pub peak_regret: BlockCumulativeSumPattern, + pub price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern, + pub profit: BlockCumulativeSumPattern, + pub profit_to_loss_ratio: _1m1w1y24hPattern, + pub sell_side_risk_ratio: _1m1w1y24hPattern8, + pub sopr: RatioValuePattern2, +} + /// Pattern struct for repeated tree structure. pub struct EmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2 { pub empty: _1m1w1y24hBpsPercentRatioPattern, @@ -1658,6 +1674,17 @@ pub struct ActiveInputOutputSpendablePattern { pub spendable_output_to_reused_addr_share: _1m1w1y24hBpsPercentRatioPattern, } +/// Pattern struct for repeated tree structure. +pub struct ActivityCostInvestedOutputsRealizedSupplyUnrealizedPattern2 { + pub activity: CoindaysCoinyearsDormancyTransferPattern, + pub cost_basis: InMaxMinPerSupplyPattern, + pub invested_capital: InPattern, + pub outputs: SpendingSpentUnspentPattern, + pub realized: CapCapitalizedGrossLossMvrvNetPeakPriceProfitSellSoprPattern2, + pub supply: DeltaDominanceHalfInTotalPattern2, + pub unrealized: CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2, +} + /// Pattern struct for repeated tree structure. pub struct CapLossMvrvNetPriceProfitSoprPattern { pub cap: CentsDeltaUsdPattern, @@ -3408,6 +3435,22 @@ impl PriceRatioPattern { } } +/// Pattern struct for repeated tree structure. +pub struct RatioValuePattern2 { + pub ratio: _1m1w1y24hPattern, + pub value_destroyed: AverageBlockCumulativeSumPattern, +} + +impl RatioValuePattern2 { + /// Create a new pattern node with accumulated series name. + pub fn new(client: Arc, acc: String) -> Self { + Self { + ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "sopr")), + value_destroyed: AverageBlockCumulativeSumPattern::new(client.clone(), _m(&acc, "value_destroyed")), + } + } +} + /// Pattern struct for repeated tree structure. pub struct RatioValuePattern { pub ratio: _24hPattern, @@ -7199,6 +7242,7 @@ pub struct SeriesTree_Cohorts_Utxo { pub over_age: SeriesTree_Cohorts_Utxo_OverAge, pub epoch: SeriesTree_Cohorts_Utxo_Epoch, pub class: SeriesTree_Cohorts_Utxo_Class, + pub entry: SeriesTree_Cohorts_Utxo_Entry, pub over_amount: SeriesTree_Cohorts_Utxo_OverAmount, pub amount_range: SeriesTree_Cohorts_Utxo_AmountRange, pub under_amount: SeriesTree_Cohorts_Utxo_UnderAmount, @@ -7218,6 +7262,7 @@ impl SeriesTree_Cohorts_Utxo { over_age: SeriesTree_Cohorts_Utxo_OverAge::new(client.clone(), format!("{base_path}_over_age")), epoch: SeriesTree_Cohorts_Utxo_Epoch::new(client.clone(), format!("{base_path}_epoch")), class: SeriesTree_Cohorts_Utxo_Class::new(client.clone(), format!("{base_path}_class")), + entry: SeriesTree_Cohorts_Utxo_Entry::new(client.clone(), format!("{base_path}_entry")), over_amount: SeriesTree_Cohorts_Utxo_OverAmount::new(client.clone(), format!("{base_path}_over_amount")), amount_range: SeriesTree_Cohorts_Utxo_AmountRange::new(client.clone(), format!("{base_path}_amount_range")), under_amount: SeriesTree_Cohorts_Utxo_UnderAmount::new(client.clone(), format!("{base_path}_under_amount")), @@ -7999,7 +8044,7 @@ pub struct SeriesTree_Cohorts_Utxo_Lth_Realized { pub price: SeriesTree_Cohorts_Utxo_Lth_Realized_Price, pub mvrv: SeriesPattern1, pub net_pnl: BlockChangeCumulativeDeltaSumPattern, - pub sopr: SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr, + pub sopr: RatioValuePattern2, pub gross_pnl: BlockCumulativeSumPattern, pub sell_side_risk_ratio: _1m1w1y24hPattern8, pub peak_regret: BlockCumulativeSumPattern, @@ -8016,7 +8061,7 @@ impl SeriesTree_Cohorts_Utxo_Lth_Realized { price: SeriesTree_Cohorts_Utxo_Lth_Realized_Price::new(client.clone(), format!("{base_path}_price")), mvrv: SeriesPattern1::new(client.clone(), "lth_mvrv".to_string()), net_pnl: BlockChangeCumulativeDeltaSumPattern::new(client.clone(), "lth_net".to_string()), - sopr: SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr::new(client.clone(), format!("{base_path}_sopr")), + sopr: RatioValuePattern2::new(client.clone(), "lth".to_string()), gross_pnl: BlockCumulativeSumPattern::new(client.clone(), "lth_realized_gross_pnl".to_string()), sell_side_risk_ratio: _1m1w1y24hPattern8::new(client.clone(), "lth_sell_side_risk_ratio".to_string()), peak_regret: BlockCumulativeSumPattern::new(client.clone(), "lth_realized_peak_regret".to_string()), @@ -8236,21 +8281,6 @@ impl SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y { } } -/// Series tree node. -pub struct SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr { - pub value_destroyed: AverageBlockCumulativeSumPattern, - pub ratio: _1m1w1y24hPattern, -} - -impl SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - value_destroyed: AverageBlockCumulativeSumPattern::new(client.clone(), "lth_value_destroyed".to_string()), - ratio: _1m1w1y24hPattern::new(client.clone(), "lth_sopr".to_string()), - } - } -} - /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_AgeRange { pub under_1h: ActivityOutputsRealizedSupplyUnrealizedPattern, @@ -8466,6 +8496,561 @@ impl SeriesTree_Cohorts_Utxo_Class { } } +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry { + pub discount: SeriesTree_Cohorts_Utxo_Entry_Discount, + pub premium: SeriesTree_Cohorts_Utxo_Entry_Premium, +} + +impl SeriesTree_Cohorts_Utxo_Entry { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + discount: SeriesTree_Cohorts_Utxo_Entry_Discount::new(client.clone(), format!("{base_path}_discount")), + premium: SeriesTree_Cohorts_Utxo_Entry_Premium::new(client.clone(), format!("{base_path}_premium")), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Discount { + pub supply: DeltaDominanceHalfInTotalPattern2, + pub outputs: SpendingSpentUnspentPattern, + pub activity: CoindaysCoinyearsDormancyTransferPattern, + pub realized: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized, + pub cost_basis: InMaxMinPerSupplyPattern, + pub unrealized: CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2, + pub invested_capital: InPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Discount { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + supply: DeltaDominanceHalfInTotalPattern2::new(client.clone(), "veteran_supply".to_string()), + outputs: SpendingSpentUnspentPattern::new(client.clone(), "veteran".to_string()), + activity: CoindaysCoinyearsDormancyTransferPattern::new(client.clone(), "veteran".to_string()), + realized: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized::new(client.clone(), format!("{base_path}_realized")), + cost_basis: InMaxMinPerSupplyPattern::new(client.clone(), "veteran".to_string()), + unrealized: CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2::new(client.clone(), "veteran".to_string()), + invested_capital: InPattern::new(client.clone(), "veteran_invested_capital_in".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Discount_Realized { + pub cap: CentsDeltaToUsdPattern, + pub profit: BlockCumulativeSumPattern, + pub loss: BlockCumulativeNegativeSumPattern, + pub price: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price, + pub mvrv: SeriesPattern1, + pub net_pnl: BlockChangeCumulativeDeltaSumPattern, + pub sopr: RatioValuePattern2, + pub gross_pnl: BlockCumulativeSumPattern, + pub sell_side_risk_ratio: _1m1w1y24hPattern8, + pub peak_regret: BlockCumulativeSumPattern, + pub capitalized: PricePattern, + pub profit_to_loss_ratio: _1m1w1y24hPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Discount_Realized { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + cap: CentsDeltaToUsdPattern::new(client.clone(), "veteran_realized_cap".to_string()), + profit: BlockCumulativeSumPattern::new(client.clone(), "veteran_realized_profit".to_string()), + loss: BlockCumulativeNegativeSumPattern::new(client.clone(), "veteran_realized_loss".to_string()), + price: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price::new(client.clone(), format!("{base_path}_price")), + mvrv: SeriesPattern1::new(client.clone(), "veteran_mvrv".to_string()), + net_pnl: BlockChangeCumulativeDeltaSumPattern::new(client.clone(), "veteran_net".to_string()), + sopr: RatioValuePattern2::new(client.clone(), "veteran".to_string()), + gross_pnl: BlockCumulativeSumPattern::new(client.clone(), "veteran_realized_gross_pnl".to_string()), + sell_side_risk_ratio: _1m1w1y24hPattern8::new(client.clone(), "veteran_sell_side_risk_ratio".to_string()), + peak_regret: BlockCumulativeSumPattern::new(client.clone(), "veteran_realized_peak_regret".to_string()), + capitalized: PricePattern::new(client.clone(), "veteran_capitalized_price".to_string()), + profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), "veteran_realized_profit_to_loss_ratio".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price { + pub usd: SeriesPattern1, + pub cents: SeriesPattern1, + pub sats: SeriesPattern1, + pub bps: SeriesPattern1, + pub ratio: SeriesPattern1, + pub percentiles: Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern, + pub sma: _1m1w1y2y4yAllPattern, + pub std_dev: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + usd: SeriesPattern1::new(client.clone(), "veteran_realized_price".to_string()), + cents: SeriesPattern1::new(client.clone(), "veteran_realized_price_cents".to_string()), + sats: SeriesPattern1::new(client.clone(), "veteran_realized_price_sats".to_string()), + bps: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio_bps".to_string()), + ratio: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio".to_string()), + percentiles: Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), "veteran_realized_price".to_string()), + sma: _1m1w1y2y4yAllPattern::new(client.clone(), "veteran_realized_price_ratio_sma".to_string()), + std_dev: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev::new(client.clone(), format!("{base_path}_std_dev")), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev { + pub all: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_All, + pub _4y: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_4y, + pub _2y: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_2y, + pub _1y: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_1y, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + all: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_All::new(client.clone(), format!("{base_path}_all")), + _4y: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_4y::new(client.clone(), format!("{base_path}_4y")), + _2y: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_2y::new(client.clone(), format!("{base_path}_2y")), + _1y: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_1y::new(client.clone(), format!("{base_path}_1y")), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_All { + pub sd: SeriesPattern1, + pub zscore: SeriesPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_All { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio_sd".to_string()), + zscore: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio_zscore".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "veteran_realized_price_0sd".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p0_5sd".to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p1sd".to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p1_5sd".to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p2sd".to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p2_5sd".to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p3sd".to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m0_5sd".to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m1sd".to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m1_5sd".to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m2sd".to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m2_5sd".to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m3sd".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_4y { + pub sd: SeriesPattern1, + pub zscore: SeriesPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_4y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio_sd_4y".to_string()), + zscore: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio_zscore_4y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "veteran_realized_price_0sd_4y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p0_5sd_4y".to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p1sd_4y".to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p1_5sd_4y".to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p2sd_4y".to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p2_5sd_4y".to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p3sd_4y".to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m0_5sd_4y".to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m1sd_4y".to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m1_5sd_4y".to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m2sd_4y".to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m2_5sd_4y".to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m3sd_4y".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_2y { + pub sd: SeriesPattern1, + pub zscore: SeriesPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_2y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio_sd_2y".to_string()), + zscore: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio_zscore_2y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "veteran_realized_price_0sd_2y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p0_5sd_2y".to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p1sd_2y".to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p1_5sd_2y".to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p2sd_2y".to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p2_5sd_2y".to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p3sd_2y".to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m0_5sd_2y".to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m1sd_2y".to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m1_5sd_2y".to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m2sd_2y".to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m2_5sd_2y".to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m3sd_2y".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_1y { + pub sd: SeriesPattern1, + pub zscore: SeriesPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_1y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio_sd_1y".to_string()), + zscore: SeriesPattern1::new(client.clone(), "veteran_realized_price_ratio_zscore_1y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "veteran_realized_price_0sd_1y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p0_5sd_1y".to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p1sd_1y".to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p1_5sd_1y".to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p2sd_1y".to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p2_5sd_1y".to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "p3sd_1y".to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m0_5sd_1y".to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m1sd_1y".to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m1_5sd_1y".to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m2sd_1y".to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m2_5sd_1y".to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "veteran_realized_price".to_string(), "m3sd_1y".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Premium { + pub supply: DeltaDominanceHalfInTotalPattern2, + pub outputs: SpendingSpentUnspentPattern, + pub activity: CoindaysCoinyearsDormancyTransferPattern, + pub realized: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized, + pub cost_basis: InMaxMinPerSupplyPattern, + pub unrealized: CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2, + pub invested_capital: InPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Premium { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + supply: DeltaDominanceHalfInTotalPattern2::new(client.clone(), "rookie_supply".to_string()), + outputs: SpendingSpentUnspentPattern::new(client.clone(), "rookie".to_string()), + activity: CoindaysCoinyearsDormancyTransferPattern::new(client.clone(), "rookie".to_string()), + realized: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized::new(client.clone(), format!("{base_path}_realized")), + cost_basis: InMaxMinPerSupplyPattern::new(client.clone(), "rookie".to_string()), + unrealized: CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2::new(client.clone(), "rookie".to_string()), + invested_capital: InPattern::new(client.clone(), "rookie_invested_capital_in".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Premium_Realized { + pub cap: CentsDeltaToUsdPattern, + pub profit: BlockCumulativeSumPattern, + pub loss: BlockCumulativeNegativeSumPattern, + pub price: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price, + pub mvrv: SeriesPattern1, + pub net_pnl: BlockChangeCumulativeDeltaSumPattern, + pub sopr: RatioValuePattern2, + pub gross_pnl: BlockCumulativeSumPattern, + pub sell_side_risk_ratio: _1m1w1y24hPattern8, + pub peak_regret: BlockCumulativeSumPattern, + pub capitalized: PricePattern, + pub profit_to_loss_ratio: _1m1w1y24hPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Premium_Realized { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + cap: CentsDeltaToUsdPattern::new(client.clone(), "rookie_realized_cap".to_string()), + profit: BlockCumulativeSumPattern::new(client.clone(), "rookie_realized_profit".to_string()), + loss: BlockCumulativeNegativeSumPattern::new(client.clone(), "rookie_realized_loss".to_string()), + price: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price::new(client.clone(), format!("{base_path}_price")), + mvrv: SeriesPattern1::new(client.clone(), "rookie_mvrv".to_string()), + net_pnl: BlockChangeCumulativeDeltaSumPattern::new(client.clone(), "rookie_net".to_string()), + sopr: RatioValuePattern2::new(client.clone(), "rookie".to_string()), + gross_pnl: BlockCumulativeSumPattern::new(client.clone(), "rookie_realized_gross_pnl".to_string()), + sell_side_risk_ratio: _1m1w1y24hPattern8::new(client.clone(), "rookie_sell_side_risk_ratio".to_string()), + peak_regret: BlockCumulativeSumPattern::new(client.clone(), "rookie_realized_peak_regret".to_string()), + capitalized: PricePattern::new(client.clone(), "rookie_capitalized_price".to_string()), + profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), "rookie_realized_profit_to_loss_ratio".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price { + pub usd: SeriesPattern1, + pub cents: SeriesPattern1, + pub sats: SeriesPattern1, + pub bps: SeriesPattern1, + pub ratio: SeriesPattern1, + pub percentiles: Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern, + pub sma: _1m1w1y2y4yAllPattern, + pub std_dev: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + usd: SeriesPattern1::new(client.clone(), "rookie_realized_price".to_string()), + cents: SeriesPattern1::new(client.clone(), "rookie_realized_price_cents".to_string()), + sats: SeriesPattern1::new(client.clone(), "rookie_realized_price_sats".to_string()), + bps: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio_bps".to_string()), + ratio: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio".to_string()), + percentiles: Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern::new(client.clone(), "rookie_realized_price".to_string()), + sma: _1m1w1y2y4yAllPattern::new(client.clone(), "rookie_realized_price_ratio_sma".to_string()), + std_dev: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev::new(client.clone(), format!("{base_path}_std_dev")), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev { + pub all: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_All, + pub _4y: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_4y, + pub _2y: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_2y, + pub _1y: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_1y, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + all: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_All::new(client.clone(), format!("{base_path}_all")), + _4y: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_4y::new(client.clone(), format!("{base_path}_4y")), + _2y: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_2y::new(client.clone(), format!("{base_path}_2y")), + _1y: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_1y::new(client.clone(), format!("{base_path}_1y")), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_All { + pub sd: SeriesPattern1, + pub zscore: SeriesPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_All { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio_sd".to_string()), + zscore: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio_zscore".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "rookie_realized_price_0sd".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p0_5sd".to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p1sd".to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p1_5sd".to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p2sd".to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p2_5sd".to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p3sd".to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m0_5sd".to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m1sd".to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m1_5sd".to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m2sd".to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m2_5sd".to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m3sd".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_4y { + pub sd: SeriesPattern1, + pub zscore: SeriesPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_4y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio_sd_4y".to_string()), + zscore: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio_zscore_4y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "rookie_realized_price_0sd_4y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p0_5sd_4y".to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p1sd_4y".to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p1_5sd_4y".to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p2sd_4y".to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p2_5sd_4y".to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p3sd_4y".to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m0_5sd_4y".to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m1sd_4y".to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m1_5sd_4y".to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m2sd_4y".to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m2_5sd_4y".to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m3sd_4y".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_2y { + pub sd: SeriesPattern1, + pub zscore: SeriesPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_2y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio_sd_2y".to_string()), + zscore: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio_zscore_2y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "rookie_realized_price_0sd_2y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p0_5sd_2y".to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p1sd_2y".to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p1_5sd_2y".to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p2sd_2y".to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p2_5sd_2y".to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p3sd_2y".to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m0_5sd_2y".to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m1sd_2y".to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m1_5sd_2y".to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m2sd_2y".to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m2_5sd_2y".to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m3sd_2y".to_string()), + } + } +} + +/// Series tree node. +pub struct SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_1y { + pub sd: SeriesPattern1, + pub zscore: SeriesPattern1, + pub _0sd: CentsSatsUsdPattern, + pub p0_5sd: PriceRatioPattern, + pub p1sd: PriceRatioPattern, + pub p1_5sd: PriceRatioPattern, + pub p2sd: PriceRatioPattern, + pub p2_5sd: PriceRatioPattern, + pub p3sd: PriceRatioPattern, + pub m0_5sd: PriceRatioPattern, + pub m1sd: PriceRatioPattern, + pub m1_5sd: PriceRatioPattern, + pub m2sd: PriceRatioPattern, + pub m2_5sd: PriceRatioPattern, + pub m3sd: PriceRatioPattern, +} + +impl SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_1y { + pub fn new(client: Arc, base_path: String) -> Self { + Self { + sd: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio_sd_1y".to_string()), + zscore: SeriesPattern1::new(client.clone(), "rookie_realized_price_ratio_zscore_1y".to_string()), + _0sd: CentsSatsUsdPattern::new(client.clone(), "rookie_realized_price_0sd_1y".to_string()), + p0_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p0_5sd_1y".to_string()), + p1sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p1sd_1y".to_string()), + p1_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p1_5sd_1y".to_string()), + p2sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p2sd_1y".to_string()), + p2_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p2_5sd_1y".to_string()), + p3sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "p3sd_1y".to_string()), + m0_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m0_5sd_1y".to_string()), + m1sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m1sd_1y".to_string()), + m1_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m1_5sd_1y".to_string()), + m2sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m2sd_1y".to_string()), + m2_5sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m2_5sd_1y".to_string()), + m3sd: PriceRatioPattern::new(client.clone(), "rookie_realized_price".to_string(), "m3sd_1y".to_string()), + } + } +} + /// Series tree node. pub struct SeriesTree_Cohorts_Utxo_OverAmount { pub _1sat: ActivityOutputsRealizedSupplyUnrealizedPattern2, @@ -8953,7 +9538,7 @@ pub struct BrkClient { impl BrkClient { /// Client version. - pub const VERSION: &'static str = "v0.3.2"; + pub const VERSION: &'static str = "v0.3.3"; /// Create a new client with the given base URL. pub fn new(base_url: impl Into) -> Self { diff --git a/crates/brk_cohort/src/by_entry.rs b/crates/brk_cohort/src/by_entry.rs new file mode 100644 index 000000000..3ac872e44 --- /dev/null +++ b/crates/brk_cohort/src/by_entry.rs @@ -0,0 +1,104 @@ +use brk_traversable::Traversable; +use rayon::iter::{IntoParallelIterator, ParallelIterator}; +use serde::Serialize; + +use super::{CohortName, Filter}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum EntryPrice { + Discount, + Premium, +} + +impl EntryPrice { + #[inline] + pub const fn from_is_discount(is_discount: bool) -> Self { + if is_discount { + Self::Discount + } else { + Self::Premium + } + } + + #[inline] + pub const fn is_discount(self) -> bool { + matches!(self, Self::Discount) + } +} + +pub const ENTRY_FILTERS: ByEntry = ByEntry { + discount: Filter::Entry(EntryPrice::Discount), + premium: Filter::Entry(EntryPrice::Premium), +}; + +pub const ENTRY_NAMES: ByEntry = ByEntry { + discount: CohortName::new("veteran", "Veteran", "Veteran Coins"), + premium: CohortName::new("rookie", "Rookie", "Rookie Coins"), +}; + +#[derive(Default, Clone, Traversable, Serialize)] +pub struct ByEntry { + pub discount: T, + pub premium: T, +} + +impl ByEntry { + pub const fn names() -> &'static Self { + &ENTRY_NAMES + } +} + +impl ByEntry { + pub fn new(mut create: F) -> Self + where + F: FnMut(Filter, &'static str) -> T, + { + let f = ENTRY_FILTERS; + let n = ENTRY_NAMES; + Self { + discount: create(f.discount, n.discount.id), + premium: create(f.premium, n.premium.id), + } + } + + pub fn try_new(mut create: F) -> Result + where + F: FnMut(Filter, &'static str) -> Result, + { + let f = ENTRY_FILTERS; + let n = ENTRY_NAMES; + Ok(Self { + discount: create(f.discount, n.discount.id)?, + premium: create(f.premium, n.premium.id)?, + }) + } + + pub fn get(&self, entry: EntryPrice) -> &T { + match entry { + EntryPrice::Discount => &self.discount, + EntryPrice::Premium => &self.premium, + } + } + + pub fn get_mut(&mut self, entry: EntryPrice) -> &mut T { + match entry { + EntryPrice::Discount => &mut self.discount, + EntryPrice::Premium => &mut self.premium, + } + } + + pub fn iter(&self) -> impl Iterator { + [&self.discount, &self.premium].into_iter() + } + + pub fn iter_mut(&mut self) -> impl Iterator { + [&mut self.discount, &mut self.premium].into_iter() + } + + pub fn par_iter_mut(&mut self) -> impl ParallelIterator + where + T: Send + Sync, + { + [&mut self.discount, &mut self.premium].into_par_iter() + } +} diff --git a/crates/brk_cohort/src/cohort_context.rs b/crates/brk_cohort/src/cohort_context.rs index ae7b043ef..44df505c9 100644 --- a/crates/brk_cohort/src/cohort_context.rs +++ b/crates/brk_cohort/src/cohort_context.rs @@ -24,7 +24,7 @@ impl CohortContext { /// Build full name for a filter, adding prefix only for Time/Amount filters. /// /// Prefix rules: - /// - No prefix: `All`, `Term`, `Epoch`, `Class`, `Type` + /// - No prefix: `All`, `Term`, `Epoch`, `Class`, `Entry`, `Type` /// - Context prefix: `Time`, `Amount` pub fn full_name(&self, filter: &Filter, name: &str) -> String { match filter { @@ -32,6 +32,7 @@ impl CohortContext { | Filter::Term(_) | Filter::Epoch(_) | Filter::Class(_) + | Filter::Entry(_) | Filter::Type(_) => name.to_string(), Filter::Time(_) | Filter::Amount(_) => self.prefixed(name), } diff --git a/crates/brk_cohort/src/filter.rs b/crates/brk_cohort/src/filter.rs index 6a7adcd9a..e1d8ad007 100644 --- a/crates/brk_cohort/src/filter.rs +++ b/crates/brk_cohort/src/filter.rs @@ -1,6 +1,6 @@ use brk_types::{Halving, OutputType, Sats, Year}; -use super::{AmountFilter, CohortContext, Term, TimeFilter}; +use super::{AmountFilter, CohortContext, EntryPrice, Term, TimeFilter}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum Filter { @@ -10,6 +10,7 @@ pub enum Filter { Amount(AmountFilter), Epoch(Halving), Class(Year), + Entry(EntryPrice), Type(OutputType), } @@ -68,7 +69,8 @@ impl Filter { } /// Whether to compute extended metrics (realized cap ratios, profit/loss ratios, percentiles) - /// For UTXO context: true only for age range cohorts (Range) and aggregate cohorts (All, Term) + /// For UTXO context: true for age range cohorts (Range), aggregate cohorts (All, Term), + /// and immutable entry valuation cohorts. /// For address context: always false pub fn is_extended(&self, context: CohortContext) -> bool { match context { @@ -76,7 +78,10 @@ impl Filter { CohortContext::Utxo => { matches!( self, - Filter::All | Filter::Term(_) | Filter::Time(TimeFilter::Range(_)) + Filter::All + | Filter::Term(_) + | Filter::Time(TimeFilter::Range(_)) + | Filter::Entry(_) ) } } diff --git a/crates/brk_cohort/src/lib.rs b/crates/brk_cohort/src/lib.rs index f2905fe5d..2ee398db6 100644 --- a/crates/brk_cohort/src/lib.rs +++ b/crates/brk_cohort/src/lib.rs @@ -7,6 +7,7 @@ mod amount_range; mod by_addr_type; mod by_any_addr; mod by_epoch; +mod by_entry; mod by_term; mod by_type; mod class; @@ -36,6 +37,7 @@ pub use amount_range::*; pub use by_addr_type::*; pub use by_any_addr::*; pub use by_epoch::*; +pub use by_entry::*; pub use by_term::*; pub use by_type::*; pub use class::*; diff --git a/crates/brk_cohort/src/utxo.rs b/crates/brk_cohort/src/utxo.rs index 38835faa9..10274e0ec 100644 --- a/crates/brk_cohort/src/utxo.rs +++ b/crates/brk_cohort/src/utxo.rs @@ -2,8 +2,8 @@ use brk_traversable::Traversable; use rayon::prelude::*; use crate::{ - AgeRange, AmountRange, ByEpoch, ByTerm, Class, Filter, OverAge, OverAmount, SpendableType, - UnderAge, UnderAmount, + AgeRange, AmountRange, ByEntry, ByEpoch, ByTerm, Class, Filter, OverAge, OverAmount, + SpendableType, UnderAge, UnderAmount, }; #[derive(Default, Clone, Traversable)] @@ -12,6 +12,7 @@ pub struct UTXOGroups { pub age_range: AgeRange, pub epoch: ByEpoch, pub class: Class, + pub entry: ByEntry, pub over_age: OverAge, pub over_amount: OverAmount, pub amount_range: AmountRange, @@ -31,6 +32,7 @@ impl UTXOGroups { age_range: AgeRange::new(&mut create), epoch: ByEpoch::new(&mut create), class: Class::new(&mut create), + entry: ByEntry::new(&mut create), over_age: OverAge::new(&mut create), over_amount: OverAmount::new(&mut create), amount_range: AmountRange::new(&mut create), @@ -51,6 +53,7 @@ impl UTXOGroups { .chain(self.age_range.iter()) .chain(self.epoch.iter()) .chain(self.class.iter()) + .chain(self.entry.iter()) .chain(self.amount_range.iter()) .chain(self.under_amount.iter()) .chain(self.type_.iter()) @@ -66,6 +69,7 @@ impl UTXOGroups { .chain(self.age_range.iter_mut()) .chain(self.epoch.iter_mut()) .chain(self.class.iter_mut()) + .chain(self.entry.iter_mut()) .chain(self.amount_range.iter_mut()) .chain(self.under_amount.iter_mut()) .chain(self.type_.iter_mut()) @@ -84,6 +88,7 @@ impl UTXOGroups { .chain(self.age_range.par_iter_mut()) .chain(self.epoch.par_iter_mut()) .chain(self.class.par_iter_mut()) + .chain(self.entry.par_iter_mut()) .chain(self.amount_range.par_iter_mut()) .chain(self.under_amount.par_iter_mut()) .chain(self.type_.par_iter_mut()) @@ -94,6 +99,7 @@ impl UTXOGroups { .iter() .chain(self.epoch.iter()) .chain(self.class.iter()) + .chain(self.entry.iter()) .chain(self.amount_range.iter()) .chain(self.type_.iter()) } @@ -103,6 +109,7 @@ impl UTXOGroups { .iter_mut() .chain(self.epoch.iter_mut()) .chain(self.class.iter_mut()) + .chain(self.entry.iter_mut()) .chain(self.amount_range.iter_mut()) .chain(self.type_.iter_mut()) } @@ -115,6 +122,7 @@ impl UTXOGroups { .par_iter_mut() .chain(self.epoch.par_iter_mut()) .chain(self.class.par_iter_mut()) + .chain(self.entry.par_iter_mut()) .chain(self.amount_range.par_iter_mut()) .chain(self.type_.par_iter_mut()) } diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/fenwick.rs b/crates/brk_computer/src/distribution/cohorts/utxo/fenwick.rs index 0ed2e82cc..41aff35bd 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/fenwick.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/fenwick.rs @@ -30,18 +30,34 @@ const TREE_SIZE: usize = TIER0_COUNT + TIER1_COUNT + OVERFLOW; // 190,001 pub(super) struct CostBasisNode { all_sats: i64, sth_sats: i64, + discount_sats: i64, all_usd: i128, sth_usd: i128, + discount_usd: i128, } impl CostBasisNode { #[inline(always)] - fn new(sats: i64, usd: i128, is_sth: bool) -> Self { + fn new_supply(sats: i64, usd: i128, is_sth: bool) -> Self { Self { all_sats: sats, sth_sats: if is_sth { sats } else { 0 }, + discount_sats: 0, all_usd: usd, sth_usd: if is_sth { usd } else { 0 }, + discount_usd: 0, + } + } + + #[inline(always)] + fn new_discount(sats: i64, usd: i128) -> Self { + Self { + all_sats: 0, + sth_sats: 0, + discount_sats: sats, + all_usd: 0, + sth_usd: 0, + discount_usd: usd, } } } @@ -51,8 +67,10 @@ impl FenwickNode for CostBasisNode { fn add_assign(&mut self, other: &Self) { self.all_sats += other.all_sats; self.sth_sats += other.sth_sats; + self.discount_sats += other.discount_sats; self.all_usd += other.all_usd; self.sth_usd += other.sth_usd; + self.discount_usd += other.discount_usd; } } @@ -151,16 +169,34 @@ impl CostBasisFenwick { } let bucket = price_to_bucket(price); let delta = - CostBasisNode::new(net_sats, price.as_u128() as i128 * net_sats as i128, is_sth); + CostBasisNode::new_supply(net_sats, price.as_u128() as i128 * net_sats as i128, is_sth); self.tree.add(bucket, &delta); self.totals.add_assign(&delta); } - /// Bulk-initialize from BTreeMaps (one per age-range cohort). - /// Call after state import when all pending maps have been drained. - pub(super) fn bulk_init<'a>( + /// Apply a net delta from the discount-entry cohort. + /// + /// Supply totals are maintained from the age-range cohorts; this updates + /// only the discount-entry partition so premium can be derived as all - discount. + pub(super) fn apply_discount_delta(&mut self, price: CentsCompact, pending: &PendingDelta) { + let net_sats = u64::from(pending.inc) as i64 - u64::from(pending.dec) as i64; + if net_sats == 0 { + return; + } + let bucket = price_to_bucket(price); + let delta = + CostBasisNode::new_discount(net_sats, price.as_u128() as i128 * net_sats as i128); + self.tree.add(bucket, &delta); + self.totals.add_assign(&delta); + } + + /// Bulk-initialize from age-range maps plus the discount-entry map. + /// Age-range maps maintain all/STH/LTH totals; the discount-entry map + /// maintains only the discount partition used to derive premium. + pub(super) fn bulk_init_with_discount<'a>( &mut self, maps: impl Iterator, bool)>, + discount_maps: impl Iterator>, ) { self.tree.reset(); self.totals = CostBasisNode::default(); @@ -169,7 +205,18 @@ impl CostBasisFenwick { for (&price, &sats) in map.iter() { let bucket = price_to_bucket(price); let s = u64::from(sats) as i64; - let node = CostBasisNode::new(s, price.as_u128() as i128 * s as i128, is_sth); + let node = + CostBasisNode::new_supply(s, price.as_u128() as i128 * s as i128, is_sth); + self.tree.add_raw(bucket, &node); + self.totals.add_assign(&node); + } + } + + for map in discount_maps { + for (&price, &sats) in map.iter() { + let bucket = price_to_bucket(price); + let s = u64::from(sats) as i64; + let node = CostBasisNode::new_discount(s, price.as_u128() as i128 * s as i128); self.tree.add_raw(bucket, &node); self.totals.add_assign(&node); } @@ -212,6 +259,26 @@ impl CostBasisFenwick { ) } + /// Compute percentile prices for discount-entry cohort. + pub(super) fn percentiles_discount_entry(&self) -> PercentileResult { + self.compute_percentiles( + self.totals.discount_sats, + self.totals.discount_usd, + |n| n.discount_sats, + |n| n.discount_usd, + ) + } + + /// Compute percentile prices for premium-entry cohort (all - discount). + pub(super) fn percentiles_premium_entry(&self) -> PercentileResult { + self.compute_percentiles( + self.totals.all_sats - self.totals.discount_sats, + self.totals.all_usd - self.totals.discount_usd, + |n| n.all_sats - n.discount_sats, + |n| n.all_usd - n.discount_usd, + ) + } + fn compute_percentiles( &self, total_sats: i64, @@ -271,6 +338,37 @@ impl CostBasisFenwick { return (0, 0, 0); } + let range = self.density_range(spot_price); + let all_range = range.all_sats.max(0); + let sth_range = range.sth_sats.max(0); + let lth_range = all_range - sth_range; + + let lth_total = self.totals.all_sats - self.totals.sth_sats; + ( + Self::to_bps(all_range, self.totals.all_sats), + Self::to_bps(sth_range, self.totals.sth_sats), + Self::to_bps(lth_range, lth_total), + ) + } + + /// Compute supply density for entry cohorts: (discount_bps, premium_bps). + pub(super) fn entry_density(&self, spot_price: Cents) -> (u16, u16) { + if self.totals.all_sats <= 0 { + return (0, 0); + } + + let range = self.density_range(spot_price); + let discount_range = range.discount_sats.max(0); + let premium_range = range.all_sats.max(0) - discount_range; + let premium_total = self.totals.all_sats - self.totals.discount_sats; + + ( + Self::to_bps(discount_range, self.totals.discount_sats), + Self::to_bps(premium_range, premium_total), + ) + } + + fn density_range(&self, spot_price: Cents) -> CostBasisNode { let spot_f64 = u64::from(spot_price) as f64; let low = Cents::from((spot_f64 * 0.95) as u64); let high = Cents::from((spot_f64 * 1.05) as u64); @@ -285,24 +383,23 @@ impl CostBasisFenwick { CostBasisNode::default() }; - let all_range = (cum_high.all_sats - cum_low.all_sats).max(0); - let sth_range = (cum_high.sth_sats - cum_low.sth_sats).max(0); - let lth_range = all_range - sth_range; + CostBasisNode { + all_sats: cum_high.all_sats - cum_low.all_sats, + sth_sats: cum_high.sth_sats - cum_low.sth_sats, + discount_sats: cum_high.discount_sats - cum_low.discount_sats, + all_usd: cum_high.all_usd - cum_low.all_usd, + sth_usd: cum_high.sth_usd - cum_low.sth_usd, + discount_usd: cum_high.discount_usd - cum_low.discount_usd, + } + } - let to_bps = |range: i64, total: i64| -> u16 { - if total <= 0 { - 0 - } else { - (range as f64 / total as f64 * 10000.0).round() as u16 - } - }; - - let lth_total = self.totals.all_sats - self.totals.sth_sats; - ( - to_bps(all_range, self.totals.all_sats), - to_bps(sth_range, self.totals.sth_sats), - to_bps(lth_range, lth_total), - ) + #[inline(always)] + fn to_bps(range: i64, total: i64) -> u16 { + if total <= 0 { + 0 + } else { + (range as f64 / total as f64 * 10000.0).round() as u16 + } } // ----------------------------------------------------------------------- diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs index 927c37ce4..158faad8d 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/groups.rs @@ -1,8 +1,8 @@ use std::path::Path; use brk_cohort::{ - AgeRange, AmountRange, ByEpoch, Class, CohortContext, Filter, Filtered, OverAge, OverAmount, - SpendableType, Term, UnderAge, UnderAmount, + AgeRange, AmountRange, ByEntry, ByEpoch, Class, CohortContext, Filter, Filtered, OverAge, + OverAmount, SpendableType, Term, UnderAge, UnderAmount, }; use brk_error::Result; use brk_indexer::Lengths; @@ -16,7 +16,6 @@ use vecdb::{ use crate::{ blocks, distribution::{ - DynCohortVecs, metrics::{ AllCohortMetrics, BasicCohortMetrics, CohortMetricsBase, CoreCohortMetrics, ExtendedAdjustedCohortMetrics, ExtendedCohortMetrics, ImportConfig, @@ -24,6 +23,7 @@ use crate::{ TypeCohortMetrics, }, state::UTXOCohortState, + DynCohortVecs, }, indexes, internal::{ValuePerBlockCumulativeRolling, WindowStartVec, Windows}, @@ -45,6 +45,7 @@ pub struct UTXOCohorts { pub over_age: OverAge>>, pub epoch: ByEpoch>>, pub class: Class>>, + pub entry: ByEntry>>, pub over_amount: OverAmount>>, pub amount_range: AmountRange>>, pub under_amount: UnderAmount>>, @@ -67,8 +68,10 @@ pub(crate) struct UTXOCohortsTransientState { } impl UTXOCohorts { - /// ~71 separate cohorts (21 age + 5 epoch + 18 class + 15 amount + 12 type) - const SEPARATE_COHORT_CAPACITY: usize = 80; + /// Separate cohorts currently total 72: + /// 21 age + 5 epoch + 18 class + 2 entry + 15 amount + 11 spendable type. + /// Keep small headroom because this is only Vec allocation capacity. + const SEPARATE_COHORT_CAPACITY: usize = 82; /// Import all UTXO cohorts from database. pub(crate) fn forced_import( @@ -136,6 +139,26 @@ impl UTXOCohorts { let epoch = ByEpoch::try_new(&core_separate)?; let class = Class::try_new(&core_separate)?; + let extended_separate = + |f: Filter, name: &'static str| -> Result> { + let full_name = CohortContext::Utxo.full_name(&f, name); + let cfg = ImportConfig { + db, + filter: &f, + full_name: &full_name, + version: v, + indexes, + cached_starts, + }; + let state = Some(Box::new(UTXOCohortState::new(states_path, &full_name))); + Ok(UTXOCohortVecs::new( + state, + ExtendedCohortMetrics::forced_import(&cfg)?, + )) + }; + + let entry = ByEntry::try_new(&extended_separate)?; + // Helper for separate cohorts with MinimalCohortMetrics + MinimalRealizedState let minimal_separate = |f: Filter, name: &'static str| -> Result> { @@ -281,6 +304,7 @@ impl UTXOCohorts { lth, epoch, class, + entry, type_, under_age, over_age, @@ -309,6 +333,7 @@ impl UTXOCohorts { sth, caches, age_range, + entry, .. } = self; caches @@ -327,7 +352,15 @@ impl UTXOCohorts { Some((map, caches.fenwick.is_sth_at(i))) }) .collect(); - caches.fenwick.bulk_init(maps.into_iter()); + let discount_maps = entry + .discount + .state + .as_ref() + .map(|state| state.cost_basis_map()) + .into_iter(); + caches + .fenwick + .bulk_init_with_discount(maps.into_iter(), discount_maps); } /// Apply pending deltas from all age-range cohorts to the Fenwick tree. @@ -338,7 +371,10 @@ impl UTXOCohorts { } // Destructure to get separate borrows on caches and age_range let Self { - caches, age_range, .. + caches, + age_range, + entry, + .. } = self; for (i, sub) in age_range.iter().enumerate() { if let Some(state) = sub.state.as_ref() { @@ -348,6 +384,11 @@ impl UTXOCohorts { }); } } + if let Some(state) = entry.discount.state.as_ref() { + state.for_each_cost_basis_pending(|&price, delta| { + caches.fenwick.apply_discount_delta(price, delta); + }); + } } /// Push maturation sats to the matured vecs for the given height. @@ -365,6 +406,7 @@ impl UTXOCohorts { age_range, epoch, class, + entry, amount_range, type_, .. @@ -374,6 +416,7 @@ impl UTXOCohorts { .map(|x| x as &mut dyn DynCohortVecs) .chain(epoch.par_iter_mut().map(|x| x as &mut dyn DynCohortVecs)) .chain(class.par_iter_mut().map(|x| x as &mut dyn DynCohortVecs)) + .chain(entry.par_iter_mut().map(|x| x as &mut dyn DynCohortVecs)) .chain( amount_range .par_iter_mut() @@ -389,6 +432,7 @@ impl UTXOCohorts { age_range, epoch, class, + entry, amount_range, type_, .. @@ -398,6 +442,7 @@ impl UTXOCohorts { .map(|x| x as &mut dyn DynCohortVecs) .chain(epoch.iter_mut().map(|x| x as &mut dyn DynCohortVecs)) .chain(class.iter_mut().map(|x| x as &mut dyn DynCohortVecs)) + .chain(entry.iter_mut().map(|x| x as &mut dyn DynCohortVecs)) .chain(amount_range.iter_mut().map(|x| x as &mut dyn DynCohortVecs)) .chain(type_.iter_mut().map(|x| x as &mut dyn DynCohortVecs)) } @@ -409,6 +454,7 @@ impl UTXOCohorts { .map(|x| x as &dyn DynCohortVecs) .chain(self.epoch.iter().map(|x| x as &dyn DynCohortVecs)) .chain(self.class.iter().map(|x| x as &dyn DynCohortVecs)) + .chain(self.entry.iter().map(|x| x as &dyn DynCohortVecs)) .chain(self.amount_range.iter().map(|x| x as &dyn DynCohortVecs)) .chain(self.type_.iter().map(|x| x as &dyn DynCohortVecs)) } @@ -516,6 +562,7 @@ impl UTXOCohorts { ); all.extend(self.epoch.iter_mut().map(|x| x as &mut dyn DynCohortVecs)); all.extend(self.class.iter_mut().map(|x| x as &mut dyn DynCohortVecs)); + all.extend(self.entry.iter_mut().map(|x| x as &mut dyn DynCohortVecs)); all.extend( self.amount_range .iter_mut() @@ -604,6 +651,7 @@ impl UTXOCohorts { under_amount, epoch, class, + entry, type_, .. } = self; @@ -676,6 +724,19 @@ impl UTXOCohorts { .compute_rest_part2(prices, starting_lengths, ss, au, exit) }) }), + Box::new(|| { + entry.par_iter_mut().try_for_each(|v| { + v.metrics.compute_rest_part2( + blocks, + prices, + starting_lengths, + height_to_market_cap, + ss, + au, + exit, + ) + }) + }), Box::new(|| { amount_range.par_iter_mut().try_for_each(|v| { v.metrics @@ -730,6 +791,9 @@ impl UTXOCohorts { for v in self.class.iter_mut() { vecs.extend(v.metrics.collect_all_vecs_mut()); } + for v in self.entry.iter_mut() { + vecs.extend(v.metrics.collect_all_vecs_mut()); + } for v in self.amount_range.iter_mut() { vecs.extend(v.metrics.collect_all_vecs_mut()); } @@ -813,7 +877,7 @@ impl UTXOCohorts { /// Aggregate RealizedFull fields from age_range states and push to all/sth/lth. /// Called during the block loop after separate cohorts' push_state but before reset. - pub(crate) fn push_overlapping(&mut self, height_price: Cents) { + pub(crate) fn push_overlapping(&mut self, height_price: Cents) -> Cents { let Self { all, sth, @@ -852,7 +916,7 @@ impl UTXOCohorts { } } - all.metrics.realized.push_accum(&all_acc); + let all_capitalized_price = all.metrics.realized.push_accum(&all_acc); sth.metrics.realized.push_accum(&sth_acc); lth.metrics.realized.push_accum(<h_acc); @@ -880,6 +944,8 @@ impl UTXOCohorts { .unrealized .capitalized_cap_in_loss_raw .push(CentsSquaredSats::new(lth_ccap.1)); + + all_capitalized_price } } diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/percentiles.rs b/crates/brk_computer/src/distribution/cohorts/utxo/percentiles.rs index 873266750..a76d0a57a 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/percentiles.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/percentiles.rs @@ -50,6 +50,22 @@ impl UTXOCohorts { let lth = self.caches.fenwick.percentiles_lth(); push_cost_basis(<h, lth_d, &mut self.lth.metrics.cost_basis); + let (discount_d, premium_d) = self.caches.fenwick.entry_density(spot_price); + + let discount = self.caches.fenwick.percentiles_discount_entry(); + push_cost_basis( + &discount, + discount_d, + &mut self.entry.discount.metrics.cost_basis, + ); + + let premium = self.caches.fenwick.percentiles_premium_entry(); + push_cost_basis( + &premium, + premium_d, + &mut self.entry.premium.metrics.cost_basis, + ); + let prof = self.caches.fenwick.profitability(spot_price); push_profitability(&prof, &mut self.profitability); } diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs b/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs index f343f061a..ba82f7492 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/receive.rs @@ -1,3 +1,4 @@ +use brk_cohort::EntryPrice; use brk_types::{Cents, CostBasisSnapshot, Height, Timestamp}; use vecdb::Rw; @@ -12,6 +13,7 @@ impl UTXOCohorts { /// - The "under_1h" age cohort (all new UTXOs start at 0 hours old) /// - The appropriate epoch cohort based on block height /// - The appropriate class cohort based on block timestamp + /// - The immutable entry valuation cohort based on creation price versus anchor /// - The appropriate output type cohort (P2PKH, P2SH, etc.) /// - The appropriate amount range cohort based on value pub(crate) fn receive( @@ -20,13 +22,14 @@ impl UTXOCohorts { height: Height, timestamp: Timestamp, price: Cents, + entry: EntryPrice, ) { let supply_state = received.spendable_supply; - // Pre-compute snapshot once for the 3 cohorts sharing the same supply_state + // Pre-compute snapshot once for cohorts sharing the block-level supply_state let snapshot = CostBasisSnapshot::from_utxo(price, &supply_state); - // New UTXOs go into under_1h, current epoch, and current class + // New UTXOs go into under_1h plus immutable creation cohorts self.age_range .under_1h .state @@ -45,6 +48,12 @@ impl UTXOCohorts { .unwrap() .receive_utxo_snapshot(&supply_state, &snapshot); } + self.entry + .get_mut(entry) + .state + .as_mut() + .unwrap() + .receive_utxo_snapshot(&supply_state, &snapshot); // Update output type cohorts (skip types with no outputs this block) self.type_.iter_typed_mut().for_each(|(output_type, vecs)| { diff --git a/crates/brk_computer/src/distribution/cohorts/utxo/send.rs b/crates/brk_computer/src/distribution/cohorts/utxo/send.rs index da569736e..8ed31e8e5 100644 --- a/crates/brk_computer/src/distribution/cohorts/utxo/send.rs +++ b/crates/brk_computer/src/distribution/cohorts/utxo/send.rs @@ -49,7 +49,7 @@ impl UTXOCohorts { // This is the max price between receive and send heights let peak_price = price_range_max.max_between(receive_height, send_height); - // Pre-compute once for age_range, epoch, year (all share sent.spendable_supply) + // Pre-compute once for cohorts sharing the sent supply. if let Some(pre) = SendPrecomputed::new( &sent.spendable_supply, current_price, @@ -75,6 +75,12 @@ impl UTXOCohorts { .unwrap() .send_utxo_precomputed(&sent.spendable_supply, &pre); } + self.entry + .get_mut(block_state.entry) + .state + .as_mut() + .unwrap() + .send_utxo_precomputed(&sent.spendable_supply, &pre); } else if sent.spendable_supply.utxo_count > 0 { // Zero-value UTXOs: just subtract supply self.age_range.get_mut(age).state.as_mut().unwrap().supply -= @@ -85,6 +91,12 @@ impl UTXOCohorts { if let Some(v) = self.class.mut_vec_from_timestamp(block_state.timestamp) { v.state.as_mut().unwrap().supply -= &sent.spendable_supply; } + self.entry + .get_mut(block_state.entry) + .state + .as_mut() + .unwrap() + .supply -= &sent.spendable_supply; } // Update output type cohorts (skip zero-supply entries) diff --git a/crates/brk_computer/src/distribution/compute/block_loop.rs b/crates/brk_computer/src/distribution/compute/block_loop.rs index 4d68db4a8..4d4b9a751 100644 --- a/crates/brk_computer/src/distribution/compute/block_loop.rs +++ b/crates/brk_computer/src/distribution/compute/block_loop.rs @@ -1,4 +1,4 @@ -use brk_cohort::ByAddrType; +use brk_cohort::{ByAddrType, EntryPrice}; use brk_error::Result; use brk_indexer::Indexer; use brk_types::{ @@ -46,6 +46,7 @@ pub(crate) fn process_blocks( last_height: Height, chain_state: &mut Vec, tx_index_to_height: &mut RangeMap, + mut entry_anchor: Cents, cached_prices: &[Cents], cached_timestamps: &[Timestamp], cached_price_range_max: &PriceRangeMax, @@ -370,9 +371,14 @@ pub(crate) fn process_blocks( .iterate(Sats::FIFTY_BTC, OutputType::P2PK65); } + let entry = EntryPrice::from_is_discount( + entry_anchor == Cents::ZERO || block_price <= entry_anchor, + ); + // Push current block state before processing cohort updates chain_state.push(BlockState { supply: transacted.spendable_supply, + entry, price: block_price, timestamp, }); @@ -411,7 +417,7 @@ pub(crate) fn process_blocks( || { // UTXO cohorts receive/send vecs.utxo_cohorts - .receive(transacted, height, timestamp, block_price); + .receive(transacted, height, timestamp, block_price, entry); if let Some(min_h) = vecs.utxo_cohorts .send(height_to_sent, chain_state, ctx.price_range_max) @@ -460,7 +466,7 @@ pub(crate) fn process_blocks( let is_last_of_day = is_last_of_day[offset]; let date_opt = is_last_of_day.then(|| Date::from(timestamp)); - push_cohort_states( + entry_anchor = push_cohort_states( &mut vecs.utxo_cohorts, &mut vecs.addr_cohorts, height, @@ -527,7 +533,7 @@ fn push_cohort_states( addr_cohorts: &mut AddrCohorts, height: Height, height_price: Cents, -) { +) -> Cents { // Phase 1: push + unrealized (no reset yet, states still needed for aggregation) rayon::join( || { @@ -545,7 +551,7 @@ fn push_cohort_states( ); // Phase 2: aggregate age_range states → push to overlapping cohorts - utxo_cohorts.push_overlapping(height_price); + let all_capitalized_price = utxo_cohorts.push_overlapping(height_price); // Phase 3: reset per-block values utxo_cohorts @@ -554,4 +560,6 @@ fn push_cohort_states( addr_cohorts .iter_separate_mut() .for_each(|v| v.reset_single_iteration_values()); + + all_capitalized_price } diff --git a/crates/brk_computer/src/distribution/metrics/realized/full.rs b/crates/brk_computer/src/distribution/metrics/realized/full.rs index 76832a6b4..bc0359c43 100644 --- a/crates/brk_computer/src/distribution/metrics/realized/full.rs +++ b/crates/brk_computer/src/distribution/metrics/realized/full.rs @@ -206,7 +206,7 @@ impl RealizedFull { } #[inline(always)] - pub(crate) fn push_accum(&mut self, accum: &RealizedFullAccum) { + pub(crate) fn push_accum(&mut self, accum: &RealizedFullAccum) -> Cents { self.cap_raw.push(accum.cap_raw); self.capitalized.cap_raw.push(accum.capitalized_cap_raw); @@ -221,6 +221,8 @@ impl RealizedFull { self.capitalized.price.cents.height.push(capitalized_price); self.peak_regret.value.block.cents.push(accum.peak_regret()); + + capitalized_price } pub(crate) fn compute_rest_part1( diff --git a/crates/brk_computer/src/distribution/state/block.rs b/crates/brk_computer/src/distribution/state/block.rs index ffa340b09..f29f410cd 100644 --- a/crates/brk_computer/src/distribution/state/block.rs +++ b/crates/brk_computer/src/distribution/state/block.rs @@ -1,5 +1,6 @@ use std::ops::{Add, AddAssign, SubAssign}; +use brk_cohort::EntryPrice; use brk_types::{Cents, SupplyState, Timestamp}; use serde::Serialize; @@ -8,6 +9,8 @@ pub struct BlockState { #[serde(flatten)] pub supply: SupplyState, #[serde(skip)] + pub entry: EntryPrice, + #[serde(skip)] pub price: Cents, #[serde(skip)] pub timestamp: Timestamp, diff --git a/crates/brk_computer/src/distribution/vecs.rs b/crates/brk_computer/src/distribution/vecs.rs index 9c948f74b..55fde91bd 100644 --- a/crates/brk_computer/src/distribution/vecs.rs +++ b/crates/brk_computer/src/distribution/vecs.rs @@ -1,6 +1,6 @@ use std::path::{Path, PathBuf}; -use brk_cohort::{ByAddrType, Filter}; +use brk_cohort::{ByAddrType, EntryPrice, Filter}; use brk_error::Result; use brk_indexer::Indexer; use brk_traversable::Traversable; @@ -436,13 +436,34 @@ impl Vecs { let end = usize::from(recovered_height); debug!("building supply_state vec for {} heights", recovered_height); let supply_state_data: Vec<_> = self.supply_state.collect_range_at(0, end); + let capitalized_price_data: Vec<_> = self + .utxo_cohorts + .all + .metrics + .realized + .capitalized + .price + .cents + .height + .collect_range_at(0, end); + + let mut entry_anchor = Cents::ZERO; chain_state = supply_state_data .into_iter() .enumerate() - .map(|(h, supply)| BlockState { - supply, - price: self.caches.prices[h], - timestamp: self.caches.timestamps[h], + .map(|(h, supply)| { + let price = self.caches.prices[h]; + let entry = EntryPrice::from_is_discount( + entry_anchor == Cents::ZERO || price <= entry_anchor, + ); + entry_anchor = capitalized_price_data[h]; + + BlockState { + supply, + entry, + price, + timestamp: self.caches.timestamps[h], + } }) .collect(); debug!("chain_state rebuilt"); @@ -474,6 +495,20 @@ impl Vecs { let prices = std::mem::take(&mut self.caches.prices); let timestamps = std::mem::take(&mut self.caches.timestamps); let price_range_max = std::mem::take(&mut self.caches.price_range_max); + let entry_anchor = starting_height + .decremented() + .and_then(|height| { + self.utxo_cohorts + .all + .metrics + .realized + .capitalized + .price + .cents + .height + .collect_one(height) + }) + .unwrap_or(Cents::ZERO); process_blocks( self, @@ -486,6 +521,7 @@ impl Vecs { last_height, &mut chain_state, &mut tx_index_to_height, + entry_anchor, &prices, ×tamps, &price_range_max, diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 557cc118c..4b03a4d6d 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -2506,6 +2506,22 @@ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { * @property {AdjustedRatioValuePattern} sopr */ +/** + * @typedef {Object} CapCapitalizedGrossLossMvrvNetPeakPriceProfitSellSoprPattern2 + * @property {CentsDeltaToUsdPattern} cap + * @property {PricePattern} capitalized + * @property {BlockCumulativeSumPattern} grossPnl + * @property {BlockCumulativeNegativeSumPattern} loss + * @property {SeriesPattern1} mvrv + * @property {BlockChangeCumulativeDeltaSumPattern} netPnl + * @property {BlockCumulativeSumPattern} peakRegret + * @property {BpsCentsPercentilesRatioSatsSmaStdUsdPattern} price + * @property {BlockCumulativeSumPattern} profit + * @property {_1m1w1y24hPattern} profitToLossRatio + * @property {_1m1w1y24hPattern8} sellSideRiskRatio + * @property {RatioValuePattern2} sopr + */ + /** * @typedef {Object} EmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2 * @property {_1m1w1y24hBpsPercentRatioPattern} empty @@ -3017,6 +3033,17 @@ function create_1m1w1y24hBpsPercentRatioPattern(client, acc) { * @property {_1m1w1y24hBpsPercentRatioPattern} spendableOutputToReusedAddrShare */ +/** + * @typedef {Object} ActivityCostInvestedOutputsRealizedSupplyUnrealizedPattern2 + * @property {CoindaysCoinyearsDormancyTransferPattern} activity + * @property {InMaxMinPerSupplyPattern} costBasis + * @property {InPattern} investedCapital + * @property {SpendingSpentUnspentPattern} outputs + * @property {CapCapitalizedGrossLossMvrvNetPeakPriceProfitSellSoprPattern2} realized + * @property {DeltaDominanceHalfInTotalPattern2} supply + * @property {CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2} unrealized + */ + /** * @typedef {Object} CapLossMvrvNetPriceProfitSoprPattern * @property {CentsDeltaUsdPattern} cap @@ -5046,6 +5073,25 @@ function createPriceRatioPattern(client, acc, disc) { }; } +/** + * @typedef {Object} RatioValuePattern2 + * @property {_1m1w1y24hPattern} ratio + * @property {AverageBlockCumulativeSumPattern} valueDestroyed + */ + +/** + * Create a RatioValuePattern2 pattern node + * @param {BrkClient} client + * @param {string} acc - Accumulated series name + * @returns {RatioValuePattern2} + */ +function createRatioValuePattern2(client, acc) { + return { + ratio: create_1m1w1y24hPattern(client, _m(acc, 'sopr')), + valueDestroyed: createAverageBlockCumulativeSumPattern(client, _m(acc, 'value_destroyed')), + }; +} + /** * @typedef {Object} RatioValuePattern * @property {_24hPattern} ratio @@ -6787,6 +6833,7 @@ function createTransferPattern(client, acc) { * @property {SeriesTree_Cohorts_Utxo_OverAge} overAge * @property {SeriesTree_Cohorts_Utxo_Epoch} epoch * @property {SeriesTree_Cohorts_Utxo_Class} class + * @property {SeriesTree_Cohorts_Utxo_Entry} entry * @property {SeriesTree_Cohorts_Utxo_OverAmount} overAmount * @property {SeriesTree_Cohorts_Utxo_AmountRange} amountRange * @property {SeriesTree_Cohorts_Utxo_UnderAmount} underAmount @@ -7144,7 +7191,7 @@ function createTransferPattern(client, acc) { * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Price} price * @property {SeriesPattern1} mvrv * @property {BlockChangeCumulativeDeltaSumPattern} netPnl - * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr} sopr + * @property {RatioValuePattern2} sopr * @property {BlockCumulativeSumPattern} grossPnl * @property {_1m1w1y24hPattern8} sellSideRiskRatio * @property {BlockCumulativeSumPattern} peakRegret @@ -7248,12 +7295,6 @@ function createTransferPattern(client, acc) { * @property {PriceRatioPattern} m3sd */ -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr - * @property {AverageBlockCumulativeSumPattern} valueDestroyed - * @property {_1m1w1y24hPattern} ratio - */ - /** * @typedef {Object} SeriesTree_Cohorts_Utxo_AgeRange * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} under1h @@ -7354,6 +7395,258 @@ function createTransferPattern(client, acc) { * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2026 */ +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry + * @property {SeriesTree_Cohorts_Utxo_Entry_Discount} discount + * @property {SeriesTree_Cohorts_Utxo_Entry_Premium} premium + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Discount + * @property {DeltaDominanceHalfInTotalPattern2} supply + * @property {SpendingSpentUnspentPattern} outputs + * @property {CoindaysCoinyearsDormancyTransferPattern} activity + * @property {SeriesTree_Cohorts_Utxo_Entry_Discount_Realized} realized + * @property {InMaxMinPerSupplyPattern} costBasis + * @property {CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2} unrealized + * @property {InPattern} investedCapital + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Discount_Realized + * @property {CentsDeltaToUsdPattern} cap + * @property {BlockCumulativeSumPattern} profit + * @property {BlockCumulativeNegativeSumPattern} loss + * @property {SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price} price + * @property {SeriesPattern1} mvrv + * @property {BlockChangeCumulativeDeltaSumPattern} netPnl + * @property {RatioValuePattern2} sopr + * @property {BlockCumulativeSumPattern} grossPnl + * @property {_1m1w1y24hPattern8} sellSideRiskRatio + * @property {BlockCumulativeSumPattern} peakRegret + * @property {PricePattern} capitalized + * @property {_1m1w1y24hPattern} profitToLossRatio + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price + * @property {SeriesPattern1} usd + * @property {SeriesPattern1} cents + * @property {SeriesPattern1} sats + * @property {SeriesPattern1} bps + * @property {SeriesPattern1} ratio + * @property {Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles + * @property {_1m1w1y2y4yAllPattern} sma + * @property {SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev} stdDev + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev + * @property {SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_All} all + * @property {SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_4y} _4y + * @property {SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_2y} _2y + * @property {SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_1y} _1y + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_All + * @property {SeriesPattern1} sd + * @property {SeriesPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_4y + * @property {SeriesPattern1} sd + * @property {SeriesPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_2y + * @property {SeriesPattern1} sd + * @property {SeriesPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_1y + * @property {SeriesPattern1} sd + * @property {SeriesPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Premium + * @property {DeltaDominanceHalfInTotalPattern2} supply + * @property {SpendingSpentUnspentPattern} outputs + * @property {CoindaysCoinyearsDormancyTransferPattern} activity + * @property {SeriesTree_Cohorts_Utxo_Entry_Premium_Realized} realized + * @property {InMaxMinPerSupplyPattern} costBasis + * @property {CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2} unrealized + * @property {InPattern} investedCapital + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Premium_Realized + * @property {CentsDeltaToUsdPattern} cap + * @property {BlockCumulativeSumPattern} profit + * @property {BlockCumulativeNegativeSumPattern} loss + * @property {SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price} price + * @property {SeriesPattern1} mvrv + * @property {BlockChangeCumulativeDeltaSumPattern} netPnl + * @property {RatioValuePattern2} sopr + * @property {BlockCumulativeSumPattern} grossPnl + * @property {_1m1w1y24hPattern8} sellSideRiskRatio + * @property {BlockCumulativeSumPattern} peakRegret + * @property {PricePattern} capitalized + * @property {_1m1w1y24hPattern} profitToLossRatio + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price + * @property {SeriesPattern1} usd + * @property {SeriesPattern1} cents + * @property {SeriesPattern1} sats + * @property {SeriesPattern1} bps + * @property {SeriesPattern1} ratio + * @property {Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles + * @property {_1m1w1y2y4yAllPattern} sma + * @property {SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev} stdDev + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev + * @property {SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_All} all + * @property {SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_4y} _4y + * @property {SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_2y} _2y + * @property {SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_1y} _1y + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_All + * @property {SeriesPattern1} sd + * @property {SeriesPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_4y + * @property {SeriesPattern1} sd + * @property {SeriesPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_2y + * @property {SeriesPattern1} sd + * @property {SeriesPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + +/** + * @typedef {Object} SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_1y + * @property {SeriesPattern1} sd + * @property {SeriesPattern1} zscore + * @property {CentsSatsUsdPattern} _0sd + * @property {PriceRatioPattern} p05sd + * @property {PriceRatioPattern} p1sd + * @property {PriceRatioPattern} p15sd + * @property {PriceRatioPattern} p2sd + * @property {PriceRatioPattern} p25sd + * @property {PriceRatioPattern} p3sd + * @property {PriceRatioPattern} m05sd + * @property {PriceRatioPattern} m1sd + * @property {PriceRatioPattern} m15sd + * @property {PriceRatioPattern} m2sd + * @property {PriceRatioPattern} m25sd + * @property {PriceRatioPattern} m3sd + */ + /** * @typedef {Object} SeriesTree_Cohorts_Utxo_OverAmount * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1sat @@ -7919,6 +8212,19 @@ class BrkClient extends BrkClientBase { } }); + ENTRY_NAMES = /** @type {const} */ ({ + "discount": { + "id": "veteran", + "short": "Veteran", + "long": "Veteran Coins" + }, + "premium": { + "id": "rookie", + "short": "Rookie", + "long": "Rookie Coins" + } + }); + SPENDABLE_TYPE_NAMES = /** @type {const} */ ({ "p2pk65": { "id": "p2pk65", @@ -10239,10 +10545,7 @@ class BrkClient extends BrkClientBase { }, mvrv: createSeriesPattern1(this, 'lth_mvrv'), netPnl: createBlockChangeCumulativeDeltaSumPattern(this, 'lth_net'), - sopr: { - valueDestroyed: createAverageBlockCumulativeSumPattern(this, 'lth_value_destroyed'), - ratio: create_1m1w1y24hPattern(this, 'lth_sopr'), - }, + sopr: createRatioValuePattern2(this, 'lth'), grossPnl: createBlockCumulativeSumPattern(this, 'lth_realized_gross_pnl'), sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'lth_sell_side_risk_ratio'), peakRegret: createBlockCumulativeSumPattern(this, 'lth_realized_peak_regret'), @@ -10343,6 +10646,208 @@ class BrkClient extends BrkClientBase { _2025: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2025'), _2026: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2026'), }, + entry: { + discount: { + supply: createDeltaDominanceHalfInTotalPattern2(this, 'veteran_supply'), + outputs: createSpendingSpentUnspentPattern(this, 'veteran'), + activity: createCoindaysCoinyearsDormancyTransferPattern(this, 'veteran'), + realized: { + cap: createCentsDeltaToUsdPattern(this, 'veteran_realized_cap'), + profit: createBlockCumulativeSumPattern(this, 'veteran_realized_profit'), + loss: createBlockCumulativeNegativeSumPattern(this, 'veteran_realized_loss'), + price: { + usd: createSeriesPattern1(this, 'veteran_realized_price'), + cents: createSeriesPattern1(this, 'veteran_realized_price_cents'), + sats: createSeriesPattern1(this, 'veteran_realized_price_sats'), + bps: createSeriesPattern1(this, 'veteran_realized_price_ratio_bps'), + ratio: createSeriesPattern1(this, 'veteran_realized_price_ratio'), + percentiles: createPct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern(this, 'veteran_realized_price'), + sma: create_1m1w1y2y4yAllPattern(this, 'veteran_realized_price_ratio_sma'), + stdDev: { + all: { + sd: createSeriesPattern1(this, 'veteran_realized_price_ratio_sd'), + zscore: createSeriesPattern1(this, 'veteran_realized_price_ratio_zscore'), + _0sd: createCentsSatsUsdPattern(this, 'veteran_realized_price_0sd'), + p05sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p0_5sd'), + p1sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p1sd'), + p15sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p1_5sd'), + p2sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p2sd'), + p25sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p2_5sd'), + p3sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p3sd'), + m05sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm0_5sd'), + m1sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm1sd'), + m15sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm1_5sd'), + m2sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm2sd'), + m25sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm2_5sd'), + m3sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm3sd'), + }, + _4y: { + sd: createSeriesPattern1(this, 'veteran_realized_price_ratio_sd_4y'), + zscore: createSeriesPattern1(this, 'veteran_realized_price_ratio_zscore_4y'), + _0sd: createCentsSatsUsdPattern(this, 'veteran_realized_price_0sd_4y'), + p05sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p0_5sd_4y'), + p1sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p1sd_4y'), + p15sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p1_5sd_4y'), + p2sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p2sd_4y'), + p25sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p2_5sd_4y'), + p3sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p3sd_4y'), + m05sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm0_5sd_4y'), + m1sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm1sd_4y'), + m15sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm1_5sd_4y'), + m2sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm2sd_4y'), + m25sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm2_5sd_4y'), + m3sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm3sd_4y'), + }, + _2y: { + sd: createSeriesPattern1(this, 'veteran_realized_price_ratio_sd_2y'), + zscore: createSeriesPattern1(this, 'veteran_realized_price_ratio_zscore_2y'), + _0sd: createCentsSatsUsdPattern(this, 'veteran_realized_price_0sd_2y'), + p05sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p0_5sd_2y'), + p1sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p1sd_2y'), + p15sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p1_5sd_2y'), + p2sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p2sd_2y'), + p25sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p2_5sd_2y'), + p3sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p3sd_2y'), + m05sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm0_5sd_2y'), + m1sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm1sd_2y'), + m15sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm1_5sd_2y'), + m2sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm2sd_2y'), + m25sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm2_5sd_2y'), + m3sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm3sd_2y'), + }, + _1y: { + sd: createSeriesPattern1(this, 'veteran_realized_price_ratio_sd_1y'), + zscore: createSeriesPattern1(this, 'veteran_realized_price_ratio_zscore_1y'), + _0sd: createCentsSatsUsdPattern(this, 'veteran_realized_price_0sd_1y'), + p05sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p0_5sd_1y'), + p1sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p1sd_1y'), + p15sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p1_5sd_1y'), + p2sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p2sd_1y'), + p25sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p2_5sd_1y'), + p3sd: createPriceRatioPattern(this, 'veteran_realized_price', 'p3sd_1y'), + m05sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm0_5sd_1y'), + m1sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm1sd_1y'), + m15sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm1_5sd_1y'), + m2sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm2sd_1y'), + m25sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm2_5sd_1y'), + m3sd: createPriceRatioPattern(this, 'veteran_realized_price', 'm3sd_1y'), + }, + }, + }, + mvrv: createSeriesPattern1(this, 'veteran_mvrv'), + netPnl: createBlockChangeCumulativeDeltaSumPattern(this, 'veteran_net'), + sopr: createRatioValuePattern2(this, 'veteran'), + grossPnl: createBlockCumulativeSumPattern(this, 'veteran_realized_gross_pnl'), + sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'veteran_sell_side_risk_ratio'), + peakRegret: createBlockCumulativeSumPattern(this, 'veteran_realized_peak_regret'), + capitalized: createPricePattern(this, 'veteran_capitalized_price'), + profitToLossRatio: create_1m1w1y24hPattern(this, 'veteran_realized_profit_to_loss_ratio'), + }, + costBasis: createInMaxMinPerSupplyPattern(this, 'veteran'), + unrealized: createCapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2(this, 'veteran'), + investedCapital: createInPattern(this, 'veteran_invested_capital_in'), + }, + premium: { + supply: createDeltaDominanceHalfInTotalPattern2(this, 'rookie_supply'), + outputs: createSpendingSpentUnspentPattern(this, 'rookie'), + activity: createCoindaysCoinyearsDormancyTransferPattern(this, 'rookie'), + realized: { + cap: createCentsDeltaToUsdPattern(this, 'rookie_realized_cap'), + profit: createBlockCumulativeSumPattern(this, 'rookie_realized_profit'), + loss: createBlockCumulativeNegativeSumPattern(this, 'rookie_realized_loss'), + price: { + usd: createSeriesPattern1(this, 'rookie_realized_price'), + cents: createSeriesPattern1(this, 'rookie_realized_price_cents'), + sats: createSeriesPattern1(this, 'rookie_realized_price_sats'), + bps: createSeriesPattern1(this, 'rookie_realized_price_ratio_bps'), + ratio: createSeriesPattern1(this, 'rookie_realized_price_ratio'), + percentiles: createPct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern(this, 'rookie_realized_price'), + sma: create_1m1w1y2y4yAllPattern(this, 'rookie_realized_price_ratio_sma'), + stdDev: { + all: { + sd: createSeriesPattern1(this, 'rookie_realized_price_ratio_sd'), + zscore: createSeriesPattern1(this, 'rookie_realized_price_ratio_zscore'), + _0sd: createCentsSatsUsdPattern(this, 'rookie_realized_price_0sd'), + p05sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p0_5sd'), + p1sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p1sd'), + p15sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p1_5sd'), + p2sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p2sd'), + p25sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p2_5sd'), + p3sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p3sd'), + m05sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm0_5sd'), + m1sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm1sd'), + m15sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm1_5sd'), + m2sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm2sd'), + m25sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm2_5sd'), + m3sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm3sd'), + }, + _4y: { + sd: createSeriesPattern1(this, 'rookie_realized_price_ratio_sd_4y'), + zscore: createSeriesPattern1(this, 'rookie_realized_price_ratio_zscore_4y'), + _0sd: createCentsSatsUsdPattern(this, 'rookie_realized_price_0sd_4y'), + p05sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p0_5sd_4y'), + p1sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p1sd_4y'), + p15sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p1_5sd_4y'), + p2sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p2sd_4y'), + p25sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p2_5sd_4y'), + p3sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p3sd_4y'), + m05sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm0_5sd_4y'), + m1sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm1sd_4y'), + m15sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm1_5sd_4y'), + m2sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm2sd_4y'), + m25sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm2_5sd_4y'), + m3sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm3sd_4y'), + }, + _2y: { + sd: createSeriesPattern1(this, 'rookie_realized_price_ratio_sd_2y'), + zscore: createSeriesPattern1(this, 'rookie_realized_price_ratio_zscore_2y'), + _0sd: createCentsSatsUsdPattern(this, 'rookie_realized_price_0sd_2y'), + p05sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p0_5sd_2y'), + p1sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p1sd_2y'), + p15sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p1_5sd_2y'), + p2sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p2sd_2y'), + p25sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p2_5sd_2y'), + p3sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p3sd_2y'), + m05sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm0_5sd_2y'), + m1sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm1sd_2y'), + m15sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm1_5sd_2y'), + m2sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm2sd_2y'), + m25sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm2_5sd_2y'), + m3sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm3sd_2y'), + }, + _1y: { + sd: createSeriesPattern1(this, 'rookie_realized_price_ratio_sd_1y'), + zscore: createSeriesPattern1(this, 'rookie_realized_price_ratio_zscore_1y'), + _0sd: createCentsSatsUsdPattern(this, 'rookie_realized_price_0sd_1y'), + p05sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p0_5sd_1y'), + p1sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p1sd_1y'), + p15sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p1_5sd_1y'), + p2sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p2sd_1y'), + p25sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p2_5sd_1y'), + p3sd: createPriceRatioPattern(this, 'rookie_realized_price', 'p3sd_1y'), + m05sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm0_5sd_1y'), + m1sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm1sd_1y'), + m15sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm1_5sd_1y'), + m2sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm2sd_1y'), + m25sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm2_5sd_1y'), + m3sd: createPriceRatioPattern(this, 'rookie_realized_price', 'm3sd_1y'), + }, + }, + }, + mvrv: createSeriesPattern1(this, 'rookie_mvrv'), + netPnl: createBlockChangeCumulativeDeltaSumPattern(this, 'rookie_net'), + sopr: createRatioValuePattern2(this, 'rookie'), + grossPnl: createBlockCumulativeSumPattern(this, 'rookie_realized_gross_pnl'), + sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'rookie_sell_side_risk_ratio'), + peakRegret: createBlockCumulativeSumPattern(this, 'rookie_realized_peak_regret'), + capitalized: createPricePattern(this, 'rookie_capitalized_price'), + profitToLossRatio: create_1m1w1y24hPattern(this, 'rookie_realized_profit_to_loss_ratio'), + }, + costBasis: createInMaxMinPerSupplyPattern(this, 'rookie'), + unrealized: createCapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2(this, 'rookie'), + investedCapital: createInPattern(this, 'rookie_invested_capital_in'), + }, + }, overAmount: { _1sat: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_1sat'), _10sats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_10sats'), diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 1e695474c..a7f420bec 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -2954,6 +2954,10 @@ class CapCapitalizedGrossLossMvrvNetPeakPriceProfitSellSoprPattern: """Pattern struct for repeated tree structure.""" pass +class CapCapitalizedGrossLossMvrvNetPeakPriceProfitSellSoprPattern2: + """Pattern struct for repeated tree structure.""" + pass + class EmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2: """Pattern struct for repeated tree structure.""" @@ -3181,6 +3185,10 @@ class ActiveInputOutputSpendablePattern: """Pattern struct for repeated tree structure.""" pass +class ActivityCostInvestedOutputsRealizedSupplyUnrealizedPattern2: + """Pattern struct for repeated tree structure.""" + pass + class CapLossMvrvNetPriceProfitSoprPattern: """Pattern struct for repeated tree structure.""" @@ -4056,6 +4064,14 @@ class PriceRatioPattern: self.price: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, disc)) self.ratio: SeriesPattern1[StoredF32] = SeriesPattern1(client, _m(acc, f'ratio_{disc}')) +class RatioValuePattern2: + """Pattern struct for repeated tree structure.""" + + def __init__(self, client: BrkClient, acc: str): + """Create pattern node with accumulated series name.""" + self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'sopr')) + self.value_destroyed: AverageBlockCumulativeSumPattern[Cents] = AverageBlockCumulativeSumPattern(client, _m(acc, 'value_destroyed')) + class RatioValuePattern: """Pattern struct for repeated tree structure.""" @@ -6299,13 +6315,6 @@ class SeriesTree_Cohorts_Utxo_Lth_Realized_Price: self.sma: _1m1w1y2y4yAllPattern = _1m1w1y2y4yAllPattern(client, 'lth_realized_price_ratio_sma') self.std_dev: SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev = SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev(client) -class SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr: - """Series tree node.""" - - def __init__(self, client: BrkClient, base_path: str = ''): - self.value_destroyed: AverageBlockCumulativeSumPattern[Cents] = AverageBlockCumulativeSumPattern(client, 'lth_value_destroyed') - self.ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'lth_sopr') - class SeriesTree_Cohorts_Utxo_Lth_Realized: """Series tree node.""" @@ -6316,7 +6325,7 @@ class SeriesTree_Cohorts_Utxo_Lth_Realized: self.price: SeriesTree_Cohorts_Utxo_Lth_Realized_Price = SeriesTree_Cohorts_Utxo_Lth_Realized_Price(client) self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'lth_mvrv') self.net_pnl: BlockChangeCumulativeDeltaSumPattern = BlockChangeCumulativeDeltaSumPattern(client, 'lth_net') - self.sopr: SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr = SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr(client) + self.sopr: RatioValuePattern2 = RatioValuePattern2(client, 'lth') self.gross_pnl: BlockCumulativeSumPattern = BlockCumulativeSumPattern(client, 'lth_realized_gross_pnl') self.sell_side_risk_ratio: _1m1w1y24hPattern8 = _1m1w1y24hPattern8(client, 'lth_sell_side_risk_ratio') self.peak_regret: BlockCumulativeSumPattern = BlockCumulativeSumPattern(client, 'lth_realized_peak_regret') @@ -6440,6 +6449,275 @@ class SeriesTree_Cohorts_Utxo_Class: self._2025: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'class_2025') self._2026: ActivityOutputsRealizedSupplyUnrealizedPattern = ActivityOutputsRealizedSupplyUnrealizedPattern(client, 'class_2026') +class SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_All: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.sd: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_realized_price_ratio_sd') + self.zscore: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_realized_price_ratio_zscore') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'veteran_realized_price_0sd') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p0_5sd') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p1sd') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p1_5sd') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p2sd') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p2_5sd') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p3sd') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm0_5sd') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm1sd') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm1_5sd') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm2sd') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm2_5sd') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm3sd') + +class SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_4y: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.sd: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_realized_price_ratio_sd_4y') + self.zscore: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_realized_price_ratio_zscore_4y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'veteran_realized_price_0sd_4y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p0_5sd_4y') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p1sd_4y') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p1_5sd_4y') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p2sd_4y') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p2_5sd_4y') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p3sd_4y') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm0_5sd_4y') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm1sd_4y') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm1_5sd_4y') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm2sd_4y') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm2_5sd_4y') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm3sd_4y') + +class SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_2y: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.sd: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_realized_price_ratio_sd_2y') + self.zscore: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_realized_price_ratio_zscore_2y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'veteran_realized_price_0sd_2y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p0_5sd_2y') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p1sd_2y') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p1_5sd_2y') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p2sd_2y') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p2_5sd_2y') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p3sd_2y') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm0_5sd_2y') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm1sd_2y') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm1_5sd_2y') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm2sd_2y') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm2_5sd_2y') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm3sd_2y') + +class SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_1y: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.sd: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_realized_price_ratio_sd_1y') + self.zscore: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_realized_price_ratio_zscore_1y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'veteran_realized_price_0sd_1y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p0_5sd_1y') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p1sd_1y') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p1_5sd_1y') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p2sd_1y') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p2_5sd_1y') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'p3sd_1y') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm0_5sd_1y') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm1sd_1y') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm1_5sd_1y') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm2sd_1y') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm2_5sd_1y') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'veteran_realized_price', 'm3sd_1y') + +class SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.all: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_All = SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_All(client) + self._4y: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_4y = SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_4y(client) + self._2y: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_2y = SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_2y(client) + self._1y: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_1y = SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev_1y(client) + +class SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, 'veteran_realized_price') + self.cents: SeriesPattern1[Cents] = SeriesPattern1(client, 'veteran_realized_price_cents') + self.sats: SeriesPattern1[SatsFract] = SeriesPattern1(client, 'veteran_realized_price_sats') + self.bps: SeriesPattern1[BasisPoints32] = SeriesPattern1(client, 'veteran_realized_price_ratio_bps') + self.ratio: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_realized_price_ratio') + self.percentiles: Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern = Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, 'veteran_realized_price') + self.sma: _1m1w1y2y4yAllPattern = _1m1w1y2y4yAllPattern(client, 'veteran_realized_price_ratio_sma') + self.std_dev: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev = SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price_StdDev(client) + +class SeriesTree_Cohorts_Utxo_Entry_Discount_Realized: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.cap: CentsDeltaToUsdPattern = CentsDeltaToUsdPattern(client, 'veteran_realized_cap') + self.profit: BlockCumulativeSumPattern = BlockCumulativeSumPattern(client, 'veteran_realized_profit') + self.loss: BlockCumulativeNegativeSumPattern = BlockCumulativeNegativeSumPattern(client, 'veteran_realized_loss') + self.price: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price = SeriesTree_Cohorts_Utxo_Entry_Discount_Realized_Price(client) + self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'veteran_mvrv') + self.net_pnl: BlockChangeCumulativeDeltaSumPattern = BlockChangeCumulativeDeltaSumPattern(client, 'veteran_net') + self.sopr: RatioValuePattern2 = RatioValuePattern2(client, 'veteran') + self.gross_pnl: BlockCumulativeSumPattern = BlockCumulativeSumPattern(client, 'veteran_realized_gross_pnl') + self.sell_side_risk_ratio: _1m1w1y24hPattern8 = _1m1w1y24hPattern8(client, 'veteran_sell_side_risk_ratio') + self.peak_regret: BlockCumulativeSumPattern = BlockCumulativeSumPattern(client, 'veteran_realized_peak_regret') + self.capitalized: PricePattern = PricePattern(client, 'veteran_capitalized_price') + self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'veteran_realized_profit_to_loss_ratio') + +class SeriesTree_Cohorts_Utxo_Entry_Discount: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.supply: DeltaDominanceHalfInTotalPattern2 = DeltaDominanceHalfInTotalPattern2(client, 'veteran_supply') + self.outputs: SpendingSpentUnspentPattern = SpendingSpentUnspentPattern(client, 'veteran') + self.activity: CoindaysCoinyearsDormancyTransferPattern = CoindaysCoinyearsDormancyTransferPattern(client, 'veteran') + self.realized: SeriesTree_Cohorts_Utxo_Entry_Discount_Realized = SeriesTree_Cohorts_Utxo_Entry_Discount_Realized(client) + self.cost_basis: InMaxMinPerSupplyPattern = InMaxMinPerSupplyPattern(client, 'veteran') + self.unrealized: CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2 = CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2(client, 'veteran') + self.invested_capital: InPattern = InPattern(client, 'veteran_invested_capital_in') + +class SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_All: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.sd: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_realized_price_ratio_sd') + self.zscore: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_realized_price_ratio_zscore') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'rookie_realized_price_0sd') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p0_5sd') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p1sd') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p1_5sd') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p2sd') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p2_5sd') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p3sd') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm0_5sd') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm1sd') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm1_5sd') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm2sd') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm2_5sd') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm3sd') + +class SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_4y: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.sd: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_realized_price_ratio_sd_4y') + self.zscore: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_realized_price_ratio_zscore_4y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'rookie_realized_price_0sd_4y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p0_5sd_4y') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p1sd_4y') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p1_5sd_4y') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p2sd_4y') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p2_5sd_4y') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p3sd_4y') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm0_5sd_4y') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm1sd_4y') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm1_5sd_4y') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm2sd_4y') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm2_5sd_4y') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm3sd_4y') + +class SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_2y: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.sd: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_realized_price_ratio_sd_2y') + self.zscore: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_realized_price_ratio_zscore_2y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'rookie_realized_price_0sd_2y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p0_5sd_2y') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p1sd_2y') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p1_5sd_2y') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p2sd_2y') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p2_5sd_2y') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p3sd_2y') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm0_5sd_2y') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm1sd_2y') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm1_5sd_2y') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm2sd_2y') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm2_5sd_2y') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm3sd_2y') + +class SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_1y: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.sd: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_realized_price_ratio_sd_1y') + self.zscore: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_realized_price_ratio_zscore_1y') + self._0sd: CentsSatsUsdPattern = CentsSatsUsdPattern(client, 'rookie_realized_price_0sd_1y') + self.p0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p0_5sd_1y') + self.p1sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p1sd_1y') + self.p1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p1_5sd_1y') + self.p2sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p2sd_1y') + self.p2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p2_5sd_1y') + self.p3sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'p3sd_1y') + self.m0_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm0_5sd_1y') + self.m1sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm1sd_1y') + self.m1_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm1_5sd_1y') + self.m2sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm2sd_1y') + self.m2_5sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm2_5sd_1y') + self.m3sd: PriceRatioPattern = PriceRatioPattern(client, 'rookie_realized_price', 'm3sd_1y') + +class SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.all: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_All = SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_All(client) + self._4y: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_4y = SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_4y(client) + self._2y: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_2y = SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_2y(client) + self._1y: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_1y = SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev_1y(client) + +class SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.usd: SeriesPattern1[Dollars] = SeriesPattern1(client, 'rookie_realized_price') + self.cents: SeriesPattern1[Cents] = SeriesPattern1(client, 'rookie_realized_price_cents') + self.sats: SeriesPattern1[SatsFract] = SeriesPattern1(client, 'rookie_realized_price_sats') + self.bps: SeriesPattern1[BasisPoints32] = SeriesPattern1(client, 'rookie_realized_price_ratio_bps') + self.ratio: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_realized_price_ratio') + self.percentiles: Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern = Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, 'rookie_realized_price') + self.sma: _1m1w1y2y4yAllPattern = _1m1w1y2y4yAllPattern(client, 'rookie_realized_price_ratio_sma') + self.std_dev: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev = SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price_StdDev(client) + +class SeriesTree_Cohorts_Utxo_Entry_Premium_Realized: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.cap: CentsDeltaToUsdPattern = CentsDeltaToUsdPattern(client, 'rookie_realized_cap') + self.profit: BlockCumulativeSumPattern = BlockCumulativeSumPattern(client, 'rookie_realized_profit') + self.loss: BlockCumulativeNegativeSumPattern = BlockCumulativeNegativeSumPattern(client, 'rookie_realized_loss') + self.price: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price = SeriesTree_Cohorts_Utxo_Entry_Premium_Realized_Price(client) + self.mvrv: SeriesPattern1[StoredF32] = SeriesPattern1(client, 'rookie_mvrv') + self.net_pnl: BlockChangeCumulativeDeltaSumPattern = BlockChangeCumulativeDeltaSumPattern(client, 'rookie_net') + self.sopr: RatioValuePattern2 = RatioValuePattern2(client, 'rookie') + self.gross_pnl: BlockCumulativeSumPattern = BlockCumulativeSumPattern(client, 'rookie_realized_gross_pnl') + self.sell_side_risk_ratio: _1m1w1y24hPattern8 = _1m1w1y24hPattern8(client, 'rookie_sell_side_risk_ratio') + self.peak_regret: BlockCumulativeSumPattern = BlockCumulativeSumPattern(client, 'rookie_realized_peak_regret') + self.capitalized: PricePattern = PricePattern(client, 'rookie_capitalized_price') + self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, 'rookie_realized_profit_to_loss_ratio') + +class SeriesTree_Cohorts_Utxo_Entry_Premium: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.supply: DeltaDominanceHalfInTotalPattern2 = DeltaDominanceHalfInTotalPattern2(client, 'rookie_supply') + self.outputs: SpendingSpentUnspentPattern = SpendingSpentUnspentPattern(client, 'rookie') + self.activity: CoindaysCoinyearsDormancyTransferPattern = CoindaysCoinyearsDormancyTransferPattern(client, 'rookie') + self.realized: SeriesTree_Cohorts_Utxo_Entry_Premium_Realized = SeriesTree_Cohorts_Utxo_Entry_Premium_Realized(client) + self.cost_basis: InMaxMinPerSupplyPattern = InMaxMinPerSupplyPattern(client, 'rookie') + self.unrealized: CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2 = CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2(client, 'rookie') + self.invested_capital: InPattern = InPattern(client, 'rookie_invested_capital_in') + +class SeriesTree_Cohorts_Utxo_Entry: + """Series tree node.""" + + def __init__(self, client: BrkClient, base_path: str = ''): + self.discount: SeriesTree_Cohorts_Utxo_Entry_Discount = SeriesTree_Cohorts_Utxo_Entry_Discount(client) + self.premium: SeriesTree_Cohorts_Utxo_Entry_Premium = SeriesTree_Cohorts_Utxo_Entry_Premium(client) + class SeriesTree_Cohorts_Utxo_OverAmount: """Series tree node.""" @@ -6621,6 +6899,7 @@ class SeriesTree_Cohorts_Utxo: self.over_age: SeriesTree_Cohorts_Utxo_OverAge = SeriesTree_Cohorts_Utxo_OverAge(client) self.epoch: SeriesTree_Cohorts_Utxo_Epoch = SeriesTree_Cohorts_Utxo_Epoch(client) self.class_: SeriesTree_Cohorts_Utxo_Class = SeriesTree_Cohorts_Utxo_Class(client) + self.entry: SeriesTree_Cohorts_Utxo_Entry = SeriesTree_Cohorts_Utxo_Entry(client) self.over_amount: SeriesTree_Cohorts_Utxo_OverAmount = SeriesTree_Cohorts_Utxo_OverAmount(client) self.amount_range: SeriesTree_Cohorts_Utxo_AmountRange = SeriesTree_Cohorts_Utxo_AmountRange(client) self.under_amount: SeriesTree_Cohorts_Utxo_UnderAmount = SeriesTree_Cohorts_Utxo_UnderAmount(client) @@ -7064,6 +7343,19 @@ class BrkClient(BrkClientBase): } } + ENTRY_NAMES = { + "discount": { + "id": "veteran", + "short": "Veteran", + "long": "Veteran Coins" + }, + "premium": { + "id": "rookie", + "short": "Rookie", + "long": "Rookie Coins" + } + } + SPENDABLE_TYPE_NAMES = { "p2pk65": { "id": "p2pk65", diff --git a/website/scripts/modules b/website/scripts/modules new file mode 120000 index 000000000..8b0e85400 --- /dev/null +++ b/website/scripts/modules @@ -0,0 +1 @@ +../../modules \ No newline at end of file diff --git a/website/scripts/modules/.gitignore b/website/scripts/modules/.gitignore deleted file mode 100644 index 46ff68222..000000000 --- a/website/scripts/modules/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -LICENSE -**/*.*.*/*.json -*webcomponent* -cli* -extras/ -*.cjs -dev.js -*.development* -*.iife.* -nano.* -worker.* -*.mts -*.cts -*.rs diff --git a/website/scripts/modules/brk-client/.gitignore b/website/scripts/modules/brk-client/.gitignore deleted file mode 100644 index 86d4c2dd3..000000000 --- a/website/scripts/modules/brk-client/.gitignore +++ /dev/null @@ -1 +0,0 @@ -generated diff --git a/website/scripts/modules/brk-client/index.js b/website/scripts/modules/brk-client/index.js deleted file mode 100644 index 93d9c27bc..000000000 --- a/website/scripts/modules/brk-client/index.js +++ /dev/null @@ -1,12226 +0,0 @@ -// Auto-generated BRK JavaScript client -// Do not edit manually - -// Type definitions - -/** - * Bitcoin address string - * - * @typedef {string} Addr - */ -/** - * Bitcoin address + last-seen txid path parameters (Esplora-style pagination) - * - * @typedef {Object} AddrAfterTxidParam - * @property {Addr} address - * @property {Txid} afterTxid - Last txid from the previous page (return transactions strictly older than this) - */ -/** - * Address statistics on the blockchain (confirmed transactions only) - * - * Based on mempool.space's format with type_index extension. - * - * @typedef {Object} AddrChainStats - * @property {number} fundedTxoCount - Total number of transaction outputs that funded this address - * @property {Sats} fundedTxoSum - Total amount in satoshis received by this address across all funded outputs - * @property {number} spentTxoCount - Total number of transaction outputs spent from this address - * @property {Sats} spentTxoSum - Total amount in satoshis spent from this address - * @property {number} txCount - Total number of confirmed transactions involving this address - * @property {TypeIndex} typeIndex - Index of this address within its type on the blockchain - * @property {Dollars} realizedPrice - Realized price (average cost basis) in USD - */ -/** - * Address statistics in the mempool (unconfirmed transactions only) - * - * Based on mempool.space's format. - * - * @typedef {Object} AddrMempoolStats - * @property {number} fundedTxoCount - Number of unconfirmed transaction outputs funding this address - * @property {Sats} fundedTxoSum - Total amount in satoshis being received in unconfirmed transactions - * @property {number} spentTxoCount - Number of unconfirmed transaction inputs spending from this address - * @property {Sats} spentTxoSum - Total amount in satoshis being spent in unconfirmed transactions - * @property {number} txCount - Number of unconfirmed transactions involving this address - */ -/** - * Bitcoin address path parameter - * - * @typedef {Object} AddrParam - * @property {Addr} address - */ -/** - * Address information compatible with mempool.space API format - * - * @typedef {Object} AddrStats - * @property {Addr} address - Bitcoin address string - * @property {OutputType} addrType - Address type (p2pkh, p2sh, v0_p2wpkh, v0_p2wsh, v1_p2tr, etc.) - * @property {AddrChainStats} chainStats - Statistics for confirmed transactions on the blockchain - * @property {AddrMempoolStats} mempoolStats - Statistics for unconfirmed transactions in the mempool - */ -/** - * Address validation result - * - * @typedef {Object} AddrValidation - * @property {boolean} isvalid - Whether the address is valid - * @property {?string=} address - The validated address - * @property {?string=} scriptPubKey - The scriptPubKey in hex - * @property {?boolean=} isscript - Whether this is a script address (P2SH) - * @property {?boolean=} iswitness - Whether this is a witness address - * @property {?number=} witnessVersion - Witness version (0 for P2WPKH/P2WSH, 1 for P2TR) - * @property {?string=} witnessProgram - Witness program in hex - * @property {?number[]=} errorLocations - Error locations (empty array for most errors) - * @property {?string=} error - Error message for invalid addresses - */ -/** - * Unified index for any address type (funded or empty) - * - * @typedef {TypeIndex} AnyAddrIndex - */ -/** - * Unsigned basis points stored as u16. - * 1 bp = 0.0001. Range: 0–6.5535. - * Use for bounded 0–1 ratios (dominance, adoption, liveliness, etc.). - * `u16::MAX` is reserved as a NaN sentinel. - * - * @typedef {number} BasisPoints16 - */ -/** - * Unsigned basis points stored as u32. - * 1 bp = 0.0001. Range: 0–429,496.7295. - * Use for unbounded unsigned ratios (MVRV, NVT, SOPR, etc.). - * `u32::MAX` is reserved as a NaN sentinel. - * - * @typedef {number} BasisPoints32 - */ -/** - * Signed basis points stored as i16. - * 1 bp = 0.0001. Range: -3.2767 to +3.2767. - * Use for signed bounded ratios (NUPL, net PnL ratios, etc.). - * `i16::MIN` is reserved as a NaN sentinel. - * - * @typedef {number} BasisPointsSigned16 - */ -/** - * Signed basis points stored as i32. - * 1 bp = 0.0001. Range: -214,748.3647 to +214,748.3647. - * Use for unbounded signed values (returns, growth rates, volatility, z-scores, etc.). - * `i32::MIN` is reserved as a NaN sentinel. - * - * @typedef {number} BasisPointsSigned32 - */ -/** - * Bitcoin amount as floating point (1 BTC = 100,000,000 satoshis) - * - * @typedef {number} Bitcoin - */ -/** - * Block count path parameter - * - * @typedef {Object} BlockCountParam - * @property {number} blockCount - Number of recent blocks to include - */ -/** - * Extended block data matching mempool.space /api/v1/blocks extras - * - * @typedef {Object} BlockExtras - * @property {Sats} totalFees - Total fees in satoshis - * @property {FeeRate} medianFee - Median fee rate in sat/vB - * @property {FeeRate[]} feeRange - Fee rate range: [min, 10%, 25%, 50%, 75%, 90%, max] - * @property {Sats} reward - Total block reward (subsidy + fees) in satoshis - * @property {BlockPool} pool - Mining pool that mined this block - * @property {Sats} avgFee - Average fee per transaction in satoshis - * @property {FeeRate} avgFeeRate - Average fee rate in sat/vB - * @property {string} coinbaseRaw - Raw coinbase transaction scriptsig as hex - * @property {?string=} coinbaseAddress - Primary coinbase output address - * @property {string[]} coinbaseAddresses - All coinbase output addresses - * @property {string} coinbaseSignature - Coinbase output script in ASM format - * @property {string} coinbaseSignatureAscii - Coinbase scriptsig decoded as ASCII - * @property {number} avgTxSize - Average transaction size in bytes - * @property {number} totalInputs - Total number of inputs (excluding coinbase) - * @property {number} totalOutputs - Total number of outputs - * @property {Sats} totalOutputAmt - Total output amount in satoshis - * @property {Sats} medianFeeAmt - Median fee amount in satoshis - * @property {Sats[]} feePercentiles - Fee amount percentiles in satoshis: [min, 10%, 25%, 50%, 75%, 90%, max] - * @property {number} segwitTotalTxs - Number of segwit transactions - * @property {number} segwitTotalSize - Total size of segwit transactions in bytes - * @property {Weight} segwitTotalWeight - Total weight of segwit transactions - * @property {string} header - Raw 80-byte block header as hex - * @property {number} utxoSetChange - UTXO set change (total outputs - total inputs, includes unspendable like OP_RETURN). -Note: intentionally differs from utxo_set_size diff which excludes unspendable outputs. -Matches mempool.space/bitcoin-cli behavior. - * @property {number} utxoSetSize - Total spendable UTXO set size at this height (excludes OP_RETURN and other unspendable outputs) - * @property {Sats} totalInputAmt - Total input amount in satoshis - * @property {number} virtualSize - Virtual size in vbytes - * @property {?number=} firstSeen - Timestamp when the block was first seen (always null, not yet supported) - * @property {string[]} orphans - Orphaned blocks (always empty) - * @property {Dollars} price - USD price at block height - */ -/** - * A single block fee rates data point with percentiles. - * - * @typedef {Object} BlockFeeRatesEntry - * @property {Height} avgHeight - Average block height in this window - * @property {Timestamp} timestamp - Unix timestamp at the window midpoint - * @property {FeeRate} avgFee0 - Minimum fee rate (sat/vB) - * @property {FeeRate} avgFee10 - 10th percentile fee rate (sat/vB) - * @property {FeeRate} avgFee25 - 25th percentile fee rate (sat/vB) - * @property {FeeRate} avgFee50 - Median fee rate (sat/vB) - * @property {FeeRate} avgFee75 - 75th percentile fee rate (sat/vB) - * @property {FeeRate} avgFee90 - 90th percentile fee rate (sat/vB) - * @property {FeeRate} avgFee100 - Maximum fee rate (sat/vB) - */ -/** - * A single block fees data point. - * - * @typedef {Object} BlockFeesEntry - * @property {Height} avgHeight - Average block height in this window - * @property {Timestamp} timestamp - Unix timestamp at the window midpoint - * @property {Sats} avgFees - Average fees per block in this window (sats) - * @property {Dollars} uSD - BTC/USD price at this height - */ -/** - * Block hash - * - * @typedef {string} BlockHash - */ -/** - * Block hash path parameter - * - * @typedef {Object} BlockHashParam - * @property {BlockHash} hash - */ -/** - * Block hash + starting transaction index path parameters - * - * @typedef {Object} BlockHashStartIndex - * @property {BlockHash} hash - Bitcoin block hash - * @property {BlockTxIndex} startIndex - Starting transaction index within the block (0-based) - */ -/** - * Block hash + transaction index path parameters - * - * @typedef {Object} BlockHashTxIndex - * @property {BlockHash} hash - Bitcoin block hash - * @property {BlockTxIndex} index - Transaction index within the block (0-based) - */ -/** - * Block information matching mempool.space /api/block/{hash} - * - * @typedef {Object} BlockInfo - * @property {BlockHash} id - Block hash - * @property {Height} height - Block height - * @property {number} version - Block version - * @property {Timestamp} timestamp - Block timestamp (Unix time) - * @property {number} bits - Compact target (bits) - * @property {number} nonce - Nonce - * @property {number} difficulty - Block difficulty - * @property {string} merkleRoot - Merkle root of the transaction tree - * @property {number} txCount - Number of transactions - * @property {number} size - Block size in bytes - * @property {Weight} weight - Block weight in weight units - * @property {BlockHash} previousblockhash - Previous block hash - * @property {Timestamp} mediantime - Median time of the last 11 blocks - */ -/** - * Block information with extras, matching mempool.space /api/v1/blocks - * - * @typedef {Object} BlockInfoV1 - * @property {BlockHash} id - Block hash - * @property {Height} height - Block height - * @property {number} version - Block version - * @property {Timestamp} timestamp - Block timestamp (Unix time) - * @property {number} bits - Compact target (bits) - * @property {number} nonce - Nonce - * @property {number} difficulty - Block difficulty - * @property {string} merkleRoot - Merkle root of the transaction tree - * @property {number} txCount - Number of transactions - * @property {number} size - Block size in bytes - * @property {Weight} weight - Block weight in weight units - * @property {BlockHash} previousblockhash - Previous block hash - * @property {Timestamp} mediantime - Median time of the last 11 blocks - * @property {boolean=} stale - Whether this block has been replaced by a longer chain - * @property {BlockExtras} extras - Extended block data - */ -/** - * Mining pool identification for a block - * - * @typedef {Object} BlockPool - * @property {number} id - Unique pool identifier - * @property {string} name - Pool name - * @property {PoolSlug} slug - URL-friendly pool identifier - * @property {?string[]=} minerNames - Miner name tags found in coinbase scriptsig - */ -/** - * A single block rewards data point. - * - * @typedef {Object} BlockRewardsEntry - * @property {Height} avgHeight - Average block height in this window - * @property {Timestamp} timestamp - Unix timestamp at the window midpoint - * @property {Sats} avgRewards - Average coinbase reward per block (subsidy + fees, sats) - * @property {Dollars} uSD - BTC/USD price at this height - */ -/** - * A single block size data point. - * - * @typedef {Object} BlockSizeEntry - * @property {Height} avgHeight - Average block height in this window - * @property {Timestamp} timestamp - Unix timestamp at the window midpoint - * @property {number} avgSize - Rolling 24h median block size (bytes) - */ -/** - * Combined block sizes and weights response. - * - * @typedef {Object} BlockSizesWeights - * @property {BlockSizeEntry[]} sizes - Block size data points - * @property {BlockWeightEntry[]} weights - Block weight data points - */ -/** - * Block status indicating whether block is in the best chain - * - * @typedef {Object} BlockStatus - * @property {boolean} inBestChain - Whether this block is in the best chain - * @property {(Height|null)=} height - Block height (only if in best chain) - * @property {(BlockHash|null)=} nextBest - Hash of the next block in the best chain (null if tip) - */ -/** - * Projected next-block contents from Bitcoin Core's `getblocktemplate` - * (block 0 of the snapshot). Returned by - * `GET /api/v1/mempool/block-template`. - * - * @typedef {Object} BlockTemplate - * @property {NextBlockHash} hash - Pass back as `` on -`/api/v1/mempool/block-template/diff/{hash}` to fetch deltas. - * @property {MempoolBlock} stats - Aggregate stats for this block (size, vsize, fee range, ...). - * @property {Transaction[]} transactions - Full transaction bodies in `getblocktemplate` order. - */ -/** - * Delta between the current `getblocktemplate` projection and a prior - * one identified by `since`. Returned by - * `GET /api/v1/mempool/block-template/diff/{hash}`. - * - * `order` carries the full new template in template order: each entry - * is either a `Retained(idx)` pointing into the prior template (which - * the client cached at `since`) or a `New(tx)` inline body. Walk it - * once to rebuild the new template; no separate `added` array to - * cross-reference. - * - * `removed` is redundant (computable from `order` by collecting prior - * indices that don't appear) but shipped for cache-eviction ergonomics. - * - * @typedef {Object} BlockTemplateDiff - * @property {NextBlockHash} hash - Current next-block hash. Use as `since` on the next diff call. - * @property {NextBlockHash} since - Echoed prior hash the diff was computed against. - * @property {BlockTemplateDiffEntry[]} order - New template in order. Each entry is either an index into the -prior template's transactions or a full transaction body. - * @property {Txid[]} removed - Txids that left the projected next block since `since` -(confirmed, evicted, replaced, or pushed past block 0). - */ -/** - * One slot of the new template in a `BlockTemplateDiff`. - * - * Untagged on the wire so JSON type disambiguates the variants: - * - `Retained(idx)` serializes as a bare integer - index into the - * transactions of the prior template (which the client cached at - * `since`). - * - `New(tx)` serializes as a transaction object - a body that was - * not in the prior template and must be added at this position. - * - * Reconstruction is a single pass: for each entry, either copy - * `prior[idx]` or append the inline body. - * - * @typedef {(number|Transaction)} BlockTemplateDiffEntry - */ -/** - * Block information returned for timestamp queries - * - * @typedef {Object} BlockTimestamp - * @property {Height} height - Block height - * @property {BlockHash} hash - Block hash - * @property {string} timestamp - Block timestamp in ISO 8601 format - */ -/** - * Position of a transaction within a single block (0 = coinbase). - * Distinct from `TxIndex`, which is the chain-wide global tx index. - * - * @typedef {number} BlockTxIndex - */ -/** - * A single block weight data point. - * - * @typedef {Object} BlockWeightEntry - * @property {Height} avgHeight - Average block height in this window - * @property {Timestamp} timestamp - Unix timestamp at the window midpoint - * @property {Weight} avgWeight - Rolling 24h median block weight (weight units) - */ -/** - * Unsigned cents (u64) - for values that should never be negative. - * Used for invested capital, realized cap, etc. - * - * @typedef {number} Cents - */ -/** - * Cents × Sats (u128) - price in cents multiplied by amount in sats. - * Uses u128 because large amounts at any price can overflow u64. - * - * @typedef {number} CentsSats - */ -/** - * Signed cents (i64) - for values that can be negative. - * Used for profit/loss calculations, deltas, etc. - * - * @typedef {number} CentsSigned - */ -/** - * Raw cents squared (u128) - stores cents² × sats without division. - * Used for precise accumulation of capitalized cap values: Σ(price² × sats). - * capitalized_price = capitalized_cap_raw / realized_cap_raw - * - * @typedef {number} CentsSquaredSats - */ -/** - * Closing price value for a time period - * - * @typedef {Dollars} Close - */ -/** - * URPD cohort identifier. Use `GET /api/urpd` to list available cohorts. - * - * Validated at construction: non-empty, ASCII `[a-z0-9_]+`. Matches the - * schemars enum value set; the type therefore proves "this is a valid - * cohort name" wherever a `Cohort` is held. - * - * @typedef {("all"|"sth"|"lth"|"utxos_under_1h_old"|"utxos_1h_to_1d_old"|"utxos_1d_to_1w_old"|"utxos_1w_to_1m_old"|"utxos_1m_to_2m_old"|"utxos_2m_to_3m_old"|"utxos_3m_to_4m_old"|"utxos_4m_to_5m_old"|"utxos_5m_to_6m_old"|"utxos_6m_to_1y_old"|"utxos_1y_to_2y_old"|"utxos_2y_to_3y_old"|"utxos_3y_to_4y_old"|"utxos_4y_to_5y_old"|"utxos_5y_to_6y_old"|"utxos_6y_to_7y_old"|"utxos_7y_to_8y_old"|"utxos_8y_to_10y_old"|"utxos_10y_to_12y_old"|"utxos_12y_to_15y_old"|"utxos_over_15y_old")} Cohort - */ -/** - * Coinbase scriptSig tag for pool identification. - * - * Stored as a fixed 101-byte record (1 byte length + 100 bytes data). - * Uses `[u8; 101]` internally so that `size_of::()` matches - * the serialized `Bytes::Array` size (vecdb requires this for alignment). - * - * Bitcoin consensus limits coinbase scriptSig to 2-100 bytes. - * - * @typedef {string} CoinbaseTag - */ -/** - * @typedef {Object} CostBasisCohortParam - * @property {Cohort} cohort - */ -/** - * @typedef {Object} CostBasisParams - * @property {Cohort} cohort - * @property {string} date - */ -/** - * @typedef {Object} CostBasisQuery - * @property {UrpdAggregation=} bucket - * @property {CostBasisValue=} value - */ -/** - * Value type for the deprecated cost-basis distribution output. - * - * @typedef {("supply"|"realized"|"unrealized")} CostBasisValue - */ -/** - * CPFP cluster: the connected component the seed belongs to, plus its - * SFL linearization. - * - * @typedef {Object} CpfpCluster - * @property {CpfpClusterTx[]} txs - All txs in the cluster, in topological order (parents before children). - * @property {CpfpClusterChunk[]} chunks - SFL-emitted chunks ordered by descending feerate. - * @property {number} chunkIndex - Index into `chunks` of the chunk containing the seed tx. - */ -/** - * One SFL chunk inside a `CpfpCluster`. `txs` is in topological order - * (matches `CpfpCluster.txs` ordering); the chunk's `feerate` is the - * per-chunk SFL feerate and is the same for every tx in this chunk. - * - * @typedef {Object} CpfpClusterChunk - * @property {CpfpClusterTxIndex[]} txs - * @property {FeeRate} feerate - */ -/** - * One entry in a `CpfpCluster.txs` array. - * - * @typedef {Object} CpfpClusterTx - * @property {Txid} txid - * @property {Weight} weight - * @property {Sats} fee - * @property {CpfpClusterTxIndex[]} parents - In-cluster parents of this tx. - */ -/** - * Position of a transaction inside a `CpfpCluster.txs` array. Cluster-local, - * has no meaning outside the enclosing cluster. - * - * @typedef {number} CpfpClusterTxIndex - */ -/** - * A transaction in a CPFP relationship. - * - * @typedef {Object} CpfpEntry - * @property {Txid} txid - * @property {Weight} weight - * @property {Sats} fee - */ -/** - * CPFP (Child Pays For Parent) information for a transaction. - * - * @typedef {Object} CpfpInfo - * @property {CpfpEntry[]} ancestors - Ancestor transactions in the CPFP chain. - * @property {(CpfpEntry|null)=} bestDescendant - Best (highest fee rate) descendant, if any. - * @property {CpfpEntry[]} descendants - Descendant transactions in the CPFP chain. - * @property {FeeRate} effectiveFeePerVsize - Effective fee rate considering CPFP relationships (sat/vB). -This is the seed's chunk feerate after lift-merging, i.e. the -rate Core/mempool.space would surface for this tx. - * @property {SigOps} sigops - BIP-141 sigop cost for the seed tx (witness sigops count as 1, -legacy and P2SH-redeem sigops count as 4). - * @property {Sats} fee - Transaction fee (sats). - * @property {VSize} vsize - Virtual size of the seed tx (vbytes). - * @property {VSize} adjustedVsize - Policy-adjusted virtual size: `max(vsize, sigops * 5)`. - * @property {(CpfpCluster|null)=} cluster - Cluster the seed belongs to: full tx list, SFL-linearized chunks, -and the seed's chunk index. Omitted when the seed has no -ancestors and no descendants (matches mempool.space). - */ -/** - * Range parameters with output format for API query parameters. - * - * @typedef {Object} DataRangeFormat - * @property {(RangeIndex|null)=} start - Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `from`, `f`, `s` - * @property {(RangeIndex|null)=} end - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e` - * @property {(Limit|null)=} limit - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l` - * @property {Format=} format - Format of the output - */ -/** - * Date in YYYYMMDD format stored as u32 - * - * @typedef {number} Date - */ -/** @typedef {number} Day1 */ -/** @typedef {number} Day3 */ -/** - * Detailed series count with per-database breakdown - * - * @typedef {Object} DetailedSeriesCount - * @property {number} distinctSeries - Number of unique series available (e.g., realized_price, market_cap) - * @property {number} totalEndpoints - Total number of series-index combinations across all timeframes - * @property {number} lazyEndpoints - Number of lazy (computed on-the-fly) series-index combinations - * @property {number} storedEndpoints - Number of eager (stored on disk) series-index combinations - * @property {{ [key: string]: SeriesCount }} byDb - Per-database breakdown of counts - */ -/** - * Difficulty adjustment information. - * - * @typedef {Object} DifficultyAdjustment - * @property {number} progressPercent - Progress through current difficulty epoch (0-100%) - * @property {number} difficultyChange - Estimated difficulty change at next retarget (%) - * @property {number} estimatedRetargetDate - Estimated timestamp of next retarget (milliseconds) - * @property {number} remainingBlocks - Blocks remaining until retarget - * @property {number} remainingTime - Estimated time until retarget (milliseconds) - * @property {number} previousRetarget - Previous difficulty adjustment (%) - * @property {Timestamp} previousTime - Timestamp of most recent retarget (seconds) - * @property {Height} nextRetargetHeight - Height of next retarget - * @property {number} timeAvg - Average block time in current epoch (milliseconds) - * @property {number} adjustedTimeAvg - Time-adjusted average (milliseconds) - * @property {number} timeOffset - Time offset from expected schedule (seconds) - * @property {number} expectedBlocks - Expected blocks based on wall clock time since epoch start - */ -/** - * A single difficulty adjustment entry. - * Serializes as array: [timestamp, height, difficulty, change_percent] - * - * @typedef {Object} DifficultyAdjustmentEntry - * @property {Timestamp} timestamp - Unix timestamp of the adjustment - * @property {Height} height - Block height of the adjustment - * @property {number} difficulty - Difficulty value - * @property {number} changePercent - Adjustment ratio (new/previous, e.g. 1.068 = +6.8%) - */ -/** - * A single difficulty data point in the hashrate summary. - * - * @typedef {Object} DifficultyEntry - * @property {Timestamp} time - Unix timestamp of the difficulty adjustment - * @property {Height} height - Block height of the adjustment - * @property {number} difficulty - Difficulty value - * @property {number} adjustment - Adjustment ratio (new/previous, e.g. 1.068 = +6.8%) - */ -/** - * Disk usage of the indexed data - * - * @typedef {Object} DiskUsage - * @property {string} brk - Human-readable brk data size (e.g., "48.8 GiB") - * @property {number} brkBytes - brk data size in bytes - * @property {string} bitcoin - Human-readable Bitcoin blocks directory size - * @property {number} bitcoinBytes - Bitcoin blocks directory size in bytes - * @property {number} ratio - brk as percentage of Bitcoin data - */ -/** - * US Dollar amount - * - * @typedef {number} Dollars - */ -/** - * Data of an empty address - * - * @typedef {Object} EmptyAddrData - * @property {number} txCount - Total transaction count - * @property {number} fundedTxoCount - Total funded/spent transaction output count (equal since address is empty) - * @property {Sats} transfered - Total satoshis transferred - */ -/** @typedef {TypeIndex} EmptyAddrIndex */ -/** @typedef {TypeIndex} EmptyOutputIndex */ -/** @typedef {number} Epoch */ -/** - * @typedef {Object} ErrorBody - * @property {ErrorDetail} error - */ -/** - * @typedef {Object} ErrorDetail - * @property {string} type - Error category: "invalid_request", "forbidden", "not_found", "unavailable", or "internal" - * @property {string} code - Machine-readable error code (e.g. "invalid_addr", "series_not_found") - * @property {string} message - Human-readable description - * @property {string} docUrl - Link to API documentation - */ -/** - * Exchange rates (USD base, on-chain only — no fiat pairs available) - * - * @typedef {Object} ExchangeRates - */ -/** - * Fee rate in sat/vB - * - * @typedef {number} FeeRate - */ -/** - * Output format for API responses - * - * @typedef {("json"|"csv")} Format - */ -/** - * Data for a funded (non-empty) address with current balance - * - * @typedef {Object} FundedAddrData - * @property {number} txCount - Total transaction count - * @property {number} fundedTxoCount - Number of transaction outputs funded to this address - * @property {number} spentTxoCount - Number of transaction outputs spent by this address - * @property {Sats} received - Satoshis received by this address - * @property {Sats} sent - Satoshis sent by this address - * @property {CentsSats} realizedCapRaw - The realized capitalization: Σ(price × sats) - * @property {CentsSquaredSats} capitalizedCapRaw - The capitalized cap: Σ(price² × sats) - */ -/** @typedef {TypeIndex} FundedAddrIndex */ -/** @typedef {number} Halving */ -/** - * A single hashrate data point. - * - * @typedef {Object} HashrateEntry - * @property {Timestamp} timestamp - Unix timestamp - * @property {number} avgHashrate - Average hashrate (H/s) - */ -/** - * Summary of network hashrate and difficulty data. - * - * @typedef {Object} HashrateSummary - * @property {HashrateEntry[]} hashrates - Historical hashrate data points - * @property {DifficultyEntry[]} difficulty - Historical difficulty adjustments - * @property {number} currentHashrate - Current network hashrate (H/s) - * @property {number} currentDifficulty - Current network difficulty - */ -/** - * Server health status - * - * @typedef {Object} Health - * @property {string} status - Health status ("healthy") - * @property {string} service - Service name - * @property {string} version - Server version - * @property {string} timestamp - Current server time (ISO 8601) - * @property {string} startedAt - Server start time (ISO 8601) - * @property {number} uptimeSeconds - Uptime in seconds - * @property {Height} indexedHeight - Height of the last indexed block - * @property {Height} computedHeight - Height of the last computed block (series) - * @property {Height} tipHeight - Height of the chain tip (from Bitcoin node) - * @property {Height} blocksBehind - Number of blocks behind the tip - * @property {string} lastIndexedAt - Human-readable timestamp of the last indexed block (ISO 8601) - * @property {Timestamp} lastIndexedAtUnix - Unix timestamp of the last indexed block - */ -/** - * Block height - * - * @typedef {number} Height - */ -/** - * Path parameter accepting either a block height (`840000`) or a calendar date - * (`YYYY-MM-DD`). The handler resolves it and dispatches to the per-height or - * per-day variant, choosing the matching cache strategy. - * - * @typedef {Object} HeightOrDateParam - * @property {string} point - */ -/** - * Block height path parameter - * - * @typedef {Object} HeightParam - * @property {Height} height - */ -/** - * Hex-encoded string. Transparent wrapper over `String`: serializes - * as a plain JSON string and derefs to `str`, so anywhere `&str` or - * `AsRef<[u8]>` is expected the `Hex` "just works". - * - * @typedef {string} Hex - */ -/** - * Highest price value for a time period - * - * @typedef {Dollars} High - */ -/** - * Historical price response - * - * @typedef {Object} HistoricalPrice - * @property {HistoricalPriceEntry[]} prices - Price data points - * @property {ExchangeRates} exchangeRates - Exchange rates (currently empty) - */ -/** - * A single price data point - * - * @typedef {Object} HistoricalPriceEntry - * @property {Timestamp} time - Unix timestamp - * @property {Dollars} uSD - BTC/USD price - */ -/** @typedef {number} Hour1 */ -/** @typedef {number} Hour12 */ -/** @typedef {number} Hour4 */ -/** - * Aggregation dimension for querying series. Includes time-based (date, week, month, year), - * block-based (height, tx_index), and address/output type indexes. - * - * @typedef {("minute10"|"minute30"|"hour1"|"hour4"|"hour12"|"day1"|"day3"|"week1"|"month1"|"month3"|"month6"|"year1"|"year10"|"halving"|"epoch"|"height"|"tx_index"|"txin_index"|"txout_index"|"empty_output_index"|"op_return_index"|"p2a_addr_index"|"p2ms_output_index"|"p2pk33_addr_index"|"p2pk65_addr_index"|"p2pkh_addr_index"|"p2sh_addr_index"|"p2tr_addr_index"|"p2wpkh_addr_index"|"p2wsh_addr_index"|"unknown_output_index"|"funded_addr_index"|"empty_addr_index")} Index - */ -/** - * Information about an available index and its query aliases - * - * @typedef {Object} IndexInfo - * @property {Index} index - The canonical index name - * @property {string[]} aliases - All Accepted query aliases - */ -/** - * Legacy path parameter for `/api/metric/{metric}` - * - * @typedef {Object} LegacySeriesParam - * @property {SeriesName} metric - */ -/** - * Legacy path parameters for `/api/metric/{metric}/{index}` - * - * @typedef {Object} LegacySeriesWithIndex - * @property {SeriesName} metric - * @property {Index} index - */ -/** - * Maximum number of results to return. Defaults to 100 if not specified. - * - * @typedef {number} Limit - */ -/** - * Lowest price value for a time period - * - * @typedef {Dollars} Low - */ -/** - * Block info in a mempool.space like format for fee estimation. - * - * @typedef {Object} MempoolBlock - * @property {number} blockSize - Total serialized block size in bytes (witness + non-witness). - * @property {number} blockVSize - Total block virtual size in vbytes - * @property {number} nTx - Number of transactions in the projected block - * @property {Sats} totalFees - Total fees in satoshis - * @property {FeeRate} medianFee - Median fee rate in sat/vB - * @property {FeeRate[]} feeRange - Fee rate range: [min, 10%, 25%, 50%, 75%, 90%, max] - */ -/** - * Mempool statistics with incrementally maintained fee histogram. - * - * @typedef {Object} MempoolInfo - * @property {number} count - Number of transactions in the mempool - * @property {VSize} vsize - Total virtual size of all transactions in the mempool (vbytes) - * @property {Sats} totalFee - Total fees of all transactions in the mempool (satoshis) - * @property {{ [key: string]: VSize }} feeHistogram - Fee histogram: `[[fee_rate, vsize], ...]` sorted by descending fee rate - */ -/** - * Simplified mempool transaction for the `/api/mempool/recent` endpoint. - * - * @typedef {Object} MempoolRecentTx - * @property {Txid} txid - Transaction ID - * @property {Sats} fee - Transaction fee (sats) - * @property {VSize} vsize - Virtual size (vbytes) - * @property {Sats} value - Total output value (sats) - */ -/** - * Merkle inclusion proof for a transaction - * - * @typedef {Object} MerkleProof - * @property {Height} blockHeight - Block height containing the transaction - * @property {string[]} merkle - Merkle proof path (hex-encoded hashes) - * @property {number} pos - Transaction position in the block (0-indexed) - */ -/** @typedef {number} Minute10 */ -/** @typedef {number} Minute30 */ -/** @typedef {number} Month1 */ -/** @typedef {number} Month3 */ -/** @typedef {number} Month6 */ -/** - * Content hash of the projected next block (block 0 of the mempool - * snapshot). Same value as the mempool ETag. Opaque token: pass back - * as `since` on `/api/v1/mempool/block-template/diff/{hash}` to fetch - * deltas. - * - * @typedef {number} NextBlockHash - */ -/** - * `since` hash for `/api/v1/mempool/block-template/diff/{hash}`. - * - * @typedef {Object} NextBlockHashParam - * @property {NextBlockHash} hash - */ -/** - * OHLC (Open, High, Low, Close) data in cents - * - * @typedef {Object} OHLCCents - * @property {Open} open - * @property {High} high - * @property {Low} low - * @property {Close} close - */ -/** - * OHLC (Open, High, Low, Close) data in dollars - * - * @typedef {Object} OHLCDollars - * @property {Open} open - * @property {High} high - * @property {Low} low - * @property {Close} close - */ -/** - * OHLC (Open, High, Low, Close) data in satoshis - * - * @typedef {Object} OHLCSats - * @property {Open} open - * @property {High} high - * @property {Low} low - * @property {Close} close - */ -/** @typedef {TypeIndex} OpReturnIndex */ -/** - * Opening price value for a time period - * - * @typedef {Dollars} Open - */ -/** - * Optional UNIX timestamp query parameter - * - * @typedef {Object} OptionalTimestampParam - * @property {(Timestamp|null)=} timestamp - */ -/** @typedef {number} OutPoint */ -/** - * Type (P2PKH, P2WPKH, P2SH, P2TR, etc.) - * - * @typedef {("p2pk"|"p2pk"|"p2pkh"|"multisig"|"p2sh"|"op_return"|"v0_p2wpkh"|"v0_p2wsh"|"v1_p2tr"|"p2a"|"empty"|"unknown")} OutputType - */ -/** @typedef {TypeIndex} P2AAddrIndex */ -/** @typedef {U8x2} P2ABytes */ -/** @typedef {TypeIndex} P2MSOutputIndex */ -/** @typedef {TypeIndex} P2PK33AddrIndex */ -/** @typedef {U8x33} P2PK33Bytes */ -/** @typedef {TypeIndex} P2PK65AddrIndex */ -/** @typedef {U8x65} P2PK65Bytes */ -/** @typedef {TypeIndex} P2PKHAddrIndex */ -/** @typedef {U8x20} P2PKHBytes */ -/** @typedef {TypeIndex} P2SHAddrIndex */ -/** @typedef {U8x20} P2SHBytes */ -/** @typedef {TypeIndex} P2TRAddrIndex */ -/** @typedef {U8x32} P2TRBytes */ -/** @typedef {TypeIndex} P2WPKHAddrIndex */ -/** @typedef {U8x20} P2WPKHBytes */ -/** @typedef {TypeIndex} P2WSHAddrIndex */ -/** @typedef {U8x32} P2WSHBytes */ -/** - * A paginated list of available series names (1000 per page) - * - * @typedef {Object} PaginatedSeries - * @property {number} currentPage - Current page number (0-indexed) - * @property {number} maxPage - Maximum valid page index (0-indexed) - * @property {number} totalCount - Total number of series - * @property {number} perPage - Results per page - * @property {boolean} hasMore - Whether more pages are available after the current one - * @property {string[]} series - List of series names - */ -/** - * Pagination parameters for paginated API endpoints - * - * @typedef {Object} Pagination - * @property {?number=} page - Pagination index - * @property {?number=} perPage - Results per page (default: 1000, max: 1000) - */ -/** - * Block counts for different time periods - * - * @typedef {Object} PoolBlockCounts - * @property {number} all - Total blocks mined (all time) - * @property {number} _24h - Blocks mined in last 24 hours - * @property {number} _1w - Blocks mined in last week - */ -/** - * Pool's share of total blocks for different time periods - * - * @typedef {Object} PoolBlockShares - * @property {number} all - Share of all blocks (0.0 - 1.0) - * @property {number} _24h - Share of blocks in last 24 hours (0.0 - 1.0) - * @property {number} _1w - Share of blocks in last week (0.0 - 1.0) - */ -/** - * Detailed pool information with statistics across time periods - * - * @typedef {Object} PoolDetail - * @property {PoolDetailInfo} pool - Pool information - * @property {PoolBlockCounts} blockCount - Block counts for different time periods - * @property {PoolBlockShares} blockShare - Pool's share of total blocks for different time periods - * @property {number} estimatedHashrate - Estimated hashrate based on blocks mined (H/s) - * @property {?number=} reportedHashrate - Self-reported hashrate (if available, H/s) - * @property {(Sats|null)=} totalReward - Total reward earned by this pool (sats, all time; None for minor pools) - */ -/** - * Pool information for detail view - * - * @typedef {Object} PoolDetailInfo - * @property {number} id - Pool identifier - * @property {string} name - Pool name - * @property {string} link - Pool website URL - * @property {string[]} addresses - Known payout addresses - * @property {string[]} regexes - Coinbase tag patterns (regexes) - * @property {PoolSlug} slug - URL-friendly pool identifier - * @property {number} uniqueId - Unique pool identifier - */ -/** - * A single pool hashrate data point. - * - * @typedef {Object} PoolHashrateEntry - * @property {Timestamp} timestamp - Unix timestamp - * @property {number} avgHashrate - Average hashrate (H/s) - * @property {number} share - Pool's share of total network hashrate (0.0 - 1.0) - * @property {string} poolName - Pool name - */ -/** - * Basic pool information for listing all pools - * - * @typedef {Object} PoolInfo - * @property {string} name - Pool name - * @property {PoolSlug} slug - URL-friendly pool identifier - * @property {number} uniqueId - Unique numeric pool identifier - */ -/** - * URL-friendly mining pool identifier - * - * @typedef {("unknown"|"blockfills"|"ultimuspool"|"terrapool"|"luxor"|"1thash"|"btccom"|"bitfarms"|"huobipool"|"wayicn"|"canoepool"|"btctop"|"bitcoincom"|"175btc"|"gbminers"|"axbt"|"asicminer"|"bitminter"|"bitcoinrussia"|"btcserv"|"simplecoinus"|"btcguild"|"eligius"|"ozcoin"|"eclipsemc"|"maxbtc"|"triplemining"|"coinlab"|"50btc"|"ghashio"|"stminingcorp"|"bitparking"|"mmpool"|"polmine"|"kncminer"|"bitalo"|"f2pool"|"hhtt"|"megabigpower"|"mtred"|"nmcbit"|"yourbtcnet"|"givemecoins"|"braiinspool"|"antpool"|"multicoinco"|"bcpoolio"|"cointerra"|"kanopool"|"solock"|"ckpool"|"nicehash"|"bitclub"|"bitcoinaffiliatenetwork"|"btcc"|"bwpool"|"exxbw"|"bitsolo"|"bitfury"|"21inc"|"digitalbtc"|"8baochi"|"mybtccoinpool"|"tbdice"|"hashpool"|"nexious"|"bravomining"|"hotpool"|"okexpool"|"bcmonster"|"1hash"|"bixin"|"tatmaspool"|"viabtc"|"connectbtc"|"batpool"|"waterhole"|"dcexploration"|"dcex"|"btpool"|"58coin"|"bitcoinindia"|"shawnp0wers"|"phashio"|"rigpool"|"haozhuzhu"|"7pool"|"miningkings"|"hashbx"|"dpool"|"rawpool"|"haominer"|"helix"|"bitcoinukraine"|"poolin"|"secretsuperstar"|"tigerpoolnet"|"sigmapoolcom"|"okpooltop"|"hummerpool"|"tangpool"|"bytepool"|"spiderpool"|"novablock"|"miningcity"|"binancepool"|"minerium"|"lubiancom"|"okkong"|"aaopool"|"emcdpool"|"foundryusa"|"sbicrypto"|"arkpool"|"purebtccom"|"marapool"|"kucoinpool"|"entrustcharitypool"|"okminer"|"titan"|"pegapool"|"btcnuggets"|"cloudhashing"|"digitalxmintsy"|"telco214"|"btcpoolparty"|"multipool"|"transactioncoinmining"|"btcdig"|"trickysbtcpool"|"btcmp"|"eobot"|"unomp"|"patels"|"gogreenlight"|"bitcoinindiapool"|"ekanembtc"|"canoe"|"tiger"|"1m1x"|"zulupool"|"secpool"|"ocean"|"whitepool"|"wiz"|"wk057"|"futurebitapollosolo"|"carbonnegative"|"portlandhodl"|"phoenix"|"neopool"|"maxipool"|"bitfufupool"|"gdpool"|"miningdutch"|"publicpool"|"miningsquared"|"innopolistech"|"btclab"|"parasite"|"redrockpool"|"est3lar"|"braiinssolo"|"solopoolcom"|"noderunners")} PoolSlug - */ -/** - * Mining pool slug + block height path parameters - * - * @typedef {Object} PoolSlugAndHeightParam - * @property {PoolSlug} slug - * @property {Height} height - */ -/** - * Mining pool slug path parameter - * - * @typedef {Object} PoolSlugParam - * @property {PoolSlug} slug - */ -/** - * Mining pool with block statistics for a time period - * - * @typedef {Object} PoolStats - * @property {number} poolId - Unique pool identifier - * @property {string} name - Pool name - * @property {string} link - Pool website URL - * @property {number} blockCount - Number of blocks mined in the time period - * @property {number} rank - Pool ranking by block count (1 = most blocks) - * @property {number} emptyBlocks - Number of empty blocks mined - * @property {PoolSlug} slug - URL-friendly pool identifier - * @property {number} share - Pool's share of total blocks (0.0 - 1.0) - * @property {number} poolUniqueId - Unique pool identifier - */ -/** - * Mining pools response for a time period - * - * @typedef {Object} PoolsSummary - * @property {PoolStats[]} pools - List of pools sorted by block count descending - * @property {number} blockCount - Total blocks in the time period - * @property {number} lastEstimatedHashrate - Estimated network hashrate (H/s) - * @property {number} lastEstimatedHashrate3d - Estimated network hashrate over last 3 days (H/s) - * @property {number} lastEstimatedHashrate1w - Estimated network hashrate over last 1 week (H/s) - */ -/** - * Current price response matching mempool.space /api/v1/prices format - * - * @typedef {Object} Prices - * @property {Timestamp} time - Unix timestamp - * @property {Dollars} uSD - BTC/USD price - */ -/** - * A range boundary: integer index, date, or timestamp. - * - * @typedef {(number|Date|Timestamp)} RangeIndex - */ -/** - * Transaction locktime. Values below 500,000,000 are interpreted as block heights; values at or above are Unix timestamps. - * - * @typedef {number} RawLockTime - */ -/** - * Response body for `GET /api/v1/tx/:txid/rbf`. Both fields are null - * when the tx has no known RBF history within the mempool monitor's - * graveyard retention window. - * - * @typedef {Object} RbfResponse - * @property {(ReplacementNode|null)=} replacements - * @property {?Txid[]=} replaces - */ -/** - * Transaction summary carried inside an RBF replacement node. Shape - * matches mempool.space's `/api/v1/tx/:txid/rbf` and - * `/api/v1/replacements` responses. - * - * @typedef {Object} RbfTx - * @property {Txid} txid - * @property {Sats} fee - * @property {VSize} vsize - * @property {Sats} value - Sum of output amounts. - * @property {FeeRate} rate - * @property {Timestamp} time - * @property {boolean} rbf - BIP-125 signaling: at least one input has sequence < 0xffffffff-1. - * @property {?boolean=} fullRbf - Only populated on the root `tx` of an RBF response. `true` iff -this tx displaced at least one non-signaling predecessor. - */ -/** - * Recommended fee rates in sat/vB - * - * @typedef {Object} RecommendedFees - * @property {FeeRate} fastestFee - Fee rate for fastest confirmation (next block) - * @property {FeeRate} halfHourFee - Fee rate for confirmation within ~30 minutes (3 blocks) - * @property {FeeRate} hourFee - Fee rate for confirmation within ~1 hour (6 blocks) - * @property {FeeRate} economyFee - Fee rate for economical confirmation - * @property {FeeRate} minimumFee - Minimum relay fee rate - */ -/** - * One node in an RBF replacement tree. The node's `tx` replaced each - * entry in `replaces`, recursively. - * - * @typedef {Object} ReplacementNode - * @property {RbfTx} tx - * @property {Timestamp} time - First-seen timestamp, duplicated here to match mempool.space's -on-the-wire shape. - * @property {boolean} fullRbf - Any predecessor in this subtree was non-signaling. - * @property {?number=} interval - Seconds between this node's `time` and the successor that -replaced it. Omitted on the root of an RBF response. - * @property {?boolean=} mined - `Some(true)` iff this node's tx is currently confirmed. Absent -on serialization otherwise. - * @property {ReplacementNode[]} replaces - */ -/** - * Block reward statistics over a range of blocks - * - * @typedef {Object} RewardStats - * @property {Height} startBlock - First block in the range - * @property {Height} endBlock - Last block in the range - * @property {Sats} totalReward - Total coinbase rewards (subsidy + fees) in sats - * @property {Sats} totalFee - Total transaction fees in sats - * @property {number} totalTx - Total number of transactions - */ -/** - * Amount in satoshis (1 BTC = 100,000,000 sats) - * - * @typedef {number} Sats - */ -/** - * Fractional satoshis (f64) - for representing USD prices in sats - * - * Formula: `sats_fract = usd_value * 100_000_000 / btc_price` - * - * When BTC is $100,000: - * - $1 = 1,000 sats - * - $0.001 = 1 sat - * - $0.0001 = 0.1 sats (fractional) - * - * @typedef {number} SatsFract - */ -/** - * Signed satoshis (i64) - for values that can be negative. - * Used for changes, deltas, profit/loss calculations, etc. - * - * @typedef {number} SatsSigned - */ -/** - * @typedef {Object} SearchQuery - * @property {SeriesName} q - Search query string - * @property {Limit=} limit - Maximum number of results - */ -/** - * Series count statistics - distinct series and total series-index combinations - * - * @typedef {Object} SeriesCount - * @property {number} distinctSeries - Number of unique series available (e.g., realized_price, market_cap) - * @property {number} totalEndpoints - Total number of series-index combinations across all timeframes - * @property {number} lazyEndpoints - Number of lazy (computed on-the-fly) series-index combinations - * @property {number} storedEndpoints - Number of eager (stored on disk) series-index combinations - */ -/** - * Metadata about a series - * - * @typedef {Object} SeriesInfo - * @property {Index[]} indexes - Available indexes - * @property {string} type - Value type (e.g. "f32", "u64", "Sats") - */ -/** - * SeriesLeaf with JSON Schema for client generation - * - * @typedef {Object} SeriesLeafWithSchema - * @property {string} name - The series name/identifier - * @property {string} kind - The Rust type (e.g., "Sats", "StoredF64") - * @property {Index[]} indexes - Available indexes for this series - * @property {string} type - JSON Schema type (e.g., "integer", "number", "string", "boolean", "array", "object") - */ -/** - * Comma-separated list of series names - * - * @typedef {string} SeriesList - */ -/** - * Series name - * - * @typedef {string} SeriesName - */ -/** - * @typedef {Object} SeriesNameWithIndex - * @property {SeriesName} series - Series name - * @property {Index} index - Aggregation index - */ -/** - * @typedef {Object} SeriesParam - * @property {SeriesName} series - */ -/** - * Selection of series to query - * - * @typedef {Object} SeriesSelection - * @property {SeriesList} series - Requested series - * @property {Index} index - Index to query - * @property {(RangeIndex|null)=} start - Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `from`, `f`, `s` - * @property {(RangeIndex|null)=} end - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e` - * @property {(Limit|null)=} limit - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l` - * @property {Format=} format - Format of the output - */ -/** - * Legacy series selection parameters (deprecated) - * - * @typedef {Object} SeriesSelectionLegacy - * @property {Index} index - * @property {SeriesList} ids - * @property {(RangeIndex|null)=} start - Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `from`, `f`, `s` - * @property {(RangeIndex|null)=} end - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e` - * @property {(Limit|null)=} limit - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l` - * @property {Format=} format - Format of the output - */ -/** - * BIP-141 sigop cost. The block-level budget is 80,000, so a `u32` - * fits a single tx's count with room to spare. - * - * Witness sigops count as 1; legacy and P2SH-redeem sigops count as 4. - * Five vbytes per sigop is the policy adjustment Core applies in - * `nSigOpCost` to discourage sigop-heavy txs (`max(weight/4, sigops*5)`). - * - * @typedef {number} SigOps - */ -/** @typedef {boolean} StoredBool */ -/** - * Stored 32-bit floating point value - * - * @typedef {number} StoredF32 - */ -/** - * Fixed-size 64-bit floating point value optimized for on-disk storage - * - * @typedef {number} StoredF64 - */ -/** - * Fixed-size 64-bit signed integer optimized for on-disk storage - * - * @typedef {number} StoredI64 - */ -/** @typedef {number} StoredI8 */ -/** @typedef {number} StoredU16 */ -/** - * Fixed-size 32-bit unsigned integer optimized for on-disk storage - * - * @typedef {number} StoredU32 - */ -/** - * Fixed-size 64-bit unsigned integer optimized for on-disk storage - * - * @typedef {number} StoredU64 - */ -/** - * Current supply state tracking UTXO count and total value - * - * @typedef {Object} SupplyState - * @property {number} utxoCount - Number of unspent transaction outputs - * @property {Sats} value - Total value in satoshis - */ -/** - * Sync status of the indexer - * - * @typedef {Object} SyncStatus - * @property {Height} indexedHeight - Height of the last indexed block - * @property {Height} computedHeight - Height of the last computed block (series) - * @property {Height} tipHeight - Height of the chain tip (from Bitcoin node) - * @property {Height} blocksBehind - Number of blocks behind the tip - * @property {string} lastIndexedAt - Human-readable timestamp of the last indexed block (ISO 8601) - * @property {Timestamp} lastIndexedAtUnix - Unix timestamp of the last indexed block - */ -/** - * Time period for mining statistics. - * - * Used to specify the lookback window for pool statistics, hashrate calculations, - * and other time-based mining series. - * - * @typedef {("24h"|"3d"|"1w"|"1m"|"3m"|"6m"|"1y"|"2y"|"3y"|"all")} TimePeriod - */ -/** - * Time period path parameter (24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y) - * - * @typedef {Object} TimePeriodParam - * @property {TimePeriod} timePeriod - */ -/** - * UNIX timestamp in seconds - * - * @typedef {number} Timestamp - */ -/** - * UNIX timestamp path parameter - * - * @typedef {Object} TimestampParam - * @property {Timestamp} timestamp - */ -/** - * Transaction information compatible with mempool.space API format - * - * @typedef {Object} Transaction - * @property {(TxIndex|null)=} index - Internal transaction index (brk-specific, not in mempool.space) - * @property {Txid} txid - Transaction ID - * @property {TxVersionRaw} version - Transaction version (raw i32 from Bitcoin protocol, may contain non-standard values in coinbase txs) - * @property {RawLockTime} locktime - Transaction lock time - * @property {TxIn[]} vin - Transaction inputs - * @property {TxOut[]} vout - Transaction outputs - * @property {number} size - Transaction size in bytes - * @property {Weight} weight - Transaction weight - * @property {SigOps} sigops - Number of signature operations - * @property {Sats} fee - Transaction fee in satoshis - * @property {TxStatus} status - Confirmation status (confirmed, block height/hash/time) - */ -/** - * Hierarchical tree node for organizing series into categories - * - * @typedef {({ [key: string]: TreeNode }|SeriesLeafWithSchema)} TreeNode - */ -/** - * Transaction input - * - * @typedef {Object} TxIn - * @property {Txid} txid - Transaction ID of the output being spent - * @property {Vout} vout - Output index being spent (u16: coinbase is 65535, mempool.space uses u32: 4294967295) - * @property {(TxOut|null)=} prevout - Information about the previous output being spent - * @property {string} scriptsig - Signature script (hex, for non-SegWit inputs) - * @property {string} scriptsigAsm - Signature script in assembly format - * @property {Witness} witness - Witness data (stack items, present for SegWit inputs; hex-encoded on the wire) - * @property {boolean} isCoinbase - Whether this input is a coinbase (block reward) input - * @property {number} sequence - Input sequence number - * @property {string} innerRedeemscriptAsm - Inner redeemscript in assembly (for P2SH-wrapped SegWit: scriptsig + witness both present) - * @property {string} innerWitnessscriptAsm - Inner witnessscript in assembly (for P2WSH: last witness item decoded as script) - */ -/** @typedef {number} TxInIndex */ -/** - * Chain-wide transaction index (0 = the genesis coinbase). For an - * in-block position, use `BlockTxIndex` instead. - * - * @typedef {number} TxIndex - */ -/** - * Transaction index path parameter - * - * @typedef {Object} TxIndexParam - * @property {TxIndex} index - */ -/** - * Transaction output - * - * @typedef {Object} TxOut - * @property {string} scriptpubkey - Script pubkey (locking script) - * @property {Sats} value - Value of the output in satoshis - */ -/** @typedef {number} TxOutIndex */ -/** - * Status of an output indicating whether it has been spent - * - * @typedef {Object} TxOutspend - * @property {boolean} spent - Whether the output has been spent - * @property {(Txid|null)=} txid - Transaction ID of the spending transaction (only present if spent) - * @property {(Vin|null)=} vin - Input index in the spending transaction (only present if spent) - * @property {(TxStatus|null)=} status - Status of the spending transaction (only present if spent) - */ -/** - * Transaction confirmation status - * - * @typedef {Object} TxStatus - * @property {boolean} confirmed - Whether the transaction is confirmed - * @property {(Height|null)=} blockHeight - Block height (only present if confirmed) - * @property {(BlockHash|null)=} blockHash - Block hash (only present if confirmed) - * @property {(Timestamp|null)=} blockTime - Block timestamp (only present if confirmed) - */ -/** - * Transaction version number - * - * @typedef {number} TxVersion - */ -/** - * Raw transaction version (i32) from Bitcoin protocol. - * Unlike TxVersion (u8, indexed), this preserves non-standard values - * used in coinbase txs for miner signaling/branding. - * - * @typedef {number} TxVersionRaw - */ -/** - * Transaction ID (hash) - * - * @typedef {string} Txid - */ -/** - * Transaction ID path parameter - * - * @typedef {Object} TxidParam - * @property {Txid} txid - */ -/** - * Transaction output reference (txid + output index) - * - * @typedef {Object} TxidVout - * @property {Txid} txid - Transaction ID - * @property {Vout} vout - Output index - */ -/** - * Query parameter for transaction-times endpoint. - * - * Extracted manually because `serde_urlencoded` (and serde derive in general) - * doesn't support repeated keys like `txId[]=a&txId[]=b`. The schema is still - * declared via `JsonSchema` so the OpenAPI spec lists the parameter and the - * generated client SDKs see `txids: List[Txid]`. - * - * @typedef {Object} TxidsParam - * @property {Txid[]} txId - Transaction IDs to look up (max 250 per request). - */ -/** - * Index within its type (e.g., 0 for first P2WPKH address) - * - * @typedef {number} TypeIndex - */ -/** @typedef {number[]} U8x2 */ -/** @typedef {number[]} U8x20 */ -/** @typedef {number[]} U8x32 */ -/** @typedef {number[]} U8x33 */ -/** @typedef {number[]} U8x65 */ -/** @typedef {TypeIndex} UnknownOutputIndex */ -/** - * UTXO Realized Price Distribution for a cohort on a specific date. - * - * Supply is grouped by the close price at which each UTXO was last moved. - * Each bucket exposes three values: supply in BTC, realized cap contribution - * in USD (sum of `realized_price * supply` over the coins in the bucket), and - * unrealized P&L in USD (`close * supply - realized_cap`, can be negative). - * - * @typedef {Object} Urpd - * @property {Cohort} cohort - * @property {Date} date - * @property {UrpdAggregation} aggregation - Aggregation strategy applied to the buckets. - * @property {Dollars} close - Close price on `date`, in USD. Anchor for `unrealized_pnl`. - * @property {Bitcoin} totalSupply - Sum of `supply` across all buckets, in BTC. - * @property {UrpdBucket[]} buckets - */ -/** - * Aggregation strategy for URPD buckets. - * Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000), - * log10/log50/log100/log200/log500/log1000/log2000 (logarithmic with 10/50/100/200/500/1000/2000 buckets per decade). - * - * @typedef {("raw"|"lin200"|"lin500"|"lin1000"|"log10"|"log50"|"log100"|"log200"|"log500"|"log1000"|"log2000")} UrpdAggregation - */ -/** - * A single bucket in a URPD snapshot. - * - * @typedef {Object} UrpdBucket - * @property {Dollars} priceFloor - Lower bound of the bucket, in USD. Equals the exact realized price for `Raw`. - * @property {Bitcoin} supply - Supply held with a last-move price inside this bucket, in BTC. - * @property {Dollars} realizedCap - Realized cap contribution in USD: sum of `realized_price * supply` over the coins in this bucket. - * @property {Dollars} unrealizedPnl - Unrealized P&L in USD against the close on the snapshot date: `close * supply - realized_cap`. Can be negative. - */ -/** - * Path parameters for per-cohort URPD endpoints. - * - * @typedef {Object} UrpdCohortParam - * @property {Cohort} cohort - */ -/** - * Path parameters for `/api/urpd/{cohort}/{date}`. - * - * @typedef {Object} UrpdParams - * @property {Cohort} cohort - * @property {string} date - */ -/** - * Query parameters for URPD endpoints. - * - * @typedef {Object} UrpdQuery - * @property {UrpdAggregation=} agg - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias. - */ -/** - * Unspent transaction output - * - * @typedef {Object} Utxo - * @property {Txid} txid - Transaction ID of the UTXO - * @property {Vout} vout - Output index - * @property {TxStatus} status - Confirmation status - * @property {Sats} value - Output value in satoshis - */ -/** - * Virtual size in vbytes (weight / 4, rounded up). Max block vsize is ~1,000,000 vB. - * - * @typedef {number} VSize - */ -/** - * @typedef {Object} ValidateAddrParam - * @property {string} address - Bitcoin address to validate (can be any string) - */ -/** - * Version tracking for data schema and computed values. - * - * Used to detect when stored data needs to be recomputed due to changes - * in computation logic or source data versions. Supports validation - * against persisted versions to ensure compatibility. - * - * @typedef {number} Version - */ -/** - * Input index in the spending transaction - * - * @typedef {number} Vin - */ -/** - * Index of the output being spent in the previous transaction - * - * @typedef {number} Vout - */ -/** @typedef {number} Week1 */ -/** - * Weight in weight units (WU). Max block weight is 4,000,000 WU. - * - * @typedef {number} Weight - */ -/** - * Transaction witness: a stack of byte arrays, one per witness item. - * - * Wraps `bitcoin::Witness` (single-buffer layout with offsets, much - * more compact than `Vec>`). Serializes as a JSON array of - * hex strings - the format used by Bitcoin Core REST and mempool.space - * and matching brk's `script_sig: ScriptBuf` (bytes internally, hex - * on the wire). - * - * @typedef {string[]} Witness - */ -/** @typedef {number} Year1 */ -/** @typedef {number} Year10 */ - -/** - * @typedef {Object} BrkClientOptions - * @property {string} baseUrl - Base URL for the API - * @property {number} [timeout] - Request timeout in milliseconds - * @property {string|boolean} [browserCache] - Enable browser Cache API with default name (true), custom name (string), or disable (false). No effect in Node.js. Default: true - * @property {number|boolean} [memCache] - In-memory parsed-response cache size (LRU). true/undefined → 1000, false/0 → disabled. Lets 304 responses skip the JSON parse entirely. Default: 1000 - */ - -const _isBrowser = typeof window !== 'undefined' && 'caches' in window; -const _runIdle = (/** @type {VoidFunction} */ fn) => (globalThis.requestIdleCallback ?? setTimeout)(fn); -const _defaultBrowserCacheName = '__BRK_CLIENT__'; -const _DEFAULT_MEM_CACHE_SIZE = 1000; - -/** @template T @typedef {{ etag: string | null, value: T }} _MemEntry */ -/** @param {*} v */ -const _addCamelGetters = (v) => { - if (Array.isArray(v)) { v.forEach(_addCamelGetters); return v; } - if (v && typeof v === 'object' && v.constructor === Object) { - for (const k in v) { - if (k.includes('_')) { - const c = k.replace(/_([a-z])/g, (_, l) => l.toUpperCase()); - if (!(c in v)) Object.defineProperty(v, c, { get() { return this[k]; } }); - } - _addCamelGetters(v[k]); - } - } - return v; -}; - -/** - * @param {string|boolean|undefined} option - * @returns {Promise} - */ -const _openBrowserCache = (option) => { - if (!_isBrowser || option === false) return Promise.resolve(null); - const name = typeof option === 'string' ? option : _defaultBrowserCacheName; - return caches.open(name).catch(() => null); -}; - -/** - * Custom error class for BRK client errors - */ -class BrkError extends Error { - /** - * @param {string} message - * @param {number} [status] - */ - constructor(message, status) { - super(message); - this.name = 'BrkError'; - this.status = status; - } -} - -// Date conversion constants and helpers -const _GENESIS = new Date(2009, 0, 3); // day1 0, week1 0 -const _DAY_ONE = new Date(2009, 0, 9); // day1 1 (6 day gap after genesis) -const _MS_PER_DAY = 86400000; -const _MS_PER_WEEK = 7 * _MS_PER_DAY; -const _EPOCH_MS = 1230768000000; -const _DATE_INDEXES = new Set([ - 'minute10', 'minute30', - 'hour1', 'hour4', 'hour12', - 'day1', 'day3', 'week1', - 'month1', 'month3', 'month6', - 'year1', 'year10', -]); - -/** @param {number} months @returns {globalThis.Date} */ -const _addMonths = (months) => new Date(2009, months, 1); - -/** - * Convert an index value to a Date for date-based indexes. - * @param {Index} index - The index type - * @param {number} i - The index value - * @returns {globalThis.Date} - */ -function indexToDate(index, i) { - switch (index) { - case 'minute10': return new Date(_EPOCH_MS + i * 600000); - case 'minute30': return new Date(_EPOCH_MS + i * 1800000); - case 'hour1': return new Date(_EPOCH_MS + i * 3600000); - case 'hour4': return new Date(_EPOCH_MS + i * 14400000); - case 'hour12': return new Date(_EPOCH_MS + i * 43200000); - case 'day1': return i === 0 ? _GENESIS : new Date(_DAY_ONE.getTime() + (i - 1) * _MS_PER_DAY); - case 'day3': return new Date(_EPOCH_MS - 86400000 + i * 259200000); - case 'week1': return new Date(_GENESIS.getTime() + i * _MS_PER_WEEK); - case 'month1': return _addMonths(i); - case 'month3': return _addMonths(i * 3); - case 'month6': return _addMonths(i * 6); - case 'year1': return new Date(2009 + i, 0, 1); - case 'year10': return new Date(2009 + i * 10, 0, 1); - default: throw new Error(`${index} is not a date-based index`); - } -} - -/** - * Convert a Date to an index value for date-based indexes. - * Returns the floor index (latest index whose date is <= the given date). - * @param {Index} index - The index type - * @param {globalThis.Date} d - The date to convert - * @returns {number} - */ -function dateToIndex(index, d) { - const ms = d.getTime(); - switch (index) { - case 'minute10': return Math.floor((ms - _EPOCH_MS) / 600000); - case 'minute30': return Math.floor((ms - _EPOCH_MS) / 1800000); - case 'hour1': return Math.floor((ms - _EPOCH_MS) / 3600000); - case 'hour4': return Math.floor((ms - _EPOCH_MS) / 14400000); - case 'hour12': return Math.floor((ms - _EPOCH_MS) / 43200000); - case 'day1': { - if (ms < _DAY_ONE.getTime()) return 0; - return 1 + Math.floor((ms - _DAY_ONE.getTime()) / _MS_PER_DAY); - } - case 'day3': return Math.floor((ms - _EPOCH_MS + 86400000) / 259200000); - case 'week1': return Math.floor((ms - _GENESIS.getTime()) / _MS_PER_WEEK); - case 'month1': return (d.getFullYear() - 2009) * 12 + d.getMonth(); - case 'month3': return (d.getFullYear() - 2009) * 4 + Math.floor(d.getMonth() / 3); - case 'month6': return (d.getFullYear() - 2009) * 2 + Math.floor(d.getMonth() / 6); - case 'year1': return d.getFullYear() - 2009; - case 'year10': return Math.floor((d.getFullYear() - 2009) / 10); - default: throw new Error(`${index} is not a date-based index`); - } -} - -/** - * Wrap raw series data with helper methods. - * @template T - * @param {SeriesData} raw - Raw JSON response - * @returns {DateSeriesData} - */ -function _wrapSeriesData(raw) { - const { index, start, end, data } = raw; - const _dateBased = _DATE_INDEXES.has(index); - return /** @type {DateSeriesData} */ ({ - ...raw, - isDateBased: _dateBased, - indexes() { - /** @type {number[]} */ - const result = []; - for (let i = start; i < end; i++) result.push(i); - return result; - }, - keys() { - return this.indexes(); - }, - entries() { - /** @type {Array<[number, T]>} */ - const result = []; - for (let i = 0; i < data.length; i++) result.push([start + i, data[i]]); - return result; - }, - toMap() { - /** @type {Map} */ - const map = new Map(); - for (let i = 0; i < data.length; i++) map.set(start + i, data[i]); - return map; - }, - *[Symbol.iterator]() { - for (let i = 0; i < data.length; i++) yield /** @type {[number, T]} */ ([start + i, data[i]]); - }, - // DateSeriesData methods (only meaningful for date-based indexes) - dates() { - /** @type {globalThis.Date[]} */ - const result = []; - for (let i = start; i < end; i++) result.push(indexToDate(index, i)); - return result; - }, - dateEntries() { - /** @type {Array<[globalThis.Date, T]>} */ - const result = []; - for (let i = 0; i < data.length; i++) result.push([indexToDate(index, start + i), data[i]]); - return result; - }, - toDateMap() { - /** @type {Map} */ - const map = new Map(); - for (let i = 0; i < data.length; i++) map.set(indexToDate(index, start + i), data[i]); - return map; - }, - }); -} - -/** - * @template T - * @typedef {Object} SeriesDataBase - * @property {number} version - Version of the series data - * @property {Index} index - The index type used for this query - * @property {string} type - Value type (e.g. "f32", "u64", "Sats") - * @property {number} start - Start index (inclusive) - * @property {number} end - End index (exclusive) - * @property {string} stamp - ISO 8601 timestamp of when the response was generated - * @property {T[]} data - The series data - * @property {boolean} isDateBased - Whether this series uses a date-based index - * @property {() => number[]} indexes - Get index numbers - * @property {() => number[]} keys - Get keys as index numbers (alias for indexes) - * @property {() => Array<[number, T]>} entries - Get [index, value] pairs - * @property {() => Map} toMap - Convert to Map - */ - -/** @template T @typedef {SeriesDataBase & Iterable<[number, T]>} SeriesData */ - -/** - * @template T - * @typedef {Object} DateSeriesDataExtras - * @property {() => globalThis.Date[]} dates - Get dates for each data point - * @property {() => Array<[globalThis.Date, T]>} dateEntries - Get [date, value] pairs - * @property {() => Map} toDateMap - Convert to Map - */ - -/** @template T @typedef {SeriesData & DateSeriesDataExtras} DateSeriesData */ -/** @typedef {SeriesData} AnySeriesData */ - -/** @template T @typedef {(onfulfilled?: (value: SeriesData) => any, onrejected?: (reason: Error) => never) => Promise>} Thenable */ -/** @template T @typedef {(onfulfilled?: (value: DateSeriesData) => any, onrejected?: (reason: Error) => never) => Promise>} DateThenable */ - -/** - * @template T - * @typedef {Object} SeriesEndpoint - * @property {(index: number) => SingleItemBuilder} get - Get single item at index - * @property {(start?: number, end?: number) => RangeBuilder} slice - Slice by index - * @property {(n: number) => RangeBuilder} first - Get first n items - * @property {(n: number) => RangeBuilder} last - Get last n items - * @property {(n: number) => SkippedBuilder} skip - Skip first n items, chain with take() - * @property {(onValue?: (value: SeriesData) => void) => Promise>} fetch - Fetch all data - * @property {() => Promise} fetchCsv - Fetch all data as CSV - * @property {() => Promise} len - Get total number of data points - * @property {() => Promise} version - Get the current version of the series - * @property {Thenable} then - Thenable (await endpoint) - * @property {string} path - The endpoint path - */ - -/** - * @template T - * @typedef {Object} DateSeriesEndpoint - * @property {(index: number | globalThis.Date) => DateSingleItemBuilder} get - Get single item at index or Date - * @property {(start?: number | globalThis.Date, end?: number | globalThis.Date) => DateRangeBuilder} slice - Slice by index or Date - * @property {(n: number) => DateRangeBuilder} first - Get first n items - * @property {(n: number) => DateRangeBuilder} last - Get last n items - * @property {(n: number) => DateSkippedBuilder} skip - Skip first n items, chain with take() - * @property {(onValue?: (value: DateSeriesData) => void) => Promise>} fetch - Fetch all data - * @property {() => Promise} fetchCsv - Fetch all data as CSV - * @property {() => Promise} len - Get total number of data points - * @property {() => Promise} version - Get the current version of the series - * @property {DateThenable} then - Thenable (await endpoint) - * @property {string} path - The endpoint path - */ - -/** @typedef {SeriesEndpoint} AnySeriesEndpoint */ - -/** @template T @typedef {Object} SingleItemBuilder - * @property {(onValue?: (value: SeriesData) => void) => Promise>} fetch - Fetch the item - * @property {() => Promise} fetchCsv - Fetch as CSV - * @property {Thenable} then - Thenable - */ - -/** @template T @typedef {Object} DateSingleItemBuilder - * @property {(onValue?: (value: DateSeriesData) => void) => Promise>} fetch - Fetch the item - * @property {() => Promise} fetchCsv - Fetch as CSV - * @property {DateThenable} then - Thenable - */ - -/** @template T @typedef {Object} SkippedBuilder - * @property {(n: number) => RangeBuilder} take - Take n items after skipped position - * @property {(onValue?: (value: SeriesData) => void) => Promise>} fetch - Fetch from skipped position to end - * @property {() => Promise} fetchCsv - Fetch as CSV - * @property {Thenable} then - Thenable - */ - -/** @template T @typedef {Object} DateSkippedBuilder - * @property {(n: number) => DateRangeBuilder} take - Take n items after skipped position - * @property {(onValue?: (value: DateSeriesData) => void) => Promise>} fetch - Fetch from skipped position to end - * @property {() => Promise} fetchCsv - Fetch as CSV - * @property {DateThenable} then - Thenable - */ - -/** @template T @typedef {Object} RangeBuilder - * @property {(onValue?: (value: SeriesData) => void) => Promise>} fetch - Fetch the range - * @property {() => Promise} fetchCsv - Fetch as CSV - * @property {Thenable} then - Thenable - */ - -/** @template T @typedef {Object} DateRangeBuilder - * @property {(onValue?: (value: DateSeriesData) => void) => Promise>} fetch - Fetch the range - * @property {() => Promise} fetchCsv - Fetch as CSV - * @property {DateThenable} then - Thenable - */ - -/** - * @template T - * @typedef {Object} SeriesPattern - * @property {string} name - The series name - * @property {Readonly>>>} by - Index endpoints as lazy getters - * @property {() => readonly Index[]} indexes - Get the list of available indexes - * @property {(index: Index) => SeriesEndpoint|undefined} get - Get an endpoint for a specific index - */ - -/** @typedef {SeriesPattern} AnySeriesPattern */ - -/** - * Create a series endpoint builder with typestate pattern. - * @template T - * @param {BrkClient} client - * @param {string} name - The series vec name - * @param {Index} index - The index name - * @returns {DateSeriesEndpoint} - */ -function _endpoint(client, name, index) { - const p = `/api/series/${name}/${index}`; - - /** - * @param {number} [start] - * @param {number} [end] - * @param {string} [format] - * @returns {string} - */ - const buildPath = (start, end, format) => { - const params = new URLSearchParams(); - if (start !== undefined) params.set('start', String(start)); - if (end !== undefined) params.set('end', String(end)); - if (format) params.set('format', format); - const query = params.toString(); - return query ? `${p}?${query}` : p; - }; - - /** - * @param {number} [start] - * @param {number} [end] - * @returns {DateRangeBuilder} - */ - const rangeBuilder = (start, end) => ({ - fetch(onValue) { return client._fetchSeriesData(buildPath(start, end), onValue); }, - fetchCsv() { return client.getText(buildPath(start, end, 'csv')); }, - then(resolve, reject) { return this.fetch().then(resolve, reject); }, - }); - - /** - * @param {number} idx - * @returns {DateSingleItemBuilder} - */ - const singleItemBuilder = (idx) => ({ - fetch(onValue) { return client._fetchSeriesData(buildPath(idx, idx + 1), onValue); }, - fetchCsv() { return client.getText(buildPath(idx, idx + 1, 'csv')); }, - then(resolve, reject) { return this.fetch().then(resolve, reject); }, - }); - - /** - * @param {number} start - * @returns {DateSkippedBuilder} - */ - const skippedBuilder = (start) => ({ - take(n) { return rangeBuilder(start, start + n); }, - fetch(onValue) { return client._fetchSeriesData(buildPath(start, undefined), onValue); }, - fetchCsv() { return client.getText(buildPath(start, undefined, 'csv')); }, - then(resolve, reject) { return this.fetch().then(resolve, reject); }, - }); - - /** @type {DateSeriesEndpoint} */ - const endpoint = { - get(idx) { if (idx instanceof Date) idx = dateToIndex(index, idx); return singleItemBuilder(idx); }, - slice(start, end) { - if (start instanceof Date) start = dateToIndex(index, start); - if (end instanceof Date) end = dateToIndex(index, end); - return rangeBuilder(start, end); - }, - first(n) { return rangeBuilder(undefined, n); }, - last(n) { return n === 0 ? rangeBuilder(undefined, 0) : rangeBuilder(-n, undefined); }, - skip(n) { return skippedBuilder(n); }, - fetch(onValue) { return client._fetchSeriesData(buildPath(), onValue); }, - fetchCsv() { return client.getText(buildPath(undefined, undefined, 'csv')); }, - len() { return client.getSeriesLen(name, index); }, - version() { return client.getSeriesVersion(name, index); }, - then(resolve, reject) { return this.fetch().then(resolve, reject); }, - get path() { return p; }, - }; - - return endpoint; -} - -/** - * Base HTTP client for making requests with caching support - */ -class BrkClientBase { - /** - * @param {BrkClientOptions|string} options - */ - constructor(options) { - const isString = typeof options === 'string'; - const rawUrl = isString ? options : options.baseUrl; - this.baseUrl = rawUrl.endsWith('/') ? rawUrl.slice(0, -1) : rawUrl; - this.timeout = isString ? 5000 : (options.timeout ?? 5000); - /** @type {Promise} */ - this._browserCachePromise = _openBrowserCache(isString ? undefined : options.browserCache); - /** @type {Cache | null} */ - this._browserCache = null; - this._browserCachePromise.then(c => this._browserCache = c); - const memOpt = isString ? undefined : options.memCache; - this._memCacheMax = memOpt === false || memOpt === 0 - ? 0 - : (typeof memOpt === 'number' ? memOpt : _DEFAULT_MEM_CACHE_SIZE); - /** @type {Map>} */ - this._memCache = new Map(); - } - - /** - * @template T - * @param {string} key - * @returns {_MemEntry | undefined} - */ - _memGet(key) { - if (!this._memCacheMax) return undefined; - const hit = this._memCache.get(key); - if (!hit) return undefined; - this._memCache.delete(key); - this._memCache.set(key, hit); - return /** @type {_MemEntry} */ (hit); - } - - /** - * @param {string} key - * @param {string | null} etag - * @param {unknown} value - */ - _memSet(key, etag, value) { - if (!this._memCacheMax) return; - if (this._memCache.has(key)) this._memCache.delete(key); - else if (this._memCache.size >= this._memCacheMax) { - const oldest = this._memCache.keys().next().value; - if (oldest !== undefined) this._memCache.delete(oldest); - } - this._memCache.set(key, { etag, value }); - } - - /** - * @param {string} path - * @param {{ signal?: AbortSignal, cache?: boolean }} [options] - * @returns {Promise} - */ - async get(path, { signal, cache = true } = {}) { - const url = `${this.baseUrl}${path}`; - const signals = [AbortSignal.timeout(this.timeout)]; - if (signal) signals.push(signal); - /** @type {RequestInit} */ - const init = { signal: AbortSignal.any(signals) }; - if (!cache) init.cache = 'no-store'; - const res = await fetch(url, init); - if (!res.ok) throw new BrkError(`HTTP ${res.status}: ${url}`, res.status); - return res; - } - - /** - * Make a GET request with layered caching. - * - * Contract: - * - The returned Promise resolves with the **freshest** value (post-revalidation). - * - `onValue` fires once with the freshest value, or twice if a stale snapshot - * could be shown first (stale-while-revalidate). On a 304 there is no second fire. - * - * Layers: - * - L1 (memCache): in-memory parsed values keyed by URL+ETag. Lets 304s skip the parse entirely. - * - L2 (browserCache): Cache API, survives reload and feeds onValue fast on cold start. - * - * @template T - * @param {string} path - * @param {(res: Response) => Promise} parse - Response body reader - * @param {{ onValue?: (value: T) => void, signal?: AbortSignal, cache?: boolean }} [options] - * @returns {Promise} - */ - async _getCached(path, parse, { onValue, signal, cache = true } = {}) { - if (!cache) { - const res = await this.get(path, { signal, cache }); - const value = await parse(res); - if (onValue) onValue(value); - return value; - } - - const url = `${this.baseUrl}${path}`; - /** @type {_MemEntry | undefined} */ - const memHit = this._memGet(url); - const browserCache = this._browserCache; - - // L1 fast path: deliver from memCache, revalidate via network. - // ETag match → zero parse, zero clone, zero cache write, no second onValue fire. - if (memHit) { - if (onValue) onValue(memHit.value); - try { - const res = await this.get(path, { signal }); - const netEtag = res.headers.get('ETag'); - if (netEtag && netEtag === memHit.etag) return memHit.value; - const cloned = browserCache ? res.clone() : null; - const value = await parse(res); - this._memSet(url, netEtag, value); - if (onValue) onValue(value); - if (cloned && browserCache) { - const cacheStore = browserCache; - _runIdle(() => cacheStore.put(url, cloned)); - } - return value; - } catch { - return memHit.value; - } - } - - // L1 miss: race browserCache (stale snapshot) vs network (fresh). - let networkSettled = false; - const stalePromise = onValue && browserCache - ? browserCache.match(url).then(async (res) => { - if (!res || networkSettled) return null; - const value = await parse(res); - if (networkSettled) return value; - this._memSet(url, res.headers.get('ETag'), value); - onValue(value); - return value; - }).catch(() => null) - : null; - - try { - const res = await this.get(path, { signal }); - networkSettled = true; - const netEtag = res.headers.get('ETag'); - // Stale won and populated memCache with matching ETag → reuse, skip parse + second onValue. - const populated = /** @type {_MemEntry | undefined} */ (this._memGet(url)); - if (populated && netEtag && netEtag === populated.etag) return populated.value; - const cloned = browserCache ? res.clone() : null; - const value = await parse(res); - this._memSet(url, netEtag, value); - if (onValue) onValue(value); - if (cloned && browserCache) { - const cacheStore = browserCache; - _runIdle(() => cacheStore.put(url, cloned)); - } - return value; - } catch (e) { - const stale = await stalePromise; - if (stale != null) return stale; - throw e; - } - } - - /** - * Make a GET request expecting a JSON response. Cached and supports `onValue`. - * @template T - * @param {string} path - * @param {{ onValue?: (value: T) => void, signal?: AbortSignal, cache?: boolean }} [options] - * @returns {Promise} - */ - getJson(path, options) { - return this._getCached(path, async (res) => _addCamelGetters(await res.json()), options); - } - - /** - * Make a GET request expecting a text response (text/plain, text/csv, ...). - * Cached and supports `onValue`, same as `getJson`. - * @param {string} path - * @param {{ onValue?: (value: string) => void, signal?: AbortSignal, cache?: boolean }} [options] - * @returns {Promise} - */ - getText(path, options) { - return this._getCached(path, (res) => res.text(), options); - } - - /** - * Make a GET request expecting binary data (application/octet-stream). - * Cached and supports `onValue`, same as `getJson`. - * @param {string} path - * @param {{ onValue?: (value: Uint8Array) => void, signal?: AbortSignal, cache?: boolean }} [options] - * @returns {Promise} - */ - getBytes(path, options) { - return this._getCached(path, async (res) => new Uint8Array(await res.arrayBuffer()), options); - } - - /** - * Make a POST request with a string body. - * - * POST responses are uncached and never invoke `onValue` — every call hits - * the network with the same body and returns the upstream response. - * - * @param {string} path - * @param {string} body - * @param {{ signal?: AbortSignal }} [options] - * @returns {Promise} - */ - async post(path, body, { signal } = {}) { - const url = `${this.baseUrl}${path}`; - const signals = [AbortSignal.timeout(this.timeout)]; - if (signal) signals.push(signal); - const res = await fetch(url, { - method: 'POST', - body, - signal: AbortSignal.any(signals), - }); - if (!res.ok) throw new BrkError(`HTTP ${res.status}: ${url}`, res.status); - return res; - } - - /** - * Make a POST request expecting a JSON response. - * @template T - * @param {string} path - * @param {string} body - * @param {{ signal?: AbortSignal }} [options] - * @returns {Promise} - */ - async postJson(path, body, options) { - const res = await this.post(path, body, options); - return _addCamelGetters(await res.json()); - } - - /** - * Make a POST request expecting a text response. - * @param {string} path - * @param {string} body - * @param {{ signal?: AbortSignal }} [options] - * @returns {Promise} - */ - async postText(path, body, options) { - const res = await this.post(path, body, options); - return res.text(); - } - - /** - * Make a POST request expecting binary data (application/octet-stream). - * @param {string} path - * @param {string} body - * @param {{ signal?: AbortSignal }} [options] - * @returns {Promise} - */ - async postBytes(path, body, options) { - const res = await this.post(path, body, options); - return new Uint8Array(await res.arrayBuffer()); - } - - /** - * Fetch series data and wrap with helper methods (internal) - * @template T - * @param {string} path - * @param {(value: DateSeriesData) => void} [onValue] - * @returns {Promise>} - */ - async _fetchSeriesData(path, onValue) { - const wrappedOnValue = onValue ? (/** @type {SeriesData} */ raw) => onValue(_wrapSeriesData(raw)) : undefined; - const raw = await this.getJson(path, { onValue: wrappedOnValue }); - return _wrapSeriesData(raw); - } -} - -/** - * Build series name with suffix. - * @param {string} acc - Accumulated prefix - * @param {string} s - Series suffix - * @returns {string} - */ -const _m = (acc, s) => s ? (acc ? `${acc}_${s}` : s) : acc; - -/** - * Build series name with prefix. - * @param {string} prefix - Prefix to prepend - * @param {string} acc - Accumulated name - * @returns {string} - */ -const _p = (prefix, acc) => acc ? `${prefix}_${acc}` : prefix; - - -// Index group constants and factory - -const _i1 = /** @type {const} */ (["minute10", "minute30", "hour1", "hour4", "hour12", "day1", "day3", "week1", "month1", "month3", "month6", "year1", "year10", "halving", "epoch", "height"]); -const _i2 = /** @type {const} */ (["minute10", "minute30", "hour1", "hour4", "hour12", "day1", "day3", "week1", "month1", "month3", "month6", "year1", "year10", "halving", "epoch"]); -const _i3 = /** @type {const} */ (["minute10"]); -const _i4 = /** @type {const} */ (["minute30"]); -const _i5 = /** @type {const} */ (["hour1"]); -const _i6 = /** @type {const} */ (["hour4"]); -const _i7 = /** @type {const} */ (["hour12"]); -const _i8 = /** @type {const} */ (["day1"]); -const _i9 = /** @type {const} */ (["day3"]); -const _i10 = /** @type {const} */ (["week1"]); -const _i11 = /** @type {const} */ (["month1"]); -const _i12 = /** @type {const} */ (["month3"]); -const _i13 = /** @type {const} */ (["month6"]); -const _i14 = /** @type {const} */ (["year1"]); -const _i15 = /** @type {const} */ (["year10"]); -const _i16 = /** @type {const} */ (["halving"]); -const _i17 = /** @type {const} */ (["epoch"]); -const _i18 = /** @type {const} */ (["height"]); -const _i19 = /** @type {const} */ (["tx_index"]); -const _i20 = /** @type {const} */ (["txin_index"]); -const _i21 = /** @type {const} */ (["txout_index"]); -const _i22 = /** @type {const} */ (["empty_output_index"]); -const _i23 = /** @type {const} */ (["op_return_index"]); -const _i24 = /** @type {const} */ (["p2a_addr_index"]); -const _i25 = /** @type {const} */ (["p2ms_output_index"]); -const _i26 = /** @type {const} */ (["p2pk33_addr_index"]); -const _i27 = /** @type {const} */ (["p2pk65_addr_index"]); -const _i28 = /** @type {const} */ (["p2pkh_addr_index"]); -const _i29 = /** @type {const} */ (["p2sh_addr_index"]); -const _i30 = /** @type {const} */ (["p2tr_addr_index"]); -const _i31 = /** @type {const} */ (["p2wpkh_addr_index"]); -const _i32 = /** @type {const} */ (["p2wsh_addr_index"]); -const _i33 = /** @type {const} */ (["unknown_output_index"]); -const _i34 = /** @type {const} */ (["funded_addr_index"]); -const _i35 = /** @type {const} */ (["empty_addr_index"]); - -/** - * Generic series pattern factory. - * @template T - * @param {BrkClient} client - * @param {string} name - The series vec name - * @param {readonly Index[]} indexes - The supported indexes - */ -function _mp(client, name, indexes) { - const by = {}; - for (const idx of indexes) { - Object.defineProperty(by, idx, { - get() { return _endpoint(client, name, idx); }, - enumerable: true, - configurable: true - }); - } - return { - name, - by, - /** @returns {readonly Index[]} */ - indexes() { return indexes; }, - /** @param {Index} index @returns {SeriesEndpoint|undefined} */ - get(index) { return indexes.includes(index) ? _endpoint(client, name, index) : undefined; } - }; -} - -/** @template T @typedef {{ name: string, by: { readonly minute10: DateSeriesEndpoint, readonly minute30: DateSeriesEndpoint, readonly hour1: DateSeriesEndpoint, readonly hour4: DateSeriesEndpoint, readonly hour12: DateSeriesEndpoint, readonly day1: DateSeriesEndpoint, readonly day3: DateSeriesEndpoint, readonly week1: DateSeriesEndpoint, readonly month1: DateSeriesEndpoint, readonly month3: DateSeriesEndpoint, readonly month6: DateSeriesEndpoint, readonly year1: DateSeriesEndpoint, readonly year10: DateSeriesEndpoint, readonly halving: SeriesEndpoint, readonly epoch: SeriesEndpoint, readonly height: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern1 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern1} */ -function createSeriesPattern1(client, name) { return /** @type {SeriesPattern1} */ (_mp(client, name, _i1)); } -/** @template T @typedef {{ name: string, by: { readonly minute10: DateSeriesEndpoint, readonly minute30: DateSeriesEndpoint, readonly hour1: DateSeriesEndpoint, readonly hour4: DateSeriesEndpoint, readonly hour12: DateSeriesEndpoint, readonly day1: DateSeriesEndpoint, readonly day3: DateSeriesEndpoint, readonly week1: DateSeriesEndpoint, readonly month1: DateSeriesEndpoint, readonly month3: DateSeriesEndpoint, readonly month6: DateSeriesEndpoint, readonly year1: DateSeriesEndpoint, readonly year10: DateSeriesEndpoint, readonly halving: SeriesEndpoint, readonly epoch: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern2 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern2} */ -function createSeriesPattern2(client, name) { return /** @type {SeriesPattern2} */ (_mp(client, name, _i2)); } -/** @template T @typedef {{ name: string, by: { readonly minute10: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern3 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern3} */ -function createSeriesPattern3(client, name) { return /** @type {SeriesPattern3} */ (_mp(client, name, _i3)); } -/** @template T @typedef {{ name: string, by: { readonly minute30: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern4 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern4} */ -function createSeriesPattern4(client, name) { return /** @type {SeriesPattern4} */ (_mp(client, name, _i4)); } -/** @template T @typedef {{ name: string, by: { readonly hour1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern5 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern5} */ -function createSeriesPattern5(client, name) { return /** @type {SeriesPattern5} */ (_mp(client, name, _i5)); } -/** @template T @typedef {{ name: string, by: { readonly hour4: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern6 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern6} */ -function createSeriesPattern6(client, name) { return /** @type {SeriesPattern6} */ (_mp(client, name, _i6)); } -/** @template T @typedef {{ name: string, by: { readonly hour12: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern7 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern7} */ -function createSeriesPattern7(client, name) { return /** @type {SeriesPattern7} */ (_mp(client, name, _i7)); } -/** @template T @typedef {{ name: string, by: { readonly day1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern8 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern8} */ -function createSeriesPattern8(client, name) { return /** @type {SeriesPattern8} */ (_mp(client, name, _i8)); } -/** @template T @typedef {{ name: string, by: { readonly day3: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern9 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern9} */ -function createSeriesPattern9(client, name) { return /** @type {SeriesPattern9} */ (_mp(client, name, _i9)); } -/** @template T @typedef {{ name: string, by: { readonly week1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern10 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern10} */ -function createSeriesPattern10(client, name) { return /** @type {SeriesPattern10} */ (_mp(client, name, _i10)); } -/** @template T @typedef {{ name: string, by: { readonly month1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern11 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern11} */ -function createSeriesPattern11(client, name) { return /** @type {SeriesPattern11} */ (_mp(client, name, _i11)); } -/** @template T @typedef {{ name: string, by: { readonly month3: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern12 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern12} */ -function createSeriesPattern12(client, name) { return /** @type {SeriesPattern12} */ (_mp(client, name, _i12)); } -/** @template T @typedef {{ name: string, by: { readonly month6: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern13 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern13} */ -function createSeriesPattern13(client, name) { return /** @type {SeriesPattern13} */ (_mp(client, name, _i13)); } -/** @template T @typedef {{ name: string, by: { readonly year1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern14 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern14} */ -function createSeriesPattern14(client, name) { return /** @type {SeriesPattern14} */ (_mp(client, name, _i14)); } -/** @template T @typedef {{ name: string, by: { readonly year10: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern15 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern15} */ -function createSeriesPattern15(client, name) { return /** @type {SeriesPattern15} */ (_mp(client, name, _i15)); } -/** @template T @typedef {{ name: string, by: { readonly halving: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern16 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern16} */ -function createSeriesPattern16(client, name) { return /** @type {SeriesPattern16} */ (_mp(client, name, _i16)); } -/** @template T @typedef {{ name: string, by: { readonly epoch: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern17 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern17} */ -function createSeriesPattern17(client, name) { return /** @type {SeriesPattern17} */ (_mp(client, name, _i17)); } -/** @template T @typedef {{ name: string, by: { readonly height: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern18 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern18} */ -function createSeriesPattern18(client, name) { return /** @type {SeriesPattern18} */ (_mp(client, name, _i18)); } -/** @template T @typedef {{ name: string, by: { readonly tx_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern19 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern19} */ -function createSeriesPattern19(client, name) { return /** @type {SeriesPattern19} */ (_mp(client, name, _i19)); } -/** @template T @typedef {{ name: string, by: { readonly txin_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern20 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern20} */ -function createSeriesPattern20(client, name) { return /** @type {SeriesPattern20} */ (_mp(client, name, _i20)); } -/** @template T @typedef {{ name: string, by: { readonly txout_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern21 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern21} */ -function createSeriesPattern21(client, name) { return /** @type {SeriesPattern21} */ (_mp(client, name, _i21)); } -/** @template T @typedef {{ name: string, by: { readonly empty_output_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern22 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern22} */ -function createSeriesPattern22(client, name) { return /** @type {SeriesPattern22} */ (_mp(client, name, _i22)); } -/** @template T @typedef {{ name: string, by: { readonly op_return_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern23 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern23} */ -function createSeriesPattern23(client, name) { return /** @type {SeriesPattern23} */ (_mp(client, name, _i23)); } -/** @template T @typedef {{ name: string, by: { readonly p2a_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern24 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern24} */ -function createSeriesPattern24(client, name) { return /** @type {SeriesPattern24} */ (_mp(client, name, _i24)); } -/** @template T @typedef {{ name: string, by: { readonly p2ms_output_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern25 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern25} */ -function createSeriesPattern25(client, name) { return /** @type {SeriesPattern25} */ (_mp(client, name, _i25)); } -/** @template T @typedef {{ name: string, by: { readonly p2pk33_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern26 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern26} */ -function createSeriesPattern26(client, name) { return /** @type {SeriesPattern26} */ (_mp(client, name, _i26)); } -/** @template T @typedef {{ name: string, by: { readonly p2pk65_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern27 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern27} */ -function createSeriesPattern27(client, name) { return /** @type {SeriesPattern27} */ (_mp(client, name, _i27)); } -/** @template T @typedef {{ name: string, by: { readonly p2pkh_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern28 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern28} */ -function createSeriesPattern28(client, name) { return /** @type {SeriesPattern28} */ (_mp(client, name, _i28)); } -/** @template T @typedef {{ name: string, by: { readonly p2sh_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern29 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern29} */ -function createSeriesPattern29(client, name) { return /** @type {SeriesPattern29} */ (_mp(client, name, _i29)); } -/** @template T @typedef {{ name: string, by: { readonly p2tr_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern30 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern30} */ -function createSeriesPattern30(client, name) { return /** @type {SeriesPattern30} */ (_mp(client, name, _i30)); } -/** @template T @typedef {{ name: string, by: { readonly p2wpkh_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern31 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern31} */ -function createSeriesPattern31(client, name) { return /** @type {SeriesPattern31} */ (_mp(client, name, _i31)); } -/** @template T @typedef {{ name: string, by: { readonly p2wsh_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern32 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern32} */ -function createSeriesPattern32(client, name) { return /** @type {SeriesPattern32} */ (_mp(client, name, _i32)); } -/** @template T @typedef {{ name: string, by: { readonly unknown_output_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern33 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern33} */ -function createSeriesPattern33(client, name) { return /** @type {SeriesPattern33} */ (_mp(client, name, _i33)); } -/** @template T @typedef {{ name: string, by: { readonly funded_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern34 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern34} */ -function createSeriesPattern34(client, name) { return /** @type {SeriesPattern34} */ (_mp(client, name, _i34)); } -/** @template T @typedef {{ name: string, by: { readonly empty_addr_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern35 */ -/** @template T @param {BrkClient} client @param {string} name @returns {SeriesPattern35} */ -function createSeriesPattern35(client, name) { return /** @type {SeriesPattern35} */ (_mp(client, name, _i35)); } - -// Reusable structural pattern factories - -/** - * @typedef {Object} Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern - * @property {CentsSatsUsdPattern} pct05 - * @property {CentsSatsUsdPattern} pct10 - * @property {CentsSatsUsdPattern} pct15 - * @property {CentsSatsUsdPattern} pct20 - * @property {CentsSatsUsdPattern} pct25 - * @property {CentsSatsUsdPattern} pct30 - * @property {CentsSatsUsdPattern} pct35 - * @property {CentsSatsUsdPattern} pct40 - * @property {CentsSatsUsdPattern} pct45 - * @property {CentsSatsUsdPattern} pct50 - * @property {CentsSatsUsdPattern} pct55 - * @property {CentsSatsUsdPattern} pct60 - * @property {CentsSatsUsdPattern} pct65 - * @property {CentsSatsUsdPattern} pct70 - * @property {CentsSatsUsdPattern} pct75 - * @property {CentsSatsUsdPattern} pct80 - * @property {CentsSatsUsdPattern} pct85 - * @property {CentsSatsUsdPattern} pct90 - * @property {CentsSatsUsdPattern} pct95 - */ - -/** - * Create a Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} - */ -function createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, acc) { - return { - pct05: createCentsSatsUsdPattern(client, _m(acc, 'pct05')), - pct10: createCentsSatsUsdPattern(client, _m(acc, 'pct10')), - pct15: createCentsSatsUsdPattern(client, _m(acc, 'pct15')), - pct20: createCentsSatsUsdPattern(client, _m(acc, 'pct20')), - pct25: createCentsSatsUsdPattern(client, _m(acc, 'pct25')), - pct30: createCentsSatsUsdPattern(client, _m(acc, 'pct30')), - pct35: createCentsSatsUsdPattern(client, _m(acc, 'pct35')), - pct40: createCentsSatsUsdPattern(client, _m(acc, 'pct40')), - pct45: createCentsSatsUsdPattern(client, _m(acc, 'pct45')), - pct50: createCentsSatsUsdPattern(client, _m(acc, 'pct50')), - pct55: createCentsSatsUsdPattern(client, _m(acc, 'pct55')), - pct60: createCentsSatsUsdPattern(client, _m(acc, 'pct60')), - pct65: createCentsSatsUsdPattern(client, _m(acc, 'pct65')), - pct70: createCentsSatsUsdPattern(client, _m(acc, 'pct70')), - pct75: createCentsSatsUsdPattern(client, _m(acc, 'pct75')), - pct80: createCentsSatsUsdPattern(client, _m(acc, 'pct80')), - pct85: createCentsSatsUsdPattern(client, _m(acc, 'pct85')), - pct90: createCentsSatsUsdPattern(client, _m(acc, 'pct90')), - pct95: createCentsSatsUsdPattern(client, _m(acc, 'pct95')), - }; -} - -/** - * @typedef {Object} _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m3sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p3sd - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - */ - -/** - * @typedef {Object} AllEmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern - * @property {AverageBlockCumulativeSumPattern} all - * @property {AverageBlockCumulativeSumPattern} empty - * @property {AverageBlockCumulativeSumPattern} opReturn - * @property {AverageBlockCumulativeSumPattern} p2a - * @property {AverageBlockCumulativeSumPattern} p2ms - * @property {AverageBlockCumulativeSumPattern} p2pk33 - * @property {AverageBlockCumulativeSumPattern} p2pk65 - * @property {AverageBlockCumulativeSumPattern} p2pkh - * @property {AverageBlockCumulativeSumPattern} p2sh - * @property {AverageBlockCumulativeSumPattern} p2tr - * @property {AverageBlockCumulativeSumPattern} p2wpkh - * @property {AverageBlockCumulativeSumPattern} p2wsh - * @property {AverageBlockCumulativeSumPattern} unknown - */ - -/** - * Create a AllEmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AllEmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern} - */ -function createAllEmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern(client, acc) { - return { - all: createAverageBlockCumulativeSumPattern(client, _m(acc, 'bis')), - empty: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_empty_outputs_output')), - opReturn: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_op_return_output')), - p2a: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_p2a_output')), - p2ms: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_p2ms_output')), - p2pk33: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_p2pk33_output')), - p2pk65: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_p2pk65_output')), - p2pkh: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_p2pkh_output')), - p2sh: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_p2sh_output')), - p2tr: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_p2tr_output')), - p2wpkh: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_p2wpkh_output')), - p2wsh: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_p2wsh_output')), - unknown: createAverageBlockCumulativeSumPattern(client, _m(acc, 'with_unknown_outputs_output')), - }; -} - -/** - * @typedef {Object} _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 - * @property {BpsPercentRatioPattern} _10y - * @property {BpsPercentRatioPattern} _1m - * @property {BpsPercentRatioPattern} _1w - * @property {BpsPercentRatioPattern} _1y - * @property {BpsPercentRatioPattern} _2y - * @property {BpsPercentRatioPattern} _3m - * @property {BpsPercentRatioPattern} _3y - * @property {BpsPercentRatioPattern} _4y - * @property {BpsPercentRatioPattern} _5y - * @property {BpsPercentRatioPattern} _6m - * @property {BpsPercentRatioPattern} _6y - * @property {BpsPercentRatioPattern} _8y - */ - -/** - * Create a _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} - */ -function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, acc) { - return { - _10y: createBpsPercentRatioPattern(client, _m(acc, '10y')), - _1m: createBpsPercentRatioPattern(client, _m(acc, '1m')), - _1w: createBpsPercentRatioPattern(client, _m(acc, '1w')), - _1y: createBpsPercentRatioPattern(client, _m(acc, '1y')), - _2y: createBpsPercentRatioPattern(client, _m(acc, '2y')), - _3m: createBpsPercentRatioPattern(client, _m(acc, '3m')), - _3y: createBpsPercentRatioPattern(client, _m(acc, '3y')), - _4y: createBpsPercentRatioPattern(client, _m(acc, '4y')), - _5y: createBpsPercentRatioPattern(client, _m(acc, '5y')), - _6m: createBpsPercentRatioPattern(client, _m(acc, '6m')), - _6y: createBpsPercentRatioPattern(client, _m(acc, '6y')), - _8y: createBpsPercentRatioPattern(client, _m(acc, '8y')), - }; -} - -/** - * @typedef {Object} _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 - * @property {BtcCentsSatsUsdPattern} _10y - * @property {BtcCentsSatsUsdPattern} _1m - * @property {BtcCentsSatsUsdPattern} _1w - * @property {BtcCentsSatsUsdPattern} _1y - * @property {BtcCentsSatsUsdPattern} _2y - * @property {BtcCentsSatsUsdPattern} _3m - * @property {BtcCentsSatsUsdPattern} _3y - * @property {BtcCentsSatsUsdPattern} _4y - * @property {BtcCentsSatsUsdPattern} _5y - * @property {BtcCentsSatsUsdPattern} _6m - * @property {BtcCentsSatsUsdPattern} _6y - * @property {BtcCentsSatsUsdPattern} _8y - */ - -/** - * Create a _10y1m1w1y2y3m3y4y5y6m6y8yPattern3 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} - */ -function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { - return { - _10y: createBtcCentsSatsUsdPattern(client, _m(acc, '10y')), - _1m: createBtcCentsSatsUsdPattern(client, _m(acc, '1m')), - _1w: createBtcCentsSatsUsdPattern(client, _m(acc, '1w')), - _1y: createBtcCentsSatsUsdPattern(client, _m(acc, '1y')), - _2y: createBtcCentsSatsUsdPattern(client, _m(acc, '2y')), - _3m: createBtcCentsSatsUsdPattern(client, _m(acc, '3m')), - _3y: createBtcCentsSatsUsdPattern(client, _m(acc, '3y')), - _4y: createBtcCentsSatsUsdPattern(client, _m(acc, '4y')), - _5y: createBtcCentsSatsUsdPattern(client, _m(acc, '5y')), - _6m: createBtcCentsSatsUsdPattern(client, _m(acc, '6m')), - _6y: createBtcCentsSatsUsdPattern(client, _m(acc, '6y')), - _8y: createBtcCentsSatsUsdPattern(client, _m(acc, '8y')), - }; -} - -/** - * @typedef {Object} AllEmptyP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern - * @property {AverageBlockCumulativeSumPattern} all - * @property {AverageBlockCumulativeSumPattern} empty - * @property {AverageBlockCumulativeSumPattern} p2a - * @property {AverageBlockCumulativeSumPattern} p2ms - * @property {AverageBlockCumulativeSumPattern} p2pk33 - * @property {AverageBlockCumulativeSumPattern} p2pk65 - * @property {AverageBlockCumulativeSumPattern} p2pkh - * @property {AverageBlockCumulativeSumPattern} p2sh - * @property {AverageBlockCumulativeSumPattern} p2tr - * @property {AverageBlockCumulativeSumPattern} p2wpkh - * @property {AverageBlockCumulativeSumPattern} p2wsh - * @property {AverageBlockCumulativeSumPattern} unknown - */ - -/** - * @typedef {Object} CapCapitalizedGrossLossMvrvNetPeakPriceProfitSellSoprPattern - * @property {CentsDeltaToUsdPattern} cap - * @property {PricePattern} capitalized - * @property {BlockCumulativeSumPattern} grossPnl - * @property {BlockCumulativeNegativeSumPattern} loss - * @property {SeriesPattern1} mvrv - * @property {BlockChangeCumulativeDeltaSumPattern} netPnl - * @property {BlockCumulativeSumPattern} peakRegret - * @property {BpsCentsPercentilesRatioSatsSmaStdUsdPattern} price - * @property {BlockCumulativeSumPattern} profit - * @property {_1m1w1y24hPattern} profitToLossRatio - * @property {_1m1w1y24hPattern8} sellSideRiskRatio - * @property {AdjustedRatioValuePattern} sopr - */ - -/** - * @typedef {Object} EmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2 - * @property {_1m1w1y24hBpsPercentRatioPattern} empty - * @property {_1m1w1y24hBpsPercentRatioPattern} opReturn - * @property {_1m1w1y24hBpsPercentRatioPattern} p2a - * @property {_1m1w1y24hBpsPercentRatioPattern} p2ms - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk33 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk65 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2sh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2tr - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wpkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wsh - * @property {_1m1w1y24hBpsPercentRatioPattern} unknown - */ - -/** - * Create a EmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {EmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2} - */ -function createEmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2(client, acc) { - return { - empty: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'empty_outputs_output')), - opReturn: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'op_return_output')), - p2a: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2a_output')), - p2ms: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2ms_output')), - p2pk33: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2pk33_output')), - p2pk65: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2pk65_output')), - p2pkh: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2pkh_output')), - p2sh: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2sh_output')), - p2tr: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2tr_output')), - p2wpkh: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2wpkh_output')), - p2wsh: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2wsh_output')), - unknown: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'unknown_outputs_output')), - }; -} - -/** - * @typedef {Object} AverageBlockCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern - * @property {_1m1w1y24hPattern} average - * @property {SeriesPattern18} block - * @property {SeriesPattern1} cumulative - * @property {_1m1w1y24hPattern} max - * @property {_1m1w1y24hPattern} median - * @property {_1m1w1y24hPattern} min - * @property {_1m1w1y24hPattern} pct10 - * @property {_1m1w1y24hPattern} pct25 - * @property {_1m1w1y24hPattern} pct75 - * @property {_1m1w1y24hPattern} pct90 - * @property {_1m1w1y24hPattern} sum - */ - -/** - * Create a AverageBlockCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AverageBlockCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern} - */ -function createAverageBlockCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc) { - return { - average: create_1m1w1y24hPattern(client, _m(acc, 'average')), - block: createSeriesPattern18(client, acc), - cumulative: createSeriesPattern1(client, _m(acc, 'cumulative')), - max: create_1m1w1y24hPattern(client, _m(acc, 'max')), - median: create_1m1w1y24hPattern(client, _m(acc, 'median')), - min: create_1m1w1y24hPattern(client, _m(acc, 'min')), - pct10: create_1m1w1y24hPattern(client, _m(acc, 'pct10')), - pct25: create_1m1w1y24hPattern(client, _m(acc, 'pct25')), - pct75: create_1m1w1y24hPattern(client, _m(acc, 'pct75')), - pct90: create_1m1w1y24hPattern(client, _m(acc, 'pct90')), - sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} EmptyP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2 - * @property {_1m1w1y24hBpsPercentRatioPattern} empty - * @property {_1m1w1y24hBpsPercentRatioPattern} p2a - * @property {_1m1w1y24hBpsPercentRatioPattern} p2ms - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk33 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk65 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2sh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2tr - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wpkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wsh - * @property {_1m1w1y24hBpsPercentRatioPattern} unknown - */ - -/** - * Create a EmptyP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {EmptyP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2} - */ -function createEmptyP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2(client, acc) { - return { - empty: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'empty_outputs_prevout')), - p2a: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2a_prevout')), - p2ms: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2ms_prevout')), - p2pk33: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2pk33_prevout')), - p2pk65: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2pk65_prevout')), - p2pkh: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2pkh_prevout')), - p2sh: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2sh_prevout')), - p2tr: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2tr_prevout')), - p2wpkh: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2wpkh_prevout')), - p2wsh: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'p2wsh_prevout')), - unknown: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'unknown_outputs_prevout')), - }; -} - -/** - * @template T - * @typedef {Object} AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern - * @property {_1m1w1y24hPattern} average - * @property {SeriesPattern18} base - * @property {SeriesPattern1} cumulative - * @property {_1m1w1y24hPattern} max - * @property {_1m1w1y24hPattern} median - * @property {_1m1w1y24hPattern} min - * @property {_1m1w1y24hPattern} pct10 - * @property {_1m1w1y24hPattern} pct25 - * @property {_1m1w1y24hPattern} pct75 - * @property {_1m1w1y24hPattern} pct90 - * @property {_1m1w1y24hPattern} sum - */ - -/** - * Create a AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern pattern node - * @template T - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern} - */ -function createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc) { - return { - average: create_1m1w1y24hPattern(client, _m(acc, 'average')), - base: createSeriesPattern18(client, acc), - cumulative: createSeriesPattern1(client, _m(acc, 'cumulative')), - max: create_1m1w1y24hPattern(client, _m(acc, 'max')), - median: create_1m1w1y24hPattern(client, _m(acc, 'median')), - min: create_1m1w1y24hPattern(client, _m(acc, 'min')), - pct10: create_1m1w1y24hPattern(client, _m(acc, 'pct10')), - pct25: create_1m1w1y24hPattern(client, _m(acc, 'pct25')), - pct75: create_1m1w1y24hPattern(client, _m(acc, 'pct75')), - pct90: create_1m1w1y24hPattern(client, _m(acc, 'pct90')), - sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshSharePattern - * @property {BtcCentsSatsUsdPattern} all - * @property {BtcCentsSatsUsdPattern} p2a - * @property {BtcCentsSatsUsdPattern} p2pk33 - * @property {BtcCentsSatsUsdPattern} p2pk65 - * @property {BtcCentsSatsUsdPattern} p2pkh - * @property {BtcCentsSatsUsdPattern} p2sh - * @property {BtcCentsSatsUsdPattern} p2tr - * @property {BtcCentsSatsUsdPattern} p2wpkh - * @property {BtcCentsSatsUsdPattern} p2wsh - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5} share - */ - -/** - * @typedef {Object} IndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern - * @property {SeriesPattern1} index - * @property {CentsSatsUsdPattern} pct05 - * @property {CentsSatsUsdPattern} pct1 - * @property {CentsSatsUsdPattern} pct2 - * @property {CentsSatsUsdPattern} pct5 - * @property {CentsSatsUsdPattern} pct95 - * @property {CentsSatsUsdPattern} pct98 - * @property {CentsSatsUsdPattern} pct99 - * @property {CentsSatsUsdPattern} pct995 - * @property {SeriesPattern1} score - */ - -/** - * Create a IndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {IndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern} - */ -function createIndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern(client, acc) { - return { - index: createSeriesPattern1(client, _m(acc, 'index')), - pct05: createCentsSatsUsdPattern(client, _m(acc, 'pct0_5')), - pct1: createCentsSatsUsdPattern(client, _m(acc, 'pct01')), - pct2: createCentsSatsUsdPattern(client, _m(acc, 'pct02')), - pct5: createCentsSatsUsdPattern(client, _m(acc, 'pct05')), - pct95: createCentsSatsUsdPattern(client, _m(acc, 'pct95')), - pct98: createCentsSatsUsdPattern(client, _m(acc, 'pct98')), - pct99: createCentsSatsUsdPattern(client, _m(acc, 'pct99')), - pct995: createCentsSatsUsdPattern(client, _m(acc, 'pct99_5')), - score: createSeriesPattern1(client, _m(acc, 'score')), - }; -} - -/** - * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6 - * @property {AverageBlockCumulativeSumPattern} all - * @property {AverageBlockCumulativeSumPattern} p2a - * @property {AverageBlockCumulativeSumPattern} p2pk33 - * @property {AverageBlockCumulativeSumPattern} p2pk65 - * @property {AverageBlockCumulativeSumPattern} p2pkh - * @property {AverageBlockCumulativeSumPattern} p2sh - * @property {AverageBlockCumulativeSumPattern} p2tr - * @property {AverageBlockCumulativeSumPattern} p2wpkh - * @property {AverageBlockCumulativeSumPattern} p2wsh - */ - -/** - * Create a AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} - */ -function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(client, acc) { - return { - all: createAverageBlockCumulativeSumPattern(client, acc), - p2a: createAverageBlockCumulativeSumPattern(client, _p('p2a', acc)), - p2pk33: createAverageBlockCumulativeSumPattern(client, _p('p2pk33', acc)), - p2pk65: createAverageBlockCumulativeSumPattern(client, _p('p2pk65', acc)), - p2pkh: createAverageBlockCumulativeSumPattern(client, _p('p2pkh', acc)), - p2sh: createAverageBlockCumulativeSumPattern(client, _p('p2sh', acc)), - p2tr: createAverageBlockCumulativeSumPattern(client, _p('p2tr', acc)), - p2wpkh: createAverageBlockCumulativeSumPattern(client, _p('p2wpkh', acc)), - p2wsh: createAverageBlockCumulativeSumPattern(client, _p('p2wsh', acc)), - }; -} - -/** - * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5 - * @property {BpsPercentRatioPattern2} all - * @property {BpsPercentRatioPattern2} p2a - * @property {BpsPercentRatioPattern2} p2pk33 - * @property {BpsPercentRatioPattern2} p2pk65 - * @property {BpsPercentRatioPattern2} p2pkh - * @property {BpsPercentRatioPattern2} p2sh - * @property {BpsPercentRatioPattern2} p2tr - * @property {BpsPercentRatioPattern2} p2wpkh - * @property {BpsPercentRatioPattern2} p2wsh - */ - -/** - * Create a AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5} - */ -function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5(client, acc) { - return { - all: createBpsPercentRatioPattern2(client, acc), - p2a: createBpsPercentRatioPattern2(client, _p('p2a', acc)), - p2pk33: createBpsPercentRatioPattern2(client, _p('p2pk33', acc)), - p2pk65: createBpsPercentRatioPattern2(client, _p('p2pk65', acc)), - p2pkh: createBpsPercentRatioPattern2(client, _p('p2pkh', acc)), - p2sh: createBpsPercentRatioPattern2(client, _p('p2sh', acc)), - p2tr: createBpsPercentRatioPattern2(client, _p('p2tr', acc)), - p2wpkh: createBpsPercentRatioPattern2(client, _p('p2wpkh', acc)), - p2wsh: createBpsPercentRatioPattern2(client, _p('p2wsh', acc)), - }; -} - -/** - * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4 - * @property {SeriesPattern1} all - * @property {SeriesPattern1} p2a - * @property {SeriesPattern1} p2pk33 - * @property {SeriesPattern1} p2pk65 - * @property {SeriesPattern1} p2pkh - * @property {SeriesPattern1} p2sh - * @property {SeriesPattern1} p2tr - * @property {SeriesPattern1} p2wpkh - * @property {SeriesPattern1} p2wsh - */ - -/** - * Create a AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4} - */ -function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4(client, acc) { - return { - all: createSeriesPattern1(client, acc), - p2a: createSeriesPattern1(client, _p('p2a', acc)), - p2pk33: createSeriesPattern1(client, _p('p2pk33', acc)), - p2pk65: createSeriesPattern1(client, _p('p2pk65', acc)), - p2pkh: createSeriesPattern1(client, _p('p2pkh', acc)), - p2sh: createSeriesPattern1(client, _p('p2sh', acc)), - p2tr: createSeriesPattern1(client, _p('p2tr', acc)), - p2wpkh: createSeriesPattern1(client, _p('p2wpkh', acc)), - p2wsh: createSeriesPattern1(client, _p('p2wsh', acc)), - }; -} - -/** - * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7 - * @property {_1m1w1y24hBpsPercentRatioPattern} all - * @property {_1m1w1y24hBpsPercentRatioPattern} p2a - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk33 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk65 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2sh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2tr - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wpkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wsh - */ - -/** - * Create a AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} - */ -function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7(client, acc) { - return { - all: create_1m1w1y24hBpsPercentRatioPattern(client, acc), - p2a: create_1m1w1y24hBpsPercentRatioPattern(client, _p('p2a', acc)), - p2pk33: create_1m1w1y24hBpsPercentRatioPattern(client, _p('p2pk33', acc)), - p2pk65: create_1m1w1y24hBpsPercentRatioPattern(client, _p('p2pk65', acc)), - p2pkh: create_1m1w1y24hBpsPercentRatioPattern(client, _p('p2pkh', acc)), - p2sh: create_1m1w1y24hBpsPercentRatioPattern(client, _p('p2sh', acc)), - p2tr: create_1m1w1y24hBpsPercentRatioPattern(client, _p('p2tr', acc)), - p2wpkh: create_1m1w1y24hBpsPercentRatioPattern(client, _p('p2wpkh', acc)), - p2wsh: create_1m1w1y24hBpsPercentRatioPattern(client, _p('p2wsh', acc)), - }; -} - -/** - * @typedef {Object} AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern - * @property {_1m1w1y24hPattern} average - * @property {_1m1w1y24hPattern} max - * @property {_1m1w1y24hPattern} median - * @property {_1m1w1y24hPattern} min - * @property {_1m1w1y24hPattern} pct10 - * @property {_1m1w1y24hPattern} pct25 - * @property {_1m1w1y24hPattern} pct75 - * @property {_1m1w1y24hPattern} pct90 - * @property {_1m1w1y24hPattern} sum - */ - -/** - * Create a AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern} - */ -function createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc) { - return { - average: create_1m1w1y24hPattern(client, _m(acc, 'average')), - max: create_1m1w1y24hPattern(client, _m(acc, 'max')), - median: create_1m1w1y24hPattern(client, _m(acc, 'median')), - min: create_1m1w1y24hPattern(client, _m(acc, 'min')), - pct10: create_1m1w1y24hPattern(client, _m(acc, 'pct10')), - pct25: create_1m1w1y24hPattern(client, _m(acc, 'pct25')), - pct75: create_1m1w1y24hPattern(client, _m(acc, 'pct75')), - pct90: create_1m1w1y24hPattern(client, _m(acc, 'pct90')), - sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2 - * @property {SeriesPattern18} capitalizedCapInLossRaw - * @property {SeriesPattern18} capitalizedCapInProfitRaw - * @property {CentsUsdPattern3} grossPnl - * @property {InPattern2} investedCapital - * @property {CentsNegativeToUsdPattern2} loss - * @property {CentsToUsdPattern3} netPnl - * @property {BpsRatioPattern} nupl - * @property {CentsToUsdPattern4} profit - * @property {GreedNetPainPattern} sentiment - */ - -/** - * Create a CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2} - */ -function createCapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2(client, acc) { - return { - capitalizedCapInLossRaw: createSeriesPattern18(client, _m(acc, 'capitalized_cap_in_loss_raw')), - capitalizedCapInProfitRaw: createSeriesPattern18(client, _m(acc, 'capitalized_cap_in_profit_raw')), - grossPnl: createCentsUsdPattern3(client, _m(acc, 'unrealized_gross_pnl')), - investedCapital: createInPattern2(client, _m(acc, 'invested_capital_in')), - loss: createCentsNegativeToUsdPattern2(client, _m(acc, 'unrealized_loss')), - netPnl: createCentsToUsdPattern3(client, _m(acc, 'net_unrealized_pnl')), - nupl: createBpsRatioPattern(client, _m(acc, 'nupl')), - profit: createCentsToUsdPattern4(client, _m(acc, 'unrealized_profit')), - sentiment: createGreedNetPainPattern(client, acc), - }; -} - -/** - * @typedef {Object} BpsCentsPercentilesRatioSatsSmaStdUsdPattern - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} cents - * @property {Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles - * @property {SeriesPattern1} ratio - * @property {SeriesPattern1} sats - * @property {_1m1w1y2y4yAllPattern} sma - * @property {_1y2y4yAllPattern} stdDev - * @property {SeriesPattern1} usd - */ - -/** - * @typedef {Object} Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern - * @property {BpsPriceRatioPattern} pct05 - * @property {BpsPriceRatioPattern} pct1 - * @property {BpsPriceRatioPattern} pct2 - * @property {BpsPriceRatioPattern} pct5 - * @property {BpsPriceRatioPattern} pct95 - * @property {BpsPriceRatioPattern} pct98 - * @property {BpsPriceRatioPattern} pct99 - * @property {BpsPriceRatioPattern} pct995 - */ - -/** - * Create a Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern} - */ -function createPct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc) { - return { - pct05: createBpsPriceRatioPattern(client, acc, 'pct0_5'), - pct1: createBpsPriceRatioPattern(client, acc, 'pct1'), - pct2: createBpsPriceRatioPattern(client, acc, 'pct2'), - pct5: createBpsPriceRatioPattern(client, acc, 'pct5'), - pct95: createBpsPriceRatioPattern(client, acc, 'pct95'), - pct98: createBpsPriceRatioPattern(client, acc, 'pct98'), - pct99: createBpsPriceRatioPattern(client, acc, 'pct99'), - pct995: createBpsPriceRatioPattern(client, acc, 'pct99_5'), - }; -} - -/** - * @typedef {Object} _10y2y3y4y5y6y8yPattern - * @property {BpsPercentRatioPattern} _10y - * @property {BpsPercentRatioPattern} _2y - * @property {BpsPercentRatioPattern} _3y - * @property {BpsPercentRatioPattern} _4y - * @property {BpsPercentRatioPattern} _5y - * @property {BpsPercentRatioPattern} _6y - * @property {BpsPercentRatioPattern} _8y - */ - -/** - * Create a _10y2y3y4y5y6y8yPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_10y2y3y4y5y6y8yPattern} - */ -function create_10y2y3y4y5y6y8yPattern(client, acc) { - return { - _10y: createBpsPercentRatioPattern(client, _m(acc, '10y')), - _2y: createBpsPercentRatioPattern(client, _m(acc, '2y')), - _3y: createBpsPercentRatioPattern(client, _m(acc, '3y')), - _4y: createBpsPercentRatioPattern(client, _m(acc, '4y')), - _5y: createBpsPercentRatioPattern(client, _m(acc, '5y')), - _6y: createBpsPercentRatioPattern(client, _m(acc, '6y')), - _8y: createBpsPercentRatioPattern(client, _m(acc, '8y')), - }; -} - -/** - * @typedef {Object} _1m1w1y24hBpsPercentRatioPattern - * @property {BpsPercentRatioPattern2} _1m - * @property {BpsPercentRatioPattern2} _1w - * @property {BpsPercentRatioPattern2} _1y - * @property {BpsPercentRatioPattern2} _24h - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} percent - * @property {SeriesPattern1} ratio - */ - -/** - * Create a _1m1w1y24hBpsPercentRatioPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hBpsPercentRatioPattern} - */ -function create_1m1w1y24hBpsPercentRatioPattern(client, acc) { - return { - _1m: createBpsPercentRatioPattern2(client, _m(acc, '1m')), - _1w: createBpsPercentRatioPattern2(client, _m(acc, '1w')), - _1y: createBpsPercentRatioPattern2(client, _m(acc, '1y')), - _24h: createBpsPercentRatioPattern2(client, _m(acc, '24h')), - bps: createSeriesPattern1(client, _m(acc, 'bps')), - percent: createSeriesPattern1(client, acc), - ratio: createSeriesPattern1(client, _m(acc, 'ratio')), - }; -} - -/** - * @typedef {Object} ActiveInputOutputSpendablePattern - * @property {_1m1w1y24hBlockPattern} activeReusedAddrCount - * @property {_1m1w1y24hBlockPattern2} activeReusedAddrShare - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} inputFromReusedAddrCount - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} inputFromReusedAddrShare - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} outputToReusedAddrCount - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} outputToReusedAddrShare - * @property {_1m1w1y24hBpsPercentRatioPattern} spendableOutputToReusedAddrShare - */ - -/** - * @typedef {Object} CapLossMvrvNetPriceProfitSoprPattern - * @property {CentsDeltaUsdPattern} cap - * @property {BlockCumulativeNegativeSumPattern} loss - * @property {SeriesPattern1} mvrv - * @property {BlockCumulativeDeltaSumPattern} netPnl - * @property {BpsCentsRatioSatsUsdPattern} price - * @property {BlockCumulativeSumPattern} profit - * @property {RatioValuePattern} sopr - */ - -/** - * Create a CapLossMvrvNetPriceProfitSoprPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CapLossMvrvNetPriceProfitSoprPattern} - */ -function createCapLossMvrvNetPriceProfitSoprPattern(client, acc) { - return { - cap: createCentsDeltaUsdPattern(client, _m(acc, 'realized_cap')), - loss: createBlockCumulativeNegativeSumPattern(client, _m(acc, 'realized_loss')), - mvrv: createSeriesPattern1(client, _m(acc, 'mvrv')), - netPnl: createBlockCumulativeDeltaSumPattern(client, _m(acc, 'net_realized_pnl')), - price: createBpsCentsRatioSatsUsdPattern(client, _m(acc, 'realized_price')), - profit: createBlockCumulativeSumPattern(client, _m(acc, 'realized_profit')), - sopr: createRatioValuePattern(client, acc), - }; -} - -/** - * @typedef {Object} InMaxMinPerSupplyPattern - * @property {PerPattern} inLoss - * @property {PerPattern} inProfit - * @property {CentsSatsUsdPattern} max - * @property {CentsSatsUsdPattern} min - * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} perCoin - * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} perDollar - * @property {BpsPercentRatioPattern2} supplyDensity - */ - -/** - * Create a InMaxMinPerSupplyPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {InMaxMinPerSupplyPattern} - */ -function createInMaxMinPerSupplyPattern(client, acc) { - return { - inLoss: createPerPattern(client, _m(acc, 'cost_basis_in_loss_per')), - inProfit: createPerPattern(client, _m(acc, 'cost_basis_in_profit_per')), - max: createCentsSatsUsdPattern(client, _m(acc, 'cost_basis_max')), - min: createCentsSatsUsdPattern(client, _m(acc, 'cost_basis_min')), - perCoin: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis_per_coin')), - perDollar: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis_per_dollar')), - supplyDensity: createBpsPercentRatioPattern2(client, _m(acc, 'supply_density')), - }; -} - -/** - * @typedef {Object} MaxMedianMinPct10Pct25Pct75Pct90Pattern2 - * @property {SeriesPattern18} max - * @property {SeriesPattern18} median - * @property {SeriesPattern18} min - * @property {SeriesPattern18} pct10 - * @property {SeriesPattern18} pct25 - * @property {SeriesPattern18} pct75 - * @property {SeriesPattern18} pct90 - */ - -/** - * Create a MaxMedianMinPct10Pct25Pct75Pct90Pattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {MaxMedianMinPct10Pct25Pct75Pct90Pattern2} - */ -function createMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, acc) { - return { - max: createSeriesPattern18(client, _m(acc, 'max')), - median: createSeriesPattern18(client, _m(acc, 'median')), - min: createSeriesPattern18(client, _m(acc, 'min')), - pct10: createSeriesPattern18(client, _m(acc, 'pct10')), - pct25: createSeriesPattern18(client, _m(acc, 'pct25')), - pct75: createSeriesPattern18(client, _m(acc, 'pct75')), - pct90: createSeriesPattern18(client, _m(acc, 'pct90')), - }; -} - -/** - * @template T - * @typedef {Object} MaxMedianMinPct10Pct25Pct75Pct90Pattern - * @property {SeriesPattern1} max - * @property {SeriesPattern1} median - * @property {SeriesPattern1} min - * @property {SeriesPattern1} pct10 - * @property {SeriesPattern1} pct25 - * @property {SeriesPattern1} pct75 - * @property {SeriesPattern1} pct90 - */ - -/** - * Create a MaxMedianMinPct10Pct25Pct75Pct90Pattern pattern node - * @template T - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {MaxMedianMinPct10Pct25Pct75Pct90Pattern} - */ -function createMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) { - return { - max: createSeriesPattern1(client, _m(acc, 'max')), - median: createSeriesPattern1(client, _m(acc, 'median')), - min: createSeriesPattern1(client, _m(acc, 'min')), - pct10: createSeriesPattern1(client, _m(acc, 'pct10')), - pct25: createSeriesPattern1(client, _m(acc, 'pct25')), - pct75: createSeriesPattern1(client, _m(acc, 'pct75')), - pct90: createSeriesPattern1(client, _m(acc, 'pct90')), - }; -} - -/** - * @typedef {Object} _1m1w1y2y4yAllPattern - * @property {BpsRatioPattern2} _1m - * @property {BpsRatioPattern2} _1w - * @property {BpsRatioPattern2} _1y - * @property {BpsRatioPattern2} _2y - * @property {BpsRatioPattern2} _4y - * @property {BpsRatioPattern2} all - */ - -/** - * Create a _1m1w1y2y4yAllPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y2y4yAllPattern} - */ -function create_1m1w1y2y4yAllPattern(client, acc) { - return { - _1m: createBpsRatioPattern2(client, _m(acc, '1m')), - _1w: createBpsRatioPattern2(client, _m(acc, '1w')), - _1y: createBpsRatioPattern2(client, _m(acc, '1y')), - _2y: createBpsRatioPattern2(client, _m(acc, '2y')), - _4y: createBpsRatioPattern2(client, _m(acc, '4y')), - all: createBpsRatioPattern2(client, _m(acc, 'all')), - }; -} - -/** - * @typedef {Object} ActivityAddrOutputsRealizedSupplyUnrealizedPattern - * @property {TransferPattern} activity - * @property {BaseDeltaPattern} addrCount - * @property {SpendingSpentUnspentPattern} outputs - * @property {CapLossMvrvPriceProfitPattern} realized - * @property {DeltaDominanceTotalPattern} supply - * @property {NuplPattern} unrealized - */ - -/** - * Create a ActivityAddrOutputsRealizedSupplyUnrealizedPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} - */ -function createActivityAddrOutputsRealizedSupplyUnrealizedPattern(client, acc) { - return { - activity: createTransferPattern(client, _m(acc, 'transfer_volume')), - addrCount: createBaseDeltaPattern(client, _m(acc, 'addr_count')), - outputs: createSpendingSpentUnspentPattern(client, acc), - realized: createCapLossMvrvPriceProfitPattern(client, acc), - supply: createDeltaDominanceTotalPattern(client, _m(acc, 'supply')), - unrealized: createNuplPattern(client, _m(acc, 'nupl')), - }; -} - -/** - * @typedef {Object} AverageBlockCumulativeInSumPattern - * @property {_1m1w1y24hPattern3} average - * @property {BtcCentsSatsUsdPattern3} block - * @property {BtcCentsSatsUsdPattern} cumulative - * @property {AverageBlockCumulativeSumPattern3} inLoss - * @property {AverageBlockCumulativeSumPattern3} inProfit - * @property {_1m1w1y24hPattern4} sum - */ - -/** - * Create a AverageBlockCumulativeInSumPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AverageBlockCumulativeInSumPattern} - */ -function createAverageBlockCumulativeInSumPattern(client, acc) { - return { - average: create_1m1w1y24hPattern3(client, _m(acc, 'average')), - block: createBtcCentsSatsUsdPattern3(client, acc), - cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), - inLoss: createAverageBlockCumulativeSumPattern3(client, _m(acc, 'in_loss')), - inProfit: createAverageBlockCumulativeSumPattern3(client, _m(acc, 'in_profit')), - sum: create_1m1w1y24hPattern4(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} BpsCentsPercentilesRatioSatsUsdPattern - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} cents - * @property {Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles - * @property {SeriesPattern1} ratio - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} usd - */ - -/** - * Create a BpsCentsPercentilesRatioSatsUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BpsCentsPercentilesRatioSatsUsdPattern} - */ -function createBpsCentsPercentilesRatioSatsUsdPattern(client, acc) { - return { - bps: createSeriesPattern1(client, _m(acc, 'ratio_bps')), - cents: createSeriesPattern1(client, _m(acc, 'cents')), - percentiles: createPct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern(client, acc), - ratio: createSeriesPattern1(client, _m(acc, 'ratio')), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} CentsNegativeToUsdPattern2 - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} negative - * @property {BpsPercentRatioPattern2} toMcap - * @property {BpsPercentRatioPattern2} toOwnGrossPnl - * @property {BpsPercentRatioPattern4} toOwnMcap - * @property {SeriesPattern1} usd - */ - -/** - * Create a CentsNegativeToUsdPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsNegativeToUsdPattern2} - */ -function createCentsNegativeToUsdPattern2(client, acc) { - return { - cents: createSeriesPattern1(client, _m(acc, 'cents')), - negative: createSeriesPattern1(client, _m(acc, 'neg')), - toMcap: createBpsPercentRatioPattern2(client, _m(acc, 'to_mcap')), - toOwnGrossPnl: createBpsPercentRatioPattern2(client, _m(acc, 'to_own_gross_pnl')), - toOwnMcap: createBpsPercentRatioPattern4(client, _m(acc, 'to_own_mcap')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} DeltaDominanceHalfInTotalPattern2 - * @property {AbsoluteRatePattern3} delta - * @property {BpsPercentRatioPattern2} dominance - * @property {BtcCentsSatsUsdPattern} half - * @property {BtcCentsSatsShareUsdPattern} inLoss - * @property {BtcCentsSatsShareUsdPattern} inProfit - * @property {BtcCentsSatsUsdPattern} total - */ - -/** - * Create a DeltaDominanceHalfInTotalPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {DeltaDominanceHalfInTotalPattern2} - */ -function createDeltaDominanceHalfInTotalPattern2(client, acc) { - return { - delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')), - dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')), - half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), - inLoss: createBtcCentsSatsShareUsdPattern(client, _m(acc, 'in_loss')), - inProfit: createBtcCentsSatsShareUsdPattern(client, _m(acc, 'in_profit')), - total: createBtcCentsSatsUsdPattern(client, acc), - }; -} - -/** - * @typedef {Object} DeltaDominanceHalfInTotalPattern - * @property {AbsoluteRatePattern3} delta - * @property {BpsPercentRatioPattern2} dominance - * @property {BtcCentsSatsUsdPattern} half - * @property {BtcCentsSatsUsdPattern} inLoss - * @property {BtcCentsSatsUsdPattern} inProfit - * @property {BtcCentsSatsUsdPattern} total - */ - -/** - * Create a DeltaDominanceHalfInTotalPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {DeltaDominanceHalfInTotalPattern} - */ -function createDeltaDominanceHalfInTotalPattern(client, acc) { - return { - delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')), - dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')), - half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), - inLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')), - inProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')), - total: createBtcCentsSatsUsdPattern(client, acc), - }; -} - -/** - * @typedef {Object} _1m1w1y24hBlockPattern2 - * @property {SeriesPattern1} _1m - * @property {SeriesPattern1} _1w - * @property {SeriesPattern1} _1y - * @property {SeriesPattern1} _24h - * @property {SeriesPattern18} block - */ - -/** - * Create a _1m1w1y24hBlockPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hBlockPattern2} - */ -function create_1m1w1y24hBlockPattern2(client, acc) { - return { - _1m: createSeriesPattern1(client, _m(acc, 'average_1m')), - _1w: createSeriesPattern1(client, _m(acc, 'average_1w')), - _1y: createSeriesPattern1(client, _m(acc, 'average_1y')), - _24h: createSeriesPattern1(client, _m(acc, 'average_24h')), - block: createSeriesPattern18(client, acc), - }; -} - -/** - * @typedef {Object} _1m1w1y24hBlockPattern - * @property {SeriesPattern1} _1m - * @property {SeriesPattern1} _1w - * @property {SeriesPattern1} _1y - * @property {SeriesPattern1} _24h - * @property {SeriesPattern18} block - */ - -/** - * Create a _1m1w1y24hBlockPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hBlockPattern} - */ -function create_1m1w1y24hBlockPattern(client, acc) { - return { - _1m: createSeriesPattern1(client, _m(acc, 'average_1m')), - _1w: createSeriesPattern1(client, _m(acc, 'average_1w')), - _1y: createSeriesPattern1(client, _m(acc, 'average_1y')), - _24h: createSeriesPattern1(client, _m(acc, 'average_24h')), - block: createSeriesPattern18(client, acc), - }; -} - -/** - * @typedef {Object} ActiveBidirectionalReactivatedReceivingSendingPattern - * @property {_1m1w1y24hBlockPattern} active - * @property {_1m1w1y24hBlockPattern} bidirectional - * @property {_1m1w1y24hBlockPattern} reactivated - * @property {_1m1w1y24hBlockPattern} receiving - * @property {_1m1w1y24hBlockPattern} sending - */ - -/** - * Create a ActiveBidirectionalReactivatedReceivingSendingPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {ActiveBidirectionalReactivatedReceivingSendingPattern} - */ -function createActiveBidirectionalReactivatedReceivingSendingPattern(client, acc) { - return { - active: create_1m1w1y24hBlockPattern(client, _m(acc, 'active_addrs')), - bidirectional: create_1m1w1y24hBlockPattern(client, _m(acc, 'bidirectional_addrs')), - reactivated: create_1m1w1y24hBlockPattern(client, _m(acc, 'reactivated_addrs')), - receiving: create_1m1w1y24hBlockPattern(client, _m(acc, 'receiving_addrs')), - sending: create_1m1w1y24hBlockPattern(client, _m(acc, 'sending_addrs')), - }; -} - -/** - * @typedef {Object} ActivityOutputsRealizedSupplyUnrealizedPattern - * @property {CoindaysTransferPattern} activity - * @property {SpendingSpentUnspentPattern} outputs - * @property {CapLossMvrvNetPriceProfitSoprPattern} realized - * @property {DeltaDominanceHalfInTotalPattern} supply - * @property {LossNetNuplProfitPattern} unrealized - */ - -/** - * Create a ActivityOutputsRealizedSupplyUnrealizedPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {ActivityOutputsRealizedSupplyUnrealizedPattern} - */ -function createActivityOutputsRealizedSupplyUnrealizedPattern(client, acc) { - return { - activity: createCoindaysTransferPattern(client, acc), - outputs: createSpendingSpentUnspentPattern(client, acc), - realized: createCapLossMvrvNetPriceProfitSoprPattern(client, acc), - supply: createDeltaDominanceHalfInTotalPattern(client, _m(acc, 'supply')), - unrealized: createLossNetNuplProfitPattern(client, acc), - }; -} - -/** - * @typedef {Object} ActivityOutputsRealizedSupplyUnrealizedPattern3 - * @property {TransferPattern} activity - * @property {SpendingSpentUnspentPattern} outputs - * @property {CapLossMvrvPriceProfitPattern} realized - * @property {DeltaDominanceHalfInTotalPattern} supply - * @property {LossNuplProfitPattern} unrealized - */ - -/** - * Create a ActivityOutputsRealizedSupplyUnrealizedPattern3 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {ActivityOutputsRealizedSupplyUnrealizedPattern3} - */ -function createActivityOutputsRealizedSupplyUnrealizedPattern3(client, acc) { - return { - activity: createTransferPattern(client, _m(acc, 'transfer_volume')), - outputs: createSpendingSpentUnspentPattern(client, acc), - realized: createCapLossMvrvPriceProfitPattern(client, acc), - supply: createDeltaDominanceHalfInTotalPattern(client, _m(acc, 'supply')), - unrealized: createLossNuplProfitPattern(client, acc), - }; -} - -/** - * @typedef {Object} ActivityOutputsRealizedSupplyUnrealizedPattern2 - * @property {TransferPattern} activity - * @property {SpendingSpentUnspentPattern} outputs - * @property {CapLossMvrvPriceProfitPattern} realized - * @property {DeltaDominanceTotalPattern} supply - * @property {NuplPattern} unrealized - */ - -/** - * Create a ActivityOutputsRealizedSupplyUnrealizedPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {ActivityOutputsRealizedSupplyUnrealizedPattern2} - */ -function createActivityOutputsRealizedSupplyUnrealizedPattern2(client, acc) { - return { - activity: createTransferPattern(client, _m(acc, 'transfer_volume')), - outputs: createSpendingSpentUnspentPattern(client, acc), - realized: createCapLossMvrvPriceProfitPattern(client, acc), - supply: createDeltaDominanceTotalPattern(client, _m(acc, 'supply')), - unrealized: createNuplPattern(client, _m(acc, 'nupl')), - }; -} - -/** - * @typedef {Object} BlockChangeCumulativeDeltaSumPattern - * @property {CentsUsdPattern4} block - * @property {ToPattern} change1m - * @property {CentsUsdPattern} cumulative - * @property {AbsoluteRatePattern2} delta - * @property {_1m1w1y24hPattern5} sum - */ - -/** - * Create a BlockChangeCumulativeDeltaSumPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BlockChangeCumulativeDeltaSumPattern} - */ -function createBlockChangeCumulativeDeltaSumPattern(client, acc) { - return { - block: createCentsUsdPattern4(client, _m(acc, 'realized_pnl')), - change1m: createToPattern(client, _m(acc, 'pnl_change_1m_to')), - cumulative: createCentsUsdPattern(client, _m(acc, 'realized_pnl_cumulative')), - delta: createAbsoluteRatePattern2(client, _m(acc, 'realized_pnl_delta')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'realized_pnl_sum')), - }; -} - -/** - * @typedef {Object} BpsCentsRatioSatsUsdPattern - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} ratio - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} usd - */ - -/** - * Create a BpsCentsRatioSatsUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BpsCentsRatioSatsUsdPattern} - */ -function createBpsCentsRatioSatsUsdPattern(client, acc) { - return { - bps: createSeriesPattern1(client, _m(acc, 'ratio_bps')), - cents: createSeriesPattern1(client, _m(acc, 'cents')), - ratio: createSeriesPattern1(client, _m(acc, 'ratio')), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} BtcCentsDeltaSatsUsdPattern - * @property {SeriesPattern1} btc - * @property {SeriesPattern1} cents - * @property {AbsoluteRatePattern3} delta - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} usd - */ - -/** - * Create a BtcCentsDeltaSatsUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BtcCentsDeltaSatsUsdPattern} - */ -function createBtcCentsDeltaSatsUsdPattern(client, acc) { - return { - btc: createSeriesPattern1(client, acc), - cents: createSeriesPattern1(client, _m(acc, 'cents')), - delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - usd: createSeriesPattern1(client, _m(acc, 'usd')), - }; -} - -/** - * @typedef {Object} BtcCentsSatsShareUsdPattern - * @property {SeriesPattern1} btc - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {BpsPercentRatioPattern2} share - * @property {SeriesPattern1} usd - */ - -/** - * Create a BtcCentsSatsShareUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BtcCentsSatsShareUsdPattern} - */ -function createBtcCentsSatsShareUsdPattern(client, acc) { - return { - btc: createSeriesPattern1(client, acc), - cents: createSeriesPattern1(client, _m(acc, 'cents')), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - share: createBpsPercentRatioPattern2(client, _m(acc, 'share')), - usd: createSeriesPattern1(client, _m(acc, 'usd')), - }; -} - -/** - * @typedef {Object} CapLossMvrvPriceProfitPattern - * @property {CentsDeltaUsdPattern} cap - * @property {BlockCumulativeSumPattern} loss - * @property {SeriesPattern1} mvrv - * @property {BpsCentsRatioSatsUsdPattern} price - * @property {BlockCumulativeSumPattern} profit - */ - -/** - * Create a CapLossMvrvPriceProfitPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CapLossMvrvPriceProfitPattern} - */ -function createCapLossMvrvPriceProfitPattern(client, acc) { - return { - cap: createCentsDeltaUsdPattern(client, _m(acc, 'realized_cap')), - loss: createBlockCumulativeSumPattern(client, _m(acc, 'realized_loss')), - mvrv: createSeriesPattern1(client, _m(acc, 'mvrv')), - price: createBpsCentsRatioSatsUsdPattern(client, _m(acc, 'realized_price')), - profit: createBlockCumulativeSumPattern(client, _m(acc, 'realized_profit')), - }; -} - -/** - * @typedef {Object} CentsToUsdPattern4 - * @property {SeriesPattern1} cents - * @property {BpsPercentRatioPattern2} toMcap - * @property {BpsPercentRatioPattern2} toOwnGrossPnl - * @property {BpsPercentRatioPattern2} toOwnMcap - * @property {SeriesPattern1} usd - */ - -/** - * Create a CentsToUsdPattern4 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsToUsdPattern4} - */ -function createCentsToUsdPattern4(client, acc) { - return { - cents: createSeriesPattern1(client, _m(acc, 'cents')), - toMcap: createBpsPercentRatioPattern2(client, _m(acc, 'to_mcap')), - toOwnGrossPnl: createBpsPercentRatioPattern2(client, _m(acc, 'to_own_gross_pnl')), - toOwnMcap: createBpsPercentRatioPattern2(client, _m(acc, 'to_own_mcap')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} EmaHistogramLineSignalPattern - * @property {SeriesPattern1} emaFast - * @property {SeriesPattern1} emaSlow - * @property {SeriesPattern1} histogram - * @property {SeriesPattern1} line - * @property {SeriesPattern1} signal - */ - -/** - * @typedef {Object} PhsReboundThsPattern - * @property {SeriesPattern1} phs - * @property {SeriesPattern1} phsMin - * @property {BpsPercentRatioPattern} rebound - * @property {SeriesPattern1} ths - * @property {SeriesPattern1} thsMin - */ - -/** - * Create a PhsReboundThsPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {PhsReboundThsPattern} - */ -function createPhsReboundThsPattern(client, acc) { - return { - phs: createSeriesPattern1(client, _m(acc, 'phs')), - phsMin: createSeriesPattern1(client, _m(acc, 'phs_min')), - rebound: createBpsPercentRatioPattern(client, _m(acc, 'rebound')), - ths: createSeriesPattern1(client, _m(acc, 'ths')), - thsMin: createSeriesPattern1(client, _m(acc, 'ths_min')), - }; -} - -/** - * @typedef {Object} _1m1w1y24hPattern2 - * @property {BpsPercentRatioPattern} _1m - * @property {BpsPercentRatioPattern} _1w - * @property {BpsPercentRatioPattern} _1y - * @property {BpsPercentRatioPattern} _24h - */ - -/** - * Create a _1m1w1y24hPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern2} - */ -function create_1m1w1y24hPattern2(client, acc) { - return { - _1m: createBpsPercentRatioPattern(client, _m(acc, '1m_rate')), - _1w: createBpsPercentRatioPattern(client, _m(acc, '1w_rate')), - _1y: createBpsPercentRatioPattern(client, _m(acc, '1y_rate')), - _24h: createBpsPercentRatioPattern(client, _m(acc, '24h_rate')), - }; -} - -/** - * @typedef {Object} _1m1w1y24hPattern8 - * @property {BpsPercentRatioPattern4} _1m - * @property {BpsPercentRatioPattern4} _1w - * @property {BpsPercentRatioPattern4} _1y - * @property {BpsPercentRatioPattern4} _24h - */ - -/** - * Create a _1m1w1y24hPattern8 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern8} - */ -function create_1m1w1y24hPattern8(client, acc) { - return { - _1m: createBpsPercentRatioPattern4(client, _m(acc, '1m')), - _1w: createBpsPercentRatioPattern4(client, _m(acc, '1w')), - _1y: createBpsPercentRatioPattern4(client, _m(acc, '1y')), - _24h: createBpsPercentRatioPattern4(client, _m(acc, '24h')), - }; -} - -/** - * @typedef {Object} _1m1w1y24hPattern4 - * @property {BtcCentsSatsUsdPattern} _1m - * @property {BtcCentsSatsUsdPattern} _1w - * @property {BtcCentsSatsUsdPattern} _1y - * @property {BtcCentsSatsUsdPattern} _24h - */ - -/** - * Create a _1m1w1y24hPattern4 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern4} - */ -function create_1m1w1y24hPattern4(client, acc) { - return { - _1m: createBtcCentsSatsUsdPattern(client, _m(acc, '1m')), - _1w: createBtcCentsSatsUsdPattern(client, _m(acc, '1w')), - _1y: createBtcCentsSatsUsdPattern(client, _m(acc, '1y')), - _24h: createBtcCentsSatsUsdPattern(client, _m(acc, '24h')), - }; -} - -/** - * @typedef {Object} _1m1w1y24hPattern3 - * @property {BtcCentsSatsUsdPattern2} _1m - * @property {BtcCentsSatsUsdPattern2} _1w - * @property {BtcCentsSatsUsdPattern2} _1y - * @property {BtcCentsSatsUsdPattern2} _24h - */ - -/** - * Create a _1m1w1y24hPattern3 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern3} - */ -function create_1m1w1y24hPattern3(client, acc) { - return { - _1m: createBtcCentsSatsUsdPattern2(client, _m(acc, '1m')), - _1w: createBtcCentsSatsUsdPattern2(client, _m(acc, '1w')), - _1y: createBtcCentsSatsUsdPattern2(client, _m(acc, '1y')), - _24h: createBtcCentsSatsUsdPattern2(client, _m(acc, '24h')), - }; -} - -/** - * @typedef {Object} _1m1w1y24hPattern7 - * @property {BtcSatsPattern} _1m - * @property {BtcSatsPattern} _1w - * @property {BtcSatsPattern} _1y - * @property {BtcSatsPattern} _24h - */ - -/** - * Create a _1m1w1y24hPattern7 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern7} - */ -function create_1m1w1y24hPattern7(client, acc) { - return { - _1m: createBtcSatsPattern(client, _m(acc, '1m')), - _1w: createBtcSatsPattern(client, _m(acc, '1w')), - _1y: createBtcSatsPattern(client, _m(acc, '1y')), - _24h: createBtcSatsPattern(client, _m(acc, '24h')), - }; -} - -/** - * @typedef {Object} _1m1w1y2wPattern - * @property {CentsSatsUsdPattern} _1m - * @property {CentsSatsUsdPattern} _1w - * @property {CentsSatsUsdPattern} _1y - * @property {CentsSatsUsdPattern} _2w - */ - -/** - * Create a _1m1w1y2wPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y2wPattern} - */ -function create_1m1w1y2wPattern(client, acc) { - return { - _1m: createCentsSatsUsdPattern(client, _m(acc, '1m')), - _1w: createCentsSatsUsdPattern(client, _m(acc, '1w')), - _1y: createCentsSatsUsdPattern(client, _m(acc, '1y')), - _2w: createCentsSatsUsdPattern(client, _m(acc, '2w')), - }; -} - -/** - * @typedef {Object} _1m1w1y24hPattern5 - * @property {CentsUsdPattern} _1m - * @property {CentsUsdPattern} _1w - * @property {CentsUsdPattern} _1y - * @property {CentsUsdPattern} _24h - */ - -/** - * Create a _1m1w1y24hPattern5 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern5} - */ -function create_1m1w1y24hPattern5(client, acc) { - return { - _1m: createCentsUsdPattern(client, _m(acc, '1m')), - _1w: createCentsUsdPattern(client, _m(acc, '1w')), - _1y: createCentsUsdPattern(client, _m(acc, '1y')), - _24h: createCentsUsdPattern(client, _m(acc, '24h')), - }; -} - -/** - * @typedef {Object} _1m1w1y24hPattern6 - * @property {CentsUsdPattern3} _1m - * @property {CentsUsdPattern3} _1w - * @property {CentsUsdPattern3} _1y - * @property {CentsUsdPattern3} _24h - */ - -/** - * Create a _1m1w1y24hPattern6 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern6} - */ -function create_1m1w1y24hPattern6(client, acc) { - return { - _1m: createCentsUsdPattern3(client, _m(acc, '1m')), - _1w: createCentsUsdPattern3(client, _m(acc, '1w')), - _1y: createCentsUsdPattern3(client, _m(acc, '1y')), - _24h: createCentsUsdPattern3(client, _m(acc, '24h')), - }; -} - -/** - * @typedef {Object} _1y2y4yAllPattern - * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern} _1y - * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern} _2y - * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern} _4y - * @property {_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern} all - */ - -/** - * @typedef {Object} AverageBlockCumulativeSumPattern2 - * @property {_1m1w1y24hPattern} average - * @property {SeriesPattern18} block - * @property {SeriesPattern1} cumulative - * @property {_1m1w1y24hPattern} sum - */ - -/** - * Create a AverageBlockCumulativeSumPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AverageBlockCumulativeSumPattern2} - */ -function createAverageBlockCumulativeSumPattern2(client, acc) { - return { - average: create_1m1w1y24hPattern(client, _m(acc, 'average')), - block: createSeriesPattern18(client, acc), - cumulative: createSeriesPattern1(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} AverageBlockCumulativeSumPattern3 - * @property {_1m1w1y24hPattern3} average - * @property {BtcCentsSatsUsdPattern3} block - * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern4} sum - */ - -/** - * Create a AverageBlockCumulativeSumPattern3 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AverageBlockCumulativeSumPattern3} - */ -function createAverageBlockCumulativeSumPattern3(client, acc) { - return { - average: create_1m1w1y24hPattern3(client, _m(acc, 'average')), - block: createBtcCentsSatsUsdPattern3(client, acc), - cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern4(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} BlockCumulativeNegativeSumPattern - * @property {CentsUsdPattern2} block - * @property {CentsUsdPattern3} cumulative - * @property {BaseSumPattern} negative - * @property {_1m1w1y24hPattern6} sum - */ - -/** - * Create a BlockCumulativeNegativeSumPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BlockCumulativeNegativeSumPattern} - */ -function createBlockCumulativeNegativeSumPattern(client, acc) { - return { - block: createCentsUsdPattern2(client, acc), - cumulative: createCentsUsdPattern3(client, _m(acc, 'cumulative')), - negative: createBaseSumPattern(client, _m(acc, 'neg')), - sum: create_1m1w1y24hPattern6(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} BlockCumulativeDeltaSumPattern - * @property {CentsUsdPattern4} block - * @property {CentsUsdPattern} cumulative - * @property {AbsoluteRatePattern2} delta - * @property {_1m1w1y24hPattern5} sum - */ - -/** - * Create a BlockCumulativeDeltaSumPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BlockCumulativeDeltaSumPattern} - */ -function createBlockCumulativeDeltaSumPattern(client, acc) { - return { - block: createCentsUsdPattern4(client, acc), - cumulative: createCentsUsdPattern(client, _m(acc, 'cumulative')), - delta: createAbsoluteRatePattern2(client, _m(acc, 'delta')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} BtcCentsSatsUsdPattern - * @property {SeriesPattern1} btc - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} usd - */ - -/** - * Create a BtcCentsSatsUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BtcCentsSatsUsdPattern} - */ -function createBtcCentsSatsUsdPattern(client, acc) { - return { - btc: createSeriesPattern1(client, acc), - cents: createSeriesPattern1(client, _m(acc, 'cents')), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - usd: createSeriesPattern1(client, _m(acc, 'usd')), - }; -} - -/** - * @typedef {Object} BtcCentsSatsUsdPattern2 - * @property {SeriesPattern1} btc - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} usd - */ - -/** - * Create a BtcCentsSatsUsdPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BtcCentsSatsUsdPattern2} - */ -function createBtcCentsSatsUsdPattern2(client, acc) { - return { - btc: createSeriesPattern1(client, acc), - cents: createSeriesPattern1(client, _m(acc, 'cents')), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - usd: createSeriesPattern1(client, _m(acc, 'usd')), - }; -} - -/** - * @typedef {Object} BtcCentsSatsUsdPattern3 - * @property {SeriesPattern18} btc - * @property {SeriesPattern18} cents - * @property {SeriesPattern18} sats - * @property {SeriesPattern18} usd - */ - -/** - * Create a BtcCentsSatsUsdPattern3 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BtcCentsSatsUsdPattern3} - */ -function createBtcCentsSatsUsdPattern3(client, acc) { - return { - btc: createSeriesPattern18(client, acc), - cents: createSeriesPattern18(client, _m(acc, 'cents')), - sats: createSeriesPattern18(client, _m(acc, 'sats')), - usd: createSeriesPattern18(client, _m(acc, 'usd')), - }; -} - -/** - * @typedef {Object} CentsDeltaToUsdPattern - * @property {SeriesPattern1} cents - * @property {AbsoluteRatePattern2} delta - * @property {BpsPercentRatioPattern4} toOwnMcap - * @property {SeriesPattern1} usd - */ - -/** - * Create a CentsDeltaToUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsDeltaToUsdPattern} - */ -function createCentsDeltaToUsdPattern(client, acc) { - return { - cents: createSeriesPattern1(client, _m(acc, 'cents')), - delta: createAbsoluteRatePattern2(client, _m(acc, 'delta')), - toOwnMcap: createBpsPercentRatioPattern4(client, _m(acc, 'to_own_mcap')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} CentsToUsdPattern3 - * @property {SeriesPattern1} cents - * @property {BpsPercentRatioPattern} toOwnGrossPnl - * @property {BpsPercentRatioPattern} toOwnMcap - * @property {SeriesPattern1} usd - */ - -/** - * Create a CentsToUsdPattern3 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsToUsdPattern3} - */ -function createCentsToUsdPattern3(client, acc) { - return { - cents: createSeriesPattern1(client, _m(acc, 'cents')), - toOwnGrossPnl: createBpsPercentRatioPattern(client, _m(acc, 'to_own_gross_pnl')), - toOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'to_own_mcap')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} CoindaysCoinyearsDormancyTransferPattern - * @property {AverageBlockCumulativeSumPattern} coindaysDestroyed - * @property {SeriesPattern1} coinyearsDestroyed - * @property {_1m1w1y24hPattern} dormancy - * @property {AverageBlockCumulativeInSumPattern} transferVolume - */ - -/** - * Create a CoindaysCoinyearsDormancyTransferPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CoindaysCoinyearsDormancyTransferPattern} - */ -function createCoindaysCoinyearsDormancyTransferPattern(client, acc) { - return { - coindaysDestroyed: createAverageBlockCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')), - coinyearsDestroyed: createSeriesPattern1(client, _m(acc, 'coinyears_destroyed')), - dormancy: create_1m1w1y24hPattern(client, _m(acc, 'dormancy')), - transferVolume: createAverageBlockCumulativeInSumPattern(client, _m(acc, 'transfer_volume')), - }; -} - -/** - * @typedef {Object} LossNetNuplProfitPattern - * @property {CentsNegativeUsdPattern} loss - * @property {CentsUsdPattern} netPnl - * @property {BpsRatioPattern} nupl - * @property {CentsUsdPattern3} profit - */ - -/** - * Create a LossNetNuplProfitPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {LossNetNuplProfitPattern} - */ -function createLossNetNuplProfitPattern(client, acc) { - return { - loss: createCentsNegativeUsdPattern(client, _m(acc, 'unrealized_loss')), - netPnl: createCentsUsdPattern(client, _m(acc, 'net_unrealized_pnl')), - nupl: createBpsRatioPattern(client, _m(acc, 'nupl')), - profit: createCentsUsdPattern3(client, _m(acc, 'unrealized_profit')), - }; -} - -/** - * @typedef {Object} NuplRealizedSupplyUnrealizedPattern - * @property {BpsRatioPattern} nupl - * @property {AllSthPattern} realizedCap - * @property {AllSthPattern2} supply - * @property {AllSthPattern} unrealizedPnl - */ - -/** - * Create a NuplRealizedSupplyUnrealizedPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {NuplRealizedSupplyUnrealizedPattern} - */ -function createNuplRealizedSupplyUnrealizedPattern(client, acc) { - return { - nupl: createBpsRatioPattern(client, _m(acc, 'nupl')), - realizedCap: createAllSthPattern(client, acc, 'realized_cap'), - supply: createAllSthPattern2(client, acc), - unrealizedPnl: createAllSthPattern(client, acc, 'unrealized_pnl'), - }; -} - -/** - * @template T - * @typedef {Object} _1m1w1y24hPattern - * @property {SeriesPattern1} _1m - * @property {SeriesPattern1} _1w - * @property {SeriesPattern1} _1y - * @property {SeriesPattern1} _24h - */ - -/** - * Create a _1m1w1y24hPattern pattern node - * @template T - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_1m1w1y24hPattern} - */ -function create_1m1w1y24hPattern(client, acc) { - return { - _1m: createSeriesPattern1(client, _m(acc, '1m')), - _1w: createSeriesPattern1(client, _m(acc, '1w')), - _1y: createSeriesPattern1(client, _m(acc, '1y')), - _24h: createSeriesPattern1(client, _m(acc, '24h')), - }; -} - -/** - * @template T - * @typedef {Object} AverageBlockCumulativeSumPattern - * @property {_1m1w1y24hPattern} average - * @property {SeriesPattern18} block - * @property {SeriesPattern1} cumulative - * @property {_1m1w1y24hPattern} sum - */ - -/** - * Create a AverageBlockCumulativeSumPattern pattern node - * @template T - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AverageBlockCumulativeSumPattern} - */ -function createAverageBlockCumulativeSumPattern(client, acc) { - return { - average: create_1m1w1y24hPattern(client, _m(acc, 'average')), - block: createSeriesPattern18(client, acc), - cumulative: createSeriesPattern1(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} AdjustedRatioValuePattern - * @property {RatioTransferValuePattern} adjusted - * @property {_1m1w1y24hPattern} ratio - * @property {AverageBlockCumulativeSumPattern} valueDestroyed - */ - -/** - * Create a AdjustedRatioValuePattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AdjustedRatioValuePattern} - */ -function createAdjustedRatioValuePattern(client, acc) { - return { - adjusted: createRatioTransferValuePattern(client, acc), - ratio: create_1m1w1y24hPattern(client, _m(acc, 'sopr')), - valueDestroyed: createAverageBlockCumulativeSumPattern(client, _m(acc, 'value_destroyed')), - }; -} - -/** - * @typedef {Object} BlockCumulativeSumPattern - * @property {CentsUsdPattern2} block - * @property {CentsUsdPattern3} cumulative - * @property {_1m1w1y24hPattern6} sum - */ - -/** - * Create a BlockCumulativeSumPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BlockCumulativeSumPattern} - */ -function createBlockCumulativeSumPattern(client, acc) { - return { - block: createCentsUsdPattern2(client, acc), - cumulative: createCentsUsdPattern3(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern6(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} BlocksDominanceRewardsPattern - * @property {AverageBlockCumulativeSumPattern2} blocksMined - * @property {_1m1w1y24hBpsPercentRatioPattern} dominance - * @property {AverageBlockCumulativeSumPattern3} rewards - */ - -/** - * Create a BlocksDominanceRewardsPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BlocksDominanceRewardsPattern} - */ -function createBlocksDominanceRewardsPattern(client, acc) { - return { - blocksMined: createAverageBlockCumulativeSumPattern2(client, _m(acc, 'blocks_mined')), - dominance: create_1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'dominance')), - rewards: createAverageBlockCumulativeSumPattern3(client, _m(acc, 'rewards')), - }; -} - -/** - * @typedef {Object} BpsPercentRatioPattern2 - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} percent - * @property {SeriesPattern1} ratio - */ - -/** - * Create a BpsPercentRatioPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BpsPercentRatioPattern2} - */ -function createBpsPercentRatioPattern2(client, acc) { - return { - bps: createSeriesPattern1(client, _m(acc, 'bps')), - percent: createSeriesPattern1(client, acc), - ratio: createSeriesPattern1(client, _m(acc, 'ratio')), - }; -} - -/** - * @typedef {Object} BpsPercentRatioPattern4 - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} percent - * @property {SeriesPattern1} ratio - */ - -/** - * Create a BpsPercentRatioPattern4 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BpsPercentRatioPattern4} - */ -function createBpsPercentRatioPattern4(client, acc) { - return { - bps: createSeriesPattern1(client, _m(acc, 'bps')), - percent: createSeriesPattern1(client, acc), - ratio: createSeriesPattern1(client, _m(acc, 'ratio')), - }; -} - -/** - * @typedef {Object} BpsPriceRatioPattern - * @property {SeriesPattern1} bps - * @property {CentsSatsUsdPattern} price - * @property {SeriesPattern1} ratio - */ - -/** - * Create a BpsPriceRatioPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @param {string} disc - Discriminator suffix - * @returns {BpsPriceRatioPattern} - */ -function createBpsPriceRatioPattern(client, acc, disc) { - return { - bps: createSeriesPattern1(client, _m(acc, `ratio_${disc}_bps`)), - price: createCentsSatsUsdPattern(client, _m(acc, disc)), - ratio: createSeriesPattern1(client, _m(_m(acc, 'ratio'), disc)), - }; -} - -/** - * @typedef {Object} BpsPercentRatioPattern5 - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} percent - * @property {SeriesPattern1} ratio - */ - -/** - * Create a BpsPercentRatioPattern5 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BpsPercentRatioPattern5} - */ -function createBpsPercentRatioPattern5(client, acc) { - return { - bps: createSeriesPattern1(client, _m(acc, 'bps')), - percent: createSeriesPattern1(client, acc), - ratio: createSeriesPattern1(client, _m(acc, 'ratio')), - }; -} - -/** - * @typedef {Object} BpsPercentRatioPattern - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} percent - * @property {SeriesPattern1} ratio - */ - -/** - * Create a BpsPercentRatioPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BpsPercentRatioPattern} - */ -function createBpsPercentRatioPattern(client, acc) { - return { - bps: createSeriesPattern1(client, _m(acc, 'bps')), - percent: createSeriesPattern1(client, acc), - ratio: createSeriesPattern1(client, _m(acc, 'ratio')), - }; -} - -/** - * @typedef {Object} CentsSatsUsdPattern3 - * @property {SeriesPattern2} cents - * @property {SeriesPattern2} sats - * @property {SeriesPattern2} usd - */ - -/** - * Create a CentsSatsUsdPattern3 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsSatsUsdPattern3} - */ -function createCentsSatsUsdPattern3(client, acc) { - return { - cents: createSeriesPattern2(client, _m(acc, 'cents')), - sats: createSeriesPattern2(client, _m(acc, 'sats')), - usd: createSeriesPattern2(client, acc), - }; -} - -/** - * @typedef {Object} CentsDeltaUsdPattern - * @property {SeriesPattern1} cents - * @property {AbsoluteRatePattern2} delta - * @property {SeriesPattern1} usd - */ - -/** - * Create a CentsDeltaUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsDeltaUsdPattern} - */ -function createCentsDeltaUsdPattern(client, acc) { - return { - cents: createSeriesPattern1(client, _m(acc, 'cents')), - delta: createAbsoluteRatePattern2(client, _m(acc, 'delta')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} CentsNegativeUsdPattern - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} negative - * @property {SeriesPattern1} usd - */ - -/** - * Create a CentsNegativeUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsNegativeUsdPattern} - */ -function createCentsNegativeUsdPattern(client, acc) { - return { - cents: createSeriesPattern1(client, _m(acc, 'cents')), - negative: createSeriesPattern1(client, _m(acc, 'neg')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} CentsSatsUsdPattern - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} usd - */ - -/** - * Create a CentsSatsUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsSatsUsdPattern} - */ -function createCentsSatsUsdPattern(client, acc) { - return { - cents: createSeriesPattern1(client, _m(acc, 'cents')), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} CountEventsSupplyPattern - * @property {FundedTotalPattern} count - * @property {ActiveInputOutputSpendablePattern} events - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshSharePattern} supply - */ - -/** - * @typedef {Object} CumulativeRollingSumPattern - * @property {SeriesPattern1} cumulative - * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern} rolling - * @property {SeriesPattern18} sum - */ - -/** - * Create a CumulativeRollingSumPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CumulativeRollingSumPattern} - */ -function createCumulativeRollingSumPattern(client, acc) { - return { - cumulative: createSeriesPattern1(client, _m(acc, 'cumulative')), - rolling: createAverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern(client, acc), - sum: createSeriesPattern18(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} DeltaDominanceTotalPattern - * @property {AbsoluteRatePattern3} delta - * @property {BpsPercentRatioPattern2} dominance - * @property {BtcCentsSatsUsdPattern} total - */ - -/** - * Create a DeltaDominanceTotalPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {DeltaDominanceTotalPattern} - */ -function createDeltaDominanceTotalPattern(client, acc) { - return { - delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')), - dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')), - total: createBtcCentsSatsUsdPattern(client, acc), - }; -} - -/** - * @typedef {Object} GreedNetPainPattern - * @property {CentsUsdPattern3} greedIndex - * @property {CentsUsdPattern} net - * @property {CentsUsdPattern3} painIndex - */ - -/** - * Create a GreedNetPainPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {GreedNetPainPattern} - */ -function createGreedNetPainPattern(client, acc) { - return { - greedIndex: createCentsUsdPattern3(client, _m(acc, 'greed_index')), - net: createCentsUsdPattern(client, _m(acc, 'net_sentiment')), - painIndex: createCentsUsdPattern3(client, _m(acc, 'pain_index')), - }; -} - -/** - * @typedef {Object} LossNuplProfitPattern - * @property {CentsNegativeUsdPattern} loss - * @property {BpsRatioPattern} nupl - * @property {CentsUsdPattern3} profit - */ - -/** - * Create a LossNuplProfitPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {LossNuplProfitPattern} - */ -function createLossNuplProfitPattern(client, acc) { - return { - loss: createCentsNegativeUsdPattern(client, _m(acc, 'unrealized_loss')), - nupl: createBpsRatioPattern(client, _m(acc, 'nupl')), - profit: createCentsUsdPattern3(client, _m(acc, 'unrealized_profit')), - }; -} - -/** - * @typedef {Object} RatioTransferValuePattern - * @property {_1m1w1y24hPattern} ratio - * @property {AverageBlockCumulativeSumPattern} transferVolume - * @property {AverageBlockCumulativeSumPattern} valueDestroyed - */ - -/** - * Create a RatioTransferValuePattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {RatioTransferValuePattern} - */ -function createRatioTransferValuePattern(client, acc) { - return { - ratio: create_1m1w1y24hPattern(client, _m(acc, 'asopr')), - transferVolume: createAverageBlockCumulativeSumPattern(client, _m(acc, 'adj_value_created')), - valueDestroyed: createAverageBlockCumulativeSumPattern(client, _m(acc, 'adj_value_destroyed')), - }; -} - -/** - * @typedef {Object} RsiStochPattern - * @property {BpsPercentRatioPattern2} rsi - * @property {BpsPercentRatioPattern2} stochRsiD - * @property {BpsPercentRatioPattern2} stochRsiK - */ - -/** - * Create a RsiStochPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @param {string} disc - Discriminator suffix - * @returns {RsiStochPattern} - */ -function createRsiStochPattern(client, acc, disc) { - return { - rsi: createBpsPercentRatioPattern2(client, _m(acc, disc)), - stochRsiD: createBpsPercentRatioPattern2(client, _m(_m(acc, 'stoch_d'), disc)), - stochRsiK: createBpsPercentRatioPattern2(client, _m(_m(acc, 'stoch_k'), disc)), - }; -} - -/** - * @typedef {Object} SpendingSpentUnspentPattern - * @property {SeriesPattern1} spendingRate - * @property {AverageBlockCumulativeSumPattern2} spentCount - * @property {BaseDeltaPattern} unspentCount - */ - -/** - * Create a SpendingSpentUnspentPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {SpendingSpentUnspentPattern} - */ -function createSpendingSpentUnspentPattern(client, acc) { - return { - spendingRate: createSeriesPattern1(client, _m(acc, 'spending_rate')), - spentCount: createAverageBlockCumulativeSumPattern2(client, _m(acc, 'spent_utxo_count')), - unspentCount: createBaseDeltaPattern(client, _m(acc, 'utxo_count')), - }; -} - -/** - * @template T - * @typedef {Object} _6bBlockTxPattern - * @property {MaxMedianMinPct10Pct25Pct75Pct90Pattern} _6b - * @property {MaxMedianMinPct10Pct25Pct75Pct90Pattern} block - * @property {SeriesPattern19} txIndex - */ - -/** - * Create a _6bBlockTxPattern pattern node - * @template T - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_6bBlockTxPattern} - */ -function create_6bBlockTxPattern(client, acc) { - return { - _6b: createMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, _m(acc, '6b')), - block: createMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc), - txIndex: createSeriesPattern19(client, acc), - }; -} - -/** - * @typedef {Object} AbsoluteRatePattern - * @property {_1m1w1y24hPattern} absolute - * @property {_1m1w1y24hPattern2} rate - */ - -/** - * Create a AbsoluteRatePattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AbsoluteRatePattern} - */ -function createAbsoluteRatePattern(client, acc) { - return { - absolute: create_1m1w1y24hPattern(client, acc), - rate: create_1m1w1y24hPattern2(client, acc), - }; -} - -/** - * @typedef {Object} AbsoluteRatePattern2 - * @property {_1m1w1y24hPattern5} absolute - * @property {_1m1w1y24hPattern2} rate - */ - -/** - * Create a AbsoluteRatePattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AbsoluteRatePattern2} - */ -function createAbsoluteRatePattern2(client, acc) { - return { - absolute: create_1m1w1y24hPattern5(client, acc), - rate: create_1m1w1y24hPattern2(client, acc), - }; -} - -/** - * @typedef {Object} AbsoluteRatePattern3 - * @property {_1m1w1y24hPattern7} absolute - * @property {_1m1w1y24hPattern2} rate - */ - -/** - * Create a AbsoluteRatePattern3 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AbsoluteRatePattern3} - */ -function createAbsoluteRatePattern3(client, acc) { - return { - absolute: create_1m1w1y24hPattern7(client, acc), - rate: create_1m1w1y24hPattern2(client, acc), - }; -} - -/** - * @typedef {Object} AddrUtxoPattern - * @property {BtcCentsSatsUsdPattern} addr - * @property {BtcCentsSatsUsdPattern} utxo - */ - -/** - * Create a AddrUtxoPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AddrUtxoPattern} - */ -function createAddrUtxoPattern(client, acc) { - return { - addr: createBtcCentsSatsUsdPattern(client, _m(acc, 'addr_amount')), - utxo: createBtcCentsSatsUsdPattern(client, _m(acc, 'utxo_amount')), - }; -} - -/** - * @typedef {Object} AllSthPattern2 - * @property {BtcCentsDeltaSatsUsdPattern} all - * @property {BtcCentsSatsUsdPattern} sth - */ - -/** - * Create a AllSthPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {AllSthPattern2} - */ -function createAllSthPattern2(client, acc) { - return { - all: createBtcCentsDeltaSatsUsdPattern(client, _m(acc, 'supply')), - sth: createBtcCentsSatsUsdPattern(client, _m(acc, 'sth_supply')), - }; -} - -/** - * @typedef {Object} AllSthPattern - * @property {SeriesPattern1} all - * @property {SeriesPattern1} sth - */ - -/** - * Create a AllSthPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @param {string} disc - Discriminator suffix - * @returns {AllSthPattern} - */ -function createAllSthPattern(client, acc, disc) { - return { - all: createSeriesPattern1(client, _m(acc, disc)), - sth: createSeriesPattern1(client, _m(_m(acc, 'sth'), disc)), - }; -} - -/** - * @typedef {Object} BaseSumPattern - * @property {SeriesPattern18} base - * @property {_1m1w1y24hPattern} sum - */ - -/** - * Create a BaseSumPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BaseSumPattern} - */ -function createBaseSumPattern(client, acc) { - return { - base: createSeriesPattern18(client, acc), - sum: create_1m1w1y24hPattern(client, _m(acc, 'sum')), - }; -} - -/** - * @typedef {Object} BaseDeltaPattern - * @property {SeriesPattern1} base - * @property {AbsoluteRatePattern} delta - */ - -/** - * Create a BaseDeltaPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BaseDeltaPattern} - */ -function createBaseDeltaPattern(client, acc) { - return { - base: createSeriesPattern1(client, acc), - delta: createAbsoluteRatePattern(client, _m(acc, 'delta')), - }; -} - -/** - * @typedef {Object} BlockCumulativePattern - * @property {BtcCentsSatsUsdPattern3} block - * @property {BtcCentsSatsUsdPattern} cumulative - */ - -/** - * Create a BlockCumulativePattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BlockCumulativePattern} - */ -function createBlockCumulativePattern(client, acc) { - return { - block: createBtcCentsSatsUsdPattern3(client, acc), - cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), - }; -} - -/** - * @typedef {Object} BlocksDominancePattern - * @property {AverageBlockCumulativeSumPattern2} blocksMined - * @property {BpsPercentRatioPattern2} dominance - */ - -/** - * Create a BlocksDominancePattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BlocksDominancePattern} - */ -function createBlocksDominancePattern(client, acc) { - return { - blocksMined: createAverageBlockCumulativeSumPattern2(client, _m(acc, 'blocks_mined')), - dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')), - }; -} - -/** - * @typedef {Object} BpsRatioPattern2 - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} ratio - */ - -/** - * Create a BpsRatioPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BpsRatioPattern2} - */ -function createBpsRatioPattern2(client, acc) { - return { - bps: createSeriesPattern1(client, _m(acc, 'bps')), - ratio: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} BpsRatioPattern - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} ratio - */ - -/** - * Create a BpsRatioPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BpsRatioPattern} - */ -function createBpsRatioPattern(client, acc) { - return { - bps: createSeriesPattern1(client, _m(acc, 'bps')), - ratio: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} BtcSatsPattern - * @property {SeriesPattern1} btc - * @property {SeriesPattern1} sats - */ - -/** - * Create a BtcSatsPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {BtcSatsPattern} - */ -function createBtcSatsPattern(client, acc) { - return { - btc: createSeriesPattern1(client, acc), - sats: createSeriesPattern1(client, _m(acc, 'sats')), - }; -} - -/** - * @typedef {Object} CentsUsdPattern3 - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} usd - */ - -/** - * Create a CentsUsdPattern3 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsUsdPattern3} - */ -function createCentsUsdPattern3(client, acc) { - return { - cents: createSeriesPattern1(client, _m(acc, 'cents')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} CentsUsdPattern2 - * @property {SeriesPattern18} cents - * @property {SeriesPattern18} usd - */ - -/** - * Create a CentsUsdPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsUsdPattern2} - */ -function createCentsUsdPattern2(client, acc) { - return { - cents: createSeriesPattern18(client, _m(acc, 'cents')), - usd: createSeriesPattern18(client, acc), - }; -} - -/** - * @typedef {Object} CentsUsdPattern - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} usd - */ - -/** - * Create a CentsUsdPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsUsdPattern} - */ -function createCentsUsdPattern(client, acc) { - return { - cents: createSeriesPattern1(client, _m(acc, 'cents')), - usd: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} CentsUsdPattern4 - * @property {SeriesPattern18} cents - * @property {SeriesPattern18} usd - */ - -/** - * Create a CentsUsdPattern4 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CentsUsdPattern4} - */ -function createCentsUsdPattern4(client, acc) { - return { - cents: createSeriesPattern18(client, _m(acc, 'cents')), - usd: createSeriesPattern18(client, acc), - }; -} - -/** - * @typedef {Object} CoindaysTransferPattern - * @property {AverageBlockCumulativeSumPattern} coindaysDestroyed - * @property {AverageBlockCumulativeInSumPattern} transferVolume - */ - -/** - * Create a CoindaysTransferPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {CoindaysTransferPattern} - */ -function createCoindaysTransferPattern(client, acc) { - return { - coindaysDestroyed: createAverageBlockCumulativeSumPattern(client, _m(acc, 'coindays_destroyed')), - transferVolume: createAverageBlockCumulativeInSumPattern(client, _m(acc, 'transfer_volume')), - }; -} - -/** - * @typedef {Object} FundedTotalPattern - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4} funded - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4} total - */ - -/** - * Create a FundedTotalPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {FundedTotalPattern} - */ -function createFundedTotalPattern(client, acc) { - return { - funded: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4(client, acc), - total: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4(client, _p('total', acc)), - }; -} - -/** - * @typedef {Object} InPattern2 - * @property {CentsUsdPattern3} inLoss - * @property {CentsUsdPattern3} inProfit - */ - -/** - * Create a InPattern2 pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {InPattern2} - */ -function createInPattern2(client, acc) { - return { - inLoss: createCentsUsdPattern3(client, _m(acc, 'loss')), - inProfit: createCentsUsdPattern3(client, _m(acc, 'profit')), - }; -} - -/** - * @typedef {Object} InPattern - * @property {SharePattern} inLoss - * @property {SharePattern} inProfit - */ - -/** - * Create a InPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {InPattern} - */ -function createInPattern(client, acc) { - return { - inLoss: createSharePattern(client, _m(acc, 'loss_share')), - inProfit: createSharePattern(client, _m(acc, 'profit_share')), - }; -} - -/** - * @typedef {Object} PerPattern - * @property {CentsSatsUsdPattern} perCoin - * @property {CentsSatsUsdPattern} perDollar - */ - -/** - * Create a PerPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {PerPattern} - */ -function createPerPattern(client, acc) { - return { - perCoin: createCentsSatsUsdPattern(client, _m(acc, 'coin')), - perDollar: createCentsSatsUsdPattern(client, _m(acc, 'dollar')), - }; -} - -/** - * @typedef {Object} PriceRatioPattern - * @property {CentsSatsUsdPattern} price - * @property {SeriesPattern1} ratio - */ - -/** - * Create a PriceRatioPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @param {string} disc - Discriminator suffix - * @returns {PriceRatioPattern} - */ -function createPriceRatioPattern(client, acc, disc) { - return { - price: createCentsSatsUsdPattern(client, _m(acc, disc)), - ratio: createSeriesPattern1(client, _m(_m(acc, 'ratio'), disc)), - }; -} - -/** - * @typedef {Object} RatioValuePattern - * @property {_24hPattern} ratio - * @property {AverageBlockCumulativeSumPattern} valueDestroyed - */ - -/** - * Create a RatioValuePattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {RatioValuePattern} - */ -function createRatioValuePattern(client, acc) { - return { - ratio: create_24hPattern(client, _m(acc, 'sopr_24h')), - valueDestroyed: createAverageBlockCumulativeSumPattern(client, _m(acc, 'value_destroyed')), - }; -} - -/** - * @typedef {Object} SdSmaPattern - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} sma - */ - -/** - * @typedef {Object} ToPattern - * @property {BpsPercentRatioPattern} toMcap - * @property {BpsPercentRatioPattern} toRcap - */ - -/** - * Create a ToPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {ToPattern} - */ -function createToPattern(client, acc) { - return { - toMcap: createBpsPercentRatioPattern(client, _m(acc, 'mcap')), - toRcap: createBpsPercentRatioPattern(client, _m(acc, 'rcap')), - }; -} - -/** - * @typedef {Object} _24hPattern - * @property {SeriesPattern1} _24h - */ - -/** - * Create a _24hPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {_24hPattern} - */ -function create_24hPattern(client, acc) { - return { - _24h: createSeriesPattern1(client, acc), - }; -} - -/** - * @typedef {Object} NuplPattern - * @property {BpsRatioPattern} nupl - */ - -/** - * Create a NuplPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {NuplPattern} - */ -function createNuplPattern(client, acc) { - return { - nupl: createBpsRatioPattern(client, acc), - }; -} - -/** - * @typedef {Object} PricePattern - * @property {BpsCentsPercentilesRatioSatsUsdPattern} price - */ - -/** - * Create a PricePattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {PricePattern} - */ -function createPricePattern(client, acc) { - return { - price: createBpsCentsPercentilesRatioSatsUsdPattern(client, acc), - }; -} - -/** - * @typedef {Object} SharePattern - * @property {BpsPercentRatioPattern2} share - */ - -/** - * Create a SharePattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {SharePattern} - */ -function createSharePattern(client, acc) { - return { - share: createBpsPercentRatioPattern2(client, acc), - }; -} - -/** - * @typedef {Object} TransferPattern - * @property {AverageBlockCumulativeSumPattern3} transferVolume - */ - -/** - * Create a TransferPattern pattern node - * @param {BrkClient} client - * @param {string} acc - Accumulated series name - * @returns {TransferPattern} - */ -function createTransferPattern(client, acc) { - return { - transferVolume: createAverageBlockCumulativeSumPattern3(client, acc), - }; -} - -// Catalog tree typedefs - -/** - * @typedef {Object} SeriesTree - * @property {SeriesTree_Blocks} blocks - * @property {SeriesTree_Transactions} transactions - * @property {SeriesTree_Inputs} inputs - * @property {SeriesTree_Outputs} outputs - * @property {SeriesTree_Addrs} addrs - * @property {SeriesTree_Scripts} scripts - * @property {SeriesTree_Mining} mining - * @property {SeriesTree_Cointime} cointime - * @property {SeriesTree_Constants} constants - * @property {SeriesTree_Indexes} indexes - * @property {SeriesTree_Indicators} indicators - * @property {SeriesTree_Investing} investing - * @property {SeriesTree_Market} market - * @property {SeriesTree_Pools} pools - * @property {SeriesTree_Prices} prices - * @property {SeriesTree_Supply} supply - * @property {SeriesTree_Cohorts} cohorts - */ - -/** - * @typedef {Object} SeriesTree_Blocks - * @property {SeriesPattern18} blockhash - * @property {SeriesPattern18} coinbaseTag - * @property {SeriesTree_Blocks_Difficulty} difficulty - * @property {SeriesTree_Blocks_Time} time - * @property {SeriesTree_Blocks_Size} size - * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern} weight - * @property {SeriesPattern18} segwitTxs - * @property {SeriesPattern18} segwitSize - * @property {SeriesPattern18} segwitWeight - * @property {SeriesTree_Blocks_Count} count - * @property {SeriesTree_Blocks_Lookback} lookback - * @property {SeriesTree_Blocks_Interval} interval - * @property {AverageBlockCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern} vbytes - * @property {SeriesTree_Blocks_Fullness} fullness - * @property {SeriesTree_Blocks_Halving} halving - */ - -/** - * @typedef {Object} SeriesTree_Blocks_Difficulty - * @property {SeriesPattern1} value - * @property {SeriesPattern1} hashrate - * @property {BpsPercentRatioPattern} adjustment - * @property {SeriesPattern1} epoch - * @property {SeriesPattern1} blocksToRetarget - * @property {SeriesPattern1} daysToRetarget - */ - -/** - * @typedef {Object} SeriesTree_Blocks_Time - * @property {SeriesPattern18} timestamp - */ - -/** - * @typedef {Object} SeriesTree_Blocks_Size - * @property {SeriesPattern18} base - * @property {SeriesPattern1} cumulative - * @property {_1m1w1y24hPattern} sum - * @property {_1m1w1y24hPattern} average - * @property {_1m1w1y24hPattern} min - * @property {_1m1w1y24hPattern} max - * @property {_1m1w1y24hPattern} pct10 - * @property {_1m1w1y24hPattern} pct25 - * @property {_1m1w1y24hPattern} median - * @property {_1m1w1y24hPattern} pct75 - * @property {_1m1w1y24hPattern} pct90 - */ - -/** - * @typedef {Object} SeriesTree_Blocks_Count - * @property {_1m1w1y24hPattern} target - * @property {AverageBlockCumulativeSumPattern2} total - */ - -/** - * @typedef {Object} SeriesTree_Blocks_Lookback - * @property {SeriesPattern18} _1h - * @property {SeriesPattern18} _24h - * @property {SeriesPattern18} _3d - * @property {SeriesPattern18} _1w - * @property {SeriesPattern18} _8d - * @property {SeriesPattern18} _9d - * @property {SeriesPattern18} _12d - * @property {SeriesPattern18} _13d - * @property {SeriesPattern18} _2w - * @property {SeriesPattern18} _21d - * @property {SeriesPattern18} _26d - * @property {SeriesPattern18} _1m - * @property {SeriesPattern18} _34d - * @property {SeriesPattern18} _55d - * @property {SeriesPattern18} _2m - * @property {SeriesPattern18} _9w - * @property {SeriesPattern18} _12w - * @property {SeriesPattern18} _89d - * @property {SeriesPattern18} _3m - * @property {SeriesPattern18} _14w - * @property {SeriesPattern18} _111d - * @property {SeriesPattern18} _144d - * @property {SeriesPattern18} _6m - * @property {SeriesPattern18} _26w - * @property {SeriesPattern18} _200d - * @property {SeriesPattern18} _9m - * @property {SeriesPattern18} _350d - * @property {SeriesPattern18} _12m - * @property {SeriesPattern18} _1y - * @property {SeriesPattern18} _14m - * @property {SeriesPattern18} _2y - * @property {SeriesPattern18} _26m - * @property {SeriesPattern18} _3y - * @property {SeriesPattern18} _200w - * @property {SeriesPattern18} _4y - * @property {SeriesPattern18} _5y - * @property {SeriesPattern18} _6y - * @property {SeriesPattern18} _8y - * @property {SeriesPattern18} _9y - * @property {SeriesPattern18} _10y - * @property {SeriesPattern18} _12y - * @property {SeriesPattern18} _14y - * @property {SeriesPattern18} _26y - */ - -/** - * @typedef {Object} SeriesTree_Blocks_Interval - * @property {SeriesPattern18} block - * @property {SeriesPattern1} _24h - * @property {SeriesPattern1} _1w - * @property {SeriesPattern1} _1m - * @property {SeriesPattern1} _1y - */ - -/** - * @typedef {Object} SeriesTree_Blocks_Fullness - * @property {SeriesPattern18} bps - * @property {SeriesPattern18} ratio - * @property {SeriesPattern18} percent - */ - -/** - * @typedef {Object} SeriesTree_Blocks_Halving - * @property {SeriesPattern1} epoch - * @property {SeriesPattern1} blocksToHalving - * @property {SeriesPattern1} daysToHalving - */ - -/** - * @typedef {Object} SeriesTree_Transactions - * @property {SeriesTree_Transactions_Raw} raw - * @property {SeriesTree_Transactions_Count} count - * @property {SeriesTree_Transactions_Size} size - * @property {SeriesTree_Transactions_Fees} fees - * @property {SeriesTree_Transactions_Versions} versions - * @property {SeriesTree_Transactions_Volume} volume - */ - -/** - * @typedef {Object} SeriesTree_Transactions_Raw - * @property {SeriesPattern18} firstTxIndex - * @property {SeriesPattern19} txid - * @property {SeriesPattern19} txVersion - * @property {SeriesPattern19} rawLocktime - * @property {SeriesPattern19} baseSize - * @property {SeriesPattern19} totalSize - * @property {SeriesPattern19} totalSigopCost - * @property {SeriesPattern19} isExplicitlyRbf - * @property {SeriesPattern19} firstTxinIndex - * @property {SeriesPattern19} firstTxoutIndex - */ - -/** - * @typedef {Object} SeriesTree_Transactions_Count - * @property {AverageBlockCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern} total - */ - -/** - * @typedef {Object} SeriesTree_Transactions_Size - * @property {_6bBlockTxPattern} vsize - * @property {SeriesTree_Transactions_Size_Weight} weight - */ - -/** - * @typedef {Object} SeriesTree_Transactions_Size_Weight - * @property {SeriesPattern19} txIndex - * @property {MaxMedianMinPct10Pct25Pct75Pct90Pattern2} block - * @property {MaxMedianMinPct10Pct25Pct75Pct90Pattern2} _6b - */ - -/** - * @typedef {Object} SeriesTree_Transactions_Fees - * @property {SeriesPattern19} inputValue - * @property {SeriesPattern19} outputValue - * @property {_6bBlockTxPattern} fee - * @property {SeriesPattern19} feeRate - * @property {_6bBlockTxPattern} effectiveFeeRate - */ - -/** - * @typedef {Object} SeriesTree_Transactions_Versions - * @property {AverageBlockCumulativeSumPattern} v1 - * @property {AverageBlockCumulativeSumPattern} v2 - * @property {AverageBlockCumulativeSumPattern} v3 - */ - -/** - * @typedef {Object} SeriesTree_Transactions_Volume - * @property {AverageBlockCumulativeSumPattern3} transferVolume - * @property {_1m1w1y24hPattern} txPerSec - */ - -/** - * @typedef {Object} SeriesTree_Inputs - * @property {SeriesTree_Inputs_Raw} raw - * @property {SeriesTree_Inputs_Spent} spent - * @property {CumulativeRollingSumPattern} count - * @property {_1m1w1y24hPattern} perSec - * @property {SeriesTree_Inputs_ByType} byType - */ - -/** - * @typedef {Object} SeriesTree_Inputs_Raw - * @property {SeriesPattern18} firstTxinIndex - * @property {SeriesPattern20} outpoint - * @property {SeriesPattern20} txIndex - * @property {SeriesPattern20} outputType - * @property {SeriesPattern20} typeIndex - */ - -/** - * @typedef {Object} SeriesTree_Inputs_Spent - * @property {SeriesPattern20} txoutIndex - * @property {SeriesPattern20} value - */ - -/** - * @typedef {Object} SeriesTree_Inputs_ByType - * @property {SeriesTree_Inputs_ByType_InputCount} inputCount - * @property {SeriesTree_Inputs_ByType_InputShare} inputShare - * @property {SeriesTree_Inputs_ByType_TxCount} txCount - * @property {EmptyP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2} txShare - */ - -/** - * @typedef {Object} SeriesTree_Inputs_ByType_InputCount - * @property {AverageBlockCumulativeSumPattern} all - * @property {AverageBlockCumulativeSumPattern} p2pk65 - * @property {AverageBlockCumulativeSumPattern} p2pk33 - * @property {AverageBlockCumulativeSumPattern} p2pkh - * @property {AverageBlockCumulativeSumPattern} p2ms - * @property {AverageBlockCumulativeSumPattern} p2sh - * @property {AverageBlockCumulativeSumPattern} p2wpkh - * @property {AverageBlockCumulativeSumPattern} p2wsh - * @property {AverageBlockCumulativeSumPattern} p2tr - * @property {AverageBlockCumulativeSumPattern} p2a - * @property {AverageBlockCumulativeSumPattern} unknown - * @property {AverageBlockCumulativeSumPattern} empty - */ - -/** - * @typedef {Object} SeriesTree_Inputs_ByType_InputShare - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk65 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk33 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2ms - * @property {_1m1w1y24hBpsPercentRatioPattern} p2sh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wpkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wsh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2tr - * @property {_1m1w1y24hBpsPercentRatioPattern} p2a - * @property {_1m1w1y24hBpsPercentRatioPattern} unknown - * @property {_1m1w1y24hBpsPercentRatioPattern} empty - */ - -/** - * @typedef {Object} SeriesTree_Inputs_ByType_TxCount - * @property {AverageBlockCumulativeSumPattern} all - * @property {AverageBlockCumulativeSumPattern} p2pk65 - * @property {AverageBlockCumulativeSumPattern} p2pk33 - * @property {AverageBlockCumulativeSumPattern} p2pkh - * @property {AverageBlockCumulativeSumPattern} p2ms - * @property {AverageBlockCumulativeSumPattern} p2sh - * @property {AverageBlockCumulativeSumPattern} p2wpkh - * @property {AverageBlockCumulativeSumPattern} p2wsh - * @property {AverageBlockCumulativeSumPattern} p2tr - * @property {AverageBlockCumulativeSumPattern} p2a - * @property {AverageBlockCumulativeSumPattern} unknown - * @property {AverageBlockCumulativeSumPattern} empty - */ - -/** - * @typedef {Object} SeriesTree_Outputs - * @property {SeriesTree_Outputs_Raw} raw - * @property {SeriesTree_Outputs_Spent} spent - * @property {SeriesTree_Outputs_Count} count - * @property {_1m1w1y24hPattern} perSec - * @property {SeriesTree_Outputs_Unspent} unspent - * @property {SeriesTree_Outputs_ByType} byType - * @property {SeriesTree_Outputs_Value} value - */ - -/** - * @typedef {Object} SeriesTree_Outputs_Raw - * @property {SeriesPattern18} firstTxoutIndex - * @property {SeriesPattern21} value - * @property {SeriesPattern21} outputType - * @property {SeriesPattern21} typeIndex - * @property {SeriesPattern21} txIndex - */ - -/** - * @typedef {Object} SeriesTree_Outputs_Spent - * @property {SeriesPattern21} txinIndex - */ - -/** - * @typedef {Object} SeriesTree_Outputs_Count - * @property {CumulativeRollingSumPattern} total - */ - -/** - * @typedef {Object} SeriesTree_Outputs_Unspent - * @property {SeriesPattern1} count - */ - -/** - * @typedef {Object} SeriesTree_Outputs_ByType - * @property {SeriesTree_Outputs_ByType_OutputCount} outputCount - * @property {AverageBlockCumulativeSumPattern} spendableOutputCount - * @property {SeriesTree_Outputs_ByType_OutputShare} outputShare - * @property {AllEmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern} txCount - * @property {EmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2} txShare - */ - -/** - * @typedef {Object} SeriesTree_Outputs_ByType_OutputCount - * @property {AverageBlockCumulativeSumPattern} all - * @property {AverageBlockCumulativeSumPattern} p2pk65 - * @property {AverageBlockCumulativeSumPattern} p2pk33 - * @property {AverageBlockCumulativeSumPattern} p2pkh - * @property {AverageBlockCumulativeSumPattern} p2ms - * @property {AverageBlockCumulativeSumPattern} p2sh - * @property {AverageBlockCumulativeSumPattern} p2wpkh - * @property {AverageBlockCumulativeSumPattern} p2wsh - * @property {AverageBlockCumulativeSumPattern} p2tr - * @property {AverageBlockCumulativeSumPattern} p2a - * @property {AverageBlockCumulativeSumPattern} unknown - * @property {AverageBlockCumulativeSumPattern} empty - * @property {AverageBlockCumulativeSumPattern} opReturn - */ - -/** - * @typedef {Object} SeriesTree_Outputs_ByType_OutputShare - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk65 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pk33 - * @property {_1m1w1y24hBpsPercentRatioPattern} p2pkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2ms - * @property {_1m1w1y24hBpsPercentRatioPattern} p2sh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wpkh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2wsh - * @property {_1m1w1y24hBpsPercentRatioPattern} p2tr - * @property {_1m1w1y24hBpsPercentRatioPattern} p2a - * @property {_1m1w1y24hBpsPercentRatioPattern} unknown - * @property {_1m1w1y24hBpsPercentRatioPattern} empty - * @property {_1m1w1y24hBpsPercentRatioPattern} opReturn - */ - -/** - * @typedef {Object} SeriesTree_Outputs_Value - * @property {BlockCumulativePattern} opReturn - */ - -/** - * @typedef {Object} SeriesTree_Addrs - * @property {SeriesTree_Addrs_Raw} raw - * @property {SeriesTree_Addrs_Indexes} indexes - * @property {SeriesTree_Addrs_Data} data - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4} funded - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4} empty - * @property {SeriesTree_Addrs_Activity} activity - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4} total - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} new - * @property {SeriesTree_Addrs_Reused} reused - * @property {SeriesTree_Addrs_Respent} respent - * @property {SeriesTree_Addrs_Exposed} exposed - * @property {SeriesTree_Addrs_Delta} delta - * @property {SeriesTree_Addrs_AvgAmount} avgAmount - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Raw - * @property {SeriesTree_Addrs_Raw_P2pk65} p2pk65 - * @property {SeriesTree_Addrs_Raw_P2pk33} p2pk33 - * @property {SeriesTree_Addrs_Raw_P2pkh} p2pkh - * @property {SeriesTree_Addrs_Raw_P2sh} p2sh - * @property {SeriesTree_Addrs_Raw_P2wpkh} p2wpkh - * @property {SeriesTree_Addrs_Raw_P2wsh} p2wsh - * @property {SeriesTree_Addrs_Raw_P2tr} p2tr - * @property {SeriesTree_Addrs_Raw_P2a} p2a - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Raw_P2pk65 - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern27} bytes - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Raw_P2pk33 - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern26} bytes - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Raw_P2pkh - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern28} bytes - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Raw_P2sh - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern29} bytes - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Raw_P2wpkh - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern31} bytes - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Raw_P2wsh - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern32} bytes - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Raw_P2tr - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern30} bytes - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Raw_P2a - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern24} bytes - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Indexes - * @property {SeriesPattern24} p2a - * @property {SeriesPattern26} p2pk33 - * @property {SeriesPattern27} p2pk65 - * @property {SeriesPattern28} p2pkh - * @property {SeriesPattern29} p2sh - * @property {SeriesPattern30} p2tr - * @property {SeriesPattern31} p2wpkh - * @property {SeriesPattern32} p2wsh - * @property {SeriesPattern34} funded - * @property {SeriesPattern35} empty - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Data - * @property {SeriesPattern34} funded - * @property {SeriesPattern35} empty - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Activity - * @property {SeriesTree_Addrs_Activity_All} all - * @property {ActiveBidirectionalReactivatedReceivingSendingPattern} p2pk65 - * @property {ActiveBidirectionalReactivatedReceivingSendingPattern} p2pk33 - * @property {ActiveBidirectionalReactivatedReceivingSendingPattern} p2pkh - * @property {ActiveBidirectionalReactivatedReceivingSendingPattern} p2sh - * @property {ActiveBidirectionalReactivatedReceivingSendingPattern} p2wpkh - * @property {ActiveBidirectionalReactivatedReceivingSendingPattern} p2wsh - * @property {ActiveBidirectionalReactivatedReceivingSendingPattern} p2tr - * @property {ActiveBidirectionalReactivatedReceivingSendingPattern} p2a - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Activity_All - * @property {_1m1w1y24hBlockPattern} reactivated - * @property {_1m1w1y24hBlockPattern} sending - * @property {_1m1w1y24hBlockPattern} receiving - * @property {_1m1w1y24hBlockPattern} bidirectional - * @property {_1m1w1y24hBlockPattern} active - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Reused - * @property {FundedTotalPattern} count - * @property {SeriesTree_Addrs_Reused_Events} events - * @property {SeriesTree_Addrs_Reused_Supply} supply - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Reused_Events - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} outputToReusedAddrCount - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} outputToReusedAddrShare - * @property {_1m1w1y24hBpsPercentRatioPattern} spendableOutputToReusedAddrShare - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} inputFromReusedAddrCount - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} inputFromReusedAddrShare - * @property {_1m1w1y24hBlockPattern} activeReusedAddrCount - * @property {_1m1w1y24hBlockPattern2} activeReusedAddrShare - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Reused_Supply - * @property {BtcCentsSatsUsdPattern} all - * @property {BtcCentsSatsUsdPattern} p2pk65 - * @property {BtcCentsSatsUsdPattern} p2pk33 - * @property {BtcCentsSatsUsdPattern} p2pkh - * @property {BtcCentsSatsUsdPattern} p2sh - * @property {BtcCentsSatsUsdPattern} p2wpkh - * @property {BtcCentsSatsUsdPattern} p2wsh - * @property {BtcCentsSatsUsdPattern} p2tr - * @property {BtcCentsSatsUsdPattern} p2a - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5} share - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Respent - * @property {FundedTotalPattern} count - * @property {SeriesTree_Addrs_Respent_Events} events - * @property {SeriesTree_Addrs_Respent_Supply} supply - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Respent_Events - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} outputToReusedAddrCount - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} outputToReusedAddrShare - * @property {_1m1w1y24hBpsPercentRatioPattern} spendableOutputToReusedAddrShare - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} inputFromReusedAddrCount - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} inputFromReusedAddrShare - * @property {_1m1w1y24hBlockPattern} activeReusedAddrCount - * @property {_1m1w1y24hBlockPattern2} activeReusedAddrShare - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Respent_Supply - * @property {BtcCentsSatsUsdPattern} all - * @property {BtcCentsSatsUsdPattern} p2pk65 - * @property {BtcCentsSatsUsdPattern} p2pk33 - * @property {BtcCentsSatsUsdPattern} p2pkh - * @property {BtcCentsSatsUsdPattern} p2sh - * @property {BtcCentsSatsUsdPattern} p2wpkh - * @property {BtcCentsSatsUsdPattern} p2wsh - * @property {BtcCentsSatsUsdPattern} p2tr - * @property {BtcCentsSatsUsdPattern} p2a - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5} share - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Exposed - * @property {FundedTotalPattern} count - * @property {SeriesTree_Addrs_Exposed_Supply} supply - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Exposed_Supply - * @property {BtcCentsSatsUsdPattern} all - * @property {BtcCentsSatsUsdPattern} p2pk65 - * @property {BtcCentsSatsUsdPattern} p2pk33 - * @property {BtcCentsSatsUsdPattern} p2pkh - * @property {BtcCentsSatsUsdPattern} p2sh - * @property {BtcCentsSatsUsdPattern} p2wpkh - * @property {BtcCentsSatsUsdPattern} p2wsh - * @property {BtcCentsSatsUsdPattern} p2tr - * @property {BtcCentsSatsUsdPattern} p2a - * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5} share - */ - -/** - * @typedef {Object} SeriesTree_Addrs_Delta - * @property {AbsoluteRatePattern} all - * @property {AbsoluteRatePattern} p2pk65 - * @property {AbsoluteRatePattern} p2pk33 - * @property {AbsoluteRatePattern} p2pkh - * @property {AbsoluteRatePattern} p2sh - * @property {AbsoluteRatePattern} p2wpkh - * @property {AbsoluteRatePattern} p2wsh - * @property {AbsoluteRatePattern} p2tr - * @property {AbsoluteRatePattern} p2a - */ - -/** - * @typedef {Object} SeriesTree_Addrs_AvgAmount - * @property {AddrUtxoPattern} all - * @property {AddrUtxoPattern} p2pk65 - * @property {AddrUtxoPattern} p2pk33 - * @property {AddrUtxoPattern} p2pkh - * @property {AddrUtxoPattern} p2sh - * @property {AddrUtxoPattern} p2wpkh - * @property {AddrUtxoPattern} p2wsh - * @property {AddrUtxoPattern} p2tr - * @property {AddrUtxoPattern} p2a - */ - -/** - * @typedef {Object} SeriesTree_Scripts - * @property {SeriesTree_Scripts_Raw} raw - */ - -/** - * @typedef {Object} SeriesTree_Scripts_Raw - * @property {SeriesTree_Scripts_Raw_Empty} empty - * @property {SeriesTree_Scripts_Raw_OpReturn} opReturn - * @property {SeriesTree_Scripts_Raw_P2ms} p2ms - * @property {SeriesTree_Scripts_Raw_Unknown} unknown - */ - -/** - * @typedef {Object} SeriesTree_Scripts_Raw_Empty - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern22} toTxIndex - */ - -/** - * @typedef {Object} SeriesTree_Scripts_Raw_OpReturn - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern23} toTxIndex - */ - -/** - * @typedef {Object} SeriesTree_Scripts_Raw_P2ms - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern25} toTxIndex - */ - -/** - * @typedef {Object} SeriesTree_Scripts_Raw_Unknown - * @property {SeriesPattern18} firstIndex - * @property {SeriesPattern33} toTxIndex - */ - -/** - * @typedef {Object} SeriesTree_Mining - * @property {SeriesTree_Mining_Rewards} rewards - * @property {SeriesTree_Mining_Hashrate} hashrate - */ - -/** - * @typedef {Object} SeriesTree_Mining_Rewards - * @property {AverageBlockCumulativeSumPattern3} coinbase - * @property {SeriesTree_Mining_Rewards_Subsidy} subsidy - * @property {SeriesTree_Mining_Rewards_Fees} fees - * @property {SeriesPattern18} outputVolume - * @property {BlockCumulativePattern} unclaimed - */ - -/** - * @typedef {Object} SeriesTree_Mining_Rewards_Subsidy - * @property {BtcCentsSatsUsdPattern3} block - * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern4} sum - * @property {_1m1w1y24hPattern3} average - * @property {_1m1w1y24hBpsPercentRatioPattern} dominance - */ - -/** - * @typedef {Object} SeriesTree_Mining_Rewards_Fees - * @property {BtcCentsSatsUsdPattern3} block - * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern4} sum - * @property {_1m1w1y24hPattern3} average - * @property {_1m1w1y24hPattern4} min - * @property {_1m1w1y24hPattern4} max - * @property {_1m1w1y24hPattern4} pct10 - * @property {_1m1w1y24hPattern4} pct25 - * @property {_1m1w1y24hPattern4} median - * @property {_1m1w1y24hPattern4} pct75 - * @property {_1m1w1y24hPattern4} pct90 - * @property {_1m1w1y24hBpsPercentRatioPattern} dominance - * @property {SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio} toSubsidyRatio - */ - -/** - * @typedef {Object} SeriesTree_Mining_Rewards_Fees_ToSubsidyRatio - * @property {BpsRatioPattern2} _24h - * @property {BpsRatioPattern2} _1w - * @property {BpsRatioPattern2} _1m - * @property {BpsRatioPattern2} _1y - */ - -/** - * @typedef {Object} SeriesTree_Mining_Hashrate - * @property {SeriesTree_Mining_Hashrate_Rate} rate - * @property {PhsReboundThsPattern} price - * @property {PhsReboundThsPattern} value - */ - -/** - * @typedef {Object} SeriesTree_Mining_Hashrate_Rate - * @property {SeriesPattern1} base - * @property {SeriesTree_Mining_Hashrate_Rate_Sma} sma - * @property {SeriesPattern1} ath - * @property {BpsPercentRatioPattern5} drawdown - */ - -/** - * @typedef {Object} SeriesTree_Mining_Hashrate_Rate_Sma - * @property {SeriesPattern1} _1w - * @property {SeriesPattern1} _1m - * @property {SeriesPattern1} _2m - * @property {SeriesPattern1} _1y - */ - -/** - * @typedef {Object} SeriesTree_Cointime - * @property {SeriesTree_Cointime_Activity} activity - * @property {SeriesTree_Cointime_Supply} supply - * @property {SeriesTree_Cointime_Value} value - * @property {SeriesTree_Cointime_Cap} cap - * @property {SeriesTree_Cointime_Prices} prices - * @property {SeriesTree_Cointime_Adjusted} adjusted - * @property {SeriesTree_Cointime_ReserveRisk} reserveRisk - */ - -/** - * @typedef {Object} SeriesTree_Cointime_Activity - * @property {AverageBlockCumulativeSumPattern} coinblocksCreated - * @property {AverageBlockCumulativeSumPattern} coinblocksStored - * @property {SeriesPattern1} liveliness - * @property {SeriesPattern1} vaultedness - * @property {SeriesPattern1} ratio - * @property {AverageBlockCumulativeSumPattern} coinblocksDestroyed - */ - -/** - * @typedef {Object} SeriesTree_Cointime_Supply - * @property {BtcCentsSatsUsdPattern} vaulted - * @property {BtcCentsSatsUsdPattern} active - */ - -/** - * @typedef {Object} SeriesTree_Cointime_Value - * @property {AverageBlockCumulativeSumPattern} destroyed - * @property {AverageBlockCumulativeSumPattern} created - * @property {AverageBlockCumulativeSumPattern} stored - * @property {AverageBlockCumulativeSumPattern} vocdd - */ - -/** - * @typedef {Object} SeriesTree_Cointime_Cap - * @property {CentsUsdPattern3} thermo - * @property {CentsUsdPattern3} investor - * @property {CentsUsdPattern3} vaulted - * @property {CentsUsdPattern3} active - * @property {CentsUsdPattern3} cointime - * @property {BpsRatioPattern2} aviv - */ - -/** - * @typedef {Object} SeriesTree_Cointime_Prices - * @property {BpsCentsPercentilesRatioSatsUsdPattern} vaulted - * @property {BpsCentsPercentilesRatioSatsUsdPattern} active - * @property {BpsCentsPercentilesRatioSatsUsdPattern} trueMarketMean - * @property {BpsCentsPercentilesRatioSatsUsdPattern} cointime - */ - -/** - * @typedef {Object} SeriesTree_Cointime_Adjusted - * @property {BpsPercentRatioPattern} inflationRate - * @property {SeriesPattern1} txVelocityNative - * @property {SeriesPattern1} txVelocityFiat - */ - -/** - * @typedef {Object} SeriesTree_Cointime_ReserveRisk - * @property {SeriesPattern1} value - * @property {SeriesPattern18} vocddMedian1y - * @property {SeriesPattern18} hodlBank - */ - -/** - * @typedef {Object} SeriesTree_Constants - * @property {SeriesPattern1} _0 - * @property {SeriesPattern1} _1 - * @property {SeriesPattern1} _2 - * @property {SeriesPattern1} _3 - * @property {SeriesPattern1} _4 - * @property {SeriesPattern1} _20 - * @property {SeriesPattern1} _30 - * @property {SeriesPattern1} _382 - * @property {SeriesPattern1} _50 - * @property {SeriesPattern1} _618 - * @property {SeriesPattern1} _70 - * @property {SeriesPattern1} _80 - * @property {SeriesPattern1} _100 - * @property {SeriesPattern1} _600 - * @property {SeriesPattern1} minus1 - * @property {SeriesPattern1} minus2 - * @property {SeriesPattern1} minus3 - * @property {SeriesPattern1} minus4 - */ - -/** - * @typedef {Object} SeriesTree_Indexes - * @property {SeriesTree_Indexes_Addr} addr - * @property {SeriesTree_Indexes_Height} height - * @property {SeriesTree_Indexes_Epoch} epoch - * @property {SeriesTree_Indexes_Halving} halving - * @property {SeriesTree_Indexes_Minute10} minute10 - * @property {SeriesTree_Indexes_Minute30} minute30 - * @property {SeriesTree_Indexes_Hour1} hour1 - * @property {SeriesTree_Indexes_Hour4} hour4 - * @property {SeriesTree_Indexes_Hour12} hour12 - * @property {SeriesTree_Indexes_Day1} day1 - * @property {SeriesTree_Indexes_Day3} day3 - * @property {SeriesTree_Indexes_Week1} week1 - * @property {SeriesTree_Indexes_Month1} month1 - * @property {SeriesTree_Indexes_Month3} month3 - * @property {SeriesTree_Indexes_Month6} month6 - * @property {SeriesTree_Indexes_Year1} year1 - * @property {SeriesTree_Indexes_Year10} year10 - * @property {SeriesTree_Indexes_TxIndex} txIndex - * @property {SeriesTree_Indexes_TxinIndex} txinIndex - * @property {SeriesTree_Indexes_TxoutIndex} txoutIndex - * @property {SeriesTree_Indexes_Timestamp} timestamp - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr - * @property {SeriesTree_Indexes_Addr_P2pk33} p2pk33 - * @property {SeriesTree_Indexes_Addr_P2pk65} p2pk65 - * @property {SeriesTree_Indexes_Addr_P2pkh} p2pkh - * @property {SeriesTree_Indexes_Addr_P2sh} p2sh - * @property {SeriesTree_Indexes_Addr_P2tr} p2tr - * @property {SeriesTree_Indexes_Addr_P2wpkh} p2wpkh - * @property {SeriesTree_Indexes_Addr_P2wsh} p2wsh - * @property {SeriesTree_Indexes_Addr_P2a} p2a - * @property {SeriesTree_Indexes_Addr_P2ms} p2ms - * @property {SeriesTree_Indexes_Addr_Empty} empty - * @property {SeriesTree_Indexes_Addr_Unknown} unknown - * @property {SeriesTree_Indexes_Addr_OpReturn} opReturn - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_P2pk33 - * @property {SeriesPattern26} identity - * @property {SeriesPattern26} addr - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_P2pk65 - * @property {SeriesPattern27} identity - * @property {SeriesPattern27} addr - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_P2pkh - * @property {SeriesPattern28} identity - * @property {SeriesPattern28} addr - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_P2sh - * @property {SeriesPattern29} identity - * @property {SeriesPattern29} addr - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_P2tr - * @property {SeriesPattern30} identity - * @property {SeriesPattern30} addr - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_P2wpkh - * @property {SeriesPattern31} identity - * @property {SeriesPattern31} addr - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_P2wsh - * @property {SeriesPattern32} identity - * @property {SeriesPattern32} addr - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_P2a - * @property {SeriesPattern24} identity - * @property {SeriesPattern24} addr - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_P2ms - * @property {SeriesPattern25} identity - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_Empty - * @property {SeriesPattern22} identity - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_Unknown - * @property {SeriesPattern33} identity - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Addr_OpReturn - * @property {SeriesPattern23} identity - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Height - * @property {SeriesPattern18} minute10 - * @property {SeriesPattern18} minute30 - * @property {SeriesPattern18} hour1 - * @property {SeriesPattern18} hour4 - * @property {SeriesPattern18} hour12 - * @property {SeriesPattern18} day1 - * @property {SeriesPattern18} day3 - * @property {SeriesPattern18} epoch - * @property {SeriesPattern18} halving - * @property {SeriesPattern18} week1 - * @property {SeriesPattern18} month1 - * @property {SeriesPattern18} month3 - * @property {SeriesPattern18} month6 - * @property {SeriesPattern18} year1 - * @property {SeriesPattern18} year10 - * @property {SeriesPattern18} txIndexCount - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Epoch - * @property {SeriesPattern17} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Halving - * @property {SeriesPattern16} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Minute10 - * @property {SeriesPattern3} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Minute30 - * @property {SeriesPattern4} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Hour1 - * @property {SeriesPattern5} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Hour4 - * @property {SeriesPattern6} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Hour12 - * @property {SeriesPattern7} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Day1 - * @property {SeriesPattern8} date - * @property {SeriesPattern8} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Day3 - * @property {SeriesPattern9} date - * @property {SeriesPattern9} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Week1 - * @property {SeriesPattern10} date - * @property {SeriesPattern10} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Month1 - * @property {SeriesPattern11} date - * @property {SeriesPattern11} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Month3 - * @property {SeriesPattern12} date - * @property {SeriesPattern12} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Month6 - * @property {SeriesPattern13} date - * @property {SeriesPattern13} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Year1 - * @property {SeriesPattern14} date - * @property {SeriesPattern14} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Year10 - * @property {SeriesPattern15} date - * @property {SeriesPattern15} firstHeight - */ - -/** - * @typedef {Object} SeriesTree_Indexes_TxIndex - * @property {SeriesPattern19} identity - * @property {SeriesPattern19} inputCount - * @property {SeriesPattern19} outputCount - */ - -/** - * @typedef {Object} SeriesTree_Indexes_TxinIndex - * @property {SeriesPattern20} identity - */ - -/** - * @typedef {Object} SeriesTree_Indexes_TxoutIndex - * @property {SeriesPattern21} identity - */ - -/** - * @typedef {Object} SeriesTree_Indexes_Timestamp - * @property {SeriesPattern18} monotonic - * @property {SeriesPattern2} resolutions - */ - -/** - * @typedef {Object} SeriesTree_Indicators - * @property {BpsRatioPattern2} puellMultiple - * @property {BpsRatioPattern2} nvt - * @property {BpsPercentRatioPattern2} gini - * @property {BpsRatioPattern2} rhodlRatio - * @property {BpsRatioPattern2} thermoCapMultiple - * @property {SeriesPattern1} coindaysDestroyedSupplyAdj - * @property {SeriesPattern1} coinyearsDestroyedSupplyAdj - * @property {SeriesTree_Indicators_Dormancy} dormancy - * @property {SeriesPattern1} stockToFlow - * @property {SeriesPattern1} sellerExhaustion - * @property {SeriesTree_Indicators_RarityMeter} rarityMeter - */ - -/** - * @typedef {Object} SeriesTree_Indicators_Dormancy - * @property {SeriesPattern1} supplyAdj - * @property {SeriesPattern1} flow - */ - -/** - * @typedef {Object} SeriesTree_Indicators_RarityMeter - * @property {IndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern} full - * @property {IndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern} local - * @property {IndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern} cycle - */ - -/** - * @typedef {Object} SeriesTree_Investing - * @property {SeriesPattern18} satsPerDay - * @property {SeriesTree_Investing_Period} period - * @property {SeriesTree_Investing_Class} class - */ - -/** - * @typedef {Object} SeriesTree_Investing_Period - * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} dcaStack - * @property {SeriesTree_Investing_Period_DcaCostBasis} dcaCostBasis - * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} dcaReturn - * @property {_10y2y3y4y5y6y8yPattern} dcaCagr - * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern3} lumpSumStack - * @property {_10y1m1w1y2y3m3y4y5y6m6y8yPattern2} lumpSumReturn - */ - -/** - * @typedef {Object} SeriesTree_Investing_Period_DcaCostBasis - * @property {CentsSatsUsdPattern} _1w - * @property {CentsSatsUsdPattern} _1m - * @property {CentsSatsUsdPattern} _3m - * @property {CentsSatsUsdPattern} _6m - * @property {CentsSatsUsdPattern} _1y - * @property {CentsSatsUsdPattern} _2y - * @property {CentsSatsUsdPattern} _3y - * @property {CentsSatsUsdPattern} _4y - * @property {CentsSatsUsdPattern} _5y - * @property {CentsSatsUsdPattern} _6y - * @property {CentsSatsUsdPattern} _8y - * @property {CentsSatsUsdPattern} _10y - */ - -/** - * @typedef {Object} SeriesTree_Investing_Class - * @property {SeriesTree_Investing_Class_DcaStack} dcaStack - * @property {SeriesTree_Investing_Class_DcaCostBasis} dcaCostBasis - * @property {SeriesTree_Investing_Class_DcaReturn} dcaReturn - */ - -/** - * @typedef {Object} SeriesTree_Investing_Class_DcaStack - * @property {BtcCentsSatsUsdPattern} from2015 - * @property {BtcCentsSatsUsdPattern} from2016 - * @property {BtcCentsSatsUsdPattern} from2017 - * @property {BtcCentsSatsUsdPattern} from2018 - * @property {BtcCentsSatsUsdPattern} from2019 - * @property {BtcCentsSatsUsdPattern} from2020 - * @property {BtcCentsSatsUsdPattern} from2021 - * @property {BtcCentsSatsUsdPattern} from2022 - * @property {BtcCentsSatsUsdPattern} from2023 - * @property {BtcCentsSatsUsdPattern} from2024 - * @property {BtcCentsSatsUsdPattern} from2025 - * @property {BtcCentsSatsUsdPattern} from2026 - */ - -/** - * @typedef {Object} SeriesTree_Investing_Class_DcaCostBasis - * @property {CentsSatsUsdPattern} from2015 - * @property {CentsSatsUsdPattern} from2016 - * @property {CentsSatsUsdPattern} from2017 - * @property {CentsSatsUsdPattern} from2018 - * @property {CentsSatsUsdPattern} from2019 - * @property {CentsSatsUsdPattern} from2020 - * @property {CentsSatsUsdPattern} from2021 - * @property {CentsSatsUsdPattern} from2022 - * @property {CentsSatsUsdPattern} from2023 - * @property {CentsSatsUsdPattern} from2024 - * @property {CentsSatsUsdPattern} from2025 - * @property {CentsSatsUsdPattern} from2026 - */ - -/** - * @typedef {Object} SeriesTree_Investing_Class_DcaReturn - * @property {BpsPercentRatioPattern} from2015 - * @property {BpsPercentRatioPattern} from2016 - * @property {BpsPercentRatioPattern} from2017 - * @property {BpsPercentRatioPattern} from2018 - * @property {BpsPercentRatioPattern} from2019 - * @property {BpsPercentRatioPattern} from2020 - * @property {BpsPercentRatioPattern} from2021 - * @property {BpsPercentRatioPattern} from2022 - * @property {BpsPercentRatioPattern} from2023 - * @property {BpsPercentRatioPattern} from2024 - * @property {BpsPercentRatioPattern} from2025 - * @property {BpsPercentRatioPattern} from2026 - */ - -/** - * @typedef {Object} SeriesTree_Market - * @property {SeriesTree_Market_Ath} ath - * @property {SeriesTree_Market_Lookback} lookback - * @property {SeriesTree_Market_Returns} returns - * @property {_1m1w1y24hPattern} volatility - * @property {SeriesTree_Market_Range} range - * @property {SeriesTree_Market_MovingAverage} movingAverage - * @property {SeriesTree_Market_Technical} technical - */ - -/** - * @typedef {Object} SeriesTree_Market_Ath - * @property {CentsSatsUsdPattern} high - * @property {BpsPercentRatioPattern5} drawdown - * @property {SeriesPattern1} daysSince - * @property {SeriesPattern1} yearsSince - * @property {SeriesPattern1} maxDaysBetween - * @property {SeriesPattern1} maxYearsBetween - */ - -/** - * @typedef {Object} SeriesTree_Market_Lookback - * @property {CentsSatsUsdPattern} _24h - * @property {CentsSatsUsdPattern} _1w - * @property {CentsSatsUsdPattern} _1m - * @property {CentsSatsUsdPattern} _3m - * @property {CentsSatsUsdPattern} _6m - * @property {CentsSatsUsdPattern} _1y - * @property {CentsSatsUsdPattern} _2y - * @property {CentsSatsUsdPattern} _3y - * @property {CentsSatsUsdPattern} _4y - * @property {CentsSatsUsdPattern} _5y - * @property {CentsSatsUsdPattern} _6y - * @property {CentsSatsUsdPattern} _8y - * @property {CentsSatsUsdPattern} _10y - */ - -/** - * @typedef {Object} SeriesTree_Market_Returns - * @property {SeriesTree_Market_Returns_Periods} periods - * @property {_10y2y3y4y5y6y8yPattern} cagr - * @property {SeriesTree_Market_Returns_Sd24h} sd24h - */ - -/** - * @typedef {Object} SeriesTree_Market_Returns_Periods - * @property {BpsPercentRatioPattern} _24h - * @property {BpsPercentRatioPattern} _1w - * @property {BpsPercentRatioPattern} _1m - * @property {BpsPercentRatioPattern} _3m - * @property {BpsPercentRatioPattern} _6m - * @property {BpsPercentRatioPattern} _1y - * @property {BpsPercentRatioPattern} _2y - * @property {BpsPercentRatioPattern} _3y - * @property {BpsPercentRatioPattern} _4y - * @property {BpsPercentRatioPattern} _5y - * @property {BpsPercentRatioPattern} _6y - * @property {BpsPercentRatioPattern} _8y - * @property {BpsPercentRatioPattern} _10y - */ - -/** - * @typedef {Object} SeriesTree_Market_Returns_Sd24h - * @property {SeriesTree_Market_Returns_Sd24h_24h} _24h - * @property {SeriesTree_Market_Returns_Sd24h_1w} _1w - * @property {SeriesTree_Market_Returns_Sd24h_1m} _1m - * @property {SeriesTree_Market_Returns_Sd24h_1y} _1y - */ - -/** - * @typedef {Object} SeriesTree_Market_Returns_Sd24h_24h - * @property {SeriesPattern1} sma - * @property {SeriesPattern1} sd - */ - -/** - * @typedef {Object} SeriesTree_Market_Returns_Sd24h_1w - * @property {SeriesPattern1} sma - * @property {SeriesPattern1} sd - */ - -/** - * @typedef {Object} SeriesTree_Market_Returns_Sd24h_1m - * @property {SeriesPattern1} sma - * @property {SeriesPattern1} sd - */ - -/** - * @typedef {Object} SeriesTree_Market_Returns_Sd24h_1y - * @property {SeriesPattern1} sma - * @property {SeriesPattern1} sd - */ - -/** - * @typedef {Object} SeriesTree_Market_Range - * @property {_1m1w1y2wPattern} min - * @property {_1m1w1y2wPattern} max - * @property {SeriesPattern1} trueRange - * @property {SeriesPattern1} trueRangeSum2w - * @property {BpsPercentRatioPattern2} choppinessIndex2w - */ - -/** - * @typedef {Object} SeriesTree_Market_MovingAverage - * @property {SeriesTree_Market_MovingAverage_Sma} sma - * @property {SeriesTree_Market_MovingAverage_Ema} ema - */ - -/** - * @typedef {Object} SeriesTree_Market_MovingAverage_Sma - * @property {BpsCentsRatioSatsUsdPattern} _1w - * @property {BpsCentsRatioSatsUsdPattern} _8d - * @property {BpsCentsRatioSatsUsdPattern} _13d - * @property {BpsCentsRatioSatsUsdPattern} _21d - * @property {BpsCentsRatioSatsUsdPattern} _1m - * @property {BpsCentsRatioSatsUsdPattern} _34d - * @property {BpsCentsRatioSatsUsdPattern} _55d - * @property {BpsCentsRatioSatsUsdPattern} _89d - * @property {BpsCentsRatioSatsUsdPattern} _111d - * @property {BpsCentsRatioSatsUsdPattern} _144d - * @property {SeriesTree_Market_MovingAverage_Sma_200d} _200d - * @property {SeriesTree_Market_MovingAverage_Sma_350d} _350d - * @property {BpsCentsRatioSatsUsdPattern} _1y - * @property {BpsCentsRatioSatsUsdPattern} _2y - * @property {BpsCentsRatioSatsUsdPattern} _200w - * @property {BpsCentsRatioSatsUsdPattern} _4y - */ - -/** - * @typedef {Object} SeriesTree_Market_MovingAverage_Sma_200d - * @property {SeriesPattern1} usd - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} ratio - * @property {CentsSatsUsdPattern} x24 - * @property {CentsSatsUsdPattern} x08 - */ - -/** - * @typedef {Object} SeriesTree_Market_MovingAverage_Sma_350d - * @property {SeriesPattern1} usd - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} ratio - * @property {CentsSatsUsdPattern} x2 - */ - -/** - * @typedef {Object} SeriesTree_Market_MovingAverage_Ema - * @property {BpsCentsRatioSatsUsdPattern} _1w - * @property {BpsCentsRatioSatsUsdPattern} _8d - * @property {BpsCentsRatioSatsUsdPattern} _12d - * @property {BpsCentsRatioSatsUsdPattern} _13d - * @property {BpsCentsRatioSatsUsdPattern} _21d - * @property {BpsCentsRatioSatsUsdPattern} _26d - * @property {BpsCentsRatioSatsUsdPattern} _1m - * @property {BpsCentsRatioSatsUsdPattern} _34d - * @property {BpsCentsRatioSatsUsdPattern} _55d - * @property {BpsCentsRatioSatsUsdPattern} _89d - * @property {BpsCentsRatioSatsUsdPattern} _144d - * @property {BpsCentsRatioSatsUsdPattern} _200d - * @property {BpsCentsRatioSatsUsdPattern} _1y - * @property {BpsCentsRatioSatsUsdPattern} _2y - * @property {BpsCentsRatioSatsUsdPattern} _200w - * @property {BpsCentsRatioSatsUsdPattern} _4y - */ - -/** - * @typedef {Object} SeriesTree_Market_Technical - * @property {SeriesTree_Market_Technical_Rsi} rsi - * @property {BpsRatioPattern2} piCycle - * @property {SeriesTree_Market_Technical_Macd} macd - */ - -/** - * @typedef {Object} SeriesTree_Market_Technical_Rsi - * @property {RsiStochPattern} _24h - * @property {RsiStochPattern} _1w - * @property {RsiStochPattern} _1m - */ - -/** - * @typedef {Object} SeriesTree_Market_Technical_Macd - * @property {SeriesTree_Market_Technical_Macd_24h} _24h - * @property {SeriesTree_Market_Technical_Macd_1w} _1w - * @property {SeriesTree_Market_Technical_Macd_1m} _1m - */ - -/** - * @typedef {Object} SeriesTree_Market_Technical_Macd_24h - * @property {SeriesPattern1} emaFast - * @property {SeriesPattern1} emaSlow - * @property {SeriesPattern1} line - * @property {SeriesPattern1} signal - * @property {SeriesPattern1} histogram - */ - -/** - * @typedef {Object} SeriesTree_Market_Technical_Macd_1w - * @property {SeriesPattern1} emaFast - * @property {SeriesPattern1} emaSlow - * @property {SeriesPattern1} line - * @property {SeriesPattern1} signal - * @property {SeriesPattern1} histogram - */ - -/** - * @typedef {Object} SeriesTree_Market_Technical_Macd_1m - * @property {SeriesPattern1} emaFast - * @property {SeriesPattern1} emaSlow - * @property {SeriesPattern1} line - * @property {SeriesPattern1} signal - * @property {SeriesPattern1} histogram - */ - -/** - * @typedef {Object} SeriesTree_Pools - * @property {SeriesPattern18} pool - * @property {SeriesTree_Pools_Major} major - * @property {SeriesTree_Pools_Minor} minor - */ - -/** - * @typedef {Object} SeriesTree_Pools_Major - * @property {BlocksDominanceRewardsPattern} unknown - * @property {BlocksDominanceRewardsPattern} luxor - * @property {BlocksDominanceRewardsPattern} btccom - * @property {BlocksDominanceRewardsPattern} btctop - * @property {BlocksDominanceRewardsPattern} btcguild - * @property {BlocksDominanceRewardsPattern} eligius - * @property {BlocksDominanceRewardsPattern} f2pool - * @property {BlocksDominanceRewardsPattern} braiinspool - * @property {BlocksDominanceRewardsPattern} antpool - * @property {BlocksDominanceRewardsPattern} btcc - * @property {BlocksDominanceRewardsPattern} bwpool - * @property {BlocksDominanceRewardsPattern} bitfury - * @property {BlocksDominanceRewardsPattern} viabtc - * @property {BlocksDominanceRewardsPattern} poolin - * @property {BlocksDominanceRewardsPattern} spiderpool - * @property {BlocksDominanceRewardsPattern} binancepool - * @property {BlocksDominanceRewardsPattern} foundryusa - * @property {BlocksDominanceRewardsPattern} sbicrypto - * @property {BlocksDominanceRewardsPattern} marapool - * @property {BlocksDominanceRewardsPattern} secpool - * @property {BlocksDominanceRewardsPattern} ocean - * @property {BlocksDominanceRewardsPattern} whitepool - */ - -/** - * @typedef {Object} SeriesTree_Pools_Minor - * @property {BlocksDominancePattern} blockfills - * @property {BlocksDominancePattern} ultimuspool - * @property {BlocksDominancePattern} terrapool - * @property {BlocksDominancePattern} onethash - * @property {BlocksDominancePattern} bitfarms - * @property {BlocksDominancePattern} huobipool - * @property {BlocksDominancePattern} wayicn - * @property {BlocksDominancePattern} canoepool - * @property {BlocksDominancePattern} bitcoincom - * @property {BlocksDominancePattern} pool175btc - * @property {BlocksDominancePattern} gbminers - * @property {BlocksDominancePattern} axbt - * @property {BlocksDominancePattern} asicminer - * @property {BlocksDominancePattern} bitminter - * @property {BlocksDominancePattern} bitcoinrussia - * @property {BlocksDominancePattern} btcserv - * @property {BlocksDominancePattern} simplecoinus - * @property {BlocksDominancePattern} ozcoin - * @property {BlocksDominancePattern} eclipsemc - * @property {BlocksDominancePattern} maxbtc - * @property {BlocksDominancePattern} triplemining - * @property {BlocksDominancePattern} coinlab - * @property {BlocksDominancePattern} pool50btc - * @property {BlocksDominancePattern} ghashio - * @property {BlocksDominancePattern} stminingcorp - * @property {BlocksDominancePattern} bitparking - * @property {BlocksDominancePattern} mmpool - * @property {BlocksDominancePattern} polmine - * @property {BlocksDominancePattern} kncminer - * @property {BlocksDominancePattern} bitalo - * @property {BlocksDominancePattern} hhtt - * @property {BlocksDominancePattern} megabigpower - * @property {BlocksDominancePattern} mtred - * @property {BlocksDominancePattern} nmcbit - * @property {BlocksDominancePattern} yourbtcnet - * @property {BlocksDominancePattern} givemecoins - * @property {BlocksDominancePattern} multicoinco - * @property {BlocksDominancePattern} bcpoolio - * @property {BlocksDominancePattern} cointerra - * @property {BlocksDominancePattern} kanopool - * @property {BlocksDominancePattern} solock - * @property {BlocksDominancePattern} ckpool - * @property {BlocksDominancePattern} nicehash - * @property {BlocksDominancePattern} bitclub - * @property {BlocksDominancePattern} bitcoinaffiliatenetwork - * @property {BlocksDominancePattern} exxbw - * @property {BlocksDominancePattern} bitsolo - * @property {BlocksDominancePattern} twentyoneinc - * @property {BlocksDominancePattern} digitalbtc - * @property {BlocksDominancePattern} eightbaochi - * @property {BlocksDominancePattern} mybtccoinpool - * @property {BlocksDominancePattern} tbdice - * @property {BlocksDominancePattern} hashpool - * @property {BlocksDominancePattern} nexious - * @property {BlocksDominancePattern} bravomining - * @property {BlocksDominancePattern} hotpool - * @property {BlocksDominancePattern} okexpool - * @property {BlocksDominancePattern} bcmonster - * @property {BlocksDominancePattern} onehash - * @property {BlocksDominancePattern} bixin - * @property {BlocksDominancePattern} tatmaspool - * @property {BlocksDominancePattern} connectbtc - * @property {BlocksDominancePattern} batpool - * @property {BlocksDominancePattern} waterhole - * @property {BlocksDominancePattern} dcexploration - * @property {BlocksDominancePattern} dcex - * @property {BlocksDominancePattern} btpool - * @property {BlocksDominancePattern} fiftyeightcoin - * @property {BlocksDominancePattern} bitcoinindia - * @property {BlocksDominancePattern} shawnp0wers - * @property {BlocksDominancePattern} phashio - * @property {BlocksDominancePattern} rigpool - * @property {BlocksDominancePattern} haozhuzhu - * @property {BlocksDominancePattern} sevenpool - * @property {BlocksDominancePattern} miningkings - * @property {BlocksDominancePattern} hashbx - * @property {BlocksDominancePattern} dpool - * @property {BlocksDominancePattern} rawpool - * @property {BlocksDominancePattern} haominer - * @property {BlocksDominancePattern} helix - * @property {BlocksDominancePattern} bitcoinukraine - * @property {BlocksDominancePattern} secretsuperstar - * @property {BlocksDominancePattern} tigerpoolnet - * @property {BlocksDominancePattern} sigmapoolcom - * @property {BlocksDominancePattern} okpooltop - * @property {BlocksDominancePattern} hummerpool - * @property {BlocksDominancePattern} tangpool - * @property {BlocksDominancePattern} bytepool - * @property {BlocksDominancePattern} novablock - * @property {BlocksDominancePattern} miningcity - * @property {BlocksDominancePattern} minerium - * @property {BlocksDominancePattern} lubiancom - * @property {BlocksDominancePattern} okkong - * @property {BlocksDominancePattern} aaopool - * @property {BlocksDominancePattern} emcdpool - * @property {BlocksDominancePattern} arkpool - * @property {BlocksDominancePattern} purebtccom - * @property {BlocksDominancePattern} kucoinpool - * @property {BlocksDominancePattern} entrustcharitypool - * @property {BlocksDominancePattern} okminer - * @property {BlocksDominancePattern} titan - * @property {BlocksDominancePattern} pegapool - * @property {BlocksDominancePattern} btcnuggets - * @property {BlocksDominancePattern} cloudhashing - * @property {BlocksDominancePattern} digitalxmintsy - * @property {BlocksDominancePattern} telco214 - * @property {BlocksDominancePattern} btcpoolparty - * @property {BlocksDominancePattern} multipool - * @property {BlocksDominancePattern} transactioncoinmining - * @property {BlocksDominancePattern} btcdig - * @property {BlocksDominancePattern} trickysbtcpool - * @property {BlocksDominancePattern} btcmp - * @property {BlocksDominancePattern} eobot - * @property {BlocksDominancePattern} unomp - * @property {BlocksDominancePattern} patels - * @property {BlocksDominancePattern} gogreenlight - * @property {BlocksDominancePattern} bitcoinindiapool - * @property {BlocksDominancePattern} ekanembtc - * @property {BlocksDominancePattern} canoe - * @property {BlocksDominancePattern} tiger - * @property {BlocksDominancePattern} onem1x - * @property {BlocksDominancePattern} zulupool - * @property {BlocksDominancePattern} wiz - * @property {BlocksDominancePattern} wk057 - * @property {BlocksDominancePattern} futurebitapollosolo - * @property {BlocksDominancePattern} carbonnegative - * @property {BlocksDominancePattern} portlandhodl - * @property {BlocksDominancePattern} phoenix - * @property {BlocksDominancePattern} neopool - * @property {BlocksDominancePattern} maxipool - * @property {BlocksDominancePattern} bitfufupool - * @property {BlocksDominancePattern} gdpool - * @property {BlocksDominancePattern} miningdutch - * @property {BlocksDominancePattern} publicpool - * @property {BlocksDominancePattern} miningsquared - * @property {BlocksDominancePattern} innopolistech - * @property {BlocksDominancePattern} btclab - * @property {BlocksDominancePattern} parasite - * @property {BlocksDominancePattern} redrockpool - * @property {BlocksDominancePattern} est3lar - * @property {BlocksDominancePattern} braiinssolo - * @property {BlocksDominancePattern} solopool - * @property {BlocksDominancePattern} noderunners - */ - -/** - * @typedef {Object} SeriesTree_Prices - * @property {SeriesTree_Prices_Split} split - * @property {SeriesTree_Prices_Ohlc} ohlc - * @property {SeriesTree_Prices_Spot} spot - */ - -/** - * @typedef {Object} SeriesTree_Prices_Split - * @property {CentsSatsUsdPattern3} open - * @property {CentsSatsUsdPattern3} high - * @property {CentsSatsUsdPattern3} low - * @property {CentsSatsUsdPattern3} close - */ - -/** - * @typedef {Object} SeriesTree_Prices_Ohlc - * @property {SeriesPattern2} usd - * @property {SeriesPattern2} cents - * @property {SeriesPattern2} sats - */ - -/** - * @typedef {Object} SeriesTree_Prices_Spot - * @property {SeriesPattern1} usd - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - */ - -/** - * @typedef {Object} SeriesTree_Supply - * @property {SeriesPattern18} state - * @property {BtcCentsSatsUsdPattern} circulating - * @property {BlockCumulativePattern} burned - * @property {BpsPercentRatioPattern} inflationRate - * @property {SeriesTree_Supply_Velocity} velocity - * @property {CentsDeltaUsdPattern} marketCap - * @property {_1m1w1y24hPattern} marketMinusRealizedCapGrowthRate - * @property {BtcCentsSatsUsdPattern} hodledOrLost - */ - -/** - * @typedef {Object} SeriesTree_Supply_Velocity - * @property {SeriesPattern1} native - * @property {SeriesPattern1} fiat - */ - -/** - * @typedef {Object} SeriesTree_Cohorts - * @property {SeriesTree_Cohorts_Utxo} utxo - * @property {SeriesTree_Cohorts_Addr} addr - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo - * @property {SeriesTree_Cohorts_Utxo_All} all - * @property {SeriesTree_Cohorts_Utxo_Sth} sth - * @property {SeriesTree_Cohorts_Utxo_Lth} lth - * @property {SeriesTree_Cohorts_Utxo_AgeRange} ageRange - * @property {SeriesTree_Cohorts_Utxo_UnderAge} underAge - * @property {SeriesTree_Cohorts_Utxo_OverAge} overAge - * @property {SeriesTree_Cohorts_Utxo_Epoch} epoch - * @property {SeriesTree_Cohorts_Utxo_Class} class - * @property {SeriesTree_Cohorts_Utxo_OverAmount} overAmount - * @property {SeriesTree_Cohorts_Utxo_AmountRange} amountRange - * @property {SeriesTree_Cohorts_Utxo_UnderAmount} underAmount - * @property {SeriesTree_Cohorts_Utxo_Type} type - * @property {SeriesTree_Cohorts_Utxo_Profitability} profitability - * @property {SeriesTree_Cohorts_Utxo_Matured} matured - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All - * @property {DeltaDominanceHalfInTotalPattern2} supply - * @property {SeriesTree_Cohorts_Utxo_All_Outputs} outputs - * @property {SeriesTree_Cohorts_Utxo_All_Activity} activity - * @property {SeriesTree_Cohorts_Utxo_All_Realized} realized - * @property {SeriesTree_Cohorts_Utxo_All_CostBasis} costBasis - * @property {SeriesTree_Cohorts_Utxo_All_Unrealized} unrealized - * @property {InPattern} investedCapital - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Outputs - * @property {BaseDeltaPattern} unspentCount - * @property {AverageBlockCumulativeSumPattern2} spentCount - * @property {SeriesPattern1} spendingRate - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Activity - * @property {AverageBlockCumulativeInSumPattern} transferVolume - * @property {AverageBlockCumulativeSumPattern} coindaysDestroyed - * @property {SeriesPattern1} coinyearsDestroyed - * @property {_1m1w1y24hPattern} dormancy - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized - * @property {CentsDeltaToUsdPattern} cap - * @property {BlockCumulativeSumPattern} profit - * @property {BlockCumulativeNegativeSumPattern} loss - * @property {SeriesTree_Cohorts_Utxo_All_Realized_Price} price - * @property {SeriesPattern1} mvrv - * @property {BlockChangeCumulativeDeltaSumPattern} netPnl - * @property {SeriesTree_Cohorts_Utxo_All_Realized_Sopr} sopr - * @property {BlockCumulativeSumPattern} grossPnl - * @property {_1m1w1y24hPattern8} sellSideRiskRatio - * @property {BlockCumulativeSumPattern} peakRegret - * @property {PricePattern} capitalized - * @property {_1m1w1y24hPattern} profitToLossRatio - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Price - * @property {SeriesPattern1} usd - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} ratio - * @property {Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles - * @property {_1m1w1y2y4yAllPattern} sma - * @property {SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev} stdDev - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev - * @property {SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev_All} all - * @property {SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y} _4y - * @property {SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y} _2y - * @property {SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y} _1y - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev_All - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev_4y - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev_2y - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Price_StdDev_1y - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Sopr - * @property {AverageBlockCumulativeSumPattern} valueDestroyed - * @property {_1m1w1y24hPattern} ratio - * @property {SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted} adjusted - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Realized_Sopr_Adjusted - * @property {_1m1w1y24hPattern} ratio - * @property {AverageBlockCumulativeSumPattern} transferVolume - * @property {AverageBlockCumulativeSumPattern} valueDestroyed - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_CostBasis - * @property {PerPattern} inProfit - * @property {PerPattern} inLoss - * @property {CentsSatsUsdPattern} min - * @property {CentsSatsUsdPattern} max - * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} perCoin - * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} perDollar - * @property {BpsPercentRatioPattern2} supplyDensity - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Unrealized - * @property {BpsRatioPattern} nupl - * @property {SeriesTree_Cohorts_Utxo_All_Unrealized_Profit} profit - * @property {SeriesTree_Cohorts_Utxo_All_Unrealized_Loss} loss - * @property {SeriesTree_Cohorts_Utxo_All_Unrealized_NetPnl} netPnl - * @property {CentsUsdPattern3} grossPnl - * @property {InPattern2} investedCapital - * @property {SeriesPattern18} capitalizedCapInProfitRaw - * @property {SeriesPattern18} capitalizedCapInLossRaw - * @property {SeriesTree_Cohorts_Utxo_All_Unrealized_Sentiment} sentiment - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Unrealized_Profit - * @property {SeriesPattern1} usd - * @property {SeriesPattern1} cents - * @property {BpsPercentRatioPattern2} toMcap - * @property {BpsPercentRatioPattern2} toOwnGrossPnl - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Unrealized_Loss - * @property {SeriesPattern1} usd - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} negative - * @property {BpsPercentRatioPattern2} toMcap - * @property {BpsPercentRatioPattern2} toOwnGrossPnl - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Unrealized_NetPnl - * @property {SeriesPattern1} usd - * @property {SeriesPattern1} cents - * @property {BpsPercentRatioPattern} toOwnGrossPnl - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_All_Unrealized_Sentiment - * @property {CentsUsdPattern3} painIndex - * @property {CentsUsdPattern3} greedIndex - * @property {CentsUsdPattern} net - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth - * @property {DeltaDominanceHalfInTotalPattern2} supply - * @property {SpendingSpentUnspentPattern} outputs - * @property {CoindaysCoinyearsDormancyTransferPattern} activity - * @property {SeriesTree_Cohorts_Utxo_Sth_Realized} realized - * @property {InMaxMinPerSupplyPattern} costBasis - * @property {CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2} unrealized - * @property {InPattern} investedCapital - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized - * @property {CentsDeltaToUsdPattern} cap - * @property {BlockCumulativeSumPattern} profit - * @property {BlockCumulativeNegativeSumPattern} loss - * @property {SeriesTree_Cohorts_Utxo_Sth_Realized_Price} price - * @property {SeriesPattern1} mvrv - * @property {BlockChangeCumulativeDeltaSumPattern} netPnl - * @property {AdjustedRatioValuePattern} sopr - * @property {BlockCumulativeSumPattern} grossPnl - * @property {_1m1w1y24hPattern8} sellSideRiskRatio - * @property {BlockCumulativeSumPattern} peakRegret - * @property {PricePattern} capitalized - * @property {_1m1w1y24hPattern} profitToLossRatio - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized_Price - * @property {SeriesPattern1} usd - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} ratio - * @property {Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles - * @property {_1m1w1y2y4yAllPattern} sma - * @property {SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev} stdDev - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev - * @property {SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All} all - * @property {SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y} _4y - * @property {SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y} _2y - * @property {SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y} _1y - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_All - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_4y - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_2y - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Sth_Realized_Price_StdDev_1y - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth - * @property {DeltaDominanceHalfInTotalPattern2} supply - * @property {SpendingSpentUnspentPattern} outputs - * @property {CoindaysCoinyearsDormancyTransferPattern} activity - * @property {SeriesTree_Cohorts_Utxo_Lth_Realized} realized - * @property {InMaxMinPerSupplyPattern} costBasis - * @property {CapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2} unrealized - * @property {InPattern} investedCapital - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized - * @property {CentsDeltaToUsdPattern} cap - * @property {BlockCumulativeSumPattern} profit - * @property {BlockCumulativeNegativeSumPattern} loss - * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Price} price - * @property {SeriesPattern1} mvrv - * @property {BlockChangeCumulativeDeltaSumPattern} netPnl - * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr} sopr - * @property {BlockCumulativeSumPattern} grossPnl - * @property {_1m1w1y24hPattern8} sellSideRiskRatio - * @property {BlockCumulativeSumPattern} peakRegret - * @property {PricePattern} capitalized - * @property {_1m1w1y24hPattern} profitToLossRatio - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Price - * @property {SeriesPattern1} usd - * @property {SeriesPattern1} cents - * @property {SeriesPattern1} sats - * @property {SeriesPattern1} bps - * @property {SeriesPattern1} ratio - * @property {Pct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern} percentiles - * @property {_1m1w1y2y4yAllPattern} sma - * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev} stdDev - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev - * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All} all - * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y} _4y - * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y} _2y - * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y} _1y - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_All - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_4y - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_2y - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Price_StdDev_1y - * @property {SeriesPattern1} sd - * @property {SeriesPattern1} zscore - * @property {CentsSatsUsdPattern} _0sd - * @property {PriceRatioPattern} p05sd - * @property {PriceRatioPattern} p1sd - * @property {PriceRatioPattern} p15sd - * @property {PriceRatioPattern} p2sd - * @property {PriceRatioPattern} p25sd - * @property {PriceRatioPattern} p3sd - * @property {PriceRatioPattern} m05sd - * @property {PriceRatioPattern} m1sd - * @property {PriceRatioPattern} m15sd - * @property {PriceRatioPattern} m2sd - * @property {PriceRatioPattern} m25sd - * @property {PriceRatioPattern} m3sd - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr - * @property {AverageBlockCumulativeSumPattern} valueDestroyed - * @property {_1m1w1y24hPattern} ratio - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_AgeRange - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} under1h - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1hTo1d - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1dTo1w - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1wTo1m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1mTo2m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2mTo3m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _3mTo4m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _4mTo5m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _5mTo6m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _6mTo1y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1yTo2y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2yTo3y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _3yTo4y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _4yTo5y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _5yTo6y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _6yTo7y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _7yTo8y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _8yTo10y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _10yTo12y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _12yTo15y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} over15y - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_UnderAge - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1w - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _3m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _4m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _5m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _6m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _3y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _4y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _5y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _6y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _7y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _8y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _10y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _12y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _15y - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_OverAge - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1d - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1w - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _3m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _4m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _5m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _6m - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _3y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _4y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _5y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _6y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _7y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _8y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _10y - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _12y - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Epoch - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _0 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _1 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _3 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _4 - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Class - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2009 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2010 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2011 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2012 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2013 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2014 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2015 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2016 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2017 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2018 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2019 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2020 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2021 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2022 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2023 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2024 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2025 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern} _2026 - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_OverAmount - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1sat - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10sats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100sats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1kSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10kSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100kSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1mSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10mSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1btc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10btc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100btc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1kBtc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10kBtc - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_AmountRange - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _0sats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1satTo10sats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10satsTo100sats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100satsTo1kSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1kSatsTo10kSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10kSatsTo100kSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100kSatsTo1mSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1mSatsTo10mSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10mSatsTo1btc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1btcTo10btc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10btcTo100btc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100btcTo1kBtc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1kBtcTo10kBtc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10kBtcTo100kBtc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} over100kBtc - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_UnderAmount - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10sats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100sats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1kSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10kSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100kSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1mSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10mSats - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1btc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10btc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100btc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _1kBtc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _10kBtc - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern2} _100kBtc - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Type - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} p2pk65 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} p2pk33 - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} p2pkh - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} p2ms - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} p2sh - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} p2wpkh - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} p2wsh - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} p2tr - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} p2a - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} unknown - * @property {ActivityOutputsRealizedSupplyUnrealizedPattern3} empty - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Profitability - * @property {SeriesTree_Cohorts_Utxo_Profitability_Range} range - * @property {SeriesTree_Cohorts_Utxo_Profitability_Profit} profit - * @property {SeriesTree_Cohorts_Utxo_Profitability_Loss} loss - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Profitability_Range - * @property {NuplRealizedSupplyUnrealizedPattern} over1000pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _500pctTo1000pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _300pctTo500pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _200pctTo300pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _100pctTo200pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _90pctTo100pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _80pctTo90pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _70pctTo80pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _60pctTo70pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _50pctTo60pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _40pctTo50pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _30pctTo40pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _20pctTo30pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _10pctTo20pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _0pctTo10pctInProfit - * @property {NuplRealizedSupplyUnrealizedPattern} _0pctTo10pctInLoss - * @property {NuplRealizedSupplyUnrealizedPattern} _10pctTo20pctInLoss - * @property {NuplRealizedSupplyUnrealizedPattern} _20pctTo30pctInLoss - * @property {NuplRealizedSupplyUnrealizedPattern} _30pctTo40pctInLoss - * @property {NuplRealizedSupplyUnrealizedPattern} _40pctTo50pctInLoss - * @property {NuplRealizedSupplyUnrealizedPattern} _50pctTo60pctInLoss - * @property {NuplRealizedSupplyUnrealizedPattern} _60pctTo70pctInLoss - * @property {NuplRealizedSupplyUnrealizedPattern} _70pctTo80pctInLoss - * @property {NuplRealizedSupplyUnrealizedPattern} _80pctTo90pctInLoss - * @property {NuplRealizedSupplyUnrealizedPattern} _90pctTo100pctInLoss - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Profitability_Profit - * @property {NuplRealizedSupplyUnrealizedPattern} all - * @property {NuplRealizedSupplyUnrealizedPattern} _10pct - * @property {NuplRealizedSupplyUnrealizedPattern} _20pct - * @property {NuplRealizedSupplyUnrealizedPattern} _30pct - * @property {NuplRealizedSupplyUnrealizedPattern} _40pct - * @property {NuplRealizedSupplyUnrealizedPattern} _50pct - * @property {NuplRealizedSupplyUnrealizedPattern} _60pct - * @property {NuplRealizedSupplyUnrealizedPattern} _70pct - * @property {NuplRealizedSupplyUnrealizedPattern} _80pct - * @property {NuplRealizedSupplyUnrealizedPattern} _90pct - * @property {NuplRealizedSupplyUnrealizedPattern} _100pct - * @property {NuplRealizedSupplyUnrealizedPattern} _200pct - * @property {NuplRealizedSupplyUnrealizedPattern} _300pct - * @property {NuplRealizedSupplyUnrealizedPattern} _500pct - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Profitability_Loss - * @property {NuplRealizedSupplyUnrealizedPattern} all - * @property {NuplRealizedSupplyUnrealizedPattern} _10pct - * @property {NuplRealizedSupplyUnrealizedPattern} _20pct - * @property {NuplRealizedSupplyUnrealizedPattern} _30pct - * @property {NuplRealizedSupplyUnrealizedPattern} _40pct - * @property {NuplRealizedSupplyUnrealizedPattern} _50pct - * @property {NuplRealizedSupplyUnrealizedPattern} _60pct - * @property {NuplRealizedSupplyUnrealizedPattern} _70pct - * @property {NuplRealizedSupplyUnrealizedPattern} _80pct - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Utxo_Matured - * @property {AverageBlockCumulativeSumPattern3} under1h - * @property {AverageBlockCumulativeSumPattern3} _1hTo1d - * @property {AverageBlockCumulativeSumPattern3} _1dTo1w - * @property {AverageBlockCumulativeSumPattern3} _1wTo1m - * @property {AverageBlockCumulativeSumPattern3} _1mTo2m - * @property {AverageBlockCumulativeSumPattern3} _2mTo3m - * @property {AverageBlockCumulativeSumPattern3} _3mTo4m - * @property {AverageBlockCumulativeSumPattern3} _4mTo5m - * @property {AverageBlockCumulativeSumPattern3} _5mTo6m - * @property {AverageBlockCumulativeSumPattern3} _6mTo1y - * @property {AverageBlockCumulativeSumPattern3} _1yTo2y - * @property {AverageBlockCumulativeSumPattern3} _2yTo3y - * @property {AverageBlockCumulativeSumPattern3} _3yTo4y - * @property {AverageBlockCumulativeSumPattern3} _4yTo5y - * @property {AverageBlockCumulativeSumPattern3} _5yTo6y - * @property {AverageBlockCumulativeSumPattern3} _6yTo7y - * @property {AverageBlockCumulativeSumPattern3} _7yTo8y - * @property {AverageBlockCumulativeSumPattern3} _8yTo10y - * @property {AverageBlockCumulativeSumPattern3} _10yTo12y - * @property {AverageBlockCumulativeSumPattern3} _12yTo15y - * @property {AverageBlockCumulativeSumPattern3} over15y - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Addr - * @property {SeriesTree_Cohorts_Addr_OverAmount} overAmount - * @property {SeriesTree_Cohorts_Addr_AmountRange} amountRange - * @property {SeriesTree_Cohorts_Addr_UnderAmount} underAmount - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Addr_OverAmount - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1sat - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10sats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100sats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1kSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10kSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100kSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1mSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10mSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1btc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10btc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100btc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1kBtc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10kBtc - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Addr_AmountRange - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _0sats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1satTo10sats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10satsTo100sats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100satsTo1kSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1kSatsTo10kSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10kSatsTo100kSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100kSatsTo1mSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1mSatsTo10mSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10mSatsTo1btc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1btcTo10btc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10btcTo100btc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100btcTo1kBtc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1kBtcTo10kBtc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10kBtcTo100kBtc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} over100kBtc - */ - -/** - * @typedef {Object} SeriesTree_Cohorts_Addr_UnderAmount - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10sats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100sats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1kSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10kSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100kSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1mSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10mSats - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1btc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10btc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100btc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _1kBtc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _10kBtc - * @property {ActivityAddrOutputsRealizedSupplyUnrealizedPattern} _100kBtc - */ - -/** - * Main BRK client with series tree and API methods - * @extends BrkClientBase - */ -class BrkClient extends BrkClientBase { - VERSION = "v0.3.1"; - - INDEXES = /** @type {const} */ ([ - "minute10", - "minute30", - "hour1", - "hour4", - "hour12", - "day1", - "day3", - "week1", - "month1", - "month3", - "month6", - "year1", - "year10", - "halving", - "epoch", - "height", - "tx_index", - "txin_index", - "txout_index", - "empty_output_index", - "op_return_index", - "p2a_addr_index", - "p2ms_output_index", - "p2pk33_addr_index", - "p2pk65_addr_index", - "p2pkh_addr_index", - "p2sh_addr_index", - "p2tr_addr_index", - "p2wpkh_addr_index", - "p2wsh_addr_index", - "unknown_output_index", - "funded_addr_index", - "empty_addr_index" - ]); - - POOL_ID_TO_POOL_NAME = /** @type {const} */ ({ - "aaopool": "AAO Pool", - "antpool": "AntPool", - "arkpool": "ArkPool", - "asicminer": "ASICMiner", - "axbt": "A-XBT", - "batpool": "BATPOOL", - "bcmonster": "BCMonster", - "bcpoolio": "bcpool.io", - "binancepool": "Binance Pool", - "bitalo": "Bitalo", - "bitclub": "BitClub", - "bitcoinaffiliatenetwork": "Bitcoin Affiliate Network", - "bitcoincom": "Bitcoin.com", - "bitcoinindia": "Bitcoin India", - "bitcoinindiapool": "BitcoinIndia", - "bitcoinrussia": "BitcoinRussia", - "bitcoinukraine": "Bitcoin-Ukraine", - "bitfarms": "Bitfarms", - "bitfufupool": "BitFuFuPool", - "bitfury": "BitFury", - "bitminter": "BitMinter", - "bitparking": "Bitparking", - "bitsolo": "Bitsolo", - "bixin": "Bixin", - "blockfills": "BlockFills", - "braiinspool": "Braiins Pool", - "braiinssolo": "Braiins Solo", - "bravomining": "Bravo Mining", - "btcc": "BTCC", - "btccom": "BTC.com", - "btcdig": "BTCDig", - "btcguild": "BTC Guild", - "btclab": "BTCLab", - "btcmp": "BTCMP", - "btcnuggets": "BTC Nuggets", - "btcpoolparty": "BTC Pool Party", - "btcserv": "BTCServ", - "btctop": "BTC.TOP", - "btpool": "BTPOOL", - "bwpool": "BWPool", - "bytepool": "BytePool", - "canoe": "CANOE", - "canoepool": "CanoePool", - "carbonnegative": "Carbon Negative", - "ckpool": "CKPool", - "cloudhashing": "CloudHashing", - "coinlab": "CoinLab", - "cointerra": "Cointerra", - "connectbtc": "ConnectBTC", - "dcex": "DCEX", - "dcexploration": "DCExploration", - "digitalbtc": "digitalBTC", - "digitalxmintsy": "digitalX Mintsy", - "dpool": "DPOOL", - "eclipsemc": "EclipseMC", - "eightbaochi": "8baochi", - "ekanembtc": "EkanemBTC", - "eligius": "Eligius", - "emcdpool": "EMCDPool", - "entrustcharitypool": "Entrust Charity Pool", - "eobot": "Eobot", - "est3lar": "Est3lar", - "exxbw": "EXX&BW", - "f2pool": "F2Pool", - "fiftyeightcoin": "58COIN", - "foundryusa": "Foundry USA", - "futurebitapollosolo": "FutureBit Apollo Solo", - "gbminers": "GBMiners", - "gdpool": "GDPool", - "ghashio": "GHash.IO", - "givemecoins": "Give Me Coins", - "gogreenlight": "GoGreenLight", - "haominer": "haominer", - "haozhuzhu": "HAOZHUZHU", - "hashbx": "HashBX", - "hashpool": "HASHPOOL", - "helix": "Helix", - "hhtt": "HHTT", - "hotpool": "HotPool", - "hummerpool": "Hummerpool", - "huobipool": "Huobi.pool", - "innopolistech": "Innopolis Tech", - "kanopool": "KanoPool", - "kncminer": "KnCMiner", - "kucoinpool": "KuCoinPool", - "lubiancom": "Lubian.com", - "luxor": "Luxor", - "marapool": "MARA Pool", - "maxbtc": "MaxBTC", - "maxipool": "MaxiPool", - "megabigpower": "MegaBigPower", - "minerium": "Minerium", - "miningcity": "MiningCity", - "miningdutch": "Mining-Dutch", - "miningkings": "MiningKings", - "miningsquared": "Mining Squared", - "mmpool": "mmpool", - "mtred": "Mt Red", - "multicoinco": "MultiCoin.co", - "multipool": "Multipool", - "mybtccoinpool": "myBTCcoin Pool", - "neopool": "Neopool", - "nexious": "Nexious", - "nicehash": "NiceHash", - "nmcbit": "NMCbit", - "noderunners": "Noderunners", - "novablock": "NovaBlock", - "ocean": "OCEAN", - "okexpool": "OKExPool", - "okkong": "OKKONG", - "okminer": "OKMINER", - "okpooltop": "okpool.top", - "onehash": "1Hash", - "onem1x": "1M1X", - "onethash": "1THash", - "ozcoin": "OzCoin", - "parasite": "Parasite", - "patels": "Patels", - "pegapool": "PEGA Pool", - "phashio": "PHash.IO", - "phoenix": "Phoenix", - "polmine": "Polmine", - "pool175btc": "175btc", - "pool50btc": "50BTC", - "poolin": "Poolin", - "portlandhodl": "Portland.HODL", - "publicpool": "Public Pool", - "purebtccom": "PureBTC.COM", - "rawpool": "Rawpool", - "redrockpool": "RedRock Pool", - "rigpool": "RigPool", - "sbicrypto": "SBI Crypto", - "secpool": "SECPOOL", - "secretsuperstar": "SecretSuperstar", - "sevenpool": "7pool", - "shawnp0wers": "shawnp0wers", - "sigmapoolcom": "Sigmapool.com", - "simplecoinus": "simplecoin.us", - "solock": "Solo CK", - "solopool": "SoloPool.com", - "spiderpool": "SpiderPool", - "stminingcorp": "ST Mining Corp", - "tangpool": "Tangpool", - "tatmaspool": "TATMAS Pool", - "tbdice": "TBDice", - "telco214": "Telco 214", - "terrapool": "Terra Pool", - "tiger": "tiger", - "tigerpoolnet": "tigerpool.net", - "titan": "Titan", - "transactioncoinmining": "transactioncoinmining", - "trickysbtcpool": "Tricky's BTC Pool", - "triplemining": "TripleMining", - "twentyoneinc": "21 Inc.", - "ultimuspool": "ULTIMUSPOOL", - "unknown": "Unknown", - "unomp": "UNOMP", - "viabtc": "ViaBTC", - "waterhole": "Waterhole", - "wayicn": "WAYI.CN", - "whitepool": "WhitePool", - "wiz": "wiz", - "wk057": "wk057", - "yourbtcnet": "Yourbtc.net", - "zulupool": "Zulupool" - }); - - TERM_NAMES = /** @type {const} */ ({ - "short": { - "id": "sth", - "short": "STH", - "long": "Short Term Holders" - }, - "long": { - "id": "lth", - "short": "LTH", - "long": "Long Term Holders" - } - }); - - EPOCH_NAMES = /** @type {const} */ ({ - "_0": { - "id": "epoch_0", - "short": "0", - "long": "Epoch 0" - }, - "_1": { - "id": "epoch_1", - "short": "1", - "long": "Epoch 1" - }, - "_2": { - "id": "epoch_2", - "short": "2", - "long": "Epoch 2" - }, - "_3": { - "id": "epoch_3", - "short": "3", - "long": "Epoch 3" - }, - "_4": { - "id": "epoch_4", - "short": "4", - "long": "Epoch 4" - } - }); - - CLASS_NAMES = /** @type {const} */ ({ - "_2009": { - "id": "class_2009", - "short": "2009", - "long": "Class 2009" - }, - "_2010": { - "id": "class_2010", - "short": "2010", - "long": "Class 2010" - }, - "_2011": { - "id": "class_2011", - "short": "2011", - "long": "Class 2011" - }, - "_2012": { - "id": "class_2012", - "short": "2012", - "long": "Class 2012" - }, - "_2013": { - "id": "class_2013", - "short": "2013", - "long": "Class 2013" - }, - "_2014": { - "id": "class_2014", - "short": "2014", - "long": "Class 2014" - }, - "_2015": { - "id": "class_2015", - "short": "2015", - "long": "Class 2015" - }, - "_2016": { - "id": "class_2016", - "short": "2016", - "long": "Class 2016" - }, - "_2017": { - "id": "class_2017", - "short": "2017", - "long": "Class 2017" - }, - "_2018": { - "id": "class_2018", - "short": "2018", - "long": "Class 2018" - }, - "_2019": { - "id": "class_2019", - "short": "2019", - "long": "Class 2019" - }, - "_2020": { - "id": "class_2020", - "short": "2020", - "long": "Class 2020" - }, - "_2021": { - "id": "class_2021", - "short": "2021", - "long": "Class 2021" - }, - "_2022": { - "id": "class_2022", - "short": "2022", - "long": "Class 2022" - }, - "_2023": { - "id": "class_2023", - "short": "2023", - "long": "Class 2023" - }, - "_2024": { - "id": "class_2024", - "short": "2024", - "long": "Class 2024" - }, - "_2025": { - "id": "class_2025", - "short": "2025", - "long": "Class 2025" - }, - "_2026": { - "id": "class_2026", - "short": "2026", - "long": "Class 2026" - } - }); - - SPENDABLE_TYPE_NAMES = /** @type {const} */ ({ - "p2pk65": { - "id": "p2pk65", - "short": "P2PK65", - "long": "Pay to Public Key (65 bytes)" - }, - "p2pk33": { - "id": "p2pk33", - "short": "P2PK33", - "long": "Pay to Public Key (33 bytes)" - }, - "p2pkh": { - "id": "p2pkh", - "short": "P2PKH", - "long": "Pay to Public Key Hash" - }, - "p2ms": { - "id": "p2ms", - "short": "P2MS", - "long": "Pay to Multisig" - }, - "p2sh": { - "id": "p2sh", - "short": "P2SH", - "long": "Pay to Script Hash" - }, - "p2wpkh": { - "id": "p2wpkh", - "short": "P2WPKH", - "long": "Pay to Witness Public Key Hash" - }, - "p2wsh": { - "id": "p2wsh", - "short": "P2WSH", - "long": "Pay to Witness Script Hash" - }, - "p2tr": { - "id": "p2tr", - "short": "P2TR", - "long": "Pay to Taproot" - }, - "p2a": { - "id": "p2a", - "short": "P2A", - "long": "Pay to Anchor" - }, - "unknown": { - "id": "unknown_outputs", - "short": "Unknown", - "long": "Unknown Output Type" - }, - "empty": { - "id": "empty_outputs", - "short": "Empty", - "long": "Empty Output" - } - }); - - AGE_RANGE_NAMES = /** @type {const} */ ({ - "under1h": { - "id": "under_1h_old", - "short": "<1h", - "long": "Under 1 Hour Old" - }, - "_1hTo1d": { - "id": "1h_to_1d_old", - "short": "1h-1d", - "long": "1 Hour to 1 Day Old" - }, - "_1dTo1w": { - "id": "1d_to_1w_old", - "short": "1d-1w", - "long": "1 Day to 1 Week Old" - }, - "_1wTo1m": { - "id": "1w_to_1m_old", - "short": "1w-1m", - "long": "1 Week to 1 Month Old" - }, - "_1mTo2m": { - "id": "1m_to_2m_old", - "short": "1m-2m", - "long": "1 to 2 Months Old" - }, - "_2mTo3m": { - "id": "2m_to_3m_old", - "short": "2m-3m", - "long": "2 to 3 Months Old" - }, - "_3mTo4m": { - "id": "3m_to_4m_old", - "short": "3m-4m", - "long": "3 to 4 Months Old" - }, - "_4mTo5m": { - "id": "4m_to_5m_old", - "short": "4m-5m", - "long": "4 to 5 Months Old" - }, - "_5mTo6m": { - "id": "5m_to_6m_old", - "short": "5m-6m", - "long": "5 to 6 Months Old" - }, - "_6mTo1y": { - "id": "6m_to_1y_old", - "short": "6m-1y", - "long": "6 Months to 1 Year Old" - }, - "_1yTo2y": { - "id": "1y_to_2y_old", - "short": "1y-2y", - "long": "1 to 2 Years Old" - }, - "_2yTo3y": { - "id": "2y_to_3y_old", - "short": "2y-3y", - "long": "2 to 3 Years Old" - }, - "_3yTo4y": { - "id": "3y_to_4y_old", - "short": "3y-4y", - "long": "3 to 4 Years Old" - }, - "_4yTo5y": { - "id": "4y_to_5y_old", - "short": "4y-5y", - "long": "4 to 5 Years Old" - }, - "_5yTo6y": { - "id": "5y_to_6y_old", - "short": "5y-6y", - "long": "5 to 6 Years Old" - }, - "_6yTo7y": { - "id": "6y_to_7y_old", - "short": "6y-7y", - "long": "6 to 7 Years Old" - }, - "_7yTo8y": { - "id": "7y_to_8y_old", - "short": "7y-8y", - "long": "7 to 8 Years Old" - }, - "_8yTo10y": { - "id": "8y_to_10y_old", - "short": "8y-10y", - "long": "8 to 10 Years Old" - }, - "_10yTo12y": { - "id": "10y_to_12y_old", - "short": "10y-12y", - "long": "10 to 12 Years Old" - }, - "_12yTo15y": { - "id": "12y_to_15y_old", - "short": "12y-15y", - "long": "12 to 15 Years Old" - }, - "over15y": { - "id": "over_15y_old", - "short": "15y+", - "long": "15+ Years Old" - } - }); - - UNDER_AGE_NAMES = /** @type {const} */ ({ - "_1w": { - "id": "under_1w_old", - "short": "<1w", - "long": "Under 1 Week Old" - }, - "_1m": { - "id": "under_1m_old", - "short": "<1m", - "long": "Under 1 Month Old" - }, - "_2m": { - "id": "under_2m_old", - "short": "<2m", - "long": "Under 2 Months Old" - }, - "_3m": { - "id": "under_3m_old", - "short": "<3m", - "long": "Under 3 Months Old" - }, - "_4m": { - "id": "under_4m_old", - "short": "<4m", - "long": "Under 4 Months Old" - }, - "_5m": { - "id": "under_5m_old", - "short": "<5m", - "long": "Under 5 Months Old" - }, - "_6m": { - "id": "under_6m_old", - "short": "<6m", - "long": "Under 6 Months Old" - }, - "_1y": { - "id": "under_1y_old", - "short": "<1y", - "long": "Under 1 Year Old" - }, - "_2y": { - "id": "under_2y_old", - "short": "<2y", - "long": "Under 2 Years Old" - }, - "_3y": { - "id": "under_3y_old", - "short": "<3y", - "long": "Under 3 Years Old" - }, - "_4y": { - "id": "under_4y_old", - "short": "<4y", - "long": "Under 4 Years Old" - }, - "_5y": { - "id": "under_5y_old", - "short": "<5y", - "long": "Under 5 Years Old" - }, - "_6y": { - "id": "under_6y_old", - "short": "<6y", - "long": "Under 6 Years Old" - }, - "_7y": { - "id": "under_7y_old", - "short": "<7y", - "long": "Under 7 Years Old" - }, - "_8y": { - "id": "under_8y_old", - "short": "<8y", - "long": "Under 8 Years Old" - }, - "_10y": { - "id": "under_10y_old", - "short": "<10y", - "long": "Under 10 Years Old" - }, - "_12y": { - "id": "under_12y_old", - "short": "<12y", - "long": "Under 12 Years Old" - }, - "_15y": { - "id": "under_15y_old", - "short": "<15y", - "long": "Under 15 Years Old" - } - }); - - OVER_AGE_NAMES = /** @type {const} */ ({ - "_1d": { - "id": "over_1d_old", - "short": "1d+", - "long": "Over 1 Day Old" - }, - "_1w": { - "id": "over_1w_old", - "short": "1w+", - "long": "Over 1 Week Old" - }, - "_1m": { - "id": "over_1m_old", - "short": "1m+", - "long": "Over 1 Month Old" - }, - "_2m": { - "id": "over_2m_old", - "short": "2m+", - "long": "Over 2 Months Old" - }, - "_3m": { - "id": "over_3m_old", - "short": "3m+", - "long": "Over 3 Months Old" - }, - "_4m": { - "id": "over_4m_old", - "short": "4m+", - "long": "Over 4 Months Old" - }, - "_5m": { - "id": "over_5m_old", - "short": "5m+", - "long": "Over 5 Months Old" - }, - "_6m": { - "id": "over_6m_old", - "short": "6m+", - "long": "Over 6 Months Old" - }, - "_1y": { - "id": "over_1y_old", - "short": "1y+", - "long": "Over 1 Year Old" - }, - "_2y": { - "id": "over_2y_old", - "short": "2y+", - "long": "Over 2 Years Old" - }, - "_3y": { - "id": "over_3y_old", - "short": "3y+", - "long": "Over 3 Years Old" - }, - "_4y": { - "id": "over_4y_old", - "short": "4y+", - "long": "Over 4 Years Old" - }, - "_5y": { - "id": "over_5y_old", - "short": "5y+", - "long": "Over 5 Years Old" - }, - "_6y": { - "id": "over_6y_old", - "short": "6y+", - "long": "Over 6 Years Old" - }, - "_7y": { - "id": "over_7y_old", - "short": "7y+", - "long": "Over 7 Years Old" - }, - "_8y": { - "id": "over_8y_old", - "short": "8y+", - "long": "Over 8 Years Old" - }, - "_10y": { - "id": "over_10y_old", - "short": "10y+", - "long": "Over 10 Years Old" - }, - "_12y": { - "id": "over_12y_old", - "short": "12y+", - "long": "Over 12 Years Old" - } - }); - - AMOUNT_RANGE_NAMES = /** @type {const} */ ({ - "_0sats": { - "id": "0sats", - "short": "0 sats", - "long": "0 Sats" - }, - "_1satTo10sats": { - "id": "1sat_to_10sats", - "short": "1-10 sats", - "long": "1-10 Sats" - }, - "_10satsTo100sats": { - "id": "10sats_to_100sats", - "short": "10-100 sats", - "long": "10-100 Sats" - }, - "_100satsTo1kSats": { - "id": "100sats_to_1k_sats", - "short": "100-1k sats", - "long": "100-1K Sats" - }, - "_1kSatsTo10kSats": { - "id": "1k_sats_to_10k_sats", - "short": "1k-10k sats", - "long": "1K-10K Sats" - }, - "_10kSatsTo100kSats": { - "id": "10k_sats_to_100k_sats", - "short": "10k-100k sats", - "long": "10K-100K Sats" - }, - "_100kSatsTo1mSats": { - "id": "100k_sats_to_1m_sats", - "short": "100k-1M sats", - "long": "100K-1M Sats" - }, - "_1mSatsTo10mSats": { - "id": "1m_sats_to_10m_sats", - "short": "1M-10M sats", - "long": "1M-10M Sats" - }, - "_10mSatsTo1btc": { - "id": "10m_sats_to_1btc", - "short": "0.1-1 BTC", - "long": "0.1-1 BTC" - }, - "_1btcTo10btc": { - "id": "1btc_to_10btc", - "short": "1-10 BTC", - "long": "1-10 BTC" - }, - "_10btcTo100btc": { - "id": "10btc_to_100btc", - "short": "10-100 BTC", - "long": "10-100 BTC" - }, - "_100btcTo1kBtc": { - "id": "100btc_to_1k_btc", - "short": "100-1k BTC", - "long": "100-1K BTC" - }, - "_1kBtcTo10kBtc": { - "id": "1k_btc_to_10k_btc", - "short": "1k-10k BTC", - "long": "1K-10K BTC" - }, - "_10kBtcTo100kBtc": { - "id": "10k_btc_to_100k_btc", - "short": "10k-100k BTC", - "long": "10K-100K BTC" - }, - "over100kBtc": { - "id": "over_100k_btc", - "short": "100k+ BTC", - "long": "100K+ BTC" - } - }); - - OVER_AMOUNT_NAMES = /** @type {const} */ ({ - "_1sat": { - "id": "over_1sat", - "short": "1+ sats", - "long": "Over 1 Sat" - }, - "_10sats": { - "id": "over_10sats", - "short": "10+ sats", - "long": "Over 10 Sats" - }, - "_100sats": { - "id": "over_100sats", - "short": "100+ sats", - "long": "Over 100 Sats" - }, - "_1kSats": { - "id": "over_1k_sats", - "short": "1k+ sats", - "long": "Over 1K Sats" - }, - "_10kSats": { - "id": "over_10k_sats", - "short": "10k+ sats", - "long": "Over 10K Sats" - }, - "_100kSats": { - "id": "over_100k_sats", - "short": "100k+ sats", - "long": "Over 100K Sats" - }, - "_1mSats": { - "id": "over_1m_sats", - "short": "1M+ sats", - "long": "Over 1M Sats" - }, - "_10mSats": { - "id": "over_10m_sats", - "short": "0.1+ BTC", - "long": "Over 0.1 BTC" - }, - "_1btc": { - "id": "over_1btc", - "short": "1+ BTC", - "long": "Over 1 BTC" - }, - "_10btc": { - "id": "over_10btc", - "short": "10+ BTC", - "long": "Over 10 BTC" - }, - "_100btc": { - "id": "over_100btc", - "short": "100+ BTC", - "long": "Over 100 BTC" - }, - "_1kBtc": { - "id": "over_1k_btc", - "short": "1k+ BTC", - "long": "Over 1K BTC" - }, - "_10kBtc": { - "id": "over_10k_btc", - "short": "10k+ BTC", - "long": "Over 10K BTC" - } - }); - - UNDER_AMOUNT_NAMES = /** @type {const} */ ({ - "_10sats": { - "id": "under_10sats", - "short": "<10 sats", - "long": "Under 10 Sats" - }, - "_100sats": { - "id": "under_100sats", - "short": "<100 sats", - "long": "Under 100 Sats" - }, - "_1kSats": { - "id": "under_1k_sats", - "short": "<1k sats", - "long": "Under 1K Sats" - }, - "_10kSats": { - "id": "under_10k_sats", - "short": "<10k sats", - "long": "Under 10K Sats" - }, - "_100kSats": { - "id": "under_100k_sats", - "short": "<100k sats", - "long": "Under 100K Sats" - }, - "_1mSats": { - "id": "under_1m_sats", - "short": "<1M sats", - "long": "Under 1M Sats" - }, - "_10mSats": { - "id": "under_10m_sats", - "short": "<0.1 BTC", - "long": "Under 0.1 BTC" - }, - "_1btc": { - "id": "under_1btc", - "short": "<1 BTC", - "long": "Under 1 BTC" - }, - "_10btc": { - "id": "under_10btc", - "short": "<10 BTC", - "long": "Under 10 BTC" - }, - "_100btc": { - "id": "under_100btc", - "short": "<100 BTC", - "long": "Under 100 BTC" - }, - "_1kBtc": { - "id": "under_1k_btc", - "short": "<1k BTC", - "long": "Under 1K BTC" - }, - "_10kBtc": { - "id": "under_10k_btc", - "short": "<10k BTC", - "long": "Under 10K BTC" - }, - "_100kBtc": { - "id": "under_100k_btc", - "short": "<100k BTC", - "long": "Under 100K BTC" - } - }); - - PROFITABILITY_RANGE_NAMES = /** @type {const} */ ({ - "over1000pctInProfit": { - "id": "utxos_over_1000pct_in_profit", - "short": "+>1000%", - "long": "Over 1000% in Profit" - }, - "_500pctTo1000pctInProfit": { - "id": "utxos_500pct_to_1000pct_in_profit", - "short": "+500-1000%", - "long": "500-1000% in Profit" - }, - "_300pctTo500pctInProfit": { - "id": "utxos_300pct_to_500pct_in_profit", - "short": "+300-500%", - "long": "300-500% in Profit" - }, - "_200pctTo300pctInProfit": { - "id": "utxos_200pct_to_300pct_in_profit", - "short": "+200-300%", - "long": "200-300% in Profit" - }, - "_100pctTo200pctInProfit": { - "id": "utxos_100pct_to_200pct_in_profit", - "short": "+100-200%", - "long": "100-200% in Profit" - }, - "_90pctTo100pctInProfit": { - "id": "utxos_90pct_to_100pct_in_profit", - "short": "+90-100%", - "long": "90-100% in Profit" - }, - "_80pctTo90pctInProfit": { - "id": "utxos_80pct_to_90pct_in_profit", - "short": "+80-90%", - "long": "80-90% in Profit" - }, - "_70pctTo80pctInProfit": { - "id": "utxos_70pct_to_80pct_in_profit", - "short": "+70-80%", - "long": "70-80% in Profit" - }, - "_60pctTo70pctInProfit": { - "id": "utxos_60pct_to_70pct_in_profit", - "short": "+60-70%", - "long": "60-70% in Profit" - }, - "_50pctTo60pctInProfit": { - "id": "utxos_50pct_to_60pct_in_profit", - "short": "+50-60%", - "long": "50-60% in Profit" - }, - "_40pctTo50pctInProfit": { - "id": "utxos_40pct_to_50pct_in_profit", - "short": "+40-50%", - "long": "40-50% in Profit" - }, - "_30pctTo40pctInProfit": { - "id": "utxos_30pct_to_40pct_in_profit", - "short": "+30-40%", - "long": "30-40% in Profit" - }, - "_20pctTo30pctInProfit": { - "id": "utxos_20pct_to_30pct_in_profit", - "short": "+20-30%", - "long": "20-30% in Profit" - }, - "_10pctTo20pctInProfit": { - "id": "utxos_10pct_to_20pct_in_profit", - "short": "+10-20%", - "long": "10-20% in Profit" - }, - "_0pctTo10pctInProfit": { - "id": "utxos_0pct_to_10pct_in_profit", - "short": "+0-10%", - "long": "0-10% in Profit" - }, - "_0pctTo10pctInLoss": { - "id": "utxos_0pct_to_10pct_in_loss", - "short": "-0-10%", - "long": "0-10% in Loss" - }, - "_10pctTo20pctInLoss": { - "id": "utxos_10pct_to_20pct_in_loss", - "short": "-10-20%", - "long": "10-20% in Loss" - }, - "_20pctTo30pctInLoss": { - "id": "utxos_20pct_to_30pct_in_loss", - "short": "-20-30%", - "long": "20-30% in Loss" - }, - "_30pctTo40pctInLoss": { - "id": "utxos_30pct_to_40pct_in_loss", - "short": "-30-40%", - "long": "30-40% in Loss" - }, - "_40pctTo50pctInLoss": { - "id": "utxos_40pct_to_50pct_in_loss", - "short": "-40-50%", - "long": "40-50% in Loss" - }, - "_50pctTo60pctInLoss": { - "id": "utxos_50pct_to_60pct_in_loss", - "short": "-50-60%", - "long": "50-60% in Loss" - }, - "_60pctTo70pctInLoss": { - "id": "utxos_60pct_to_70pct_in_loss", - "short": "-60-70%", - "long": "60-70% in Loss" - }, - "_70pctTo80pctInLoss": { - "id": "utxos_70pct_to_80pct_in_loss", - "short": "-70-80%", - "long": "70-80% in Loss" - }, - "_80pctTo90pctInLoss": { - "id": "utxos_80pct_to_90pct_in_loss", - "short": "-80-90%", - "long": "80-90% in Loss" - }, - "_90pctTo100pctInLoss": { - "id": "utxos_90pct_to_100pct_in_loss", - "short": "-90-100%", - "long": "90-100% in Loss" - } - }); - - PROFIT_NAMES = /** @type {const} */ ({ - "all": { - "id": "utxos_in_profit", - "short": "All", - "long": "In Profit" - }, - "_10pct": { - "id": "utxos_over_10pct_in_profit", - "short": ">=10%", - "long": "Over 10% in Profit" - }, - "_20pct": { - "id": "utxos_over_20pct_in_profit", - "short": ">=20%", - "long": "Over 20% in Profit" - }, - "_30pct": { - "id": "utxos_over_30pct_in_profit", - "short": ">=30%", - "long": "Over 30% in Profit" - }, - "_40pct": { - "id": "utxos_over_40pct_in_profit", - "short": ">=40%", - "long": "Over 40% in Profit" - }, - "_50pct": { - "id": "utxos_over_50pct_in_profit", - "short": ">=50%", - "long": "Over 50% in Profit" - }, - "_60pct": { - "id": "utxos_over_60pct_in_profit", - "short": ">=60%", - "long": "Over 60% in Profit" - }, - "_70pct": { - "id": "utxos_over_70pct_in_profit", - "short": ">=70%", - "long": "Over 70% in Profit" - }, - "_80pct": { - "id": "utxos_over_80pct_in_profit", - "short": ">=80%", - "long": "Over 80% in Profit" - }, - "_90pct": { - "id": "utxos_over_90pct_in_profit", - "short": ">=90%", - "long": "Over 90% in Profit" - }, - "_100pct": { - "id": "utxos_over_100pct_in_profit", - "short": ">=100%", - "long": "Over 100% in Profit" - }, - "_200pct": { - "id": "utxos_over_200pct_in_profit", - "short": ">=200%", - "long": "Over 200% in Profit" - }, - "_300pct": { - "id": "utxos_over_300pct_in_profit", - "short": ">=300%", - "long": "Over 300% in Profit" - }, - "_500pct": { - "id": "utxos_over_500pct_in_profit", - "short": ">=500%", - "long": "Over 500% in Profit" - } - }); - - LOSS_NAMES = /** @type {const} */ ({ - "all": { - "id": "utxos_in_loss", - "short": "All", - "long": "In Loss" - }, - "_10pct": { - "id": "utxos_over_10pct_in_loss", - "short": ">=10%", - "long": "Over 10% in Loss" - }, - "_20pct": { - "id": "utxos_over_20pct_in_loss", - "short": ">=20%", - "long": "Over 20% in Loss" - }, - "_30pct": { - "id": "utxos_over_30pct_in_loss", - "short": ">=30%", - "long": "Over 30% in Loss" - }, - "_40pct": { - "id": "utxos_over_40pct_in_loss", - "short": ">=40%", - "long": "Over 40% in Loss" - }, - "_50pct": { - "id": "utxos_over_50pct_in_loss", - "short": ">=50%", - "long": "Over 50% in Loss" - }, - "_60pct": { - "id": "utxos_over_60pct_in_loss", - "short": ">=60%", - "long": "Over 60% in Loss" - }, - "_70pct": { - "id": "utxos_over_70pct_in_loss", - "short": ">=70%", - "long": "Over 70% in Loss" - }, - "_80pct": { - "id": "utxos_over_80pct_in_loss", - "short": ">=80%", - "long": "Over 80% in Loss" - } - }); - - /** - * Convert an index value to a Date for date-based indexes. - * @param {Index} index - The index type - * @param {number} i - The index value - * @returns {globalThis.Date} - */ - indexToDate(index, i) { - return indexToDate(index, i); - } - - /** - * Convert a Date to an index value for date-based indexes. - * @param {Index} index - The index type - * @param {globalThis.Date} d - The date to convert - * @returns {number} - */ - dateToIndex(index, d) { - return dateToIndex(index, d); - } - - - /** - * @param {BrkClientOptions|string} options - */ - constructor(options) { - super(options); - /** @type {SeriesTree} */ - this.series = this._buildTree(); - } - - /** - * @private - * @returns {SeriesTree} - */ - _buildTree() { - return { - blocks: { - blockhash: createSeriesPattern18(this, 'blockhash'), - coinbaseTag: createSeriesPattern18(this, 'coinbase_tag'), - difficulty: { - value: createSeriesPattern1(this, 'difficulty'), - hashrate: createSeriesPattern1(this, 'difficulty_hashrate'), - adjustment: createBpsPercentRatioPattern(this, 'difficulty_adjustment'), - epoch: createSeriesPattern1(this, 'difficulty_epoch'), - blocksToRetarget: createSeriesPattern1(this, 'blocks_to_retarget'), - daysToRetarget: createSeriesPattern1(this, 'days_to_retarget'), - }, - time: { - timestamp: createSeriesPattern18(this, 'timestamp'), - }, - size: { - base: createSeriesPattern18(this, 'total_size'), - cumulative: createSeriesPattern1(this, 'block_size_cumulative'), - sum: create_1m1w1y24hPattern(this, 'block_size_sum'), - average: create_1m1w1y24hPattern(this, 'block_size_average'), - min: create_1m1w1y24hPattern(this, 'block_size_min'), - max: create_1m1w1y24hPattern(this, 'block_size_max'), - pct10: create_1m1w1y24hPattern(this, 'block_size_pct10'), - pct25: create_1m1w1y24hPattern(this, 'block_size_pct25'), - median: create_1m1w1y24hPattern(this, 'block_size_median'), - pct75: create_1m1w1y24hPattern(this, 'block_size_pct75'), - pct90: create_1m1w1y24hPattern(this, 'block_size_pct90'), - }, - weight: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(this, 'block_weight'), - segwitTxs: createSeriesPattern18(this, 'segwit_txs'), - segwitSize: createSeriesPattern18(this, 'segwit_size'), - segwitWeight: createSeriesPattern18(this, 'segwit_weight'), - count: { - target: create_1m1w1y24hPattern(this, 'block_count_target'), - total: createAverageBlockCumulativeSumPattern2(this, 'block_count'), - }, - lookback: { - _1h: createSeriesPattern18(this, 'height_1h_ago'), - _24h: createSeriesPattern18(this, 'height_24h_ago'), - _3d: createSeriesPattern18(this, 'height_3d_ago'), - _1w: createSeriesPattern18(this, 'height_1w_ago'), - _8d: createSeriesPattern18(this, 'height_8d_ago'), - _9d: createSeriesPattern18(this, 'height_9d_ago'), - _12d: createSeriesPattern18(this, 'height_12d_ago'), - _13d: createSeriesPattern18(this, 'height_13d_ago'), - _2w: createSeriesPattern18(this, 'height_2w_ago'), - _21d: createSeriesPattern18(this, 'height_21d_ago'), - _26d: createSeriesPattern18(this, 'height_26d_ago'), - _1m: createSeriesPattern18(this, 'height_1m_ago'), - _34d: createSeriesPattern18(this, 'height_34d_ago'), - _55d: createSeriesPattern18(this, 'height_55d_ago'), - _2m: createSeriesPattern18(this, 'height_2m_ago'), - _9w: createSeriesPattern18(this, 'height_9w_ago'), - _12w: createSeriesPattern18(this, 'height_12w_ago'), - _89d: createSeriesPattern18(this, 'height_89d_ago'), - _3m: createSeriesPattern18(this, 'height_3m_ago'), - _14w: createSeriesPattern18(this, 'height_14w_ago'), - _111d: createSeriesPattern18(this, 'height_111d_ago'), - _144d: createSeriesPattern18(this, 'height_144d_ago'), - _6m: createSeriesPattern18(this, 'height_6m_ago'), - _26w: createSeriesPattern18(this, 'height_26w_ago'), - _200d: createSeriesPattern18(this, 'height_200d_ago'), - _9m: createSeriesPattern18(this, 'height_9m_ago'), - _350d: createSeriesPattern18(this, 'height_350d_ago'), - _12m: createSeriesPattern18(this, 'height_12m_ago'), - _1y: createSeriesPattern18(this, 'height_1y_ago'), - _14m: createSeriesPattern18(this, 'height_14m_ago'), - _2y: createSeriesPattern18(this, 'height_2y_ago'), - _26m: createSeriesPattern18(this, 'height_26m_ago'), - _3y: createSeriesPattern18(this, 'height_3y_ago'), - _200w: createSeriesPattern18(this, 'height_200w_ago'), - _4y: createSeriesPattern18(this, 'height_4y_ago'), - _5y: createSeriesPattern18(this, 'height_5y_ago'), - _6y: createSeriesPattern18(this, 'height_6y_ago'), - _8y: createSeriesPattern18(this, 'height_8y_ago'), - _9y: createSeriesPattern18(this, 'height_9y_ago'), - _10y: createSeriesPattern18(this, 'height_10y_ago'), - _12y: createSeriesPattern18(this, 'height_12y_ago'), - _14y: createSeriesPattern18(this, 'height_14y_ago'), - _26y: createSeriesPattern18(this, 'height_26y_ago'), - }, - interval: { - block: createSeriesPattern18(this, 'block_interval'), - _24h: createSeriesPattern1(this, 'block_interval_average_24h'), - _1w: createSeriesPattern1(this, 'block_interval_average_1w'), - _1m: createSeriesPattern1(this, 'block_interval_average_1m'), - _1y: createSeriesPattern1(this, 'block_interval_average_1y'), - }, - vbytes: createAverageBlockCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(this, 'block_vbytes'), - fullness: { - bps: createSeriesPattern18(this, 'block_fullness_bps'), - ratio: createSeriesPattern18(this, 'block_fullness_ratio'), - percent: createSeriesPattern18(this, 'block_fullness'), - }, - halving: { - epoch: createSeriesPattern1(this, 'halving_epoch'), - blocksToHalving: createSeriesPattern1(this, 'blocks_to_halving'), - daysToHalving: createSeriesPattern1(this, 'days_to_halving'), - }, - }, - transactions: { - raw: { - firstTxIndex: createSeriesPattern18(this, 'first_tx_index'), - txid: createSeriesPattern19(this, 'txid'), - txVersion: createSeriesPattern19(this, 'tx_version'), - rawLocktime: createSeriesPattern19(this, 'raw_locktime'), - baseSize: createSeriesPattern19(this, 'base_size'), - totalSize: createSeriesPattern19(this, 'total_size'), - totalSigopCost: createSeriesPattern19(this, 'total_sigop_cost'), - isExplicitlyRbf: createSeriesPattern19(this, 'is_explicitly_rbf'), - firstTxinIndex: createSeriesPattern19(this, 'first_txin_index'), - firstTxoutIndex: createSeriesPattern19(this, 'first_txout_index'), - }, - count: { - total: createAverageBlockCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(this, 'tx_count'), - }, - size: { - vsize: create_6bBlockTxPattern(this, 'tx_vsize'), - weight: { - txIndex: createSeriesPattern19(this, 'tx_weight'), - block: createMaxMedianMinPct10Pct25Pct75Pct90Pattern2(this, 'tx_weight'), - _6b: createMaxMedianMinPct10Pct25Pct75Pct90Pattern2(this, 'tx_weight_6b'), - }, - }, - fees: { - inputValue: createSeriesPattern19(this, 'input_value'), - outputValue: createSeriesPattern19(this, 'output_value'), - fee: create_6bBlockTxPattern(this, 'fee'), - feeRate: createSeriesPattern19(this, 'fee_rate'), - effectiveFeeRate: create_6bBlockTxPattern(this, 'effective_fee_rate'), - }, - versions: { - v1: createAverageBlockCumulativeSumPattern(this, 'tx_v1'), - v2: createAverageBlockCumulativeSumPattern(this, 'tx_v2'), - v3: createAverageBlockCumulativeSumPattern(this, 'tx_v3'), - }, - volume: { - transferVolume: createAverageBlockCumulativeSumPattern3(this, 'transfer_volume_bis'), - txPerSec: create_1m1w1y24hPattern(this, 'tx_per_sec'), - }, - }, - inputs: { - raw: { - firstTxinIndex: createSeriesPattern18(this, 'first_txin_index'), - outpoint: createSeriesPattern20(this, 'outpoint'), - txIndex: createSeriesPattern20(this, 'tx_index'), - outputType: createSeriesPattern20(this, 'output_type'), - typeIndex: createSeriesPattern20(this, 'type_index'), - }, - spent: { - txoutIndex: createSeriesPattern20(this, 'txout_index'), - value: createSeriesPattern20(this, 'value'), - }, - count: createCumulativeRollingSumPattern(this, 'input_count'), - perSec: create_1m1w1y24hPattern(this, 'inputs_per_sec'), - byType: { - inputCount: { - all: createAverageBlockCumulativeSumPattern(this, 'input_count_bis'), - p2pk65: createAverageBlockCumulativeSumPattern(this, 'p2pk65_prevout_count'), - p2pk33: createAverageBlockCumulativeSumPattern(this, 'p2pk33_prevout_count'), - p2pkh: createAverageBlockCumulativeSumPattern(this, 'p2pkh_prevout_count'), - p2ms: createAverageBlockCumulativeSumPattern(this, 'p2ms_prevout_count'), - p2sh: createAverageBlockCumulativeSumPattern(this, 'p2sh_prevout_count'), - p2wpkh: createAverageBlockCumulativeSumPattern(this, 'p2wpkh_prevout_count'), - p2wsh: createAverageBlockCumulativeSumPattern(this, 'p2wsh_prevout_count'), - p2tr: createAverageBlockCumulativeSumPattern(this, 'p2tr_prevout_count'), - p2a: createAverageBlockCumulativeSumPattern(this, 'p2a_prevout_count'), - unknown: createAverageBlockCumulativeSumPattern(this, 'unknown_outputs_prevout_count'), - empty: createAverageBlockCumulativeSumPattern(this, 'empty_outputs_prevout_count'), - }, - inputShare: { - p2pk65: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2pk65_prevout_share'), - p2pk33: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2pk33_prevout_share'), - p2pkh: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2pkh_prevout_share'), - p2ms: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2ms_prevout_share'), - p2sh: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2sh_prevout_share'), - p2wpkh: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2wpkh_prevout_share'), - p2wsh: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2wsh_prevout_share'), - p2tr: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2tr_prevout_share'), - p2a: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2a_prevout_share'), - unknown: create_1m1w1y24hBpsPercentRatioPattern(this, 'unknown_outputs_prevout_share'), - empty: create_1m1w1y24hBpsPercentRatioPattern(this, 'empty_outputs_prevout_share'), - }, - txCount: { - all: createAverageBlockCumulativeSumPattern(this, 'non_coinbase_tx_count'), - p2pk65: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_p2pk65_prevout'), - p2pk33: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_p2pk33_prevout'), - p2pkh: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_p2pkh_prevout'), - p2ms: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_p2ms_prevout'), - p2sh: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_p2sh_prevout'), - p2wpkh: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_p2wpkh_prevout'), - p2wsh: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_p2wsh_prevout'), - p2tr: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_p2tr_prevout'), - p2a: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_p2a_prevout'), - unknown: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_unknown_outputs_prevout'), - empty: createAverageBlockCumulativeSumPattern(this, 'tx_count_with_empty_outputs_prevout'), - }, - txShare: createEmptyP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2(this, 'tx_share_with'), - }, - }, - outputs: { - raw: { - firstTxoutIndex: createSeriesPattern18(this, 'first_txout_index'), - value: createSeriesPattern21(this, 'value'), - outputType: createSeriesPattern21(this, 'output_type'), - typeIndex: createSeriesPattern21(this, 'type_index'), - txIndex: createSeriesPattern21(this, 'tx_index'), - }, - spent: { - txinIndex: createSeriesPattern21(this, 'txin_index'), - }, - count: { - total: createCumulativeRollingSumPattern(this, 'output_count'), - }, - perSec: create_1m1w1y24hPattern(this, 'outputs_per_sec'), - unspent: { - count: createSeriesPattern1(this, 'utxo_count_bis'), - }, - byType: { - outputCount: { - all: createAverageBlockCumulativeSumPattern(this, 'output_count_bis'), - p2pk65: createAverageBlockCumulativeSumPattern(this, 'p2pk65_output_count'), - p2pk33: createAverageBlockCumulativeSumPattern(this, 'p2pk33_output_count'), - p2pkh: createAverageBlockCumulativeSumPattern(this, 'p2pkh_output_count'), - p2ms: createAverageBlockCumulativeSumPattern(this, 'p2ms_output_count'), - p2sh: createAverageBlockCumulativeSumPattern(this, 'p2sh_output_count'), - p2wpkh: createAverageBlockCumulativeSumPattern(this, 'p2wpkh_output_count'), - p2wsh: createAverageBlockCumulativeSumPattern(this, 'p2wsh_output_count'), - p2tr: createAverageBlockCumulativeSumPattern(this, 'p2tr_output_count'), - p2a: createAverageBlockCumulativeSumPattern(this, 'p2a_output_count'), - unknown: createAverageBlockCumulativeSumPattern(this, 'unknown_outputs_output_count'), - empty: createAverageBlockCumulativeSumPattern(this, 'empty_outputs_output_count'), - opReturn: createAverageBlockCumulativeSumPattern(this, 'op_return_output_count'), - }, - spendableOutputCount: createAverageBlockCumulativeSumPattern(this, 'spendable_output_count'), - outputShare: { - p2pk65: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2pk65_output_share'), - p2pk33: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2pk33_output_share'), - p2pkh: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2pkh_output_share'), - p2ms: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2ms_output_share'), - p2sh: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2sh_output_share'), - p2wpkh: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2wpkh_output_share'), - p2wsh: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2wsh_output_share'), - p2tr: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2tr_output_share'), - p2a: create_1m1w1y24hBpsPercentRatioPattern(this, 'p2a_output_share'), - unknown: create_1m1w1y24hBpsPercentRatioPattern(this, 'unknown_outputs_output_share'), - empty: create_1m1w1y24hBpsPercentRatioPattern(this, 'empty_outputs_output_share'), - opReturn: create_1m1w1y24hBpsPercentRatioPattern(this, 'op_return_output_share'), - }, - txCount: createAllEmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern(this, 'tx_count'), - txShare: createEmptyOpP2aP2msP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshUnknownPattern2(this, 'tx_share_with'), - }, - value: { - opReturn: createBlockCumulativePattern(this, 'op_return_value'), - }, - }, - addrs: { - raw: { - p2pk65: { - firstIndex: createSeriesPattern18(this, 'first_p2pk65_addr_index'), - bytes: createSeriesPattern27(this, 'p2pk65_bytes'), - }, - p2pk33: { - firstIndex: createSeriesPattern18(this, 'first_p2pk33_addr_index'), - bytes: createSeriesPattern26(this, 'p2pk33_bytes'), - }, - p2pkh: { - firstIndex: createSeriesPattern18(this, 'first_p2pkh_addr_index'), - bytes: createSeriesPattern28(this, 'p2pkh_bytes'), - }, - p2sh: { - firstIndex: createSeriesPattern18(this, 'first_p2sh_addr_index'), - bytes: createSeriesPattern29(this, 'p2sh_bytes'), - }, - p2wpkh: { - firstIndex: createSeriesPattern18(this, 'first_p2wpkh_addr_index'), - bytes: createSeriesPattern31(this, 'p2wpkh_bytes'), - }, - p2wsh: { - firstIndex: createSeriesPattern18(this, 'first_p2wsh_addr_index'), - bytes: createSeriesPattern32(this, 'p2wsh_bytes'), - }, - p2tr: { - firstIndex: createSeriesPattern18(this, 'first_p2tr_addr_index'), - bytes: createSeriesPattern30(this, 'p2tr_bytes'), - }, - p2a: { - firstIndex: createSeriesPattern18(this, 'first_p2a_addr_index'), - bytes: createSeriesPattern24(this, 'p2a_bytes'), - }, - }, - indexes: { - p2a: createSeriesPattern24(this, 'any_addr_index'), - p2pk33: createSeriesPattern26(this, 'any_addr_index'), - p2pk65: createSeriesPattern27(this, 'any_addr_index'), - p2pkh: createSeriesPattern28(this, 'any_addr_index'), - p2sh: createSeriesPattern29(this, 'any_addr_index'), - p2tr: createSeriesPattern30(this, 'any_addr_index'), - p2wpkh: createSeriesPattern31(this, 'any_addr_index'), - p2wsh: createSeriesPattern32(this, 'any_addr_index'), - funded: createSeriesPattern34(this, 'funded_addr_index'), - empty: createSeriesPattern35(this, 'empty_addr_index'), - }, - data: { - funded: createSeriesPattern34(this, 'funded_addr_data'), - empty: createSeriesPattern35(this, 'empty_addr_data'), - }, - funded: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4(this, 'addr_count'), - empty: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4(this, 'empty_addr_count'), - activity: { - all: { - reactivated: create_1m1w1y24hBlockPattern(this, 'reactivated_addrs'), - sending: create_1m1w1y24hBlockPattern(this, 'sending_addrs'), - receiving: create_1m1w1y24hBlockPattern(this, 'receiving_addrs'), - bidirectional: create_1m1w1y24hBlockPattern(this, 'bidirectional_addrs'), - active: create_1m1w1y24hBlockPattern(this, 'active_addrs'), - }, - p2pk65: createActiveBidirectionalReactivatedReceivingSendingPattern(this, 'p2pk65'), - p2pk33: createActiveBidirectionalReactivatedReceivingSendingPattern(this, 'p2pk33'), - p2pkh: createActiveBidirectionalReactivatedReceivingSendingPattern(this, 'p2pkh'), - p2sh: createActiveBidirectionalReactivatedReceivingSendingPattern(this, 'p2sh'), - p2wpkh: createActiveBidirectionalReactivatedReceivingSendingPattern(this, 'p2wpkh'), - p2wsh: createActiveBidirectionalReactivatedReceivingSendingPattern(this, 'p2wsh'), - p2tr: createActiveBidirectionalReactivatedReceivingSendingPattern(this, 'p2tr'), - p2a: createActiveBidirectionalReactivatedReceivingSendingPattern(this, 'p2a'), - }, - total: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4(this, 'total_addr_count'), - new: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(this, 'new_addr_count'), - reused: { - count: createFundedTotalPattern(this, 'reused_addr_count'), - events: { - outputToReusedAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(this, 'output_to_reused_addr_count'), - outputToReusedAddrShare: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7(this, 'output_to_reused_addr_share'), - spendableOutputToReusedAddrShare: create_1m1w1y24hBpsPercentRatioPattern(this, 'spendable_output_to_reused_addr_share'), - inputFromReusedAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(this, 'input_from_reused_addr_count'), - inputFromReusedAddrShare: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7(this, 'input_from_reused_addr_share'), - activeReusedAddrCount: create_1m1w1y24hBlockPattern(this, 'active_reused_addr_count'), - activeReusedAddrShare: create_1m1w1y24hBlockPattern2(this, 'active_reused_addr_share'), - }, - supply: { - all: createBtcCentsSatsUsdPattern(this, 'reused_addr_supply'), - p2pk65: createBtcCentsSatsUsdPattern(this, 'p2pk65_reused_addr_supply'), - p2pk33: createBtcCentsSatsUsdPattern(this, 'p2pk33_reused_addr_supply'), - p2pkh: createBtcCentsSatsUsdPattern(this, 'p2pkh_reused_addr_supply'), - p2sh: createBtcCentsSatsUsdPattern(this, 'p2sh_reused_addr_supply'), - p2wpkh: createBtcCentsSatsUsdPattern(this, 'p2wpkh_reused_addr_supply'), - p2wsh: createBtcCentsSatsUsdPattern(this, 'p2wsh_reused_addr_supply'), - p2tr: createBtcCentsSatsUsdPattern(this, 'p2tr_reused_addr_supply'), - p2a: createBtcCentsSatsUsdPattern(this, 'p2a_reused_addr_supply'), - share: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5(this, 'reused_addr_supply_share'), - }, - }, - respent: { - count: createFundedTotalPattern(this, 'respent_addr_count'), - events: { - outputToReusedAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(this, 'output_to_respent_addr_count'), - outputToReusedAddrShare: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7(this, 'output_to_respent_addr_share'), - spendableOutputToReusedAddrShare: create_1m1w1y24hBpsPercentRatioPattern(this, 'spendable_output_to_respent_addr_share'), - inputFromReusedAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(this, 'input_from_respent_addr_count'), - inputFromReusedAddrShare: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7(this, 'input_from_respent_addr_share'), - activeReusedAddrCount: create_1m1w1y24hBlockPattern(this, 'active_respent_addr_count'), - activeReusedAddrShare: create_1m1w1y24hBlockPattern2(this, 'active_respent_addr_share'), - }, - supply: { - all: createBtcCentsSatsUsdPattern(this, 'respent_addr_supply'), - p2pk65: createBtcCentsSatsUsdPattern(this, 'p2pk65_respent_addr_supply'), - p2pk33: createBtcCentsSatsUsdPattern(this, 'p2pk33_respent_addr_supply'), - p2pkh: createBtcCentsSatsUsdPattern(this, 'p2pkh_respent_addr_supply'), - p2sh: createBtcCentsSatsUsdPattern(this, 'p2sh_respent_addr_supply'), - p2wpkh: createBtcCentsSatsUsdPattern(this, 'p2wpkh_respent_addr_supply'), - p2wsh: createBtcCentsSatsUsdPattern(this, 'p2wsh_respent_addr_supply'), - p2tr: createBtcCentsSatsUsdPattern(this, 'p2tr_respent_addr_supply'), - p2a: createBtcCentsSatsUsdPattern(this, 'p2a_respent_addr_supply'), - share: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5(this, 'respent_addr_supply_share'), - }, - }, - exposed: { - count: createFundedTotalPattern(this, 'exposed_addr_count'), - supply: { - all: createBtcCentsSatsUsdPattern(this, 'exposed_addr_supply'), - p2pk65: createBtcCentsSatsUsdPattern(this, 'p2pk65_exposed_addr_supply'), - p2pk33: createBtcCentsSatsUsdPattern(this, 'p2pk33_exposed_addr_supply'), - p2pkh: createBtcCentsSatsUsdPattern(this, 'p2pkh_exposed_addr_supply'), - p2sh: createBtcCentsSatsUsdPattern(this, 'p2sh_exposed_addr_supply'), - p2wpkh: createBtcCentsSatsUsdPattern(this, 'p2wpkh_exposed_addr_supply'), - p2wsh: createBtcCentsSatsUsdPattern(this, 'p2wsh_exposed_addr_supply'), - p2tr: createBtcCentsSatsUsdPattern(this, 'p2tr_exposed_addr_supply'), - p2a: createBtcCentsSatsUsdPattern(this, 'p2a_exposed_addr_supply'), - share: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5(this, 'exposed_addr_supply_share'), - }, - }, - delta: { - all: createAbsoluteRatePattern(this, 'addr_count'), - p2pk65: createAbsoluteRatePattern(this, 'p2pk65_addr_count'), - p2pk33: createAbsoluteRatePattern(this, 'p2pk33_addr_count'), - p2pkh: createAbsoluteRatePattern(this, 'p2pkh_addr_count'), - p2sh: createAbsoluteRatePattern(this, 'p2sh_addr_count'), - p2wpkh: createAbsoluteRatePattern(this, 'p2wpkh_addr_count'), - p2wsh: createAbsoluteRatePattern(this, 'p2wsh_addr_count'), - p2tr: createAbsoluteRatePattern(this, 'p2tr_addr_count'), - p2a: createAbsoluteRatePattern(this, 'p2a_addr_count'), - }, - avgAmount: { - all: createAddrUtxoPattern(this, 'avg'), - p2pk65: createAddrUtxoPattern(this, 'p2pk65_avg'), - p2pk33: createAddrUtxoPattern(this, 'p2pk33_avg'), - p2pkh: createAddrUtxoPattern(this, 'p2pkh_avg'), - p2sh: createAddrUtxoPattern(this, 'p2sh_avg'), - p2wpkh: createAddrUtxoPattern(this, 'p2wpkh_avg'), - p2wsh: createAddrUtxoPattern(this, 'p2wsh_avg'), - p2tr: createAddrUtxoPattern(this, 'p2tr_avg'), - p2a: createAddrUtxoPattern(this, 'p2a_avg'), - }, - }, - scripts: { - raw: { - empty: { - firstIndex: createSeriesPattern18(this, 'first_empty_output_index'), - toTxIndex: createSeriesPattern22(this, 'tx_index'), - }, - opReturn: { - firstIndex: createSeriesPattern18(this, 'first_op_return_index'), - toTxIndex: createSeriesPattern23(this, 'tx_index'), - }, - p2ms: { - firstIndex: createSeriesPattern18(this, 'first_p2ms_output_index'), - toTxIndex: createSeriesPattern25(this, 'tx_index'), - }, - unknown: { - firstIndex: createSeriesPattern18(this, 'first_unknown_output_index'), - toTxIndex: createSeriesPattern33(this, 'tx_index'), - }, - }, - }, - mining: { - rewards: { - coinbase: createAverageBlockCumulativeSumPattern3(this, 'coinbase'), - subsidy: { - block: createBtcCentsSatsUsdPattern3(this, 'subsidy'), - cumulative: createBtcCentsSatsUsdPattern(this, 'subsidy_cumulative'), - sum: create_1m1w1y24hPattern4(this, 'subsidy_sum'), - average: create_1m1w1y24hPattern3(this, 'subsidy_average'), - dominance: create_1m1w1y24hBpsPercentRatioPattern(this, 'subsidy_dominance'), - }, - fees: { - block: createBtcCentsSatsUsdPattern3(this, 'fees'), - cumulative: createBtcCentsSatsUsdPattern(this, 'fees_cumulative'), - sum: create_1m1w1y24hPattern4(this, 'fees_sum'), - average: create_1m1w1y24hPattern3(this, 'fees_average'), - min: create_1m1w1y24hPattern4(this, 'fees_min'), - max: create_1m1w1y24hPattern4(this, 'fees_max'), - pct10: create_1m1w1y24hPattern4(this, 'fees_pct10'), - pct25: create_1m1w1y24hPattern4(this, 'fees_pct25'), - median: create_1m1w1y24hPattern4(this, 'fees_median'), - pct75: create_1m1w1y24hPattern4(this, 'fees_pct75'), - pct90: create_1m1w1y24hPattern4(this, 'fees_pct90'), - dominance: create_1m1w1y24hBpsPercentRatioPattern(this, 'fee_dominance'), - toSubsidyRatio: { - _24h: createBpsRatioPattern2(this, 'fee_to_subsidy_ratio_24h'), - _1w: createBpsRatioPattern2(this, 'fee_to_subsidy_ratio_1w'), - _1m: createBpsRatioPattern2(this, 'fee_to_subsidy_ratio_1m'), - _1y: createBpsRatioPattern2(this, 'fee_to_subsidy_ratio_1y'), - }, - }, - outputVolume: createSeriesPattern18(this, 'output_volume'), - unclaimed: createBlockCumulativePattern(this, 'unclaimed_rewards'), - }, - hashrate: { - rate: { - base: createSeriesPattern1(this, 'hash_rate'), - sma: { - _1w: createSeriesPattern1(this, 'hash_rate_sma_1w'), - _1m: createSeriesPattern1(this, 'hash_rate_sma_1m'), - _2m: createSeriesPattern1(this, 'hash_rate_sma_2m'), - _1y: createSeriesPattern1(this, 'hash_rate_sma_1y'), - }, - ath: createSeriesPattern1(this, 'hash_rate_ath'), - drawdown: createBpsPercentRatioPattern5(this, 'hash_rate_drawdown'), - }, - price: createPhsReboundThsPattern(this, 'hash_price'), - value: createPhsReboundThsPattern(this, 'hash_value'), - }, - }, - cointime: { - activity: { - coinblocksCreated: createAverageBlockCumulativeSumPattern(this, 'coinblocks_created'), - coinblocksStored: createAverageBlockCumulativeSumPattern(this, 'coinblocks_stored'), - liveliness: createSeriesPattern1(this, 'liveliness'), - vaultedness: createSeriesPattern1(this, 'vaultedness'), - ratio: createSeriesPattern1(this, 'activity_to_vaultedness'), - coinblocksDestroyed: createAverageBlockCumulativeSumPattern(this, 'coinblocks_destroyed'), - }, - supply: { - vaulted: createBtcCentsSatsUsdPattern(this, 'vaulted_supply'), - active: createBtcCentsSatsUsdPattern(this, 'active_supply'), - }, - value: { - destroyed: createAverageBlockCumulativeSumPattern(this, 'cointime_value_destroyed'), - created: createAverageBlockCumulativeSumPattern(this, 'cointime_value_created'), - stored: createAverageBlockCumulativeSumPattern(this, 'cointime_value_stored'), - vocdd: createAverageBlockCumulativeSumPattern(this, 'vocdd'), - }, - cap: { - thermo: createCentsUsdPattern3(this, 'thermo_cap'), - investor: createCentsUsdPattern3(this, 'investor_cap'), - vaulted: createCentsUsdPattern3(this, 'vaulted_cap'), - active: createCentsUsdPattern3(this, 'active_cap'), - cointime: createCentsUsdPattern3(this, 'cointime_cap'), - aviv: createBpsRatioPattern2(this, 'aviv_ratio'), - }, - prices: { - vaulted: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'vaulted_price'), - active: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'active_price'), - trueMarketMean: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'true_market_mean'), - cointime: createBpsCentsPercentilesRatioSatsUsdPattern(this, 'cointime_price'), - }, - adjusted: { - inflationRate: createBpsPercentRatioPattern(this, 'cointime_adj_inflation_rate'), - txVelocityNative: createSeriesPattern1(this, 'cointime_adj_tx_velocity_btc'), - txVelocityFiat: createSeriesPattern1(this, 'cointime_adj_tx_velocity_usd'), - }, - reserveRisk: { - value: createSeriesPattern1(this, 'reserve_risk'), - vocddMedian1y: createSeriesPattern18(this, 'vocdd_median_1y'), - hodlBank: createSeriesPattern18(this, 'hodl_bank'), - }, - }, - constants: { - _0: createSeriesPattern1(this, 'constant_0'), - _1: createSeriesPattern1(this, 'constant_1'), - _2: createSeriesPattern1(this, 'constant_2'), - _3: createSeriesPattern1(this, 'constant_3'), - _4: createSeriesPattern1(this, 'constant_4'), - _20: createSeriesPattern1(this, 'constant_20'), - _30: createSeriesPattern1(this, 'constant_30'), - _382: createSeriesPattern1(this, 'constant_38_2'), - _50: createSeriesPattern1(this, 'constant_50'), - _618: createSeriesPattern1(this, 'constant_61_8'), - _70: createSeriesPattern1(this, 'constant_70'), - _80: createSeriesPattern1(this, 'constant_80'), - _100: createSeriesPattern1(this, 'constant_100'), - _600: createSeriesPattern1(this, 'constant_600'), - minus1: createSeriesPattern1(this, 'constant_minus_1'), - minus2: createSeriesPattern1(this, 'constant_minus_2'), - minus3: createSeriesPattern1(this, 'constant_minus_3'), - minus4: createSeriesPattern1(this, 'constant_minus_4'), - }, - indexes: { - addr: { - p2pk33: { - identity: createSeriesPattern26(this, 'p2pk33_addr_index'), - addr: createSeriesPattern26(this, 'p2pk33_addr'), - }, - p2pk65: { - identity: createSeriesPattern27(this, 'p2pk65_addr_index'), - addr: createSeriesPattern27(this, 'p2pk65_addr'), - }, - p2pkh: { - identity: createSeriesPattern28(this, 'p2pkh_addr_index'), - addr: createSeriesPattern28(this, 'p2pkh_addr'), - }, - p2sh: { - identity: createSeriesPattern29(this, 'p2sh_addr_index'), - addr: createSeriesPattern29(this, 'p2sh_addr'), - }, - p2tr: { - identity: createSeriesPattern30(this, 'p2tr_addr_index'), - addr: createSeriesPattern30(this, 'p2tr_addr'), - }, - p2wpkh: { - identity: createSeriesPattern31(this, 'p2wpkh_addr_index'), - addr: createSeriesPattern31(this, 'p2wpkh_addr'), - }, - p2wsh: { - identity: createSeriesPattern32(this, 'p2wsh_addr_index'), - addr: createSeriesPattern32(this, 'p2wsh_addr'), - }, - p2a: { - identity: createSeriesPattern24(this, 'p2a_addr_index'), - addr: createSeriesPattern24(this, 'p2a_addr'), - }, - p2ms: { - identity: createSeriesPattern25(this, 'p2ms_output_index'), - }, - empty: { - identity: createSeriesPattern22(this, 'empty_output_index'), - }, - unknown: { - identity: createSeriesPattern33(this, 'unknown_output_index'), - }, - opReturn: { - identity: createSeriesPattern23(this, 'op_return_index'), - }, - }, - height: { - minute10: createSeriesPattern18(this, 'minute10'), - minute30: createSeriesPattern18(this, 'minute30'), - hour1: createSeriesPattern18(this, 'hour1'), - hour4: createSeriesPattern18(this, 'hour4'), - hour12: createSeriesPattern18(this, 'hour12'), - day1: createSeriesPattern18(this, 'day1'), - day3: createSeriesPattern18(this, 'day3'), - epoch: createSeriesPattern18(this, 'epoch'), - halving: createSeriesPattern18(this, 'halving'), - week1: createSeriesPattern18(this, 'week1'), - month1: createSeriesPattern18(this, 'month1'), - month3: createSeriesPattern18(this, 'month3'), - month6: createSeriesPattern18(this, 'month6'), - year1: createSeriesPattern18(this, 'year1'), - year10: createSeriesPattern18(this, 'year10'), - txIndexCount: createSeriesPattern18(this, 'tx_index_count'), - }, - epoch: { - firstHeight: createSeriesPattern17(this, 'first_height'), - }, - halving: { - firstHeight: createSeriesPattern16(this, 'first_height'), - }, - minute10: { - firstHeight: createSeriesPattern3(this, 'first_height'), - }, - minute30: { - firstHeight: createSeriesPattern4(this, 'first_height'), - }, - hour1: { - firstHeight: createSeriesPattern5(this, 'first_height'), - }, - hour4: { - firstHeight: createSeriesPattern6(this, 'first_height'), - }, - hour12: { - firstHeight: createSeriesPattern7(this, 'first_height'), - }, - day1: { - date: createSeriesPattern8(this, 'date'), - firstHeight: createSeriesPattern8(this, 'first_height'), - }, - day3: { - date: createSeriesPattern9(this, 'date'), - firstHeight: createSeriesPattern9(this, 'first_height'), - }, - week1: { - date: createSeriesPattern10(this, 'date'), - firstHeight: createSeriesPattern10(this, 'first_height'), - }, - month1: { - date: createSeriesPattern11(this, 'date'), - firstHeight: createSeriesPattern11(this, 'first_height'), - }, - month3: { - date: createSeriesPattern12(this, 'date'), - firstHeight: createSeriesPattern12(this, 'first_height'), - }, - month6: { - date: createSeriesPattern13(this, 'date'), - firstHeight: createSeriesPattern13(this, 'first_height'), - }, - year1: { - date: createSeriesPattern14(this, 'date'), - firstHeight: createSeriesPattern14(this, 'first_height'), - }, - year10: { - date: createSeriesPattern15(this, 'date'), - firstHeight: createSeriesPattern15(this, 'first_height'), - }, - txIndex: { - identity: createSeriesPattern19(this, 'tx_index'), - inputCount: createSeriesPattern19(this, 'input_count'), - outputCount: createSeriesPattern19(this, 'output_count'), - }, - txinIndex: { - identity: createSeriesPattern20(this, 'txin_index'), - }, - txoutIndex: { - identity: createSeriesPattern21(this, 'txout_index'), - }, - timestamp: { - monotonic: createSeriesPattern18(this, 'timestamp_monotonic'), - resolutions: createSeriesPattern2(this, 'timestamp'), - }, - }, - indicators: { - puellMultiple: createBpsRatioPattern2(this, 'puell_multiple'), - nvt: createBpsRatioPattern2(this, 'nvt'), - gini: createBpsPercentRatioPattern2(this, 'gini'), - rhodlRatio: createBpsRatioPattern2(this, 'rhodl_ratio'), - thermoCapMultiple: createBpsRatioPattern2(this, 'thermo_cap_multiple'), - coindaysDestroyedSupplyAdj: createSeriesPattern1(this, 'coindays_destroyed_supply_adj'), - coinyearsDestroyedSupplyAdj: createSeriesPattern1(this, 'coinyears_destroyed_supply_adj'), - dormancy: { - supplyAdj: createSeriesPattern1(this, 'dormancy_supply_adj'), - flow: createSeriesPattern1(this, 'dormancy_flow'), - }, - stockToFlow: createSeriesPattern1(this, 'stock_to_flow'), - sellerExhaustion: createSeriesPattern1(this, 'seller_exhaustion'), - rarityMeter: { - full: createIndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern(this, 'rarity_meter'), - local: createIndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern(this, 'local_rarity_meter'), - cycle: createIndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern(this, 'cycle_rarity_meter'), - }, - }, - investing: { - satsPerDay: createSeriesPattern18(this, 'dca_sats_per_day'), - period: { - dcaStack: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(this, 'dca_stack'), - dcaCostBasis: { - _1w: createCentsSatsUsdPattern(this, 'dca_cost_basis_1w'), - _1m: createCentsSatsUsdPattern(this, 'dca_cost_basis_1m'), - _3m: createCentsSatsUsdPattern(this, 'dca_cost_basis_3m'), - _6m: createCentsSatsUsdPattern(this, 'dca_cost_basis_6m'), - _1y: createCentsSatsUsdPattern(this, 'dca_cost_basis_1y'), - _2y: createCentsSatsUsdPattern(this, 'dca_cost_basis_2y'), - _3y: createCentsSatsUsdPattern(this, 'dca_cost_basis_3y'), - _4y: createCentsSatsUsdPattern(this, 'dca_cost_basis_4y'), - _5y: createCentsSatsUsdPattern(this, 'dca_cost_basis_5y'), - _6y: createCentsSatsUsdPattern(this, 'dca_cost_basis_6y'), - _8y: createCentsSatsUsdPattern(this, 'dca_cost_basis_8y'), - _10y: createCentsSatsUsdPattern(this, 'dca_cost_basis_10y'), - }, - dcaReturn: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'dca_return'), - dcaCagr: create_10y2y3y4y5y6y8yPattern(this, 'dca_cagr'), - lumpSumStack: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(this, 'lump_sum_stack'), - lumpSumReturn: create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(this, 'lump_sum_return'), - }, - class: { - dcaStack: { - from2015: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2015'), - from2016: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2016'), - from2017: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2017'), - from2018: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2018'), - from2019: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2019'), - from2020: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2020'), - from2021: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2021'), - from2022: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2022'), - from2023: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2023'), - from2024: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2024'), - from2025: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2025'), - from2026: createBtcCentsSatsUsdPattern(this, 'dca_stack_from_2026'), - }, - dcaCostBasis: { - from2015: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2015'), - from2016: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2016'), - from2017: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2017'), - from2018: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2018'), - from2019: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2019'), - from2020: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2020'), - from2021: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2021'), - from2022: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2022'), - from2023: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2023'), - from2024: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2024'), - from2025: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2025'), - from2026: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2026'), - }, - dcaReturn: { - from2015: createBpsPercentRatioPattern(this, 'dca_return_from_2015'), - from2016: createBpsPercentRatioPattern(this, 'dca_return_from_2016'), - from2017: createBpsPercentRatioPattern(this, 'dca_return_from_2017'), - from2018: createBpsPercentRatioPattern(this, 'dca_return_from_2018'), - from2019: createBpsPercentRatioPattern(this, 'dca_return_from_2019'), - from2020: createBpsPercentRatioPattern(this, 'dca_return_from_2020'), - from2021: createBpsPercentRatioPattern(this, 'dca_return_from_2021'), - from2022: createBpsPercentRatioPattern(this, 'dca_return_from_2022'), - from2023: createBpsPercentRatioPattern(this, 'dca_return_from_2023'), - from2024: createBpsPercentRatioPattern(this, 'dca_return_from_2024'), - from2025: createBpsPercentRatioPattern(this, 'dca_return_from_2025'), - from2026: createBpsPercentRatioPattern(this, 'dca_return_from_2026'), - }, - }, - }, - market: { - ath: { - high: createCentsSatsUsdPattern(this, 'price_ath'), - drawdown: createBpsPercentRatioPattern5(this, 'price_drawdown'), - daysSince: createSeriesPattern1(this, 'days_since_price_ath'), - yearsSince: createSeriesPattern1(this, 'years_since_price_ath'), - maxDaysBetween: createSeriesPattern1(this, 'max_days_between_price_ath'), - maxYearsBetween: createSeriesPattern1(this, 'max_years_between_price_ath'), - }, - lookback: { - _24h: createCentsSatsUsdPattern(this, 'price_past_24h'), - _1w: createCentsSatsUsdPattern(this, 'price_past_1w'), - _1m: createCentsSatsUsdPattern(this, 'price_past_1m'), - _3m: createCentsSatsUsdPattern(this, 'price_past_3m'), - _6m: createCentsSatsUsdPattern(this, 'price_past_6m'), - _1y: createCentsSatsUsdPattern(this, 'price_past_1y'), - _2y: createCentsSatsUsdPattern(this, 'price_past_2y'), - _3y: createCentsSatsUsdPattern(this, 'price_past_3y'), - _4y: createCentsSatsUsdPattern(this, 'price_past_4y'), - _5y: createCentsSatsUsdPattern(this, 'price_past_5y'), - _6y: createCentsSatsUsdPattern(this, 'price_past_6y'), - _8y: createCentsSatsUsdPattern(this, 'price_past_8y'), - _10y: createCentsSatsUsdPattern(this, 'price_past_10y'), - }, - returns: { - periods: { - _24h: createBpsPercentRatioPattern(this, 'price_return_24h'), - _1w: createBpsPercentRatioPattern(this, 'price_return_1w'), - _1m: createBpsPercentRatioPattern(this, 'price_return_1m'), - _3m: createBpsPercentRatioPattern(this, 'price_return_3m'), - _6m: createBpsPercentRatioPattern(this, 'price_return_6m'), - _1y: createBpsPercentRatioPattern(this, 'price_return_1y'), - _2y: createBpsPercentRatioPattern(this, 'price_return_2y'), - _3y: createBpsPercentRatioPattern(this, 'price_return_3y'), - _4y: createBpsPercentRatioPattern(this, 'price_return_4y'), - _5y: createBpsPercentRatioPattern(this, 'price_return_5y'), - _6y: createBpsPercentRatioPattern(this, 'price_return_6y'), - _8y: createBpsPercentRatioPattern(this, 'price_return_8y'), - _10y: createBpsPercentRatioPattern(this, 'price_return_10y'), - }, - cagr: create_10y2y3y4y5y6y8yPattern(this, 'price_cagr'), - sd24h: { - _24h: { - sma: createSeriesPattern1(this, 'price_return_24h_sma_24h'), - sd: createSeriesPattern1(this, 'price_return_24h_sd_24h'), - }, - _1w: { - sma: createSeriesPattern1(this, 'price_return_24h_sma_1w'), - sd: createSeriesPattern1(this, 'price_return_24h_sd_1w'), - }, - _1m: { - sma: createSeriesPattern1(this, 'price_return_24h_sma_1m'), - sd: createSeriesPattern1(this, 'price_return_24h_sd_1m'), - }, - _1y: { - sma: createSeriesPattern1(this, 'price_return_24h_sma_1y'), - sd: createSeriesPattern1(this, 'price_return_24h_sd_1y'), - }, - }, - }, - volatility: create_1m1w1y24hPattern(this, 'price_volatility'), - range: { - min: create_1m1w1y2wPattern(this, 'price_min'), - max: create_1m1w1y2wPattern(this, 'price_max'), - trueRange: createSeriesPattern1(this, 'price_true_range'), - trueRangeSum2w: createSeriesPattern1(this, 'price_true_range_sum_2w'), - choppinessIndex2w: createBpsPercentRatioPattern2(this, 'price_choppiness_index_2w'), - }, - movingAverage: { - sma: { - _1w: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_1w'), - _8d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_8d'), - _13d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_13d'), - _21d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_21d'), - _1m: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_1m'), - _34d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_34d'), - _55d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_55d'), - _89d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_89d'), - _111d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_111d'), - _144d: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_144d'), - _200d: { - usd: createSeriesPattern1(this, 'price_sma_200d'), - cents: createSeriesPattern1(this, 'price_sma_200d_cents'), - sats: createSeriesPattern1(this, 'price_sma_200d_sats'), - bps: createSeriesPattern1(this, 'price_sma_200d_ratio_bps'), - ratio: createSeriesPattern1(this, 'price_sma_200d_ratio'), - x24: createCentsSatsUsdPattern(this, 'price_sma_200d_x2_4'), - x08: createCentsSatsUsdPattern(this, 'price_sma_200d_x0_8'), - }, - _350d: { - usd: createSeriesPattern1(this, 'price_sma_350d'), - cents: createSeriesPattern1(this, 'price_sma_350d_cents'), - sats: createSeriesPattern1(this, 'price_sma_350d_sats'), - bps: createSeriesPattern1(this, 'price_sma_350d_ratio_bps'), - ratio: createSeriesPattern1(this, 'price_sma_350d_ratio'), - x2: createCentsSatsUsdPattern(this, 'price_sma_350d_x2'), - }, - _1y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_1y'), - _2y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_2y'), - _200w: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_200w'), - _4y: createBpsCentsRatioSatsUsdPattern(this, 'price_sma_4y'), - }, - ema: { - _1w: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_1w'), - _8d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_8d'), - _12d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_12d'), - _13d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_13d'), - _21d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_21d'), - _26d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_26d'), - _1m: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_1m'), - _34d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_34d'), - _55d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_55d'), - _89d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_89d'), - _144d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_144d'), - _200d: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_200d'), - _1y: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_1y'), - _2y: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_2y'), - _200w: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_200w'), - _4y: createBpsCentsRatioSatsUsdPattern(this, 'price_ema_4y'), - }, - }, - technical: { - rsi: { - _24h: createRsiStochPattern(this, 'rsi', '24h'), - _1w: createRsiStochPattern(this, 'rsi', '1w'), - _1m: createRsiStochPattern(this, 'rsi', '1m'), - }, - piCycle: createBpsRatioPattern2(this, 'pi_cycle'), - macd: { - _24h: { - emaFast: createSeriesPattern1(this, 'macd_ema_fast_24h'), - emaSlow: createSeriesPattern1(this, 'macd_ema_slow_24h'), - line: createSeriesPattern1(this, 'macd_line_24h'), - signal: createSeriesPattern1(this, 'macd_signal_24h'), - histogram: createSeriesPattern1(this, 'macd_histogram_24h'), - }, - _1w: { - emaFast: createSeriesPattern1(this, 'macd_ema_fast_1w'), - emaSlow: createSeriesPattern1(this, 'macd_ema_slow_1w'), - line: createSeriesPattern1(this, 'macd_line_1w'), - signal: createSeriesPattern1(this, 'macd_signal_1w'), - histogram: createSeriesPattern1(this, 'macd_histogram_1w'), - }, - _1m: { - emaFast: createSeriesPattern1(this, 'macd_ema_fast_1m'), - emaSlow: createSeriesPattern1(this, 'macd_ema_slow_1m'), - line: createSeriesPattern1(this, 'macd_line_1m'), - signal: createSeriesPattern1(this, 'macd_signal_1m'), - histogram: createSeriesPattern1(this, 'macd_histogram_1m'), - }, - }, - }, - }, - pools: { - pool: createSeriesPattern18(this, 'pool'), - major: { - unknown: createBlocksDominanceRewardsPattern(this, 'unknown'), - luxor: createBlocksDominanceRewardsPattern(this, 'luxor'), - btccom: createBlocksDominanceRewardsPattern(this, 'btccom'), - btctop: createBlocksDominanceRewardsPattern(this, 'btctop'), - btcguild: createBlocksDominanceRewardsPattern(this, 'btcguild'), - eligius: createBlocksDominanceRewardsPattern(this, 'eligius'), - f2pool: createBlocksDominanceRewardsPattern(this, 'f2pool'), - braiinspool: createBlocksDominanceRewardsPattern(this, 'braiinspool'), - antpool: createBlocksDominanceRewardsPattern(this, 'antpool'), - btcc: createBlocksDominanceRewardsPattern(this, 'btcc'), - bwpool: createBlocksDominanceRewardsPattern(this, 'bwpool'), - bitfury: createBlocksDominanceRewardsPattern(this, 'bitfury'), - viabtc: createBlocksDominanceRewardsPattern(this, 'viabtc'), - poolin: createBlocksDominanceRewardsPattern(this, 'poolin'), - spiderpool: createBlocksDominanceRewardsPattern(this, 'spiderpool'), - binancepool: createBlocksDominanceRewardsPattern(this, 'binancepool'), - foundryusa: createBlocksDominanceRewardsPattern(this, 'foundryusa'), - sbicrypto: createBlocksDominanceRewardsPattern(this, 'sbicrypto'), - marapool: createBlocksDominanceRewardsPattern(this, 'marapool'), - secpool: createBlocksDominanceRewardsPattern(this, 'secpool'), - ocean: createBlocksDominanceRewardsPattern(this, 'ocean'), - whitepool: createBlocksDominanceRewardsPattern(this, 'whitepool'), - }, - minor: { - blockfills: createBlocksDominancePattern(this, 'blockfills'), - ultimuspool: createBlocksDominancePattern(this, 'ultimuspool'), - terrapool: createBlocksDominancePattern(this, 'terrapool'), - onethash: createBlocksDominancePattern(this, 'onethash'), - bitfarms: createBlocksDominancePattern(this, 'bitfarms'), - huobipool: createBlocksDominancePattern(this, 'huobipool'), - wayicn: createBlocksDominancePattern(this, 'wayicn'), - canoepool: createBlocksDominancePattern(this, 'canoepool'), - bitcoincom: createBlocksDominancePattern(this, 'bitcoincom'), - pool175btc: createBlocksDominancePattern(this, 'pool175btc'), - gbminers: createBlocksDominancePattern(this, 'gbminers'), - axbt: createBlocksDominancePattern(this, 'axbt'), - asicminer: createBlocksDominancePattern(this, 'asicminer'), - bitminter: createBlocksDominancePattern(this, 'bitminter'), - bitcoinrussia: createBlocksDominancePattern(this, 'bitcoinrussia'), - btcserv: createBlocksDominancePattern(this, 'btcserv'), - simplecoinus: createBlocksDominancePattern(this, 'simplecoinus'), - ozcoin: createBlocksDominancePattern(this, 'ozcoin'), - eclipsemc: createBlocksDominancePattern(this, 'eclipsemc'), - maxbtc: createBlocksDominancePattern(this, 'maxbtc'), - triplemining: createBlocksDominancePattern(this, 'triplemining'), - coinlab: createBlocksDominancePattern(this, 'coinlab'), - pool50btc: createBlocksDominancePattern(this, 'pool50btc'), - ghashio: createBlocksDominancePattern(this, 'ghashio'), - stminingcorp: createBlocksDominancePattern(this, 'stminingcorp'), - bitparking: createBlocksDominancePattern(this, 'bitparking'), - mmpool: createBlocksDominancePattern(this, 'mmpool'), - polmine: createBlocksDominancePattern(this, 'polmine'), - kncminer: createBlocksDominancePattern(this, 'kncminer'), - bitalo: createBlocksDominancePattern(this, 'bitalo'), - hhtt: createBlocksDominancePattern(this, 'hhtt'), - megabigpower: createBlocksDominancePattern(this, 'megabigpower'), - mtred: createBlocksDominancePattern(this, 'mtred'), - nmcbit: createBlocksDominancePattern(this, 'nmcbit'), - yourbtcnet: createBlocksDominancePattern(this, 'yourbtcnet'), - givemecoins: createBlocksDominancePattern(this, 'givemecoins'), - multicoinco: createBlocksDominancePattern(this, 'multicoinco'), - bcpoolio: createBlocksDominancePattern(this, 'bcpoolio'), - cointerra: createBlocksDominancePattern(this, 'cointerra'), - kanopool: createBlocksDominancePattern(this, 'kanopool'), - solock: createBlocksDominancePattern(this, 'solock'), - ckpool: createBlocksDominancePattern(this, 'ckpool'), - nicehash: createBlocksDominancePattern(this, 'nicehash'), - bitclub: createBlocksDominancePattern(this, 'bitclub'), - bitcoinaffiliatenetwork: createBlocksDominancePattern(this, 'bitcoinaffiliatenetwork'), - exxbw: createBlocksDominancePattern(this, 'exxbw'), - bitsolo: createBlocksDominancePattern(this, 'bitsolo'), - twentyoneinc: createBlocksDominancePattern(this, 'twentyoneinc'), - digitalbtc: createBlocksDominancePattern(this, 'digitalbtc'), - eightbaochi: createBlocksDominancePattern(this, 'eightbaochi'), - mybtccoinpool: createBlocksDominancePattern(this, 'mybtccoinpool'), - tbdice: createBlocksDominancePattern(this, 'tbdice'), - hashpool: createBlocksDominancePattern(this, 'hashpool'), - nexious: createBlocksDominancePattern(this, 'nexious'), - bravomining: createBlocksDominancePattern(this, 'bravomining'), - hotpool: createBlocksDominancePattern(this, 'hotpool'), - okexpool: createBlocksDominancePattern(this, 'okexpool'), - bcmonster: createBlocksDominancePattern(this, 'bcmonster'), - onehash: createBlocksDominancePattern(this, 'onehash'), - bixin: createBlocksDominancePattern(this, 'bixin'), - tatmaspool: createBlocksDominancePattern(this, 'tatmaspool'), - connectbtc: createBlocksDominancePattern(this, 'connectbtc'), - batpool: createBlocksDominancePattern(this, 'batpool'), - waterhole: createBlocksDominancePattern(this, 'waterhole'), - dcexploration: createBlocksDominancePattern(this, 'dcexploration'), - dcex: createBlocksDominancePattern(this, 'dcex'), - btpool: createBlocksDominancePattern(this, 'btpool'), - fiftyeightcoin: createBlocksDominancePattern(this, 'fiftyeightcoin'), - bitcoinindia: createBlocksDominancePattern(this, 'bitcoinindia'), - shawnp0wers: createBlocksDominancePattern(this, 'shawnp0wers'), - phashio: createBlocksDominancePattern(this, 'phashio'), - rigpool: createBlocksDominancePattern(this, 'rigpool'), - haozhuzhu: createBlocksDominancePattern(this, 'haozhuzhu'), - sevenpool: createBlocksDominancePattern(this, 'sevenpool'), - miningkings: createBlocksDominancePattern(this, 'miningkings'), - hashbx: createBlocksDominancePattern(this, 'hashbx'), - dpool: createBlocksDominancePattern(this, 'dpool'), - rawpool: createBlocksDominancePattern(this, 'rawpool'), - haominer: createBlocksDominancePattern(this, 'haominer'), - helix: createBlocksDominancePattern(this, 'helix'), - bitcoinukraine: createBlocksDominancePattern(this, 'bitcoinukraine'), - secretsuperstar: createBlocksDominancePattern(this, 'secretsuperstar'), - tigerpoolnet: createBlocksDominancePattern(this, 'tigerpoolnet'), - sigmapoolcom: createBlocksDominancePattern(this, 'sigmapoolcom'), - okpooltop: createBlocksDominancePattern(this, 'okpooltop'), - hummerpool: createBlocksDominancePattern(this, 'hummerpool'), - tangpool: createBlocksDominancePattern(this, 'tangpool'), - bytepool: createBlocksDominancePattern(this, 'bytepool'), - novablock: createBlocksDominancePattern(this, 'novablock'), - miningcity: createBlocksDominancePattern(this, 'miningcity'), - minerium: createBlocksDominancePattern(this, 'minerium'), - lubiancom: createBlocksDominancePattern(this, 'lubiancom'), - okkong: createBlocksDominancePattern(this, 'okkong'), - aaopool: createBlocksDominancePattern(this, 'aaopool'), - emcdpool: createBlocksDominancePattern(this, 'emcdpool'), - arkpool: createBlocksDominancePattern(this, 'arkpool'), - purebtccom: createBlocksDominancePattern(this, 'purebtccom'), - kucoinpool: createBlocksDominancePattern(this, 'kucoinpool'), - entrustcharitypool: createBlocksDominancePattern(this, 'entrustcharitypool'), - okminer: createBlocksDominancePattern(this, 'okminer'), - titan: createBlocksDominancePattern(this, 'titan'), - pegapool: createBlocksDominancePattern(this, 'pegapool'), - btcnuggets: createBlocksDominancePattern(this, 'btcnuggets'), - cloudhashing: createBlocksDominancePattern(this, 'cloudhashing'), - digitalxmintsy: createBlocksDominancePattern(this, 'digitalxmintsy'), - telco214: createBlocksDominancePattern(this, 'telco214'), - btcpoolparty: createBlocksDominancePattern(this, 'btcpoolparty'), - multipool: createBlocksDominancePattern(this, 'multipool'), - transactioncoinmining: createBlocksDominancePattern(this, 'transactioncoinmining'), - btcdig: createBlocksDominancePattern(this, 'btcdig'), - trickysbtcpool: createBlocksDominancePattern(this, 'trickysbtcpool'), - btcmp: createBlocksDominancePattern(this, 'btcmp'), - eobot: createBlocksDominancePattern(this, 'eobot'), - unomp: createBlocksDominancePattern(this, 'unomp'), - patels: createBlocksDominancePattern(this, 'patels'), - gogreenlight: createBlocksDominancePattern(this, 'gogreenlight'), - bitcoinindiapool: createBlocksDominancePattern(this, 'bitcoinindiapool'), - ekanembtc: createBlocksDominancePattern(this, 'ekanembtc'), - canoe: createBlocksDominancePattern(this, 'canoe'), - tiger: createBlocksDominancePattern(this, 'tiger'), - onem1x: createBlocksDominancePattern(this, 'onem1x'), - zulupool: createBlocksDominancePattern(this, 'zulupool'), - wiz: createBlocksDominancePattern(this, 'wiz'), - wk057: createBlocksDominancePattern(this, 'wk057'), - futurebitapollosolo: createBlocksDominancePattern(this, 'futurebitapollosolo'), - carbonnegative: createBlocksDominancePattern(this, 'carbonnegative'), - portlandhodl: createBlocksDominancePattern(this, 'portlandhodl'), - phoenix: createBlocksDominancePattern(this, 'phoenix'), - neopool: createBlocksDominancePattern(this, 'neopool'), - maxipool: createBlocksDominancePattern(this, 'maxipool'), - bitfufupool: createBlocksDominancePattern(this, 'bitfufupool'), - gdpool: createBlocksDominancePattern(this, 'gdpool'), - miningdutch: createBlocksDominancePattern(this, 'miningdutch'), - publicpool: createBlocksDominancePattern(this, 'publicpool'), - miningsquared: createBlocksDominancePattern(this, 'miningsquared'), - innopolistech: createBlocksDominancePattern(this, 'innopolistech'), - btclab: createBlocksDominancePattern(this, 'btclab'), - parasite: createBlocksDominancePattern(this, 'parasite'), - redrockpool: createBlocksDominancePattern(this, 'redrockpool'), - est3lar: createBlocksDominancePattern(this, 'est3lar'), - braiinssolo: createBlocksDominancePattern(this, 'braiinssolo'), - solopool: createBlocksDominancePattern(this, 'solopool'), - noderunners: createBlocksDominancePattern(this, 'noderunners'), - }, - }, - prices: { - split: { - open: createCentsSatsUsdPattern3(this, 'price_open'), - high: createCentsSatsUsdPattern3(this, 'price_high'), - low: createCentsSatsUsdPattern3(this, 'price_low'), - close: createCentsSatsUsdPattern3(this, 'price_close'), - }, - ohlc: { - usd: createSeriesPattern2(this, 'price_ohlc'), - cents: createSeriesPattern2(this, 'price_ohlc_cents'), - sats: createSeriesPattern2(this, 'price_ohlc_sats'), - }, - spot: { - usd: createSeriesPattern1(this, 'price'), - cents: createSeriesPattern1(this, 'price_cents'), - sats: createSeriesPattern1(this, 'price_sats'), - }, - }, - supply: { - state: createSeriesPattern18(this, 'supply_state'), - circulating: createBtcCentsSatsUsdPattern(this, 'circulating_supply'), - burned: createBlockCumulativePattern(this, 'unspendable_supply'), - inflationRate: createBpsPercentRatioPattern(this, 'inflation_rate'), - velocity: { - native: createSeriesPattern1(this, 'velocity_btc'), - fiat: createSeriesPattern1(this, 'velocity_usd'), - }, - marketCap: createCentsDeltaUsdPattern(this, 'market_cap'), - marketMinusRealizedCapGrowthRate: create_1m1w1y24hPattern(this, 'market_minus_realized_cap_growth_rate'), - hodledOrLost: createBtcCentsSatsUsdPattern(this, 'hodled_or_lost_supply'), - }, - cohorts: { - utxo: { - all: { - supply: createDeltaDominanceHalfInTotalPattern2(this, 'supply'), - outputs: { - unspentCount: createBaseDeltaPattern(this, 'utxo_count'), - spentCount: createAverageBlockCumulativeSumPattern2(this, 'spent_utxo_count'), - spendingRate: createSeriesPattern1(this, 'spending_rate'), - }, - activity: { - transferVolume: createAverageBlockCumulativeInSumPattern(this, 'transfer_volume'), - coindaysDestroyed: createAverageBlockCumulativeSumPattern(this, 'coindays_destroyed'), - coinyearsDestroyed: createSeriesPattern1(this, 'coinyears_destroyed'), - dormancy: create_1m1w1y24hPattern(this, 'dormancy'), - }, - realized: { - cap: createCentsDeltaToUsdPattern(this, 'realized_cap'), - profit: createBlockCumulativeSumPattern(this, 'realized_profit'), - loss: createBlockCumulativeNegativeSumPattern(this, 'realized_loss'), - price: { - usd: createSeriesPattern1(this, 'realized_price'), - cents: createSeriesPattern1(this, 'realized_price_cents'), - sats: createSeriesPattern1(this, 'realized_price_sats'), - bps: createSeriesPattern1(this, 'realized_price_ratio_bps'), - ratio: createSeriesPattern1(this, 'realized_price_ratio'), - percentiles: createPct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern(this, 'realized_price'), - sma: create_1m1w1y2y4yAllPattern(this, 'realized_price_ratio_sma'), - stdDev: { - all: { - sd: createSeriesPattern1(this, 'realized_price_ratio_sd'), - zscore: createSeriesPattern1(this, 'realized_price_ratio_zscore'), - _0sd: createCentsSatsUsdPattern(this, 'realized_price_0sd'), - p05sd: createPriceRatioPattern(this, 'realized_price', 'p0_5sd'), - p1sd: createPriceRatioPattern(this, 'realized_price', 'p1sd'), - p15sd: createPriceRatioPattern(this, 'realized_price', 'p1_5sd'), - p2sd: createPriceRatioPattern(this, 'realized_price', 'p2sd'), - p25sd: createPriceRatioPattern(this, 'realized_price', 'p2_5sd'), - p3sd: createPriceRatioPattern(this, 'realized_price', 'p3sd'), - m05sd: createPriceRatioPattern(this, 'realized_price', 'm0_5sd'), - m1sd: createPriceRatioPattern(this, 'realized_price', 'm1sd'), - m15sd: createPriceRatioPattern(this, 'realized_price', 'm1_5sd'), - m2sd: createPriceRatioPattern(this, 'realized_price', 'm2sd'), - m25sd: createPriceRatioPattern(this, 'realized_price', 'm2_5sd'), - m3sd: createPriceRatioPattern(this, 'realized_price', 'm3sd'), - }, - _4y: { - sd: createSeriesPattern1(this, 'realized_price_ratio_sd_4y'), - zscore: createSeriesPattern1(this, 'realized_price_ratio_zscore_4y'), - _0sd: createCentsSatsUsdPattern(this, 'realized_price_0sd_4y'), - p05sd: createPriceRatioPattern(this, 'realized_price', 'p0_5sd_4y'), - p1sd: createPriceRatioPattern(this, 'realized_price', 'p1sd_4y'), - p15sd: createPriceRatioPattern(this, 'realized_price', 'p1_5sd_4y'), - p2sd: createPriceRatioPattern(this, 'realized_price', 'p2sd_4y'), - p25sd: createPriceRatioPattern(this, 'realized_price', 'p2_5sd_4y'), - p3sd: createPriceRatioPattern(this, 'realized_price', 'p3sd_4y'), - m05sd: createPriceRatioPattern(this, 'realized_price', 'm0_5sd_4y'), - m1sd: createPriceRatioPattern(this, 'realized_price', 'm1sd_4y'), - m15sd: createPriceRatioPattern(this, 'realized_price', 'm1_5sd_4y'), - m2sd: createPriceRatioPattern(this, 'realized_price', 'm2sd_4y'), - m25sd: createPriceRatioPattern(this, 'realized_price', 'm2_5sd_4y'), - m3sd: createPriceRatioPattern(this, 'realized_price', 'm3sd_4y'), - }, - _2y: { - sd: createSeriesPattern1(this, 'realized_price_ratio_sd_2y'), - zscore: createSeriesPattern1(this, 'realized_price_ratio_zscore_2y'), - _0sd: createCentsSatsUsdPattern(this, 'realized_price_0sd_2y'), - p05sd: createPriceRatioPattern(this, 'realized_price', 'p0_5sd_2y'), - p1sd: createPriceRatioPattern(this, 'realized_price', 'p1sd_2y'), - p15sd: createPriceRatioPattern(this, 'realized_price', 'p1_5sd_2y'), - p2sd: createPriceRatioPattern(this, 'realized_price', 'p2sd_2y'), - p25sd: createPriceRatioPattern(this, 'realized_price', 'p2_5sd_2y'), - p3sd: createPriceRatioPattern(this, 'realized_price', 'p3sd_2y'), - m05sd: createPriceRatioPattern(this, 'realized_price', 'm0_5sd_2y'), - m1sd: createPriceRatioPattern(this, 'realized_price', 'm1sd_2y'), - m15sd: createPriceRatioPattern(this, 'realized_price', 'm1_5sd_2y'), - m2sd: createPriceRatioPattern(this, 'realized_price', 'm2sd_2y'), - m25sd: createPriceRatioPattern(this, 'realized_price', 'm2_5sd_2y'), - m3sd: createPriceRatioPattern(this, 'realized_price', 'm3sd_2y'), - }, - _1y: { - sd: createSeriesPattern1(this, 'realized_price_ratio_sd_1y'), - zscore: createSeriesPattern1(this, 'realized_price_ratio_zscore_1y'), - _0sd: createCentsSatsUsdPattern(this, 'realized_price_0sd_1y'), - p05sd: createPriceRatioPattern(this, 'realized_price', 'p0_5sd_1y'), - p1sd: createPriceRatioPattern(this, 'realized_price', 'p1sd_1y'), - p15sd: createPriceRatioPattern(this, 'realized_price', 'p1_5sd_1y'), - p2sd: createPriceRatioPattern(this, 'realized_price', 'p2sd_1y'), - p25sd: createPriceRatioPattern(this, 'realized_price', 'p2_5sd_1y'), - p3sd: createPriceRatioPattern(this, 'realized_price', 'p3sd_1y'), - m05sd: createPriceRatioPattern(this, 'realized_price', 'm0_5sd_1y'), - m1sd: createPriceRatioPattern(this, 'realized_price', 'm1sd_1y'), - m15sd: createPriceRatioPattern(this, 'realized_price', 'm1_5sd_1y'), - m2sd: createPriceRatioPattern(this, 'realized_price', 'm2sd_1y'), - m25sd: createPriceRatioPattern(this, 'realized_price', 'm2_5sd_1y'), - m3sd: createPriceRatioPattern(this, 'realized_price', 'm3sd_1y'), - }, - }, - }, - mvrv: createSeriesPattern1(this, 'mvrv'), - netPnl: createBlockChangeCumulativeDeltaSumPattern(this, 'net'), - sopr: { - valueDestroyed: createAverageBlockCumulativeSumPattern(this, 'value_destroyed'), - ratio: create_1m1w1y24hPattern(this, 'sopr'), - adjusted: { - ratio: create_1m1w1y24hPattern(this, 'asopr'), - transferVolume: createAverageBlockCumulativeSumPattern(this, 'adj_value_created'), - valueDestroyed: createAverageBlockCumulativeSumPattern(this, 'adj_value_destroyed'), - }, - }, - grossPnl: createBlockCumulativeSumPattern(this, 'realized_gross_pnl'), - sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'sell_side_risk_ratio'), - peakRegret: createBlockCumulativeSumPattern(this, 'realized_peak_regret'), - capitalized: createPricePattern(this, 'capitalized_price'), - profitToLossRatio: create_1m1w1y24hPattern(this, 'realized_profit_to_loss_ratio'), - }, - costBasis: { - inProfit: createPerPattern(this, 'cost_basis_in_profit_per'), - inLoss: createPerPattern(this, 'cost_basis_in_loss_per'), - min: createCentsSatsUsdPattern(this, 'cost_basis_min'), - max: createCentsSatsUsdPattern(this, 'cost_basis_max'), - perCoin: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'cost_basis_per_coin'), - perDollar: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(this, 'cost_basis_per_dollar'), - supplyDensity: createBpsPercentRatioPattern2(this, 'supply_density'), - }, - unrealized: { - nupl: createBpsRatioPattern(this, 'nupl'), - profit: { - usd: createSeriesPattern1(this, 'unrealized_profit'), - cents: createSeriesPattern1(this, 'unrealized_profit_cents'), - toMcap: createBpsPercentRatioPattern2(this, 'unrealized_profit_to_mcap'), - toOwnGrossPnl: createBpsPercentRatioPattern2(this, 'unrealized_profit_to_own_gross_pnl'), - }, - loss: { - usd: createSeriesPattern1(this, 'unrealized_loss'), - cents: createSeriesPattern1(this, 'unrealized_loss_cents'), - negative: createSeriesPattern1(this, 'unrealized_loss_neg'), - toMcap: createBpsPercentRatioPattern2(this, 'unrealized_loss_to_mcap'), - toOwnGrossPnl: createBpsPercentRatioPattern2(this, 'unrealized_loss_to_own_gross_pnl'), - }, - netPnl: { - usd: createSeriesPattern1(this, 'net_unrealized_pnl'), - cents: createSeriesPattern1(this, 'net_unrealized_pnl_cents'), - toOwnGrossPnl: createBpsPercentRatioPattern(this, 'net_unrealized_pnl_to_own_gross_pnl'), - }, - grossPnl: createCentsUsdPattern3(this, 'unrealized_gross_pnl'), - investedCapital: createInPattern2(this, 'invested_capital_in'), - capitalizedCapInProfitRaw: createSeriesPattern18(this, 'capitalized_cap_in_profit_raw'), - capitalizedCapInLossRaw: createSeriesPattern18(this, 'capitalized_cap_in_loss_raw'), - sentiment: { - painIndex: createCentsUsdPattern3(this, 'pain_index'), - greedIndex: createCentsUsdPattern3(this, 'greed_index'), - net: createCentsUsdPattern(this, 'net_sentiment'), - }, - }, - investedCapital: createInPattern(this, 'invested_capital_in'), - }, - sth: { - supply: createDeltaDominanceHalfInTotalPattern2(this, 'sth_supply'), - outputs: createSpendingSpentUnspentPattern(this, 'sth'), - activity: createCoindaysCoinyearsDormancyTransferPattern(this, 'sth'), - realized: { - cap: createCentsDeltaToUsdPattern(this, 'sth_realized_cap'), - profit: createBlockCumulativeSumPattern(this, 'sth_realized_profit'), - loss: createBlockCumulativeNegativeSumPattern(this, 'sth_realized_loss'), - price: { - usd: createSeriesPattern1(this, 'sth_realized_price'), - cents: createSeriesPattern1(this, 'sth_realized_price_cents'), - sats: createSeriesPattern1(this, 'sth_realized_price_sats'), - bps: createSeriesPattern1(this, 'sth_realized_price_ratio_bps'), - ratio: createSeriesPattern1(this, 'sth_realized_price_ratio'), - percentiles: createPct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern(this, 'sth_realized_price'), - sma: create_1m1w1y2y4yAllPattern(this, 'sth_realized_price_ratio_sma'), - stdDev: { - all: { - sd: createSeriesPattern1(this, 'sth_realized_price_ratio_sd'), - zscore: createSeriesPattern1(this, 'sth_realized_price_ratio_zscore'), - _0sd: createCentsSatsUsdPattern(this, 'sth_realized_price_0sd'), - p05sd: createPriceRatioPattern(this, 'sth_realized_price', 'p0_5sd'), - p1sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1sd'), - p15sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1_5sd'), - p2sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2sd'), - p25sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2_5sd'), - p3sd: createPriceRatioPattern(this, 'sth_realized_price', 'p3sd'), - m05sd: createPriceRatioPattern(this, 'sth_realized_price', 'm0_5sd'), - m1sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1sd'), - m15sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1_5sd'), - m2sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2sd'), - m25sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2_5sd'), - m3sd: createPriceRatioPattern(this, 'sth_realized_price', 'm3sd'), - }, - _4y: { - sd: createSeriesPattern1(this, 'sth_realized_price_ratio_sd_4y'), - zscore: createSeriesPattern1(this, 'sth_realized_price_ratio_zscore_4y'), - _0sd: createCentsSatsUsdPattern(this, 'sth_realized_price_0sd_4y'), - p05sd: createPriceRatioPattern(this, 'sth_realized_price', 'p0_5sd_4y'), - p1sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1sd_4y'), - p15sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1_5sd_4y'), - p2sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2sd_4y'), - p25sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2_5sd_4y'), - p3sd: createPriceRatioPattern(this, 'sth_realized_price', 'p3sd_4y'), - m05sd: createPriceRatioPattern(this, 'sth_realized_price', 'm0_5sd_4y'), - m1sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1sd_4y'), - m15sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1_5sd_4y'), - m2sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2sd_4y'), - m25sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2_5sd_4y'), - m3sd: createPriceRatioPattern(this, 'sth_realized_price', 'm3sd_4y'), - }, - _2y: { - sd: createSeriesPattern1(this, 'sth_realized_price_ratio_sd_2y'), - zscore: createSeriesPattern1(this, 'sth_realized_price_ratio_zscore_2y'), - _0sd: createCentsSatsUsdPattern(this, 'sth_realized_price_0sd_2y'), - p05sd: createPriceRatioPattern(this, 'sth_realized_price', 'p0_5sd_2y'), - p1sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1sd_2y'), - p15sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1_5sd_2y'), - p2sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2sd_2y'), - p25sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2_5sd_2y'), - p3sd: createPriceRatioPattern(this, 'sth_realized_price', 'p3sd_2y'), - m05sd: createPriceRatioPattern(this, 'sth_realized_price', 'm0_5sd_2y'), - m1sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1sd_2y'), - m15sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1_5sd_2y'), - m2sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2sd_2y'), - m25sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2_5sd_2y'), - m3sd: createPriceRatioPattern(this, 'sth_realized_price', 'm3sd_2y'), - }, - _1y: { - sd: createSeriesPattern1(this, 'sth_realized_price_ratio_sd_1y'), - zscore: createSeriesPattern1(this, 'sth_realized_price_ratio_zscore_1y'), - _0sd: createCentsSatsUsdPattern(this, 'sth_realized_price_0sd_1y'), - p05sd: createPriceRatioPattern(this, 'sth_realized_price', 'p0_5sd_1y'), - p1sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1sd_1y'), - p15sd: createPriceRatioPattern(this, 'sth_realized_price', 'p1_5sd_1y'), - p2sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2sd_1y'), - p25sd: createPriceRatioPattern(this, 'sth_realized_price', 'p2_5sd_1y'), - p3sd: createPriceRatioPattern(this, 'sth_realized_price', 'p3sd_1y'), - m05sd: createPriceRatioPattern(this, 'sth_realized_price', 'm0_5sd_1y'), - m1sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1sd_1y'), - m15sd: createPriceRatioPattern(this, 'sth_realized_price', 'm1_5sd_1y'), - m2sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2sd_1y'), - m25sd: createPriceRatioPattern(this, 'sth_realized_price', 'm2_5sd_1y'), - m3sd: createPriceRatioPattern(this, 'sth_realized_price', 'm3sd_1y'), - }, - }, - }, - mvrv: createSeriesPattern1(this, 'sth_mvrv'), - netPnl: createBlockChangeCumulativeDeltaSumPattern(this, 'sth_net'), - sopr: createAdjustedRatioValuePattern(this, 'sth'), - grossPnl: createBlockCumulativeSumPattern(this, 'sth_realized_gross_pnl'), - sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'sth_sell_side_risk_ratio'), - peakRegret: createBlockCumulativeSumPattern(this, 'sth_realized_peak_regret'), - capitalized: createPricePattern(this, 'sth_capitalized_price'), - profitToLossRatio: create_1m1w1y24hPattern(this, 'sth_realized_profit_to_loss_ratio'), - }, - costBasis: createInMaxMinPerSupplyPattern(this, 'sth'), - unrealized: createCapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2(this, 'sth'), - investedCapital: createInPattern(this, 'sth_invested_capital_in'), - }, - lth: { - supply: createDeltaDominanceHalfInTotalPattern2(this, 'lth_supply'), - outputs: createSpendingSpentUnspentPattern(this, 'lth'), - activity: createCoindaysCoinyearsDormancyTransferPattern(this, 'lth'), - realized: { - cap: createCentsDeltaToUsdPattern(this, 'lth_realized_cap'), - profit: createBlockCumulativeSumPattern(this, 'lth_realized_profit'), - loss: createBlockCumulativeNegativeSumPattern(this, 'lth_realized_loss'), - price: { - usd: createSeriesPattern1(this, 'lth_realized_price'), - cents: createSeriesPattern1(this, 'lth_realized_price_cents'), - sats: createSeriesPattern1(this, 'lth_realized_price_sats'), - bps: createSeriesPattern1(this, 'lth_realized_price_ratio_bps'), - ratio: createSeriesPattern1(this, 'lth_realized_price_ratio'), - percentiles: createPct0Pct1Pct2Pct5Pct95Pct98Pct99Pattern(this, 'lth_realized_price'), - sma: create_1m1w1y2y4yAllPattern(this, 'lth_realized_price_ratio_sma'), - stdDev: { - all: { - sd: createSeriesPattern1(this, 'lth_realized_price_ratio_sd'), - zscore: createSeriesPattern1(this, 'lth_realized_price_ratio_zscore'), - _0sd: createCentsSatsUsdPattern(this, 'lth_realized_price_0sd'), - p05sd: createPriceRatioPattern(this, 'lth_realized_price', 'p0_5sd'), - p1sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1sd'), - p15sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1_5sd'), - p2sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2sd'), - p25sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2_5sd'), - p3sd: createPriceRatioPattern(this, 'lth_realized_price', 'p3sd'), - m05sd: createPriceRatioPattern(this, 'lth_realized_price', 'm0_5sd'), - m1sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1sd'), - m15sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1_5sd'), - m2sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2sd'), - m25sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2_5sd'), - m3sd: createPriceRatioPattern(this, 'lth_realized_price', 'm3sd'), - }, - _4y: { - sd: createSeriesPattern1(this, 'lth_realized_price_ratio_sd_4y'), - zscore: createSeriesPattern1(this, 'lth_realized_price_ratio_zscore_4y'), - _0sd: createCentsSatsUsdPattern(this, 'lth_realized_price_0sd_4y'), - p05sd: createPriceRatioPattern(this, 'lth_realized_price', 'p0_5sd_4y'), - p1sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1sd_4y'), - p15sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1_5sd_4y'), - p2sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2sd_4y'), - p25sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2_5sd_4y'), - p3sd: createPriceRatioPattern(this, 'lth_realized_price', 'p3sd_4y'), - m05sd: createPriceRatioPattern(this, 'lth_realized_price', 'm0_5sd_4y'), - m1sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1sd_4y'), - m15sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1_5sd_4y'), - m2sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2sd_4y'), - m25sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2_5sd_4y'), - m3sd: createPriceRatioPattern(this, 'lth_realized_price', 'm3sd_4y'), - }, - _2y: { - sd: createSeriesPattern1(this, 'lth_realized_price_ratio_sd_2y'), - zscore: createSeriesPattern1(this, 'lth_realized_price_ratio_zscore_2y'), - _0sd: createCentsSatsUsdPattern(this, 'lth_realized_price_0sd_2y'), - p05sd: createPriceRatioPattern(this, 'lth_realized_price', 'p0_5sd_2y'), - p1sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1sd_2y'), - p15sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1_5sd_2y'), - p2sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2sd_2y'), - p25sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2_5sd_2y'), - p3sd: createPriceRatioPattern(this, 'lth_realized_price', 'p3sd_2y'), - m05sd: createPriceRatioPattern(this, 'lth_realized_price', 'm0_5sd_2y'), - m1sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1sd_2y'), - m15sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1_5sd_2y'), - m2sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2sd_2y'), - m25sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2_5sd_2y'), - m3sd: createPriceRatioPattern(this, 'lth_realized_price', 'm3sd_2y'), - }, - _1y: { - sd: createSeriesPattern1(this, 'lth_realized_price_ratio_sd_1y'), - zscore: createSeriesPattern1(this, 'lth_realized_price_ratio_zscore_1y'), - _0sd: createCentsSatsUsdPattern(this, 'lth_realized_price_0sd_1y'), - p05sd: createPriceRatioPattern(this, 'lth_realized_price', 'p0_5sd_1y'), - p1sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1sd_1y'), - p15sd: createPriceRatioPattern(this, 'lth_realized_price', 'p1_5sd_1y'), - p2sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2sd_1y'), - p25sd: createPriceRatioPattern(this, 'lth_realized_price', 'p2_5sd_1y'), - p3sd: createPriceRatioPattern(this, 'lth_realized_price', 'p3sd_1y'), - m05sd: createPriceRatioPattern(this, 'lth_realized_price', 'm0_5sd_1y'), - m1sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1sd_1y'), - m15sd: createPriceRatioPattern(this, 'lth_realized_price', 'm1_5sd_1y'), - m2sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2sd_1y'), - m25sd: createPriceRatioPattern(this, 'lth_realized_price', 'm2_5sd_1y'), - m3sd: createPriceRatioPattern(this, 'lth_realized_price', 'm3sd_1y'), - }, - }, - }, - mvrv: createSeriesPattern1(this, 'lth_mvrv'), - netPnl: createBlockChangeCumulativeDeltaSumPattern(this, 'lth_net'), - sopr: { - valueDestroyed: createAverageBlockCumulativeSumPattern(this, 'lth_value_destroyed'), - ratio: create_1m1w1y24hPattern(this, 'lth_sopr'), - }, - grossPnl: createBlockCumulativeSumPattern(this, 'lth_realized_gross_pnl'), - sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'lth_sell_side_risk_ratio'), - peakRegret: createBlockCumulativeSumPattern(this, 'lth_realized_peak_regret'), - capitalized: createPricePattern(this, 'lth_capitalized_price'), - profitToLossRatio: create_1m1w1y24hPattern(this, 'lth_realized_profit_to_loss_ratio'), - }, - costBasis: createInMaxMinPerSupplyPattern(this, 'lth'), - unrealized: createCapitalizedGrossInvestedLossNetNuplProfitSentimentPattern2(this, 'lth'), - investedCapital: createInPattern(this, 'lth_invested_capital_in'), - }, - ageRange: { - under1h: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_1h_old'), - _1hTo1d: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_1h_to_1d_old'), - _1dTo1w: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_1d_to_1w_old'), - _1wTo1m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_1w_to_1m_old'), - _1mTo2m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_1m_to_2m_old'), - _2mTo3m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_2m_to_3m_old'), - _3mTo4m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_3m_to_4m_old'), - _4mTo5m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_4m_to_5m_old'), - _5mTo6m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_5m_to_6m_old'), - _6mTo1y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_6m_to_1y_old'), - _1yTo2y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_1y_to_2y_old'), - _2yTo3y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_2y_to_3y_old'), - _3yTo4y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_3y_to_4y_old'), - _4yTo5y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_4y_to_5y_old'), - _5yTo6y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_5y_to_6y_old'), - _6yTo7y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_6y_to_7y_old'), - _7yTo8y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_7y_to_8y_old'), - _8yTo10y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_8y_to_10y_old'), - _10yTo12y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_10y_to_12y_old'), - _12yTo15y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_12y_to_15y_old'), - over15y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_15y_old'), - }, - underAge: { - _1w: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_1w_old'), - _1m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_1m_old'), - _2m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_2m_old'), - _3m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_3m_old'), - _4m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_4m_old'), - _5m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_5m_old'), - _6m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_6m_old'), - _1y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_1y_old'), - _2y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_2y_old'), - _3y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_3y_old'), - _4y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_4y_old'), - _5y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_5y_old'), - _6y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_6y_old'), - _7y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_7y_old'), - _8y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_8y_old'), - _10y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_10y_old'), - _12y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_12y_old'), - _15y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_under_15y_old'), - }, - overAge: { - _1d: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_1d_old'), - _1w: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_1w_old'), - _1m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_1m_old'), - _2m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_2m_old'), - _3m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_3m_old'), - _4m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_4m_old'), - _5m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_5m_old'), - _6m: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_6m_old'), - _1y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_1y_old'), - _2y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_2y_old'), - _3y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_3y_old'), - _4y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_4y_old'), - _5y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_5y_old'), - _6y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_6y_old'), - _7y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_7y_old'), - _8y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_8y_old'), - _10y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_10y_old'), - _12y: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'utxos_over_12y_old'), - }, - epoch: { - _0: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'epoch_0'), - _1: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'epoch_1'), - _2: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'epoch_2'), - _3: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'epoch_3'), - _4: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'epoch_4'), - }, - class: { - _2009: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2009'), - _2010: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2010'), - _2011: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2011'), - _2012: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2012'), - _2013: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2013'), - _2014: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2014'), - _2015: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2015'), - _2016: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2016'), - _2017: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2017'), - _2018: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2018'), - _2019: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2019'), - _2020: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2020'), - _2021: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2021'), - _2022: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2022'), - _2023: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2023'), - _2024: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2024'), - _2025: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2025'), - _2026: createActivityOutputsRealizedSupplyUnrealizedPattern(this, 'class_2026'), - }, - overAmount: { - _1sat: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_1sat'), - _10sats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_10sats'), - _100sats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_100sats'), - _1kSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_1k_sats'), - _10kSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_10k_sats'), - _100kSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_100k_sats'), - _1mSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_1m_sats'), - _10mSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_10m_sats'), - _1btc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_1btc'), - _10btc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_10btc'), - _100btc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_100btc'), - _1kBtc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_1k_btc'), - _10kBtc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_10k_btc'), - }, - amountRange: { - _0sats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_0sats'), - _1satTo10sats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_1sat_to_10sats'), - _10satsTo100sats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_10sats_to_100sats'), - _100satsTo1kSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_100sats_to_1k_sats'), - _1kSatsTo10kSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_1k_sats_to_10k_sats'), - _10kSatsTo100kSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_10k_sats_to_100k_sats'), - _100kSatsTo1mSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_100k_sats_to_1m_sats'), - _1mSatsTo10mSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_1m_sats_to_10m_sats'), - _10mSatsTo1btc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_10m_sats_to_1btc'), - _1btcTo10btc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_1btc_to_10btc'), - _10btcTo100btc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_10btc_to_100btc'), - _100btcTo1kBtc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_100btc_to_1k_btc'), - _1kBtcTo10kBtc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_1k_btc_to_10k_btc'), - _10kBtcTo100kBtc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_10k_btc_to_100k_btc'), - over100kBtc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_over_100k_btc'), - }, - underAmount: { - _10sats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_10sats'), - _100sats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_100sats'), - _1kSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_1k_sats'), - _10kSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_10k_sats'), - _100kSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_100k_sats'), - _1mSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_1m_sats'), - _10mSats: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_10m_sats'), - _1btc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_1btc'), - _10btc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_10btc'), - _100btc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_100btc'), - _1kBtc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_1k_btc'), - _10kBtc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_10k_btc'), - _100kBtc: createActivityOutputsRealizedSupplyUnrealizedPattern2(this, 'utxos_under_100k_btc'), - }, - type: { - p2pk65: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'p2pk65'), - p2pk33: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'p2pk33'), - p2pkh: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'p2pkh'), - p2ms: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'p2ms'), - p2sh: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'p2sh'), - p2wpkh: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'p2wpkh'), - p2wsh: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'p2wsh'), - p2tr: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'p2tr'), - p2a: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'p2a'), - unknown: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'unknown_outputs'), - empty: createActivityOutputsRealizedSupplyUnrealizedPattern3(this, 'empty_outputs'), - }, - profitability: { - range: { - over1000pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_1000pct_in_profit'), - _500pctTo1000pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_500pct_to_1000pct_in_profit'), - _300pctTo500pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_300pct_to_500pct_in_profit'), - _200pctTo300pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_200pct_to_300pct_in_profit'), - _100pctTo200pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_100pct_to_200pct_in_profit'), - _90pctTo100pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_90pct_to_100pct_in_profit'), - _80pctTo90pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_80pct_to_90pct_in_profit'), - _70pctTo80pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_70pct_to_80pct_in_profit'), - _60pctTo70pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_60pct_to_70pct_in_profit'), - _50pctTo60pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_50pct_to_60pct_in_profit'), - _40pctTo50pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_40pct_to_50pct_in_profit'), - _30pctTo40pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_30pct_to_40pct_in_profit'), - _20pctTo30pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_20pct_to_30pct_in_profit'), - _10pctTo20pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_10pct_to_20pct_in_profit'), - _0pctTo10pctInProfit: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_0pct_to_10pct_in_profit'), - _0pctTo10pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_0pct_to_10pct_in_loss'), - _10pctTo20pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_10pct_to_20pct_in_loss'), - _20pctTo30pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_20pct_to_30pct_in_loss'), - _30pctTo40pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_30pct_to_40pct_in_loss'), - _40pctTo50pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_40pct_to_50pct_in_loss'), - _50pctTo60pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_50pct_to_60pct_in_loss'), - _60pctTo70pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_60pct_to_70pct_in_loss'), - _70pctTo80pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_70pct_to_80pct_in_loss'), - _80pctTo90pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_80pct_to_90pct_in_loss'), - _90pctTo100pctInLoss: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_90pct_to_100pct_in_loss'), - }, - profit: { - all: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_in_profit'), - _10pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_10pct_in_profit'), - _20pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_20pct_in_profit'), - _30pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_30pct_in_profit'), - _40pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_40pct_in_profit'), - _50pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_50pct_in_profit'), - _60pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_60pct_in_profit'), - _70pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_70pct_in_profit'), - _80pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_80pct_in_profit'), - _90pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_90pct_in_profit'), - _100pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_100pct_in_profit'), - _200pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_200pct_in_profit'), - _300pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_300pct_in_profit'), - _500pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_500pct_in_profit'), - }, - loss: { - all: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_in_loss'), - _10pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_10pct_in_loss'), - _20pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_20pct_in_loss'), - _30pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_30pct_in_loss'), - _40pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_40pct_in_loss'), - _50pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_50pct_in_loss'), - _60pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_60pct_in_loss'), - _70pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_70pct_in_loss'), - _80pct: createNuplRealizedSupplyUnrealizedPattern(this, 'utxos_over_80pct_in_loss'), - }, - }, - matured: { - under1h: createAverageBlockCumulativeSumPattern3(this, 'utxos_under_1h_old_matured_supply'), - _1hTo1d: createAverageBlockCumulativeSumPattern3(this, 'utxos_1h_to_1d_old_matured_supply'), - _1dTo1w: createAverageBlockCumulativeSumPattern3(this, 'utxos_1d_to_1w_old_matured_supply'), - _1wTo1m: createAverageBlockCumulativeSumPattern3(this, 'utxos_1w_to_1m_old_matured_supply'), - _1mTo2m: createAverageBlockCumulativeSumPattern3(this, 'utxos_1m_to_2m_old_matured_supply'), - _2mTo3m: createAverageBlockCumulativeSumPattern3(this, 'utxos_2m_to_3m_old_matured_supply'), - _3mTo4m: createAverageBlockCumulativeSumPattern3(this, 'utxos_3m_to_4m_old_matured_supply'), - _4mTo5m: createAverageBlockCumulativeSumPattern3(this, 'utxos_4m_to_5m_old_matured_supply'), - _5mTo6m: createAverageBlockCumulativeSumPattern3(this, 'utxos_5m_to_6m_old_matured_supply'), - _6mTo1y: createAverageBlockCumulativeSumPattern3(this, 'utxos_6m_to_1y_old_matured_supply'), - _1yTo2y: createAverageBlockCumulativeSumPattern3(this, 'utxos_1y_to_2y_old_matured_supply'), - _2yTo3y: createAverageBlockCumulativeSumPattern3(this, 'utxos_2y_to_3y_old_matured_supply'), - _3yTo4y: createAverageBlockCumulativeSumPattern3(this, 'utxos_3y_to_4y_old_matured_supply'), - _4yTo5y: createAverageBlockCumulativeSumPattern3(this, 'utxos_4y_to_5y_old_matured_supply'), - _5yTo6y: createAverageBlockCumulativeSumPattern3(this, 'utxos_5y_to_6y_old_matured_supply'), - _6yTo7y: createAverageBlockCumulativeSumPattern3(this, 'utxos_6y_to_7y_old_matured_supply'), - _7yTo8y: createAverageBlockCumulativeSumPattern3(this, 'utxos_7y_to_8y_old_matured_supply'), - _8yTo10y: createAverageBlockCumulativeSumPattern3(this, 'utxos_8y_to_10y_old_matured_supply'), - _10yTo12y: createAverageBlockCumulativeSumPattern3(this, 'utxos_10y_to_12y_old_matured_supply'), - _12yTo15y: createAverageBlockCumulativeSumPattern3(this, 'utxos_12y_to_15y_old_matured_supply'), - over15y: createAverageBlockCumulativeSumPattern3(this, 'utxos_over_15y_old_matured_supply'), - }, - }, - addr: { - overAmount: { - _1sat: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_1sat'), - _10sats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_10sats'), - _100sats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_100sats'), - _1kSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_1k_sats'), - _10kSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_10k_sats'), - _100kSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_100k_sats'), - _1mSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_1m_sats'), - _10mSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_10m_sats'), - _1btc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_1btc'), - _10btc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_10btc'), - _100btc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_100btc'), - _1kBtc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_1k_btc'), - _10kBtc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_10k_btc'), - }, - amountRange: { - _0sats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_0sats'), - _1satTo10sats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_1sat_to_10sats'), - _10satsTo100sats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_10sats_to_100sats'), - _100satsTo1kSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_100sats_to_1k_sats'), - _1kSatsTo10kSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_1k_sats_to_10k_sats'), - _10kSatsTo100kSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_10k_sats_to_100k_sats'), - _100kSatsTo1mSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_100k_sats_to_1m_sats'), - _1mSatsTo10mSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_1m_sats_to_10m_sats'), - _10mSatsTo1btc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_10m_sats_to_1btc'), - _1btcTo10btc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_1btc_to_10btc'), - _10btcTo100btc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_10btc_to_100btc'), - _100btcTo1kBtc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_100btc_to_1k_btc'), - _1kBtcTo10kBtc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_1k_btc_to_10k_btc'), - _10kBtcTo100kBtc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_10k_btc_to_100k_btc'), - over100kBtc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_over_100k_btc'), - }, - underAmount: { - _10sats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_10sats'), - _100sats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_100sats'), - _1kSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_1k_sats'), - _10kSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_10k_sats'), - _100kSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_100k_sats'), - _1mSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_1m_sats'), - _10mSats: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_10m_sats'), - _1btc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_1btc'), - _10btc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_10btc'), - _100btc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_100btc'), - _1kBtc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_1k_btc'), - _10kBtc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_10k_btc'), - _100kBtc: createActivityAddrOutputsRealizedSupplyUnrealizedPattern(this, 'addrs_under_100k_btc'), - }, - }, - }, - }; - } - - /** - * Create a dynamic series endpoint builder for any series/index combination. - * - * Use this for programmatic access when the series name is determined at runtime. - * For type-safe access, use the `series` tree instead. - * - * @param {string} series - The series name - * @param {Index} index - The index name - * @returns {SeriesEndpoint} - */ - seriesEndpoint(series, index) { - return _endpoint(this, series, index); - } - - /** - * Health check - * - * Liveness probe. Returns server identity, uptime, and indexed/computed heights from local state only (no bitcoind round-trip). For real chain-tip catch-up, see `/api/server/sync`. - * - * Endpoint: `GET /health` - * @param {{ signal?: AbortSignal, onValue?: (value: Health) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getHealth({ signal, onValue, cache } = {}) { - const path = `/health`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * API version - * - * Returns the current version of the API server - * - * Endpoint: `GET /version` - * @param {{ signal?: AbortSignal, onValue?: (value: string) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getVersion({ signal, onValue, cache } = {}) { - const path = `/version`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Sync status - * - * Returns the sync status of the indexer, including indexed height, tip height, blocks behind, and last indexed timestamp. - * - * Endpoint: `GET /api/server/sync` - * @param {{ signal?: AbortSignal, onValue?: (value: SyncStatus) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getSyncStatus({ signal, onValue, cache } = {}) { - const path = `/api/server/sync`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Disk usage - * - * Returns the disk space used by BRK and Bitcoin data. - * - * Endpoint: `GET /api/server/disk` - * @param {{ signal?: AbortSignal, onValue?: (value: DiskUsage) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getDiskUsage({ signal, onValue, cache } = {}) { - const path = `/api/server/disk`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Series catalog - * - * Returns the complete hierarchical catalog of available series organized as a tree structure. Series are grouped by categories and subcategories. - * - * Endpoint: `GET /api/series` - * @param {{ signal?: AbortSignal, onValue?: (value: TreeNode) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getSeriesTree({ signal, onValue, cache } = {}) { - const path = `/api/series`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Series count - * - * Returns the number of series available per index type. - * - * Endpoint: `GET /api/series/count` - * @param {{ signal?: AbortSignal, onValue?: (value: SeriesCount[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getSeriesCount({ signal, onValue, cache } = {}) { - const path = `/api/series/count`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * List available indexes - * - * Returns all available indexes with their accepted query aliases. Use any alias when querying series. - * - * Endpoint: `GET /api/series/indexes` - * @param {{ signal?: AbortSignal, onValue?: (value: IndexInfo[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getIndexes({ signal, onValue, cache } = {}) { - const path = `/api/series/indexes`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Series list - * - * Paginated flat list of all available series names. Use `page` query param for pagination. - * - * Endpoint: `GET /api/series/list` - * - * @param {number=} [page] - Pagination index - * @param {number=} [per_page] - Results per page (default: 1000, max: 1000) - * @param {{ signal?: AbortSignal, onValue?: (value: PaginatedSeries) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async listSeries(page, per_page, { signal, onValue, cache } = {}) { - const params = new URLSearchParams(); - if (page !== undefined) params.set('page', String(page)); - if (per_page !== undefined) params.set('per_page', String(per_page)); - const query = params.toString(); - const path = `/api/series/list${query ? '?' + query : ''}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Search series - * - * Fuzzy search for series by name. Supports partial matches and typos. - * - * Endpoint: `GET /api/series/search` - * - * @param {SeriesName} q - Search query string - * @param {Limit=} [limit] - Maximum number of results - * @param {{ signal?: AbortSignal, onValue?: (value: string[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async searchSeries(q, limit, { signal, onValue, cache } = {}) { - const params = new URLSearchParams(); - params.set('q', String(q)); - if (limit !== undefined) params.set('limit', String(limit)); - const query = params.toString(); - const path = `/api/series/search${query ? '?' + query : ''}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Get series info - * - * Returns the supported indexes and value type for the specified series. - * - * Endpoint: `GET /api/series/{series}` - * - * @param {SeriesName} series - * @param {{ signal?: AbortSignal, onValue?: (value: SeriesInfo) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getSeriesInfo(series, { signal, onValue, cache } = {}) { - const path = `/api/series/${series}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Get series data - * - * Fetch data for a specific series at the given index. Use query parameters to filter by date range and format (json/csv). - * - * Endpoint: `GET /api/series/{series}/{index}` - * - * @param {SeriesName} series - Series name - * @param {Index} index - Aggregation index - * @param {RangeIndex=} [start] - Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `from`, `f`, `s` - * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e` - * @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l` - * @param {Format=} [format] - Format of the output - * @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData | string) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getSeries(series, index, start, end, limit, format, { signal, onValue, cache } = {}) { - const params = new URLSearchParams(); - if (start !== undefined) params.set('start', String(start)); - if (end !== undefined) params.set('end', String(end)); - if (limit !== undefined) params.set('limit', String(limit)); - if (format !== undefined) params.set('format', String(format)); - const query = params.toString(); - const path = `/api/series/${series}/${index}${query ? '?' + query : ''}`; - if (format === 'csv') return this.getText(path, { signal, onValue, cache }); - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Get raw series data - * - * Returns just the data array without the SeriesData wrapper. Supports the same range and format parameters as the standard endpoint. - * - * Endpoint: `GET /api/series/{series}/{index}/data` - * - * @param {SeriesName} series - Series name - * @param {Index} index - Aggregation index - * @param {RangeIndex=} [start] - Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `from`, `f`, `s` - * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e` - * @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l` - * @param {Format=} [format] - Format of the output - * @param {{ signal?: AbortSignal, onValue?: (value: boolean[] | string) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getSeriesData(series, index, start, end, limit, format, { signal, onValue, cache } = {}) { - const params = new URLSearchParams(); - if (start !== undefined) params.set('start', String(start)); - if (end !== undefined) params.set('end', String(end)); - if (limit !== undefined) params.set('limit', String(limit)); - if (format !== undefined) params.set('format', String(format)); - const query = params.toString(); - const path = `/api/series/${series}/${index}/data${query ? '?' + query : ''}`; - if (format === 'csv') return this.getText(path, { signal, onValue, cache }); - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Get latest series value - * - * Returns the single most recent value for a series, unwrapped (not inside a SeriesData object). - * - * Endpoint: `GET /api/series/{series}/{index}/latest` - * - * @param {SeriesName} series - Series name - * @param {Index} index - Aggregation index - * @param {{ signal?: AbortSignal, onValue?: (value: *) => void, cache?: boolean }} [options] - * @returns {Promise<*>} - */ - async getSeriesLatest(series, index, { signal, onValue, cache } = {}) { - const path = `/api/series/${series}/${index}/latest`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Get series data length - * - * Returns the total number of data points for a series at the given index. - * - * Endpoint: `GET /api/series/{series}/{index}/len` - * - * @param {SeriesName} series - Series name - * @param {Index} index - Aggregation index - * @param {{ signal?: AbortSignal, onValue?: (value: number) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getSeriesLen(series, index, { signal, onValue, cache } = {}) { - const path = `/api/series/${series}/${index}/len`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Get series version - * - * Returns the current version of a series. Changes when the series data is updated. - * - * Endpoint: `GET /api/series/{series}/{index}/version` - * - * @param {SeriesName} series - Series name - * @param {Index} index - Aggregation index - * @param {{ signal?: AbortSignal, onValue?: (value: Version) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getSeriesVersion(series, index, { signal, onValue, cache } = {}) { - const path = `/api/series/${series}/${index}/version`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Bulk series data - * - * Fetch multiple series in a single request. Supports filtering by index and date range. Returns an array of SeriesData objects. For a single series, use `get_series` instead. - * - * Endpoint: `GET /api/series/bulk` - * - * @param {SeriesList} series - Requested series - * @param {Index} index - Index to query - * @param {RangeIndex=} [start] - Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `from`, `f`, `s` - * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e` - * @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l` - * @param {Format=} [format] - Format of the output - * @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData[] | string) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getSeriesBulk(series, index, start, end, limit, format, { signal, onValue, cache } = {}) { - const params = new URLSearchParams(); - params.set('series', String(series)); - params.set('index', String(index)); - if (start !== undefined) params.set('start', String(start)); - if (end !== undefined) params.set('end', String(end)); - if (limit !== undefined) params.set('limit', String(limit)); - if (format !== undefined) params.set('format', String(format)); - const query = params.toString(); - const path = `/api/series/bulk${query ? '?' + query : ''}`; - if (format === 'csv') return this.getText(path, { signal, onValue, cache }); - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Available URPD cohorts - * - * Cohorts for which URPD data is available. Returns names like `all`, `sth`, `lth`, `utxos_under_1h_old`. - * - * Endpoint: `GET /api/urpd` - * @param {{ signal?: AbortSignal, onValue?: (value: Cohort[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async listUrpdCohorts({ signal, onValue, cache } = {}) { - const path = `/api/urpd`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Available URPD dates - * - * Dates for which a URPD snapshot is available for the cohort. One entry per UTC day, sorted ascending. - * - * Endpoint: `GET /api/urpd/{cohort}/dates` - * - * @param {Cohort} cohort - * @param {{ signal?: AbortSignal, onValue?: (value: Date[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async listUrpdDates(cohort, { signal, onValue, cache } = {}) { - const path = `/api/urpd/${cohort}/dates`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Latest URPD - * - * URPD for the most recent available date in the cohort. The response's `date` field echoes which date was served. - * - * See the URPD tag description for the response shape and `agg` options. - * - * Endpoint: `GET /api/urpd/{cohort}` - * - * @param {Cohort} cohort - * @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias. - * @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getUrpd(cohort, agg, { signal, onValue, cache } = {}) { - const params = new URLSearchParams(); - if (agg !== undefined) params.set('agg', String(agg)); - const query = params.toString(); - const path = `/api/urpd/${cohort}${query ? '?' + query : ''}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * URPD at date - * - * URPD for a (cohort, date) pair. Returns `{ cohort, date, aggregation, close, total_supply, buckets }` where each bucket is `{ price_floor, supply, realized_cap, unrealized_pnl }`. - * - * See the URPD tag description for unit conventions and `agg` options. - * - * Endpoint: `GET /api/urpd/{cohort}/{date}` - * - * @param {Cohort} cohort - * @param {string} date - * @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias. - * @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getUrpdAt(cohort, date, agg, { signal, onValue, cache } = {}) { - const params = new URLSearchParams(); - if (agg !== undefined) params.set('agg', String(agg)); - const query = params.toString(); - const path = `/api/urpd/${cohort}/${date}${query ? '?' + query : ''}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Difficulty adjustment - * - * Get current difficulty adjustment progress and estimates. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustment)* - * - * Endpoint: `GET /api/v1/difficulty-adjustment` - * @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustment) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getDifficultyAdjustment({ signal, onValue, cache } = {}) { - const path = `/api/v1/difficulty-adjustment`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Current BTC price - * - * Returns bitcoin latest price (on-chain derived, USD only). - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-price)* - * - * Endpoint: `GET /api/v1/prices` - * @param {{ signal?: AbortSignal, onValue?: (value: Prices) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPrices({ signal, onValue, cache } = {}) { - const path = `/api/v1/prices`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Historical price - * - * Get historical BTC/USD price. Optionally specify a UNIX timestamp to get the price at that time. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-historical-price)* - * - * Endpoint: `GET /api/v1/historical-price` - * - * @param {Timestamp=} [timestamp] - * @param {{ signal?: AbortSignal, onValue?: (value: HistoricalPrice) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getHistoricalPrice(timestamp, { signal, onValue, cache } = {}) { - const params = new URLSearchParams(); - if (timestamp !== undefined) params.set('timestamp', String(timestamp)); - const query = params.toString(); - const path = `/api/v1/historical-price${query ? '?' + query : ''}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Address information - * - * Retrieve address information including balance and transaction counts. Supports all standard Bitcoin address types (P2PKH, P2SH, P2WPKH, P2WSH, P2TR). - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address)* - * - * Endpoint: `GET /api/address/{address}` - * - * @param {Addr} address - * @param {{ signal?: AbortSignal, onValue?: (value: AddrStats) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getAddress(address, { signal, onValue, cache } = {}) { - const path = `/api/address/${address}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Address transactions - * - * Get transaction history for an address, newest first. Returns up to 50 mempool transactions plus a confirmed page sized to fill the response to 50 total (chain floor of 25, so 25-50 confirmed depending on mempool weight). To paginate further confirmed history, use `/address/{address}/txs/chain/{last_seen_txid}`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions)* - * - * Endpoint: `GET /api/address/{address}/txs` - * - * @param {Addr} address - * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getAddressTxs(address, { signal, onValue, cache } = {}) { - const path = `/api/address/${address}/txs`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Address confirmed transactions - * - * Get the first 25 confirmed transactions for an address. For pagination, use the path-style form `/txs/chain/{last_seen_txid}`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions-chain)* - * - * Endpoint: `GET /api/address/{address}/txs/chain` - * - * @param {Addr} address - * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getAddressConfirmedTxs(address, { signal, onValue, cache } = {}) { - const path = `/api/address/${address}/txs/chain`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Address confirmed transactions (paginated) - * - * Get the next 25 confirmed transactions strictly older than `after_txid` (Esplora-canonical pagination form, matches mempool.space). - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions-chain)* - * - * Endpoint: `GET /api/address/{address}/txs/chain/{after_txid}` - * - * @param {Addr} address - * @param {Txid} after_txid - Last txid from the previous page (return transactions strictly older than this) - * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getAddressConfirmedTxsAfter(address, after_txid, { signal, onValue, cache } = {}) { - const path = `/api/address/${address}/txs/chain/${after_txid}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Address mempool transactions - * - * Get unconfirmed transactions for an address from the mempool, newest first (up to 50). - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions-mempool)* - * - * Endpoint: `GET /api/address/{address}/txs/mempool` - * - * @param {Addr} address - * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getAddressMempoolTxs(address, { signal, onValue, cache } = {}) { - const path = `/api/address/${address}/txs/mempool`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Address UTXOs - * - * Get unspent transaction outputs (UTXOs) for an address. Returns txid, vout, value, and confirmation status for each UTXO. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-utxo)* - * - * Endpoint: `GET /api/address/{address}/utxo` - * - * @param {Addr} address - * @param {{ signal?: AbortSignal, onValue?: (value: Utxo[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getAddressUtxos(address, { signal, onValue, cache } = {}) { - const path = `/api/address/${address}/utxo`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Validate address - * - * Validate a Bitcoin address and get information about its type and scriptPubKey. Returns `isvalid: false` with an error message for invalid addresses. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-validate)* - * - * Endpoint: `GET /api/v1/validate-address/{address}` - * - * @param {string} address - Bitcoin address to validate (can be any string) - * @param {{ signal?: AbortSignal, onValue?: (value: AddrValidation) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async validateAddress(address, { signal, onValue, cache } = {}) { - const path = `/api/v1/validate-address/${address}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block information - * - * Retrieve block information by block hash. Returns block metadata including height, timestamp, difficulty, size, weight, and transaction count. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block)* - * - * Endpoint: `GET /api/block/{hash}` - * - * @param {BlockHash} hash - * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlock(hash, { signal, onValue, cache } = {}) { - const path = `/api/block/${hash}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block (v1) - * - * Returns block details with extras by hash. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-v1)* - * - * Endpoint: `GET /api/v1/block/{hash}` - * - * @param {BlockHash} hash - * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockV1(hash, { signal, onValue, cache } = {}) { - const path = `/api/v1/block/${hash}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block header - * - * Returns the hex-encoded 80-byte block header. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-header)* - * - * Endpoint: `GET /api/block/{hash}/header` - * - * @param {BlockHash} hash - * @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockHeader(hash, { signal, onValue, cache } = {}) { - const path = `/api/block/${hash}/header`; - return this.getText(path, { signal, onValue, cache }); - } - - /** - * Block hash by height - * - * Retrieve the block hash at a given height. Returns the hash as plain text. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-height)* - * - * Endpoint: `GET /api/block-height/{height}` - * - * @param {Height} height - * @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockByHeight(height, { signal, onValue, cache } = {}) { - const path = `/api/block-height/${height}`; - return this.getText(path, { signal, onValue, cache }); - } - - /** - * Block by timestamp - * - * Find the block closest to a given UNIX timestamp. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-timestamp)* - * - * Endpoint: `GET /api/v1/mining/blocks/timestamp/{timestamp}` - * - * @param {Timestamp} timestamp - * @param {{ signal?: AbortSignal, onValue?: (value: BlockTimestamp) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockByTimestamp(timestamp, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/blocks/timestamp/${timestamp}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Raw block - * - * Returns the raw block data in binary format. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-raw)* - * - * Endpoint: `GET /api/block/{hash}/raw` - * - * @param {BlockHash} hash - * @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockRaw(hash, { signal, onValue, cache } = {}) { - const path = `/api/block/${hash}/raw`; - return this.getBytes(path, { signal, onValue, cache }); - } - - /** - * Block status - * - * Retrieve the status of a block. Returns whether the block is in the best chain and, if so, its height and the hash of the next block. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-status)* - * - * Endpoint: `GET /api/block/{hash}/status` - * - * @param {BlockHash} hash - * @param {{ signal?: AbortSignal, onValue?: (value: BlockStatus) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockStatus(hash, { signal, onValue, cache } = {}) { - const path = `/api/block/${hash}/status`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block tip height - * - * Returns the height of the last block. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-height)* - * - * Endpoint: `GET /api/blocks/tip/height` - * @param {{ signal?: AbortSignal, onValue?: (value: Height) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockTipHeight({ signal, onValue, cache } = {}) { - const path = `/api/blocks/tip/height`; - return Number(await this.getText(path, { signal, cache, onValue: onValue ? (v) => onValue(Number(v)) : undefined })); - } - - /** - * Block tip hash - * - * Returns the hash of the last block. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-hash)* - * - * Endpoint: `GET /api/blocks/tip/hash` - * @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockTipHash({ signal, onValue, cache } = {}) { - const path = `/api/blocks/tip/hash`; - return this.getText(path, { signal, onValue, cache }); - } - - /** - * Transaction ID at index - * - * Retrieve a single transaction ID at a specific index within a block. Returns plain text txid. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-transaction-id)* - * - * Endpoint: `GET /api/block/{hash}/txid/{index}` - * - * @param {BlockHash} hash - Bitcoin block hash - * @param {BlockTxIndex} index - Transaction index within the block (0-based) - * @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockTxid(hash, index, { signal, onValue, cache } = {}) { - const path = `/api/block/${hash}/txid/${index}`; - return this.getText(path, { signal, onValue, cache }); - } - - /** - * Block transaction IDs - * - * Retrieve all transaction IDs in a block. Returns an array of txids in block order. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-transaction-ids)* - * - * Endpoint: `GET /api/block/{hash}/txids` - * - * @param {BlockHash} hash - * @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockTxids(hash, { signal, onValue, cache } = {}) { - const path = `/api/block/${hash}/txids`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block transactions - * - * Retrieve transactions in a block by block hash. Returns up to 25 transactions starting from index 0. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-transactions)* - * - * Endpoint: `GET /api/block/{hash}/txs` - * - * @param {BlockHash} hash - * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockTxs(hash, { signal, onValue, cache } = {}) { - const path = `/api/block/${hash}/txs`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block transactions (paginated) - * - * Retrieve transactions in a block by block hash, starting from the specified index. Returns up to 25 transactions at a time. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-transactions)* - * - * Endpoint: `GET /api/block/{hash}/txs/{start_index}` - * - * @param {BlockHash} hash - Bitcoin block hash - * @param {BlockTxIndex} start_index - Starting transaction index within the block (0-based) - * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockTxsFromIndex(hash, start_index, { signal, onValue, cache } = {}) { - const path = `/api/block/${hash}/txs/${start_index}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Recent blocks - * - * Retrieve the last 10 blocks. Returns block metadata for each block. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks)* - * - * Endpoint: `GET /api/blocks` - * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlocks({ signal, onValue, cache } = {}) { - const path = `/api/blocks`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Blocks from height - * - * Retrieve up to 10 blocks going backwards from the given height. For example, height=100 returns blocks 100, 99, 98, ..., 91. Height=0 returns only block 0. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks)* - * - * Endpoint: `GET /api/blocks/{height}` - * - * @param {Height} height - * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlocksFromHeight(height, { signal, onValue, cache } = {}) { - const path = `/api/blocks/${height}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Recent blocks with extras - * - * Retrieve the last 15 blocks with extended data including pool identification and fee statistics. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)* - * - * Endpoint: `GET /api/v1/blocks` - * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlocksV1({ signal, onValue, cache } = {}) { - const path = `/api/v1/blocks`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Blocks from height with extras - * - * Retrieve up to 15 blocks with extended data going backwards from the given height. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)* - * - * Endpoint: `GET /api/v1/blocks/{height}` - * - * @param {Height} height - * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlocksV1FromHeight(height, { signal, onValue, cache } = {}) { - const path = `/api/v1/blocks/${height}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * List all mining pools - * - * Get list of all known mining pools with their identifiers. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)* - * - * Endpoint: `GET /api/v1/mining/pools` - * @param {{ signal?: AbortSignal, onValue?: (value: PoolInfo[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPools({ signal, onValue, cache } = {}) { - const path = `/api/v1/mining/pools`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Mining pool statistics - * - * Get mining pool statistics for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)* - * - * Endpoint: `GET /api/v1/mining/pools/{time_period}` - * - * @param {TimePeriod} time_period - * @param {{ signal?: AbortSignal, onValue?: (value: PoolsSummary) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPoolStats(time_period, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/pools/${time_period}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Mining pool details - * - * Get detailed information about a specific mining pool including block counts and shares for different time periods. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool)* - * - * Endpoint: `GET /api/v1/mining/pool/{slug}` - * - * @param {PoolSlug} slug - * @param {{ signal?: AbortSignal, onValue?: (value: PoolDetail) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPool(slug, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/pool/${slug}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * All pools hashrate (all time) - * - * Get hashrate data for all mining pools. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)* - * - * Endpoint: `GET /api/v1/mining/hashrate/pools` - * @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPoolsHashrate({ signal, onValue, cache } = {}) { - const path = `/api/v1/mining/hashrate/pools`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * All pools hashrate - * - * Get hashrate data for all mining pools for a time period. Valid periods: `1m`, `3m`, `6m`, `1y`, `2y`, `3y`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)* - * - * Endpoint: `GET /api/v1/mining/hashrate/pools/{time_period}` - * - * @param {TimePeriod} time_period - * @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPoolsHashrateByPeriod(time_period, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/hashrate/pools/${time_period}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Mining pool hashrate - * - * Get hashrate history for a specific mining pool. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrate)* - * - * Endpoint: `GET /api/v1/mining/pool/{slug}/hashrate` - * - * @param {PoolSlug} slug - * @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPoolHashrate(slug, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/pool/${slug}/hashrate`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Mining pool blocks - * - * Get the 10 most recent blocks mined by a specific pool. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-blocks)* - * - * Endpoint: `GET /api/v1/mining/pool/{slug}/blocks` - * - * @param {PoolSlug} slug - * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPoolBlocks(slug, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/pool/${slug}/blocks`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Mining pool blocks from height - * - * Get 10 blocks mined by a specific pool before (and including) the given height. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-blocks)* - * - * Endpoint: `GET /api/v1/mining/pool/{slug}/blocks/{height}` - * - * @param {PoolSlug} slug - * @param {Height} height - * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPoolBlocksFrom(slug, height, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/pool/${slug}/blocks/${height}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Network hashrate (all time) - * - * Get network hashrate and difficulty data for all time. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)* - * - * Endpoint: `GET /api/v1/mining/hashrate` - * @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getHashrate({ signal, onValue, cache } = {}) { - const path = `/api/v1/mining/hashrate`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Network hashrate - * - * Get network hashrate and difficulty data for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)* - * - * Endpoint: `GET /api/v1/mining/hashrate/{time_period}` - * - * @param {TimePeriod} time_period - * @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getHashrateByPeriod(time_period, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/hashrate/${time_period}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Difficulty adjustments (all time) - * - * Get historical difficulty adjustments including timestamp, block height, difficulty value, and percentage change. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)* - * - * Endpoint: `GET /api/v1/mining/difficulty-adjustments` - * @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getDifficultyAdjustments({ signal, onValue, cache } = {}) { - const path = `/api/v1/mining/difficulty-adjustments`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Difficulty adjustments - * - * Get historical difficulty adjustments for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)* - * - * Endpoint: `GET /api/v1/mining/difficulty-adjustments/{time_period}` - * - * @param {TimePeriod} time_period - * @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getDifficultyAdjustmentsByPeriod(time_period, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/difficulty-adjustments/${time_period}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Mining reward statistics - * - * Get mining reward statistics for the last N blocks including total rewards, fees, and transaction count. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-reward-stats)* - * - * Endpoint: `GET /api/v1/mining/reward-stats/{block_count}` - * - * @param {number} block_count - Number of recent blocks to include - * @param {{ signal?: AbortSignal, onValue?: (value: RewardStats) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getRewardStats(block_count, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/reward-stats/${block_count}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block fees - * - * Get average total fees per block for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-fees)* - * - * Endpoint: `GET /api/v1/mining/blocks/fees/{time_period}` - * - * @param {TimePeriod} time_period - * @param {{ signal?: AbortSignal, onValue?: (value: BlockFeesEntry[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockFees(time_period, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/blocks/fees/${time_period}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block rewards - * - * Get average coinbase reward (subsidy + fees) per block for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-rewards)* - * - * Endpoint: `GET /api/v1/mining/blocks/rewards/{time_period}` - * - * @param {TimePeriod} time_period - * @param {{ signal?: AbortSignal, onValue?: (value: BlockRewardsEntry[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockRewards(time_period, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/blocks/rewards/${time_period}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block fee rates - * - * Get block fee rate percentiles (min, 10th, 25th, median, 75th, 90th, max) for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-feerates)* - * - * Endpoint: `GET /api/v1/mining/blocks/fee-rates/{time_period}` - * - * @param {TimePeriod} time_period - * @param {{ signal?: AbortSignal, onValue?: (value: BlockFeeRatesEntry[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockFeeRates(time_period, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/blocks/fee-rates/${time_period}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block sizes and weights - * - * Get average block sizes and weights for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-sizes-weights)* - * - * Endpoint: `GET /api/v1/mining/blocks/sizes-weights/{time_period}` - * - * @param {TimePeriod} time_period - * @param {{ signal?: AbortSignal, onValue?: (value: BlockSizesWeights) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockSizesWeights(time_period, { signal, onValue, cache } = {}) { - const path = `/api/v1/mining/blocks/sizes-weights/${time_period}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Projected mempool blocks - * - * Projected blocks for fee estimation. Block 0 reflects Bitcoin Core's actual next-block selection; blocks 1+ are a fee-tier approximation. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-blocks-fees)* - * - * Endpoint: `GET /api/v1/fees/mempool-blocks` - * @param {{ signal?: AbortSignal, onValue?: (value: MempoolBlock[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getMempoolBlocks({ signal, onValue, cache } = {}) { - const path = `/api/v1/fees/mempool-blocks`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Recommended fees - * - * Recommended fee rates by confirmation target. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees)* - * - * Endpoint: `GET /api/v1/fees/recommended` - * @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getRecommendedFees({ signal, onValue, cache } = {}) { - const path = `/api/v1/fees/recommended`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Precise recommended fees - * - * Recommended fee rates with sub-integer precision. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees-precise)* - * - * Endpoint: `GET /api/v1/fees/precise` - * @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getPreciseFees({ signal, onValue, cache } = {}) { - const path = `/api/v1/fees/precise`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Mempool statistics - * - * Get current mempool statistics including transaction count, total vsize, total fees, and fee histogram. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool)* - * - * Endpoint: `GET /api/mempool` - * @param {{ signal?: AbortSignal, onValue?: (value: MempoolInfo) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getMempool({ signal, onValue, cache } = {}) { - const path = `/api/mempool`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Mempool content hash - * - * Returns an opaque hash that changes whenever the projected next block changes. Same value as the mempool ETag. Useful as a freshness/liveness signal: if it stays constant for tens of seconds on a live network, the mempool sync loop has stalled. - * - * Endpoint: `GET /api/mempool/hash` - * @param {{ signal?: AbortSignal, onValue?: (value: NextBlockHash) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getMempoolHash({ signal, onValue, cache } = {}) { - const path = `/api/mempool/hash`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Mempool transaction IDs - * - * Get all transaction IDs currently in the mempool. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-transaction-ids)* - * - * Endpoint: `GET /api/mempool/txids` - * @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getMempoolTxids({ signal, onValue, cache } = {}) { - const path = `/api/mempool/txids`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Recent mempool transactions - * - * Get the last 10 transactions to enter the mempool. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-recent)* - * - * Endpoint: `GET /api/mempool/recent` - * @param {{ signal?: AbortSignal, onValue?: (value: MempoolRecentTx[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getMempoolRecent({ signal, onValue, cache } = {}) { - const path = `/api/mempool/recent`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Recent RBF replacements - * - * Returns up to 25 most-recent RBF replacement trees across the whole mempool. Each entry has the same shape as `tx_rbf().replacements`. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-replacements)* - * - * Endpoint: `GET /api/v1/replacements` - * @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getReplacements({ signal, onValue, cache } = {}) { - const path = `/api/v1/replacements`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Recent full-RBF replacements - * - * Like `/api/v1/replacements`, but limited to trees where at least one predecessor was non-signaling (full-RBF). - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-fullrbf-replacements)* - * - * Endpoint: `GET /api/v1/fullrbf/replacements` - * @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getFullrbfReplacements({ signal, onValue, cache } = {}) { - const path = `/api/v1/fullrbf/replacements`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Projected next block template - * - * Bitcoin Core's `getblocktemplate` selection: full transaction bodies in GBT order with aggregate stats. The returned `hash` is an opaque content token; pass it as `` on `/api/v1/mempool/block-template/diff/{hash}` to fetch deltas instead of refetching the whole template. - * - * Endpoint: `GET /api/v1/mempool/block-template` - * @param {{ signal?: AbortSignal, onValue?: (value: BlockTemplate) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockTemplate({ signal, onValue, cache } = {}) { - const path = `/api/v1/mempool/block-template`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Block template diff since hash - * - * Delta of the projected next block since ``. `order` is the full new template in order: each entry is either a number (index into the prior template the client cached at ``) or a transaction object (new body to insert at this position). Walk `order` once to rebuild; `removed` is a convenience list of txids that left so clients can evict cached bodies. After applying, use the response `hash` as `` on the next call to keep iterating. Returns `404` when `` has aged out of server history; clients should fall back to `/api/v1/mempool/block-template`. - * - * Endpoint: `GET /api/v1/mempool/block-template/diff/{hash}` - * - * @param {NextBlockHash} hash - * @param {{ signal?: AbortSignal, onValue?: (value: BlockTemplateDiff) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getBlockTemplateDiff(hash, { signal, onValue, cache } = {}) { - const path = `/api/v1/mempool/block-template/diff/${hash}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Live BTC/USD price - * - * Returns the current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the last 12 blocks plus mempool. - * - * Endpoint: `GET /api/mempool/price` - * @param {{ signal?: AbortSignal, onValue?: (value: Dollars) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getLivePrice({ signal, onValue, cache } = {}) { - const path = `/api/mempool/price`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Live BTC/USD price - * - * Current BTC/USD price in dollars. Same value as `/api/mempool/price`. Confirmed per-height history is available at `/api/vecs/height-to-price`. - * - * Endpoint: `GET /api/oracle/price` - * @param {{ signal?: AbortSignal, onValue?: (value: Dollars) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getOraclePrice({ signal, onValue, cache } = {}) { - const path = `/api/oracle/price`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Live payment output histogram - * - * Live smoothed histogram of oracle-eligible payment outputs, binned by output value on the oracle log scale. It combines the committed oracle window with the forming mempool block. A flat array of log-scale bins. - * - * Endpoint: `GET /api/oracle/histogram/payments/live` - * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getOracleHistogramPaymentsLive({ signal, onValue, cache } = {}) { - const path = `/api/oracle/histogram/payments/live`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Payment output histogram at height or day - * - * Smoothed histogram of oracle-eligible payment outputs for a confirmed point. A block height (`840000`) gives that block's oracle payment histogram; a calendar date (`YYYY-MM-DD`) gives the average of that day's per-block payment histograms. A flat array of log-scale bins. - * - * Endpoint: `GET /api/oracle/histogram/payments/{point}` - * - * @param {string} point - * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getOracleHistogramPayments(point, { signal, onValue, cache } = {}) { - const path = `/api/oracle/histogram/payments/${point}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Live output value histogram - * - * Live unfiltered output value histogram for the forming mempool block. Every live output is binned by value on the oracle log scale; no oracle payment filters are applied. A flat array of log-scale bins, all zero when no mempool is configured. - * - * Endpoint: `GET /api/oracle/histogram/outputs/live` - * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getOracleHistogramOutputsLive({ signal, onValue, cache } = {}) { - const path = `/api/oracle/histogram/outputs/live`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Output value histogram at height or day - * - * Unfiltered output value histogram for a confirmed point. A block height (`840000`) gives every output in that block, coinbase included, binned by value on the oracle log scale; a calendar date (`YYYY-MM-DD`) sums every block that day. A flat array of log-scale bins. - * - * Endpoint: `GET /api/oracle/histogram/outputs/{point}` - * - * @param {string} point - * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getOracleHistogramOutputs(point, { signal, onValue, cache } = {}) { - const path = `/api/oracle/histogram/outputs/${point}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Txid by index - * - * Retrieve the transaction ID (txid) at a given global transaction index. Returns the txid as plain text. - * - * Endpoint: `GET /api/tx-index/{index}` - * - * @param {TxIndex} index - * @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTxByIndex(index, { signal, onValue, cache } = {}) { - const path = `/api/tx-index/${index}`; - return this.getText(path, { signal, onValue, cache }); - } - - /** - * CPFP info - * - * Returns ancestors and descendants for a CPFP (Child Pays For Parent) transaction, including the effective fee rate of the package. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-children-pay-for-parent)* - * - * Endpoint: `GET /api/v1/cpfp/{txid}` - * - * @param {Txid} txid - * @param {{ signal?: AbortSignal, onValue?: (value: CpfpInfo) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getCpfp(txid, { signal, onValue, cache } = {}) { - const path = `/api/v1/cpfp/${txid}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * RBF replacement history - * - * Returns the RBF replacement tree for a transaction, if any. Both `replacements` and `replaces` are null when the tx has no known RBF history within the mempool monitor's retention window. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-rbf-history)* - * - * Endpoint: `GET /api/v1/tx/{txid}/rbf` - * - * @param {Txid} txid - * @param {{ signal?: AbortSignal, onValue?: (value: RbfResponse) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTxRbf(txid, { signal, onValue, cache } = {}) { - const path = `/api/v1/tx/${txid}/rbf`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Transaction information - * - * Retrieve complete transaction data by transaction ID (txid). Returns inputs, outputs, fee, size, and confirmation status. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction)* - * - * Endpoint: `GET /api/tx/{txid}` - * - * @param {Txid} txid - * @param {{ signal?: AbortSignal, onValue?: (value: Transaction) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTx(txid, { signal, onValue, cache } = {}) { - const path = `/api/tx/${txid}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Transaction hex - * - * Retrieve the raw transaction as a hex-encoded string. Returns the serialized transaction in hexadecimal format. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-hex)* - * - * Endpoint: `GET /api/tx/{txid}/hex` - * - * @param {Txid} txid - * @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTxHex(txid, { signal, onValue, cache } = {}) { - const path = `/api/tx/${txid}/hex`; - return this.getText(path, { signal, onValue, cache }); - } - - /** - * Transaction merkleblock proof - * - * Get the merkleblock proof for a transaction (BIP37 format, hex encoded). - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-merkleblock-proof)* - * - * Endpoint: `GET /api/tx/{txid}/merkleblock-proof` - * - * @param {Txid} txid - * @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTxMerkleblockProof(txid, { signal, onValue, cache } = {}) { - const path = `/api/tx/${txid}/merkleblock-proof`; - return this.getText(path, { signal, onValue, cache }); - } - - /** - * Transaction merkle proof - * - * Get the merkle inclusion proof for a transaction. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-merkle-proof)* - * - * Endpoint: `GET /api/tx/{txid}/merkle-proof` - * - * @param {Txid} txid - * @param {{ signal?: AbortSignal, onValue?: (value: MerkleProof) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTxMerkleProof(txid, { signal, onValue, cache } = {}) { - const path = `/api/tx/${txid}/merkle-proof`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Output spend status - * - * Get the spending status of a transaction output. Returns whether the output has been spent and, if so, the spending transaction details. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-outspend)* - * - * Endpoint: `GET /api/tx/{txid}/outspend/{vout}` - * - * @param {Txid} txid - Transaction ID - * @param {Vout} vout - Output index - * @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTxOutspend(txid, vout, { signal, onValue, cache } = {}) { - const path = `/api/tx/${txid}/outspend/${vout}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * All output spend statuses - * - * Get the spending status of all outputs in a transaction. Returns an array with the spend status for each output. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-outspends)* - * - * Endpoint: `GET /api/tx/{txid}/outspends` - * - * @param {Txid} txid - * @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTxOutspends(txid, { signal, onValue, cache } = {}) { - const path = `/api/tx/${txid}/outspends`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Transaction raw - * - * Returns a transaction as binary data. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-raw)* - * - * Endpoint: `GET /api/tx/{txid}/raw` - * - * @param {Txid} txid - * @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTxRaw(txid, { signal, onValue, cache } = {}) { - const path = `/api/tx/${txid}/raw`; - return this.getBytes(path, { signal, onValue, cache }); - } - - /** - * Transaction status - * - * Retrieve the confirmation status of a transaction. Returns whether the transaction is confirmed and, if so, the block height, hash, and timestamp. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-status)* - * - * Endpoint: `GET /api/tx/{txid}/status` - * - * @param {Txid} txid - * @param {{ signal?: AbortSignal, onValue?: (value: TxStatus) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTxStatus(txid, { signal, onValue, cache } = {}) { - const path = `/api/tx/${txid}/status`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Transaction first-seen times - * - * Returns timestamps when transactions were first seen in the mempool. Returns 0 for mined or unknown transactions. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-times)* - * - * Endpoint: `GET /api/v1/transaction-times` - * - * @param {Txid[]} txId - Transaction IDs to look up (max 250 per request). - * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options] - * @returns {Promise} - */ - async getTransactionTimes(txId, { signal, onValue, cache } = {}) { - const params = new URLSearchParams(); - for (const _v of txId) params.append('txId[]', String(_v)); - const query = params.toString(); - const path = `/api/v1/transaction-times${query ? '?' + query : ''}`; - return this.getJson(path, { signal, onValue, cache }); - } - - /** - * Broadcast transaction - * - * Broadcast a raw transaction to the network. The transaction should be provided as hex in the request body. The txid will be returned on success. - * - * *[Mempool.space docs](https://mempool.space/docs/api/rest#post-transaction)* - * - * Endpoint: `POST /api/tx` - * - * @param {string} body - Request body - * @param {{ signal?: AbortSignal }} [options] - * @returns {Promise} - */ - async postTx(body, { signal } = {}) { - const path = `/api/tx`; - return this.postJson(path, body, { signal }); - } - - /** - * OpenAPI specification - * - * Full OpenAPI 3.1 specification for this API. - * - * Endpoint: `GET /openapi.json` - * @param {{ signal?: AbortSignal, onValue?: (value: *) => void, cache?: boolean }} [options] - * @returns {Promise<*>} - */ - async getOpenapi({ signal, onValue, cache } = {}) { - const path = `/openapi.json`; - return this.getText(path, { signal, onValue, cache }); - } - - /** - * Compact OpenAPI specification - * - * Compact OpenAPI specification optimized for LLM consumption. Removes redundant fields while preserving essential API information. Full spec available at `/openapi.json`. - * - * Endpoint: `GET /api.json` - * @param {{ signal?: AbortSignal, onValue?: (value: *) => void, cache?: boolean }} [options] - * @returns {Promise<*>} - */ - async getApi({ signal, onValue, cache } = {}) { - const path = `/api.json`; - return this.getJson(path, { signal, onValue, cache }); - } - -} - -export { BrkClient, BrkError }; diff --git a/website/scripts/modules/brk-client/jsconfig.json b/website/scripts/modules/brk-client/jsconfig.json deleted file mode 100644 index cffb39bbd..000000000 --- a/website/scripts/modules/brk-client/jsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compilerOptions": { - "checkJs": true, - "strict": true, - "target": "ESNext", - "module": "ESNext", - "skipLibCheck": true - }, - "exclude": ["dist"] -} diff --git a/website/scripts/modules/brk-client/package.json b/website/scripts/modules/brk-client/package.json deleted file mode 100644 index b5a0e8ec0..000000000 --- a/website/scripts/modules/brk-client/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "bugs": { - "url": "https://github.com/bitcoinresearchkit/brk/issues" - }, - "scripts": { - "test": "node tests/basic.js && node tests/tree.js", - "test:basic": "node tests/basic.js", - "test:tree": "node tests/tree.js" - }, - "description": "Bitcoin on-chain analytics client — thousands of metrics, block explorer, and address index", - "engines": { - "node": ">=18" - }, - "exports": { - ".": "./index.js" - }, - "files": [ - "index.js", - "generated" - ], - "homepage": "https://github.com/bitcoinresearchkit/brk/tree/main/modules/brk-client", - "keywords": [ - "brk", - "bitcoin", - "blockchain", - "research", - "on-chain", - "analytics", - "metrics", - "api", - "data", - "cryptocurrency" - ], - "license": "MIT", - "main": "index.js", - "name": "brk-client", - "repository": { - "directory": "modules/brk-client", - "type": "git", - "url": "git+https://github.com/bitcoinresearchkit/brk.git" - }, - "type": "module", - "version": "0.3.1" -} diff --git a/website/scripts/modules/brk-client/tests/basic.js b/website/scripts/modules/brk-client/tests/basic.js deleted file mode 100644 index 3dbe83b4a..000000000 --- a/website/scripts/modules/brk-client/tests/basic.js +++ /dev/null @@ -1,66 +0,0 @@ -import { BrkClient } from "../index.js"; - -const client = new BrkClient("http://localhost:3110"); - -console.log("Testing idiomatic API...\n"); - -// Test getter access (property) -console.log("1. Getter access (.by.dateindex):"); -const all = await client.series.prices.split.close.usd.by.day1; -console.log(` Got: ${all.data.length} items\n`); - -// Test dynamic access (bracket notation) -console.log("2. Dynamic access (.by['dateindex']):"); -const allDynamic = await client.series.prices.split.close.usd.by.day1; -console.log(` Got: ${allDynamic.data.length} items\n`); - -// Test fetch all (explicit .fetch()) -console.log("3. Explicit .fetch():"); -const allExplicit = await client.series.prices.split.close.usd.by.day1.fetch(); -console.log(` Got: ${allExplicit.data.length} items\n`); - -// Test first(n) -console.log("4. First 5 items (.first(5)):"); -const first5 = await client.series.prices.split.close.usd.by.day1.first(5); -console.log( - ` Start: ${first5.start}, End: ${first5.end}, Got: ${first5.data.length} items\n`, -); - -// Test last(n) -console.log("5. Last 5 items (.last(5)):"); -const last5 = await client.series.prices.split.close.usd.by.day1.last(5); -console.log( - ` Start: ${last5.start}, End: ${last5.end}, Got: ${last5.data.length} items\n`, -); - -// Test slice(start, end) -console.log("6. Slice 10-20 (.slice(10, 20)):"); -const sliced = await client.series.prices.split.close.usd.by.day1.slice(10, 20); -console.log( - ` Start: ${sliced.start}, End: ${sliced.end}, Got: ${sliced.data.length} items\n`, -); - -// Test get(index) - single item -console.log("7. Single item (.get(100)):"); -const single = await client.series.prices.split.close.usd.by.day1.get(100); -console.log( - ` Start: ${single.start}, End: ${single.end}, Got: ${single.data.length} item(s)\n`, -); - -// Test skip(n).take(m) chaining -console.log("8. Skip and take (.skip(100).take(10)):"); -const skipTake = await client.series.prices.split.close.usd.by.day1 - .skip(100) - .take(10); -console.log( - ` Start: ${skipTake.start}, End: ${skipTake.end}, Got: ${skipTake.data.length} items\n`, -); - -// Test fetchCsv -console.log("9. Fetch as CSV (.last(3).fetchCsv()):"); -const csv = await client.series.prices.split.close.usd.by.day1 - .last(3) - .fetchCsv(); -console.log(` CSV preview: ${csv.substring(0, 100)}...\n`); - -console.log("All tests passed!"); diff --git a/website/scripts/modules/brk-client/tests/consistency.js b/website/scripts/modules/brk-client/tests/consistency.js deleted file mode 100644 index 5014f534d..000000000 --- a/website/scripts/modules/brk-client/tests/consistency.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Consistency test: verifies that all series sharing the same index have the same length. - * Useful for catching stale/inconsistent state after a reorg rollback. - */ - -import { BrkClient } from "../index.js"; - -/** - * @typedef {import('../index.js').AnySeriesPattern} AnyMetricPattern - */ - -/** - * @param {any} obj - * @returns {obj is AnyMetricPattern} - */ -function isMetricPattern(obj) { - return ( - obj && - typeof obj === "object" && - typeof obj.indexes === "function" && - obj.by && - typeof obj.by === "object" - ); -} - -/** - * Recursively collect all metric patterns from the tree. - * @param {Record} obj - * @param {string} path - * @returns {Array<{path: string, metric: AnyMetricPattern}>} - */ -function getAllMetrics(obj, path = "") { - /** @type {Array<{path: string, metric: AnyMetricPattern}>} */ - const metrics = []; - - for (const key of Object.keys(obj)) { - const attr = obj[key]; - if (!attr || typeof attr !== "object") continue; - - const currentPath = path ? `${path}.${key}` : key; - - if (isMetricPattern(attr)) { - metrics.push({ path: currentPath, metric: attr }); - } - - if (typeof attr === "object" && !Array.isArray(attr)) { - metrics.push(...getAllMetrics(attr, currentPath)); - } - } - - return metrics; -} - -async function testConsistency() { - const client = new BrkClient({ - baseUrl: "http://localhost:3110", - timeout: 15000, - }); - - const metrics = getAllMetrics(client.series); - console.log(`\nFound ${metrics.length} metrics`); - - /** @type {Map>} */ - const byIndex = new Map(); - - for (const { path, metric } of metrics) { - const indexes = metric.indexes(); - - for (const idxName of indexes) { - const fullPath = `${path}.by.${idxName}`; - const endpoint = metric.by[idxName]; - - if (!endpoint) { - console.log(`SKIP: ${fullPath} (undefined endpoint)`); - continue; - } - - try { - const result = await endpoint.last(0); - const total = result.end; - - if (!byIndex.has(idxName)) { - byIndex.set(idxName, []); - } - /** @type {Array<{path: string, total: number}>} */ (byIndex.get(idxName)).push({ path: fullPath, total }); - } catch (e) { - console.log( - `FAIL: ${fullPath} -> ${e instanceof Error ? e.message : e}`, - ); - return; - } - } - } - - let failed = false; - - for (const [index, entries] of byIndex) { - const totals = new Set(entries.map((e) => e.total)); - - if (totals.size === 1) { - const [total] = totals; - console.log(`OK: ${index} — ${entries.length} series, all length ${total}`); - continue; - } - - failed = true; - console.log(`\nMISMATCH: ${index} — ${entries.length} series with ${totals.size} different lengths:`); - - /** @type {Map} */ - const grouped = new Map(); - for (const { path, total } of entries) { - if (!grouped.has(total)) grouped.set(total, []); - /** @type {string[]} */ (grouped.get(total)).push(path); - } - - for (const [total, paths] of [...grouped].sort((a, b) => b[0] - a[0])) { - console.log(` length ${total}: (${paths.length} series)`); - for (const p of paths) { - console.log(` ${p}`); - } - } - } - - if (failed) { - console.log("\nFAILED: length mismatches detected"); - throw new Error("length mismatches detected"); - } else { - console.log("\nPASSED: all indexes consistent"); - } -} - -testConsistency(); diff --git a/website/scripts/modules/brk-client/tests/metric_data.js b/website/scripts/modules/brk-client/tests/metric_data.js deleted file mode 100644 index d8497af5a..000000000 --- a/website/scripts/modules/brk-client/tests/metric_data.js +++ /dev/null @@ -1,248 +0,0 @@ -/** - * Tests for MetricData helper methods and date conversion functions. - * Run: node tests/metric_data.js - */ - -import { BrkClient } from "../index.js"; - -const client = new BrkClient("http://localhost:3110"); - -console.log("Testing MetricData helpers...\n"); - -// Fetch a date-based metric -console.log("1. Fetching price data (day1):"); -const price = await client.series.prices.split.close.usd.by.day1.first(5); -console.log(` Start: ${price.start}, End: ${price.end}`); - -// Test isDateBased -console.log("\n2. isDateBased:"); -if (!price.isDateBased) throw new Error("day1 should be date-based"); -console.log(` day1: ${price.isDateBased}`); - -// Test indexes() - always returns numbers -console.log("\n3. indexes():"); -const indexes = price.indexes(); -console.log(` ${JSON.stringify(indexes)}`); -if (indexes.length !== 5) throw new Error("Expected 5 indexes"); -if (indexes[0] !== price.start) - throw new Error("First index should equal start"); - -// Test dates() - DateMetricData method -console.log("\n4. dates():"); -const dates = price.dates(); -console.log( - ` First: ${dates[0].toISOString()}, Last: ${dates[dates.length - 1].toISOString()}`, -); -if (dates.length !== 5) throw new Error("Expected 5 dates"); -// DateIndex 0 = Jan 3, 2009 (genesis) -if ( - dates[0].getFullYear() !== 2009 || - dates[0].getMonth() !== 0 || - dates[0].getDate() !== 3 -) { - throw new Error( - `Expected genesis date (2009-01-03), got ${dates[0].toISOString()}`, - ); -} - -// Test keys() - always returns numbers (alias for indexes) -console.log("\n5. keys():"); -const keys = price.keys(); -if (keys.length !== 5) throw new Error("Expected 5 keys"); -if (typeof keys[0] !== "number") throw new Error("Expected number keys"); -console.log(` Length: ${keys.length}, First: ${keys[0]}`); - -// Test entries() - returns [number, value] pairs -console.log("\n6. entries():"); -const entries = price.entries(); -if (typeof entries[0][0] !== "number") - throw new Error("Expected number entry key"); -console.log(` First: [${entries[0][0]}, ${entries[0][1]}]`); -if (entries[0][1] !== price.data[0]) - throw new Error("First entry value mismatch"); - -// Test dateEntries() - DateMetricData method, returns [Date, value] pairs -console.log("\n7. dateEntries():"); -const dateEntries = price.dateEntries(); -if (!(dateEntries[0][0] instanceof Date)) - throw new Error("Expected Date entry key"); -console.log( - ` First: [${dateEntries[0][0].toISOString()}, ${dateEntries[0][1]}]`, -); - -// Test toMap() - returns Map -console.log("\n8. toMap():"); -const map = price.toMap(); -console.log(` Size: ${map.size}`); -if (map.size !== 5) throw new Error("Expected map size 5"); - -// Test toDateMap() - DateMetricData method -console.log("\n9. toDateMap():"); -const dateMap = price.toDateMap(); -console.log(` Size: ${dateMap.size}`); -if (dateMap.size !== 5) throw new Error("Expected date map size 5"); - -// Test Symbol.iterator (for...of) - yields [number, value] -console.log("\n10. for...of iteration:"); -let count = 0; -for (const [key, _val] of price) { - if (count === 0 && typeof key !== "number") - throw new Error("Expected number keys in iteration"); - count++; -} -console.log(` Iterated ${count} items`); -if (count !== 5) throw new Error("Expected 5 iterations"); - -// Test with non-date-based index (height) -console.log("\n11. Testing height-based metric:"); -const heightMetric = await client.series.prices.spot.usd.by.height.last(3); -console.log(` Start: ${heightMetric.start}, End: ${heightMetric.end}`); -if (heightMetric.isDateBased) - throw new Error("height should not be date-based"); - -// Test keys() - always numbers -const heightKeys = heightMetric.keys(); -console.log(` keys(): ${JSON.stringify(heightKeys)}`); -if (typeof heightKeys[0] !== "number") - throw new Error("Expected number keys for height"); - -// Test entries() - [number, value] -const heightEntries = heightMetric.entries(); -console.log( - ` entries()[0]: [${heightEntries[0][0]}, ${heightEntries[0][1]}]`, -); -if (heightEntries[0][0] !== heightMetric.start) - throw new Error("First entry index mismatch"); - -// Test toMap() - Map -const heightMap = heightMetric.toMap(); -if (heightMap.size !== 3) throw new Error("Expected map size 3"); -if (heightMap.get(heightMetric.start) !== heightMetric.data[0]) - throw new Error("First value mismatch"); - -// Test for...of on non-date metric -console.log("\n12. for...of iteration (height):"); -let heightCount = 0; -for (const [key, _val] of heightMetric) { - if (heightCount === 0 && typeof key !== "number") - throw new Error("Expected number keys for height iteration"); - heightCount++; -} -console.log(` Iterated ${heightCount} items`); - -// Test different date indexes -console.log("\n13. Testing month1:"); -const monthMetric = - await client.series.prices.split.close.usd.by.month1.first(3); -const monthDates = monthMetric.dates(); -console.log(` First month: ${monthDates[0].toISOString()}`); -// MonthIndex 0 = Jan 1, 2009 -if ( - monthDates[0].getFullYear() !== 2009 || - monthDates[0].getMonth() !== 0 || - monthDates[0].getDate() !== 1 -) { - throw new Error(`Expected 2009-01-01, got ${monthDates[0].toISOString()}`); -} - -// Test indexToDate directly -console.log("\n14. Testing indexToDate():"); -const genesis = client.indexToDate("day1", 0); -if ( - genesis.getFullYear() !== 2009 || - genesis.getMonth() !== 0 || - genesis.getDate() !== 3 -) { - throw new Error(`Expected genesis 2009-01-03, got ${genesis.toISOString()}`); -} -const dayOne = client.indexToDate("day1", 1); -if ( - dayOne.getFullYear() !== 2009 || - dayOne.getMonth() !== 0 || - dayOne.getDate() !== 9 -) { - throw new Error(`Expected day one 2009-01-09, got ${dayOne.toISOString()}`); -} -console.log(` day1 0: ${genesis.toISOString()}`); -console.log(` day1 1: ${dayOne.toISOString()}`); - -// Test week1 -const week0 = client.indexToDate("week1", 0); -const week1 = client.indexToDate("week1", 1); -if (week0.getTime() !== genesis.getTime()) - throw new Error("week1 0 should equal genesis"); -console.log(` week1 0: ${week0.toISOString()}`); -console.log(` week1 1: ${week1.toISOString()}`); - -// Test year1 -const year0 = client.indexToDate("year1", 0); -const year1 = client.indexToDate("year1", 1); -if ( - year0.getFullYear() !== 2009 || - year0.getMonth() !== 0 || - year0.getDate() !== 1 -) { - throw new Error(`Expected 2009-01-01, got ${year0.toISOString()}`); -} -if (year1.getFullYear() !== 2010) throw new Error("year1 1 should be 2010"); -console.log(` year1 0: ${year0.toISOString()}`); -console.log(` year1 1: ${year1.toISOString()}`); - -// Test month3 -const q0 = client.indexToDate("month3", 0); -const q1 = client.indexToDate("month3", 1); -if (q0.getMonth() !== 0) throw new Error("month3 0 should be January"); -if (q1.getMonth() !== 3) throw new Error("month3 1 should be April"); -console.log(` month3 0: ${q0.toISOString()}`); -console.log(` month3 1: ${q1.toISOString()}`); - -// Test month6 -const s0 = client.indexToDate("month6", 0); -const s1 = client.indexToDate("month6", 1); -if (s0.getMonth() !== 0) throw new Error("month6 0 should be January"); -if (s1.getMonth() !== 6) throw new Error("month6 1 should be July"); -console.log(` month6 0: ${s0.toISOString()}`); -console.log(` month6 1: ${s1.toISOString()}`); - -// Test year10 -const d0 = client.indexToDate("year10", 0); -const d1 = client.indexToDate("year10", 1); -if (d0.getFullYear() !== 2009) throw new Error("year10 0 should be 2009"); -if (d1.getFullYear() !== 2019) throw new Error("year10 1 should be 2019"); -console.log(` year10 0: ${d0.toISOString()}`); -console.log(` year10 1: ${d1.toISOString()}`); - -// Test dateToIndex -console.log("\n15. Testing dateToIndex():"); -const idx = client.dateToIndex("day1", new Date(Date.UTC(2009, 0, 9))); -if (idx !== 1) throw new Error(`Expected day1 index 1, got ${idx}`); -console.log(` day1 2009-01-09: ${idx}`); - -const monthIdx = client.dateToIndex("month1", new Date(Date.UTC(2010, 0, 1))); -if (monthIdx !== 12) - throw new Error(`Expected month1 index 12, got ${monthIdx}`); -console.log(` month1 2010-01-01: ${monthIdx}`); - -const yearIdx = client.dateToIndex("year1", new Date(Date.UTC(2019, 0, 1))); -if (yearIdx !== 10) throw new Error(`Expected year1 index 10, got ${yearIdx}`); -console.log(` year1 2019-01-01: ${yearIdx}`); - -// Test roundtrip: indexToDate -> dateToIndex -const testDate = client.indexToDate("day1", 100); -const roundtrip = client.dateToIndex("day1", testDate); -if (roundtrip !== 100) - throw new Error(`Roundtrip failed: expected 100, got ${roundtrip}`); -console.log(` Roundtrip day1 100: ${testDate.toISOString()} -> ${roundtrip}`); - -// Test slice with Date -console.log("\n16. Testing slice with Date:"); -const dateSlice = await client.series.prices.split.close.usd.by.day1 - .slice(new Date(Date.UTC(2020, 0, 1)), new Date(Date.UTC(2020, 0, 4))) - .fetch(); -console.log( - ` Slice start: ${dateSlice.start}, end: ${dateSlice.end}, items: ${dateSlice.data.length}`, -); -if (dateSlice.data.length !== dateSlice.end - dateSlice.start) - throw new Error("Slice data length mismatch"); - -console.log("\nAll MetricData tests passed!"); diff --git a/website/scripts/modules/brk-client/tests/tree.js b/website/scripts/modules/brk-client/tests/tree.js deleted file mode 100644 index 03914f71a..000000000 --- a/website/scripts/modules/brk-client/tests/tree.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Comprehensive test that fetches all endpoints in the tree. - */ - -import { BrkClient } from "../index.js"; - -/** - * @typedef {import('../index.js').AnySeriesPattern} AnyMetricPattern - */ - -/** - * Check if an object is a metric pattern (has indexes() method and by object). - * @param {any} obj - * @returns {obj is AnyMetricPattern} - */ -function isMetricPattern(obj) { - return ( - obj && - typeof obj === "object" && - typeof obj.indexes === "function" && - obj.by && - typeof obj.by === "object" - ); -} - -/** - * Recursively collect all metric patterns from the tree. - * @param {Record} obj - * @param {string} path - * @returns {Array<{path: string, metric: AnyMetricPattern}>} - */ -function getAllMetrics(obj, path = "") { - /** @type {Array<{path: string, metric: AnyMetricPattern}>} */ - const metrics = []; - - for (const key of Object.keys(obj)) { - const attr = obj[key]; - if (!attr || typeof attr !== "object") continue; - - const currentPath = path ? `${path}.${key}` : key; - - // Check if this is a metric pattern using the indexes() method - if (isMetricPattern(attr)) { - metrics.push({ path: currentPath, metric: attr }); - } - - // Recurse into nested tree nodes - if (typeof attr === "object" && !Array.isArray(attr)) { - metrics.push(...getAllMetrics(attr, currentPath)); - } - } - - return metrics; -} - -async function testAllEndpoints() { - const client = new BrkClient({ - baseUrl: "http://localhost:3110", - timeout: 15000, - }); - - const metrics = getAllMetrics(client.series); - console.log(`\nFound ${metrics.length} metrics`); - - let success = 0; - - for (const { path, metric } of metrics) { - // Use the indexes() method to get all available indexes - const indexes = metric.indexes(); - - for (const idxName of indexes) { - const fullPath = `${path}.by.${idxName}`; - - try { - // Verify both access methods work: .by[index] and .get(index) - const endpointByProperty = metric.by[idxName]; - const endpointByGet = metric.get(idxName); - - if (!endpointByProperty) { - throw new Error(`metric.by.${idxName} is undefined`); - } - if (!endpointByGet) { - throw new Error(`metric.get('${idxName}') returned undefined`); - } - - await endpointByProperty.last(0); - success++; - console.log(`OK: ${fullPath}`); - } catch (e) { - console.log( - `FAIL: ${fullPath} -> ${e instanceof Error ? e.message : e}`, - ); - return; - } - } - } - - console.log(`\n=== Results ===`); - console.log(`Success: ${success}`); -} - -testAllEndpoints(); diff --git a/website/scripts/modules/brk-client/tsconfig.json b/website/scripts/modules/brk-client/tsconfig.json deleted file mode 100644 index 6ac44303e..000000000 --- a/website/scripts/modules/brk-client/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "strict": true, - "target": "ESNext", - "module": "ESNext", - "outDir": "/tmp/brk", - "lib": ["DOM", "DOM.Iterable", "ESNext", "WebWorker"], - "skipLibCheck": true - }, - "exclude": ["dist", "tests"] -} diff --git a/website/scripts/modules/lean-qr/.gitignore b/website/scripts/modules/lean-qr/.gitignore deleted file mode 100644 index a6c7c2852..000000000 --- a/website/scripts/modules/lean-qr/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.js diff --git a/website/scripts/modules/lean-qr/2.7.1/index.d.ts b/website/scripts/modules/lean-qr/2.7.1/index.d.ts deleted file mode 100644 index e5856704e..000000000 --- a/website/scripts/modules/lean-qr/2.7.1/index.d.ts +++ /dev/null @@ -1,653 +0,0 @@ -declare module 'lean-qr' { - interface ImageDataLike { - readonly data: Uint8ClampedArray; - } - - interface Context2DLike { - createImageData(width: number, height: number): DataT; - putImageData(data: DataT, x: number, y: number): void; - } - - interface CanvasLike { - width: number; - height: number; - getContext(type: '2d'): Context2DLike | null; - } - - /** - * A colour in `[red, green, blue, alpha]` format (all values from 0 to 255). - * If alpha is omitted, it is assumed to be 255 (opaque). - */ - export type RGBA = readonly [number, number, number, number?]; - - export interface Bitmap1D { - /** - * Appends a sequence of bits. - * - * @param value an integer containing the bits to append (big endian). - * @param bits the number of bits to read from `value`. Must be between 1 and 24. - */ - push(value: number, bits: number): void; - } - - export interface StringOptions { - /** the text to use for modules which are 'on' (typically black) */ - on?: string; - - /** the text to use for modules which are 'off' (typically white) */ - off?: string; - - /** the text to use for linefeeds between rows */ - lf?: string; - - /** the padding to apply around the output (populated with 'off' modules) */ - pad?: number; - - /** - * the padding to apply on the left and right of the output (populated with 'off' modules) - * @deprecated use `pad` instead - */ - padX?: number; - - /** - * the padding to apply on the top and bottom of the output (populated with 'off' modules) - * @deprecated use `pad` instead - */ - padY?: number; - } - - export interface ImageDataOptions { - /** the colour to use for modules which are 'on' (typically black) */ - on?: RGBA; - - /** the colour to use for modules which are 'off' (typically white) */ - off?: RGBA; - - /** the padding to apply around the output (filled with 'off') */ - pad?: number; - - /** - * the padding to apply on the left and right of the output (filled with 'off') - * @deprecated use `pad` instead - */ - padX?: number; - - /** - * the padding to apply on the top and bottom of the output (filled with 'off') - * @deprecated use `pad` instead - */ - padY?: number; - } - - export interface Bitmap2D { - /** the width / height of the QR code in modules (excluding any padding) */ - readonly size: number; - - /** - * Read the state of a module from the QR code. - * - * @param x the x coordinate to read. Can be negative / out of bounds. - * @param y the y coordinate to read. Can be negative / out of bounds. - * @returns true if the requested module is set (i.e. typically black) - */ - get(x: number, y: number): boolean; - - /** - * Generate a string containing the QR code, suitable for displaying in a - * terminal environment. Generally, you should customise on and off to use - * the ANSI escapes of your target terminal for better rendering. - * - * @param options optional configuration for the display. - */ - toString(options?: Readonly): string; - - /** - * Generate image data containing the QR code, at a scale of 1 pixel per - * module. Use this if you need more control than toCanvas allows. - * - * @param context a context to use for creating the image data. - * @param options optional configuration for the display. - */ - toImageData( - context: Context2DLike, - options?: Readonly, - ): DataT; - - /** - * Generate a `data:image/*` URL for the QR code. - * - * @param options optional configuration for the output. - * @returns a string suitable for use as the `src` of an `img` tag. - */ - toDataURL( - options?: Readonly< - ImageDataOptions & { - type?: `image/${string}`; - scale?: number; - } - >, - ): string; - - /** - * Populate a given canvas with the QR code, at a scale of 1 pixel per - * module. Set image-rendering: pixelated and scale the canvas using CSS - * for a large image. Automatically resizes the canvas to fit the QR code - * if necessary. - * - * @param canvas the canvas to populate. - * @param options optional configuration for the display. - */ - toCanvas( - canvas: CanvasLike, - options?: Readonly, - ): void; - } - - export type Mask = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; - export type Mode = (data: Bitmap1D, version: number) => void; - export interface ModeFactory { - (value: string): Mode; - /** a function which returns true when given a character which the current mode can represent */ - test(string: string): boolean; - /** a function which returns an estimate of the number of bits required to encode a given value */ - est(value: string, version: number): number; - /** an optional ECI which must be active for this mode to be interpreted correctly by a reader */ - eci?: number; - } - - interface ModeAutoOptions { - /** a list of modes which can be considered when encoding a message */ - modes?: ReadonlyArray; - } - - export const mode: Readonly<{ - /** automatically picks the most optimal combination of modes for the requested message */ - auto(value: string, options?: Readonly): Mode; - /** concatenates multiple modes together */ - multi(...modes: ReadonlyArray): Mode; - /** sets the Extended Channel Interpretation for the message from this point onwards */ - eci(id: number): Mode; - /** supports `0-9` and stores 3 characters per 10 bits */ - numeric: ModeFactory; - /** supports `0-9A-Z $%*+-./:` and stores 2 characters per 11 bits */ - alphaNumeric: ModeFactory; - /** arbitrary byte data, typically combined with `eci` */ - bytes(data: Uint8Array | ReadonlyArray): Mode; - /** supports 7-bit ASCII and stores 1 character per 8 bits with no ECI */ - ascii: ModeFactory; - /** supports 8-bit ISO-8859-1 and stores 1 character per 8 bits with ECI 3 */ - iso8859_1: ModeFactory; - /** supports double-byte Shift-JIS characters stores 1 character per 13 bits */ - shift_jis: ModeFactory; - /** supports variable length UTF-8 with ECI 26 */ - utf8: ModeFactory; - }>; - - export type Correction = number & { readonly _: unique symbol }; - export const correction: Readonly<{ - /** - * minimum possible correction level (same as L) - * @deprecated use correction.L - */ - min: Correction; - /** ~7.5% error tolerance, ~25% data overhead */ - L: Correction; - /** ~15% error tolerance, ~60% data overhead */ - M: Correction; - /** ~22.5% error tolerance, ~120% data overhead */ - Q: Correction; - /** ~30% error tolerance, ~190% data overhead */ - H: Correction; - /** - * maximum possible correction level (same as H) - * @deprecated use correction.H - */ - max: Correction; - }>; - - export interface GenerateOptions extends ModeAutoOptions { - /** the minimum correction level to use (higher levels may still be used if the chosen version has space) */ - minCorrectionLevel?: Correction; - /** the maximum correction level to use */ - maxCorrectionLevel?: Correction; - /** the minimum version (size) of code to generate (must be between 1 and 40) */ - minVersion?: number; - /** the maximum version (size) of code to generate (must be between 1 and 40) */ - maxVersion?: number; - /** a mask to use on the QR code (should be left as `null` for ISO compliance but may be changed for artistic effect) */ - mask?: null | Mask; - /** padding bits to use for extra space in the QR code (should be left as the default for ISO compliance but may be changed for artistic effect) */ - trailer?: number; - } - - /** - * Generate a QR code. - * - * @param data either a string, or a pre-encoded mode. - * @param options optional configuration for the QR code. - * @returns the requested QR code. - */ - export type GenerateFn = ( - data: Mode | string, - options?: Readonly, - ) => Bitmap2D; - interface Generate extends GenerateFn { - /** - * Creates a scoped `generate` function which considers additional modes - * when using auto encoding. - * - * @param modes the modes to add. - * @returns a `generate` function which will additionally consider the - * given modes when using auto encoding. - * - * @deprecated this will be removed in version 3. Prefer passing an explicit list of modes when calling `generate`. - */ - with(...modes: ReadonlyArray): GenerateFn; - } - export const generate: Generate; -} - -declare module 'lean-qr/nano' { - import type { - Correction, - Bitmap2D as FullBitmap2D, - GenerateOptions as FullGenerateOptions, - } from 'lean-qr'; - import { correction as fullCorrection } from 'lean-qr'; - - export type { Correction }; - - export const correction: Pick; - - export type Bitmap2D = Pick; - - export type GenerateOptions = Pick< - FullGenerateOptions, - 'minCorrectionLevel' | 'minVersion' - >; - - /** - * Generate a QR code. - * - * @param data either a string, or a pre-encoded mode. - * @param options optional configuration for the QR code. - * @returns the requested QR code. - */ - export function generate( - data: string, - options?: Readonly, - ): Bitmap2D; -} - -declare module 'lean-qr/extras/svg' { - import type { Bitmap2D as FullBitmap2D } from 'lean-qr'; - - type Bitmap2D = Pick; - - export interface SVGOptions { - /** the colour to use for modules which are 'on' (typically black) */ - on?: string; - /** the colour to use for modules which are 'off' (typically white) */ - off?: string; - /** the padding to apply around the output (filled with 'off') */ - pad?: number; - /** - * the padding to apply on the left and right of the output (filled with 'off') - * @deprecated use `pad` instead - */ - padX?: number; - /** - * the padding to apply on the top and bottom of the output (filled with 'off') - * @deprecated use `pad` instead - */ - padY?: number; - /** a width to apply to the resulting image (overrides `scale`) */ - width?: number | null; - /** a height to apply to the resulting image (overrides `scale`) */ - height?: number | null; - /** a scale to apply to the resulting image (`scale` pixels = 1 module) */ - scale?: number; - } - - /** - * Generate the raw outline of the QR code for use in an existing SVG. - * - * @param code the QR code to convert. - * @returns a string suitable for passing to the `d` attribute of a `path`. - */ - export function toSvgPath(code: Bitmap2D): string; - - /** - * Generate an SVG element which can be added to the DOM. - * - * @param code the QR code to convert. - * @param options optional configuration for the display. - * @returns an SVG element. - */ - export function toSvg( - code: Bitmap2D, - target: Document | SVGElement, - options?: Readonly, - ): SVGElement; - - /** - * Generate an SVG document which can be exported to a file or served from a - * web server. - * - * @param code the QR code to convert. - * @param options optional configuration for the display. - * @returns an SVG document. - */ - export function toSvgSource( - code: Bitmap2D, - options?: Readonly< - SVGOptions & { - /** `true` to include an XML declaration at the start of the source (for standalone documents which will not be embedded inside another document) */ - xmlDeclaration?: boolean; - } - >, - ): string; - - /** - * Generate a `data:image/svg+xml` URL. - * - * @param code the QR code to convert. - * @param options optional configuration for the display. - * @returns a string suitable for use as the `src` of an `img` tag. - */ - export function toSvgDataURL( - code: Bitmap2D, - options?: Readonly, - ): string; -} - -declare module 'lean-qr/extras/node_export' { - import type { RGBA, Bitmap2D as FullBitmap2D } from 'lean-qr'; - - type Bitmap2D = Pick; - - export interface PNGOptions { - /** the colour to use for modules which are 'on' (typically black) */ - on?: RGBA; - /** the colour to use for modules which are 'off' (typically white) */ - off?: RGBA; - /** the padding to apply around the output (filled with 'off') */ - pad?: number; - /** - * the padding to apply on the left and right of the output (filled with 'off') - * @deprecated use `pad` instead - */ - padX?: number; - /** - * the padding to apply on the top and bottom of the output (filled with 'off') - * @deprecated use `pad` instead - */ - padY?: number; - /** a scale to apply to the resulting image (`scale` pixels = 1 module) */ - scale?: number; - } - - /** - * Generate a PNG document which can be exported to a file or served from a - * web server. - * - * @param code the QR code to convert. - * @param options optional configuration for the display. - * @returns a PNG document. - */ - export function toPngBuffer( - code: Bitmap2D, - options?: Readonly, - ): Uint8Array; - - /** - * Generate a `data:image/png` URL. - * - * @param code the QR code to convert. - * @param options optional configuration for the display. - * @returns a string suitable for use as the `src` of an `img` tag. - */ - export function toPngDataURL( - code: Bitmap2D, - options?: Readonly, - ): string; -} - -declare module 'lean-qr/extras/react' { - import type { - Bitmap2D as FullBitmap2D, - GenerateOptions, - ImageDataOptions, - } from 'lean-qr'; - import type { - SVGOptions, - toSvgDataURL as toSvgDataURLFn, - } from 'lean-qr/extras/svg'; - - export interface AsyncFramework { - createElement: ( - type: 'canvas', - props: { - ref: any; - style: { imageRendering: 'pixelated' }; - className: string; - }, - ) => T; - useRef(initialValue: T | null): { readonly current: T | null }; - useEffect(fn: () => void | (() => void), deps: unknown[]): void; - } - - interface QRComponentProps { - content: string; - className?: string; - } - - export interface AsyncQRComponentProps - extends ImageDataOptions, - GenerateOptions, - QRComponentProps {} - - export type AsyncQRComponent = ( - props: Readonly, - ) => T; - - /** - * Generate an asynchronous QR component (rendering to a `canvas`). - * You should call this just once, in the global scope. - * - * ```js - * import * as React from 'react'; - * import { generate } from 'lean-qr'; - * import { makeAsyncComponent } from 'lean-qr/extras/react'; - * const QR = makeAsyncComponent(React, generate); - * ``` - * - * This is not suitable for server-side rendering (use `makeSyncComponent` - * instead). - * - * @param framework the framework to use (e.g. `React`). - * @param generate the `generate` function to use - * (from `lean-qr` or `lean-qr/nano`). - * @param defaultProps optional default properties to apply when the - * component is used (overridden by properties set on use). - * @returns a component which can be rendered elsewhere. - */ - export function makeAsyncComponent( - framework: Readonly>, - generate: ( - data: string, - options?: Readonly, - ) => Pick, - defaultProps?: Readonly>, - ): AsyncQRComponent; - - export interface SyncFramework { - createElement: ( - type: 'img', - props: { - src: string; - style: { imageRendering: 'pixelated' }; - className: string; - }, - ) => T; - useMemo(fn: () => T, deps: unknown[]): T; - } - - export interface SyncQRComponentProps - extends SVGOptions, - GenerateOptions, - QRComponentProps {} - - export type SyncQRComponent = (props: Readonly) => T; - - /** - * Generate a synchronous QR component (rendering to an SVG). - * You should call this just once, in the global scope. - * - * ```js - * import * as React from 'react'; - * import { generate } from 'lean-qr'; - * import { toSvgDataURL } from 'lean-qr/extras/svg'; - * import { makeSyncComponent } from 'lean-qr/extras/react'; - * const QR = makeSyncComponent(React, generate, toSvgDataURL); - * ``` - * - * This is best suited for server-side rendering (prefer - * `makeAsyncComponent` if you only need client-side rendering). - * - * @param framework the framework to use (e.g. `React`). - * @param generate the `generate` function to use - * (from `lean-qr` or `lean-qr/nano`). - * @param toSvgDataURL the `toSvgDataURL` function to use - * (from `lean-qr/extras/svg`). - * @param defaultProps optional default properties to apply when the - * component is used (overridden by properties set on use). - * @returns a component which can be rendered elsewhere. - */ - export function makeSyncComponent( - framework: Readonly>, - generate: ( - data: string, - options?: Readonly, - ) => Pick, - toSvgDataURL: typeof toSvgDataURLFn, - defaultProps?: Readonly>, - ): SyncQRComponent; -} - -declare module 'lean-qr/extras/vue' { - import type { - Bitmap2D as FullBitmap2D, - GenerateOptions, - ImageDataOptions, - } from 'lean-qr'; - import type { - SVGOptions, - toSvgDataURL as toSvgDataURLFn, - } from 'lean-qr/extras/svg'; - - export interface Framework { - h: - | ((type: 'canvas', props: { ref: string; style: string }) => unknown) - | ((type: 'img', props: { src: string; style: string }) => unknown); - } - - interface QRComponentProps { - content: string; - } - - export interface VueCanvasComponentProps - extends ImageDataOptions, - GenerateOptions, - QRComponentProps {} - - type VueComponentDefinition = { - props: { - [k in keyof Props]-?: { - type: { (): Required[k] }; - required: undefined extends Props[k] ? false : true; - }; - }; - } & ThisType; - - /** - * Generate a QR component which renders to a `canvas`. - * You should call this just once, in the global scope. - * - * ```js - * import { h, defineComponent } from 'vue'; - * import { generate } from 'lean-qr'; - * import { makeVueCanvasComponent } from 'lean-qr/extras/vue'; - * export const QR = defineComponent(makeVueCanvasComponent({ h }, generate)); - * ``` - * - * This is not suitable for server-side rendering (use `makeSyncComponent` - * instead). - * - * @param framework the framework to use (e.g. `{ h }`). - * @param generate the `generate` function to use - * (from `lean-qr` or `lean-qr/nano`). - * @param defaultProps optional default properties to apply when the - * component is used (overridden by properties set on use). - * @returns a component which can be rendered elsewhere. - */ - export function makeVueCanvasComponent( - framework: Readonly, - generate: ( - data: string, - options?: Readonly, - ) => Pick, - defaultProps?: Readonly>, - ): VueComponentDefinition; - - export interface VueSVGComponentProps - extends SVGOptions, - GenerateOptions, - QRComponentProps {} - - /** - * Generate a QR component which renders to an SVG. - * You should call this just once, in the global scope: - * - * ```js - * import { h, defineComponent } from 'vue'; - * import { generate } from 'lean-qr'; - * import { toSvgDataURL } from 'lean-qr/extras/svg'; - * import { makeVueSvgComponent } from 'lean-qr/extras/vue'; - * export const QR = defineComponent(makeVueSvgComponent({ h }, generate, toSvgDataURL)); - * ``` - * - * This is best suited for server-side rendering (prefer - * `makeAsyncComponent` if you only need client-side rendering). - * - * @param framework the framework to use (e.g. `{ h }`). - * @param generate the `generate` function to use - * (from `lean-qr` or `lean-qr/nano`). - * @param toSvgDataURL the `toSvgDataURL` function to use - * (from `lean-qr/extras/svg`). - * @param defaultProps optional default properties to apply when the - * component is used (overridden by properties set on use). - * @returns a component which can be rendered elsewhere. - */ - export function makeVueSvgComponent( - framework: Readonly, - generate: ( - data: string, - options?: Readonly, - ) => Pick, - toSvgDataURL: typeof toSvgDataURLFn, - defaultProps?: Readonly>, - ): VueComponentDefinition; -} - -declare module 'lean-qr/extras/errors' { - /** - * Convert an error into a human-readable message. This is intended for use - * with Lean QR errors, but will return somewhat meaningful messages for - * other errors too. - * - * @param error the error to convert. - * @returns a human-readable message explaining the error. - */ - export function readError(error: unknown): string; -} diff --git a/website/scripts/modules/lean-qr/2.7.1/index.mjs b/website/scripts/modules/lean-qr/2.7.1/index.mjs deleted file mode 100644 index f8625849e..000000000 --- a/website/scripts/modules/lean-qr/2.7.1/index.mjs +++ /dev/null @@ -1,2 +0,0 @@ -// @ts-nocheck -const t = [.2, 3 / 8, 5 / 9, 2 / 3], o = (o, e) => r => { const n = 4 * o + r - 4, s = "*-04-39?2$%%$%%'$%''%'''%')(%'))%(++'(++'(+.'+-.',/3',33)-/5)-43).36)058*18<+37<+4:<,4:E,5C/8@F/:EH/ 8 ? s : 1, c = e / f | 0, i = e % f, l = f - i, a = n > 8 ? c * t[r] + (o > 5) & -2 : s, _ = c - a; return { t: l * _ + i * _ + i, o: [[l, _], [i, _ + 1]], i: a } }, e = { min: 0, L: 0, M: 1, Q: 2, H: 3, max: 3 }, r = t => new Uint8Array(t), n = t => { const o = new Error(`lean-qr error ${t}`); throw o.code = t, o }, s = t => "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".indexOf(t), f = t => t.charCodeAt(0), c = (...t) => (o, e) => t.forEach(t => t(o, e)), i = t => o => { o.eci !== t && (o.push(7, 4), t < 128 ? o.push(t, 8) : t < 16384 ? o.push(32768 | t, 16) : o.push(12582912 | t, 24), o.eci = t) }, l = t => (o, e) => { o.push(4, 4), o.push(t.length, 8 + 8 * (e > 9)), t.forEach(t => o.push(t, 8)) }, a = (t, o, e, r, n = (t, o) => e(t.length, o), s = (r ? o => c(i(r), t(o)) : t)) => (s.test = o, s.l = e, s.est = n, s.eci = r && [r], s), _ = a(t => (o, e) => { o.push(1, 4), o.push(t.length, 10 + 2 * (e > 26) + 2 * (e > 9)); let r = 0; for (; r < t.length - 2; r += 3)o.push(+t.slice(r, r + 3), 10); r < t.length - 1 ? o.push(+t.slice(r), 7) : r < t.length && o.push(+t[r], 4) }, t => /[0-9]/.test(t), (t, o) => 14 + 2 * (o > 26) + 2 * (o > 9) + 10 * t / 3), u = a(t => (o, e) => { o.push(2, 4), o.push(t.length, 9 + 2 * (e > 26) + 2 * (e > 9)); let r = 0; for (; r < t.length - 1; r += 2)o.push(45 * s(t[r]) + s(t[r + 1]), 11); r < t.length && o.push(s(t[r]), 6) }, t => s(t) >= 0, (t, o) => 13 + 2 * (o > 26) + 2 * (o > 9) + 5.5 * t), d = a(t => l([...t].map(f)), t => f(t) < 128, (t, o) => 12 + 8 * (o > 9) + 8 * t); d._ = !0, d.u = !0; const p = a(d, t => f(t) < 256, d.l, 3); p._ = !0; const m = new TextEncoder, h = a(t => l(m.encode(t)), () => 1, 0, 26, (t, o) => 12 + 8 * (o > 9) + 8 * m.encode(t).length); h._ = !0; let w = () => { const t = new Map, o = new TextDecoder("sjis"), e = r(2); for (let r = 0; r < 7973; ++r)e[0] = r / 192 + 129 + 64 * (r > 5951), e[1] = r % 192 + 64, t.set(o.decode(e), r); return t.delete("\ufffd"), w = () => t, t }; const y = a(t => (o, e) => { o.push(8, 4), o.push(t.length, 8 + 2 * (e > 26) + 2 * (e > 9)); for (const e of t) o.push(w().get(e), 13) }, t => w().has(t), (t, o) => 12 + 2 * (o > 26) + 2 * (o > 9) + 13 * t); y._ = !0; const g = [_, u, d, p, y, h], b = { auto: (t, { modes: o = g } = {}) => (e, r) => { const s = o.map((o, e) => { const n = new Map, s = (t, o) => (n.has(t) || n.set(t, o(t, r)), n.get(t)); return { m: o, h: 1 << e, C: o.est("", r), S: o.l ? (t, e) => s(e - t, o.l) : (e, r) => s(t.slice(e, r), o.est) } }); let f = [{ v: 0 }], c = 0, i = 0, l = -1; for (const o of [...t, ""]) { let t = 0; if (o) for (const e of s) e.m.test(o) && (t |= e.h); if (!o || t !== l) { if (-1 !== l) { const t = new Set(f.map(t => t.D)), o = []; for (const { m: e, C: r, S: n, h: a } of s) if (l & a) { const s = n(c, i); for (const l of e.eci ?? t) if (!e.u || !l) { let t; for (const o of f) if (o.D === l || e.eci) { const f = o.m === e && o.D === l, a = f ? o.V : o, _ = e._ && f ? o.v + s - r : a.v + 12 * (a.D !== l) + (f ? n(f ? o.$ : c, i) : s); (!t || _ < t.v) && (t = { $: f ? o.$ : c, V: a, m: e, D: l, A: i, v: _ }) } t && o.push(t) } } f = o } l = t, c = i } i += o.length } f.length || n(5); const a = []; for (let o = f.reduce((t, o) => o.v < t.v ? o : t); o.m; o = o.V)a.push(o.m(t.slice(o.$, o.A))); a.reverse().forEach(t => t(e, r)) }, multi: c, eci: i, bytes: l, numeric: _, alphaNumeric: u, ascii: d, iso8859_1: p, shift_jis: y, utf8: h }, C = () => ({ F: r(2956), I: 0, push(t, o) { for (let e = o, r = 8 - (7 & this.I); e > 0; e -= r, r = 8)this.F[this.I >> 3] |= t << r >> e, this.I += e < r ? e : r } }), x = (t, o = t * t, e = r(o)) => ({ size: t, K: e, get: (o, r) => o >= 0 && o < t && !!(1 & e[r * t + o]), toString({ on: o = "##", off: e = " ", lf: r = "\n", pad: n = 4, padX: s = n, padY: f = n } = {}) { let c = ""; for (let n = -f; n < t + f; ++n){ for (let r = -s; r < t + s; ++r)c += this.get(r, n) ? o : e; c += r } return c }, toImageData(o, { on: e = [0, 0, 0], off: r = [0, 0, 0, 0], pad: n = 4, padX: s = n, padY: f = n } = {}) { const c = t + 2 * s, i = t + 2 * f, l = o.createImageData(c, i), a = new Uint32Array(l.data.buffer); l.data.set([...e, 255]); const _ = a[0]; l.data.set([...r, 255]); const u = a[0]; for (let t = 0; t < i; ++t)for (let o = 0; o < c; ++o)a[t * c + o] = this.get(o - s, t - f) ? _ : u; return l }, toCanvas(t, o) { const e = t.getContext("2d"), r = this.toImageData(e, o); t.width = r.width, t.height = r.height, e.putImageData(r, 0, 0) }, toDataURL({ type: t = "image/png", scale: o = 1, ...e } = {}) { const r = document.createElement("canvas"), n = r.getContext("2d"), s = this.toImageData(n, e); return r.width = s.width * o, r.height = s.height * o, n.putImageData(s, 0, 0), n.imageSmoothingEnabled = !1, n.globalCompositeOperation = "copy", n.drawImage(r, 0, 0, s.width, s.height, 0, 0, r.width, r.height), r.toDataURL(t, 1) } }), z = [(t, o) => 1 & (t ^ o), (t, o) => 1 & o, t => t % 3, (t, o) => (t + o) % 3, (t, o) => 1 & (t / 3 ^ o >> 1), (t, o) => (t & o & 1) + t * o % 3, (t, o) => (t & o) + t * o % 3 & 1, (t, o) => (t ^ o) + t * o % 3 & 1], E = r(511); for (let t = 0, o = 1; t < 255; o = 2 * o ^ 285 * (o > 127))E[E[o + 255] = t++] = o; const M = t => E[t % 255], S = t => E[t + 255], v = (t, o) => { const e = r(t.length + o.length - 1); for (let r = 0; r < t.length; ++r)for (let n = 0; n < o.length; ++n)e[r + n] ^= M(t[r] + o[n]); return e.map(S) }, D = (t, o) => { const e = r(t.length + o.length - 1); e.set(t, 0); for (let r = 0; r < t.length; ++r)if (e[r]) { const t = S(e[r]); for (let n = 0; n < o.length; ++n)e[r + n] ^= M(o[n] + t) } return e.slice(t.length) }, L = [[0], [0, 0]]; for (let t = 1; t < 30; ++t)L.push(v(L[t], [0, t])); const V = (t, o) => { const e = [[], []]; let n = 0, s = 0; for (const [r, f] of o.o) for (let c = 0; c < r; ++c, n += f){ const r = t.slice(n, n + f); e[0].push(r), e[1].push(D(r, L[o.i])), s += f + o.i } const f = r(s); s = 0; for (const t of e) for (let o, e = 0; s !== o; ++e){ o = s; for (const o of t) e < o.length && (f[s++] = o[e]) } return f }, $ = (t, o, e) => { let r = t <<= e; for (let t = 134217728; t >>= 1;)r & t && (r ^= o * (t >> e)); return r | t }, A = ({ size: t, K: o }, e) => { const r = (e, r, n, s) => { for (; n-- > 0; e += t)o.fill(s, e, e + r) }, n = (o, e, n) => { for (let s = 0; s++ < 3; n -= 2)r(e * t + o - (n >> 1) * (t + 1), n, n, 2 | s) }, s = 2 * ((t - 13) / (1 + (e / 7 | 0)) / 2 + .75 | 0); if (e > 1) for (let o = t - 7; o > 8; o -= s){ for (let t = o; t > 8; t -= s)n(o, t, 5); o < t - 7 && n(o, 6, 5) } if (e > 6) for (let r = $(e, 7973, 12), n = 1; n < 7; ++n)for (let e = 12; e-- > 9; r >>= 1)o[n * t - e] = 2 | 1 & r; r(7, 2, 9, 2), r(t - 8, 8, 9, 2); for (let e = 0; e < t; ++e)o[6 * t + e] = 3 ^ 1 & e; n(3, 3, 7), n(t - 4, 3, 7); for (let e = 0; e < t; ++e)for (let r = e; r < t; ++r)o[r * t + e] = o[e * t + r]; o[(t - 8) * t + 8] = 3 }, F = ({ size: t, K: o }) => { const e = []; for (let r = t - 2, n = t, s = -1; r >= 0; r -= 2){ for (5 === r && (r = 4); n += s, -1 !== n && n !== t;){ const s = n * t + r; o[s + 1] || e.push(s + 1), o[s] || e.push(s) } s *= -1 } return e }, H = ({ K: t }, o, e) => o.forEach((o, r) => t[o] = e[r >> 3] >> (7 & ~r) & 1), I = ({ size: t, K: o }, e, r, n) => { for (let r = 0; r < t; ++r)for (let n = 0; n < t; ++n){ const s = r * t + n; o[s] ^= !(e(n, r) || 2 & o[s]) } let s = 21522 ^ $((1 ^ n) << 3 | r, 1335, 10); for (let e = 0; e++ < 8; s >>= 1)o[(e - (e < 7)) * t + 8] = 1 & s, o[9 * t - e] = 1 & s; for (let e = 8; --e, s; s >>= 1)o[8 * t + e - (e < 7)] = 1 & s, o[(t - e) * t + 8] = 1 & s }, K = ({ size: t, K: o }, e = 0, r = 0) => { for (let n = 0; n < t; ++n){ for (let s = 0; s < 2; ++s)for (let f, c = 0, i = 0, l = 0; c < t; ++c){ const a = 1 & o[s ? n * t + c : c * t + n]; r += a, i = (i >> 1 | 2098176) & (3047517 ^ a - 1), 2049 & i && (e += 40), a !== f && (l = 0), f = a, e += 5 === ++l ? 3 : l > 5 } if (n) for (let r = t + n, s = 5 * o[n - 1] ^ o[n]; r < t * t; r += t){ const t = 5 * o[r - 1] ^ o[r]; e += 3 * !(1 & (s | t) | 4 & (s ^ t)), s = t } } return e + 10 * (10 * Math.abs(r / (t * t) - 1) | 0) }, N = [], P = (t = n(1), { minCorrectionLevel: e = 0, maxCorrectionLevel: r = 3, minVersion: s = 1, maxVersion: f = 40, mask: c, trailer: i = 60433, ...l } = {}) => { r < e && n(3), f < s && n(2), "string" == typeof t && (t = b.auto(t, l)); for (let n = s, l = 0; n <= f; ++n){ let s = N[n]; s || (N[n] = s = x(4 * n + 17), A(s, n), s.p = F(s)); const f = o(n, s.p.length >> 3); if (8 * f(e).t < l) continue; const a = C(); t(a, n), l = a.I; for (let t = r; t >= e; --t){ const o = f(t); if (8 * o.t < l) continue; for (a.I = l + 11 & -8; a.I < 8 * o.t;)a.push(i, 16); const e = x(s.size, s.K); return H(e, s.p, V(a.F, o)), (z[c ?? -1] ? [z[c]] : z).map((o, r) => { const n = x(e.size, e.K); return I(n, o, c ?? r, t), n.s = K(n), n }).reduce((t, o) => o.s < t.s ? o : t) } } n(4) }; P.with = (...t) => (o, e) => P(o, { modes: [...g, ...t], ...e }); export { e as correction, P as generate, b as mode }; diff --git a/website/scripts/modules/lightweight-charts/.gitignore b/website/scripts/modules/lightweight-charts/.gitignore deleted file mode 100644 index b604584b3..000000000 --- a/website/scripts/modules/lightweight-charts/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*charts.pro* -light*.js diff --git a/website/scripts/modules/lightweight-charts/5.2.0/dist/lightweight-charts.standalone.production.mjs b/website/scripts/modules/lightweight-charts/5.2.0/dist/lightweight-charts.standalone.production.mjs deleted file mode 100644 index 55d653306..000000000 --- a/website/scripts/modules/lightweight-charts/5.2.0/dist/lightweight-charts.standalone.production.mjs +++ /dev/null @@ -1,8 +0,0 @@ -// @ts-nocheck -/*! - * @license - * TradingView Lightweight Charts™ v5.2.0 - * Copyright (c) 2026 TradingView, Inc. - * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0 - */ -const t={title:"",visible:!0,hitTestTolerance:3,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};var i,n;function s(t,i){const n=function(t,i){switch(t){case 0:default:return[];case 1:return[i,i];case 2:return[2*i,2*i];case 3:return[6*i,6*i];case 4:return[i,4*i]}}(i,t.lineWidth);return t.setLineDash(n),n}function e(t,i,n,s){t.beginPath();const e=t.lineWidth%2?.5:0;t.moveTo(n,i+e),t.lineTo(s,i+e),t.stroke()}function r(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function h(t){if(void 0===t)throw new Error("Value is undefined");return t}function a(t){if(null===t)throw new Error("Value is null");return t}function l(t){return a(h(t))}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved"}(i||(i={})),function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted"}(n||(n={}));class o{constructor(){this.t=[]}i(t,i,n){const s={h:t,l:i,o:!0===n};this.t.push(s)}_(t){const i=this.t.findIndex((i=>t===i.h));i>-1&&this.t.splice(i,1)}u(t){this.t=this.t.filter((i=>i.l!==t))}p(t,i,n){const s=[...this.t];this.t=this.t.filter((t=>!t.o)),s.forEach((s=>s.h(t,i,n)))}v(){return this.t.length>0}m(){this.t=[]}}function _(t,...i){for(const n of i)for(const i in n)void 0!==n[i]&&Object.prototype.hasOwnProperty.call(n,i)&&!["__proto__","constructor","prototype"].includes(i)&&("object"!=typeof n[i]||void 0===t[i]||Array.isArray(n[i])?t[i]=n[i]:_(t[i],n[i]));return t}function u(t){return"number"==typeof t&&isFinite(t)}function c(t){return"number"==typeof t&&t%1==0}function d(t){return"string"==typeof t}function f(t){return"boolean"==typeof t}function p(t){const i=t;if(!i||"object"!=typeof i)return i;let n,s,e;for(s in n=Array.isArray(i)?[]:{},i)i.hasOwnProperty(s)&&(e=i[s],n[s]=e&&"object"==typeof e?p(e):e);return n}function v(t){return null!==t}function m(t){return null===t?void 0:t}const w="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function g(t,i,n){return void 0===i&&(i=w),`${n=void 0!==n?`${n} `:""}${t}px ${i}`}class M{constructor(t){this.M={S:1,C:5,P:NaN,k:"",T:"",R:"",D:"",I:0,V:0,B:0,A:0,O:0},this.L=t}N(){const t=this.M,i=this.F(),n=this.W();return t.P===i&&t.T===n||(t.P=i,t.T=n,t.k=g(i,n),t.A=2.5/12*i,t.I=t.A,t.V=i/12*t.C,t.B=i/12*t.C,t.O=0),t.R=this.H(),t.D=this.U(),this.M}H(){return this.L.N().layout.textColor}U(){return this.L.$()}F(){return this.L.N().layout.fontSize}W(){return this.L.N().layout.fontFamily}}function b(t){return t<0?0:t>255?255:Math.round(t)||0}function x(t){return.199*t[0]+.687*t[1]+.114*t[2]}class S{constructor(t,i){this.j=new Map,this.q=t,i&&(this.j=i)}Y(t,i){if("transparent"===t)return t;const n=this.K(t),s=n[3];return`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${i*s})`}Z(t){const i=this.K(t);return{G:`rgb(${i[0]}, ${i[1]}, ${i[2]})`,X:x(i)>160?"black":"white"}}J(t){return x(this.K(t))}tt(t,i,n){const[s,e,r,h]=this.K(t),[a,l,o,_]=this.K(i),u=[b(s+n*(a-s)),b(e+n*(l-e)),b(r+n*(o-r)),(c=h+n*(_-h),c<=0||c>1?Math.min(Math.max(c,0),1):Math.round(1e4*c)/1e4)];var c;return`rgba(${u[0]}, ${u[1]}, ${u[2]}, ${u[3]})`}K(t){const i=this.j.get(t);if(i)return i;const n=function(t){const i=document.createElement("div");i.style.display="none",document.body.appendChild(i),i.style.color=t;const n=window.getComputedStyle(i).color;return document.body.removeChild(i),n}(t),s=n.match(/^rgba?\s*\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d+))?\)$/);if(!s){if(this.q.length)for(const i of this.q){const n=i(t);if(n)return this.j.set(t,n),n}throw new Error(`Failed to parse color: ${t}`)}const e=[parseInt(s[1],10),parseInt(s[2],10),parseInt(s[3],10),s[4]?parseFloat(s[4]):1];return this.j.set(t,e),e}}class C{constructor(){this.it=[]}nt(t){this.it=t}st(t,i,n){this.it.forEach((s=>{s.st(t,i,n)}))}}class y{st(t,i,n){t.useBitmapCoordinateSpace((t=>this.et(t,i,n)))}}class P extends y{constructor(){super(...arguments),this.rt=null}ht(t){this.rt=t}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.rt||null===this.rt.lt)return;const s=this.rt.lt,e=this.rt,r=Math.max(1,Math.floor(i))%2/2,h=h=>{t.beginPath();for(let a=s.to-1;a>=s.from;--a){const s=e.ot[a],l=Math.round(s._t*i)+r,o=s.ut*n,_=h*n+r;t.moveTo(l,o),t.arc(l,o,_,0,2*Math.PI)}t.fill()};e.ct>0&&(t.fillStyle=e.dt,h(e.ft+e.ct)),t.fillStyle=e.vt,h(e.ft)}}function k(){return{ot:[{_t:0,ut:0,wt:0,gt:0}],vt:"",dt:"",ft:0,ct:0,lt:null}}const T={from:0,to:1};class R{constructor(t,i,n){this.Mt=new C,this.bt=[],this.xt=[],this.St=!0,this.L=t,this.Ct=i,this.yt=n,this.Mt.nt(this.bt)}Pt(t){this.kt(),this.St=!0}Tt(){return this.St&&(this.Rt(),this.St=!1),this.Mt}kt(){const t=this.yt.Dt();t.length!==this.bt.length&&(this.xt=t.map(k),this.bt=this.xt.map((t=>{const i=new P;return i.ht(t),i})),this.Mt.nt(this.bt))}Rt(){const t=2===this.Ct.N().mode||!this.Ct.It(),i=this.yt.Vt(),n=this.Ct.Et(),s=this.L.Bt();this.kt(),i.forEach(((i,e)=>{const r=this.xt[e],h=i.At(n),a=i.zt();!t&&null!==h&&i.It()&&null!==a?(r.vt=h.Ot,r.ft=h.ft,r.ct=h.Lt,r.ot[0].gt=h.gt,r.ot[0].ut=i.Ft().Nt(h.gt,a.Wt),r.dt=h.Ht??this.L.Ut(r.ot[0].ut/i.Ft().$t()),r.ot[0].wt=n,r.ot[0]._t=s.jt(n),r.lt=T):r.lt=null}))}}class D extends y{constructor(t){super(),this.qt=t}et({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:r}){if(null===this.qt)return;const h=this.qt.Yt.It,a=this.qt.Kt.It;if(!h&&!a)return;const l=Math.round(this.qt._t*n),o=Math.round(this.qt.ut*r);t.lineCap="butt",h&&l>=0&&(t.lineWidth=Math.floor(this.qt.Yt.ct*n),t.strokeStyle=this.qt.Yt.R,t.fillStyle=this.qt.Yt.R,s(t,this.qt.Yt.Zt),function(t,i,n,s){t.beginPath();const e=t.lineWidth%2?.5:0;t.moveTo(i+e,n),t.lineTo(i+e,s),t.stroke()}(t,l,0,i.height)),a&&o>=0&&(t.lineWidth=Math.floor(this.qt.Kt.ct*r),t.strokeStyle=this.qt.Kt.R,t.fillStyle=this.qt.Kt.R,s(t,this.qt.Kt.Zt),e(t,o,0,i.width))}}class I{constructor(t,i){this.St=!0,this.Gt={Yt:{ct:1,Zt:0,R:"",It:!1},Kt:{ct:1,Zt:0,R:"",It:!1},_t:0,ut:0},this.Xt=new D(this.Gt),this.Jt=t,this.yt=i}Pt(){this.St=!0}Tt(t){return this.St&&(this.Rt(),this.St=!1),this.Xt}Rt(){const t=this.Jt.It(),i=this.yt.Qt().N().crosshair,n=this.Gt;if(2===i.mode)return n.Kt.It=!1,void(n.Yt.It=!1);n.Kt.It=t&&this.Jt.ti(this.yt),n.Yt.It=t&&this.Jt.ii(),n.Kt.ct=i.horzLine.width,n.Kt.Zt=i.horzLine.style,n.Kt.R=i.horzLine.color,n.Yt.ct=i.vertLine.width,n.Yt.Zt=i.vertLine.style,n.Yt.R=i.vertLine.color,n._t=this.Jt.ni(),n.ut=this.Jt.si()}}function V(t,i,n,s,e,r){t.fillRect(i+r,n,s-2*r,r),t.fillRect(i+r,n+e-r,s-2*r,r),t.fillRect(i,n,r,e),t.fillRect(i+s-r,n,r,e)}function E(t,i,n,s,e,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,n,s,e),t.restore()}function B(t,i,n,s,e,r){t.beginPath(),t.roundRect?t.roundRect(i,n,s,e,r):(t.lineTo(i+s-r[1],n),0!==r[1]&&t.arcTo(i+s,n,i+s,n+r[1],r[1]),t.lineTo(i+s,n+e-r[2]),0!==r[2]&&t.arcTo(i+s,n+e,i+s-r[2],n+e,r[2]),t.lineTo(i+r[3],n+e),0!==r[3]&&t.arcTo(i,n+e,i,n+e-r[3],r[3]),t.lineTo(i,n+r[0]),0!==r[0]&&t.arcTo(i,n,i+r[0],n,r[0]))}function A(t,i,n,s,e,r,h=0,a=[0,0,0,0],l=""){if(t.save(),!h||!l||l===r)return B(t,i,n,s,e,a),t.fillStyle=r,t.fill(),void t.restore();const o=h/2;var _;B(t,i+o,n+o,s-h,e-h,(_=-o,a.map((t=>0===t?t:t+_)))),"transparent"!==r&&(t.fillStyle=r,t.fill()),"transparent"!==l&&(t.lineWidth=h,t.strokeStyle=l,t.closePath(),t.stroke()),t.restore()}function z(t,i,n,s,e,r,h){t.save(),t.globalCompositeOperation="copy";const a=t.createLinearGradient(0,0,0,e);a.addColorStop(0,r),a.addColorStop(1,h),t.fillStyle=a,t.fillRect(i,n,s,e),t.restore()}class O{constructor(t,i){this.ht(t,i)}ht(t,i){this.qt=t,this.ei=i}$t(t,i){return this.qt.It?t.P+t.A+t.I:0}st(t,i,n,s){if(!this.qt.It||0===this.qt.ri.length)return;const e=this.qt.R,r=this.ei.G,h=t.useBitmapCoordinateSpace((t=>{const h=t.context;h.font=i.k;const a=this.hi(t,i,n,s),l=a.ai;return a.li?A(h,l.oi,l._i,l.ui,l.ci,r,l.di,[l.ft,0,0,l.ft],r):A(h,l.fi,l._i,l.ui,l.ci,r,l.di,[0,l.ft,l.ft,0],r),this.qt.pi&&(h.fillStyle=e,h.fillRect(l.fi,l.mi,l.wi-l.fi,l.gi)),this.qt.Mi&&(h.fillStyle=i.D,h.fillRect(a.li?l.bi-l.di:0,l._i,l.di,l.xi-l._i)),a}));t.useMediaCoordinateSpace((({context:t})=>{const n=h.Si;t.font=i.k,t.textAlign=h.li?"right":"left",t.textBaseline="middle",t.fillStyle=e,t.fillText(this.qt.ri,n.Ci,(n._i+n.xi)/2+n.yi)}))}hi(t,i,n,s){const{context:e,bitmapSize:r,mediaSize:h,horizontalPixelRatio:a,verticalPixelRatio:l}=t,o=this.qt.pi||!this.qt.Pi?i.C:0,_=this.qt.ki?i.S:0,u=i.A+this.ei.Ti,c=i.I+this.ei.Ri,d=i.V,f=i.B,p=this.qt.ri,v=i.P,m=n.Di(e,p),w=Math.ceil(n.Ii(e,p)),g=v+u+c,M=i.S+d+f+w+o,b=Math.max(1,Math.floor(l));let x=Math.round(g*l);x%2!=b%2&&(x+=1);const S=_>0?Math.max(1,Math.floor(_*a)):0,C=Math.round(M*a),y=Math.round(o*a),P=this.ei.Vi??this.ei.Ei??this.ei.Bi,k=Math.round(P*l)-Math.floor(.5*l),T=Math.floor(k+b/2-x/2),R=T+x,D="right"===s,I=D?h.width-_:_,V=D?r.width-S:S;let E,B,A;return D?(E=V-C,B=V-y,A=I-o-d-_):(E=V+C,B=V+y,A=I+o+d),{li:D,ai:{_i:T,mi:k,xi:R,ui:C,ci:x,ft:2*a,di:S,oi:E,fi:V,wi:B,gi:b,bi:r.width},Si:{_i:T/l,xi:R/l,Ci:A,yi:m}}}}class L{constructor(t){this.Ai={Bi:0,G:"#000",Ri:0,Ti:0},this.zi={ri:"",It:!1,pi:!0,Pi:!1,Ht:"",R:"#FFF",Mi:!1,ki:!1},this.Oi={ri:"",It:!1,pi:!1,Pi:!0,Ht:"",R:"#FFF",Mi:!0,ki:!0},this.St=!0,this.Li=new(t||O)(this.zi,this.Ai),this.Ni=new(t||O)(this.Oi,this.Ai)}ri(){return this.Fi(),this.zi.ri}Bi(){return this.Fi(),this.Ai.Bi}Pt(){this.St=!0}$t(t,i=!1){return Math.max(this.Li.$t(t,i),this.Ni.$t(t,i))}Wi(){return this.Ai.Vi??null}Hi(){return this.Ai.Vi??this.Ai.Ei??this.Bi()}Ui(t){this.Ai.Ei=t??void 0}$i(){return this.Fi(),this.zi.It||this.Oi.It}ji(){return this.Fi(),this.zi.It}Tt(t){return this.Fi(),this.zi.pi=this.zi.pi&&t.N().ticksVisible,this.Oi.pi=this.Oi.pi&&t.N().ticksVisible,this.Li.ht(this.zi,this.Ai),this.Ni.ht(this.Oi,this.Ai),this.Li}qi(){return this.Fi(),this.Li.ht(this.zi,this.Ai),this.Ni.ht(this.Oi,this.Ai),this.Ni}Fi(){this.St&&(this.zi.pi=!0,this.Oi.pi=!1,this.Yi(this.zi,this.Oi,this.Ai))}}class N extends L{constructor(t,i,n){super(),this.Jt=t,this.Ki=i,this.Zi=n}Yi(t,i,n){if(t.It=!1,2===this.Jt.N().mode)return;const s=this.Jt.N().horzLine;if(!s.labelVisible)return;const e=this.Ki.zt();if(!this.Jt.It()||this.Ki.Gi()||null===e)return;const r=this.Ki.Xi().Z(s.labelBackgroundColor);n.G=r.G,t.R=r.X;const h=2/12*this.Ki.P();n.Ti=h,n.Ri=h;const a=this.Zi(this.Ki);n.Bi=a.Bi,t.ri=this.Ki.Ji(a.gt,e),t.It=!0}}const F=/[1-9]/g;class W{constructor(){this.qt=null}ht(t){this.qt=t}st(t,i){if(null===this.qt||!1===this.qt.It||0===this.qt.ri.length)return;const n=t.useMediaCoordinateSpace((({context:t})=>(t.font=i.k,Math.round(i.Qi.Ii(t,a(this.qt).ri,F)))));if(n<=0)return;const s=i.tn,e=n+2*s,r=e/2,h=this.qt.nn;let l=this.qt.Bi,o=Math.floor(l-r)+.5;o<0?(l+=Math.abs(0-o),o=Math.floor(l-r)+.5):o+e>h&&(l-=Math.abs(h-(o+e)),o=Math.floor(l-r)+.5);const _=o+e,u=Math.ceil(0+i.S+i.C+i.A+i.P+i.I);t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:n,verticalPixelRatio:s})=>{const e=a(this.qt);t.fillStyle=e.G;const r=Math.round(o*n),h=Math.round(0*s),l=Math.round(_*n),c=Math.round(u*s),d=Math.round(2*n);if(t.beginPath(),t.moveTo(r,h),t.lineTo(r,c-d),t.arcTo(r,c,r+d,c,d),t.lineTo(l-d,c),t.arcTo(l,c,l,c-d,d),t.lineTo(l,h),t.fill(),e.pi){const r=Math.round(e.Bi*n),a=h,l=Math.round((a+i.C)*s);t.fillStyle=e.R;const o=Math.max(1,Math.floor(n)),_=Math.floor(.5*n);t.fillRect(r-_,a,o,l-a)}})),t.useMediaCoordinateSpace((({context:t})=>{const n=a(this.qt),e=0+i.S+i.C+i.A+i.P/2;t.font=i.k,t.textAlign="left",t.textBaseline="middle",t.fillStyle=n.R;const r=i.Qi.Di(t,"Apr0");t.translate(o+s,e+r),t.fillText(n.ri,0,0)}))}}class H{constructor(t,i,n){this.St=!0,this.Xt=new W,this.Gt={It:!1,G:"#4c525e",R:"white",ri:"",nn:0,Bi:NaN,pi:!0},this.Ct=t,this.sn=i,this.Zi=n}Pt(){this.St=!0}Tt(){return this.St&&(this.Rt(),this.St=!1),this.Xt.ht(this.Gt),this.Xt}Rt(){const t=this.Gt;if(t.It=!1,2===this.Ct.N().mode)return;const i=this.Ct.N().vertLine;if(!i.labelVisible)return;const n=this.sn.Bt();if(n.Gi())return;t.nn=n.nn();const s=this.Zi();if(null===s)return;t.Bi=s.Bi;const e=n.en(this.Ct.Et());t.ri=n.rn(a(e)),t.It=!0;const r=this.sn.Xi().Z(i.labelBackgroundColor);t.G=r.G,t.R=r.X,t.pi=n.N().ticksVisible}}class U{constructor(){this.hn=null,this.an=0}ln(){return this.an}_n(t){this.an=t}Ft(){return this.hn}un(t){this.hn=t}cn(t){return[]}dn(){return[]}It(){return!0}}var $;!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden",t[t.MagnetOHLC=3]="MagnetOHLC"}($||($={}));class j extends U{constructor(t,i){super(),this.yt=null,this.fn=NaN,this.pn=0,this.vn=!1,this.mn=new Map,this.wn=!1,this.gn=new WeakMap,this.Mn=new WeakMap,this.bn=NaN,this.xn=NaN,this.Sn=NaN,this.Cn=NaN,this.sn=t,this.yn=i;this.Pn=((t,i)=>n=>{const s=i(),e=t();if(n===a(this.yt).kn())return{gt:e,Bi:s};{const t=a(n.zt());return{gt:n.Tn(s,t),Bi:s}}})((()=>this.fn),(()=>this.xn));const n=((t,i)=>()=>{const n=this.sn.Bt().Rn(t()),s=i();return n&&Number.isFinite(s)?{wt:n,Bi:s}:null})((()=>this.pn),(()=>this.ni()));this.Dn=new H(this,t,n)}N(){return this.yn}In(t,i){this.Sn=t,this.Cn=i}Vn(){this.Sn=NaN,this.Cn=NaN}En(){return this.Sn}Bn(){return this.Cn}An(t,i,n){this.wn||(this.wn=!0),this.vn=!0,this.zn(t,i,n)}Et(){return this.pn}ni(){return this.bn}si(){return this.xn}It(){return this.vn}On(){this.vn=!1,this.Ln(),this.fn=NaN,this.bn=NaN,this.xn=NaN,this.yt=null,this.Vn(),this.Nn()}Fn(t){if(!this.yn.doNotSnapToHiddenSeriesIndices)return t;const i=this.sn,n=i.Bt();let s=null,e=null;for(const n of i.Wn()){const i=n.Un().Hn(t,-1);if(i){if(i.$n===t)return t;(null===s||i.$n>s)&&(s=i.$n)}const r=n.Un().Hn(t,1);if(r){if(r.$n===t)return t;(null===e||r.$nMath.abs(h-n.jt(t))));return r[a.indexOf(Math.min(...a))]}jn(t){let i=this.gn.get(t);i||(i=new I(this,t),this.gn.set(t,i));let n=this.Mn.get(t);return n||(n=new R(this.sn,this,t),this.Mn.set(t,n)),[i,n]}ti(t){return t===this.yt&&this.yn.horzLine.visible}ii(){return this.yn.vertLine.visible}qn(t,i){this.vn&&this.yt===t||this.mn.clear();const n=[];return this.yt===t&&n.push(this.Yn(this.mn,i,this.Pn)),n}dn(){return this.vn?[this.Dn]:[]}Kn(){return this.yt}Nn(){this.sn.Zn().forEach((t=>{this.gn.get(t)?.Pt(),this.Mn.get(t)?.Pt()})),this.mn.forEach((t=>t.Pt())),this.Dn.Pt()}Gn(t){return t&&!t.kn().Gi()?t.kn():null}zn(t,i,n){this.Xn(t,i,n)&&this.Nn()}Xn(t,i,n){const s=this.bn,e=this.xn,r=this.fn,h=this.pn,a=this.yt,l=this.Gn(n);this.pn=t,this.bn=isNaN(t)?NaN:this.sn.Bt().jt(t),this.yt=n;const o=null!==l?l.zt():null;return null!==l&&null!==o?(this.fn=i,this.xn=l.Nt(i,o)):(this.fn=NaN,this.xn=NaN),s!==this.bn||e!==this.xn||h!==this.pn||r!==this.fn||a!==this.yt}Ln(){const t=this.sn.Jn().map((t=>t.Un().Qn())).filter(v),i=0===t.length?null:Math.max(...t);this.pn=null!==i?i:NaN}Yn(t,i,n){let s=t.get(i);return void 0===s&&(s=new N(this,i,n),t.set(i,s)),s}}function q(t){return"left"===t||"right"===t}class Y{constructor(t){this.ts=new Map,this.ns=[],this.ss=t}es(t,i){const n=function(t,i){return void 0===t?i:{rs:Math.max(t.rs,i.rs),hs:t.hs||i.hs}}(this.ts.get(t),i);this.ts.set(t,n)}ls(){return this.ss}_s(t){const i=this.ts.get(t);return void 0===i?{rs:this.ss}:{rs:Math.max(this.ss,i.rs),hs:i.hs}}us(){this.cs(),this.ns=[{ds:0}]}fs(t){this.cs(),this.ns=[{ds:1,Wt:t}]}ps(t){this.vs(),this.ns.push({ds:5,Wt:t})}cs(){this.vs(),this.ns.push({ds:6})}ws(){this.cs(),this.ns=[{ds:4}]}gs(t){this.cs(),this.ns.push({ds:2,Wt:t})}Ms(t){this.cs(),this.ns.push({ds:3,Wt:t})}bs(){return this.ns}xs(t){for(const i of t.ns)this.Ss(i);this.ss=Math.max(this.ss,t.ss),t.ts.forEach(((t,i)=>{this.es(i,t)}))}static Cs(){return new Y(2)}static ys(){return new Y(3)}Ss(t){switch(t.ds){case 0:this.us();break;case 1:this.fs(t.Wt);break;case 2:this.gs(t.Wt);break;case 3:this.Ms(t.Wt);break;case 4:this.ws();break;case 5:this.ps(t.Wt);break;case 6:this.vs()}}vs(){const t=this.ns.findIndex((t=>5===t.ds));-1!==t&&this.ns.splice(t,1)}}class K{formatTickmarks(t){return t.map((t=>this.format(t)))}}const Z=".";function G(t,i){if(!u(t))return"n/a";if(!c(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");if(0===i)return t.toString();return("0000000000000000"+t.toString()).slice(-i)}class X extends K{constructor(t,i){if(super(),i||(i=1),u(t)&&c(t)||(t=100),t<0)throw new TypeError("invalid base");this.Ki=t,this.Ps=i,this.ks()}format(t){const i=t<0?"−":"";return t=Math.abs(t),i+this.Ts(t)}ks(){if(this.Rs=0,this.Ki>0&&this.Ps>0){let t=this.Ki;for(;t>1;)t/=10,this.Rs++}}Ts(t){const i=this.Ki/this.Ps;let n=Math.floor(t),s="";const e=void 0!==this.Rs?this.Rs:NaN;if(i>1){let r=+(Math.round(t*i)-n*i).toFixed(this.Rs);r>=i&&(r-=i,n+=1),s=Z+G(+r.toFixed(this.Rs)*this.Ps,e)}else n=Math.round(n*i)/i,e>0&&(s=Z+G(0,e));return n.toFixed(0)+s}}class J extends X{constructor(t=100){super(t)}format(t){return`${super.format(t)}%`}}class Q extends K{constructor(t){super(),this.Ds=t}format(t){let i="";return t<0&&(i="-",t=-t),t<995?i+this.Is(t):t<999995?i+this.Is(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this.Is(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.Is(t/1e9)+"B")}Is(t){let i;const n=Math.pow(10,this.Ds);return i=(t=Math.round(t*n)/n)>=1e-15&&t<1?t.toFixed(this.Ds).replace(/\.?0+$/,""):String(t),i.replace(/(\.[1-9]*)0+$/,((t,i)=>i))}}const tt=/[2-9]/g;class it{constructor(t=50){this.Vs=0,this.Es=1,this.Bs=1,this.As={},this.zs=new Map,this.Os=t}Ls(){this.Vs=0,this.zs.clear(),this.Es=1,this.Bs=1,this.As={}}Ii(t,i,n){return this.Ns(t,i,n).width}Di(t,i,n){const s=this.Ns(t,i,n);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}Ns(t,i,n){const s=n||tt,e=String(i).replace(s,"0");if(this.zs.has(e))return h(this.zs.get(e)).Fs;if(this.Vs===this.Os){const t=this.As[this.Bs];delete this.As[this.Bs],this.zs.delete(t),this.Bs++,this.Vs--}t.save(),t.textBaseline="middle";const r=t.measureText(e);return t.restore(),0===r.width&&i.length||(this.zs.set(e,{Fs:r,Ws:this.Es}),this.As[this.Es]=e,this.Vs++,this.Es++),r}}class nt{constructor(t){this.Hs=null,this.M=null,this.Us="right",this.$s=t}js(t,i,n){this.Hs=t,this.M=i,this.Us=n}st(t){null!==this.M&&null!==this.Hs&&this.Hs.st(t,this.M,this.$s,this.Us)}}class st{constructor(t,i,n){this.qs=t,this.$s=new it(50),this.Ys=i,this.L=n,this.F=-1,this.Xt=new nt(this.$s)}Tt(){const t=this.L.Ks(this.Ys);if(null===t)return null;const i=t.Zs(this.Ys)?t.Gs():this.Ys.Ft();if(null===i)return null;const n=t.Xs(i);if("overlay"===n)return null;const s=this.L.Js();return s.P!==this.F&&(this.F=s.P,this.$s.Ls()),this.Xt.js(this.qs.qi(),s,n),this.Xt}}class et extends y{constructor(){super(...arguments),this.qt=null}ht(t){this.qt=t}Qs(t,i){if(!this.qt?.It)return null;const{ut:n,ct:s,te:e}=this.qt;return i>=n-s-7&&i<=n+s+7?{ie:this.qt,ne:Math.abs(i-n),se:2,ee:"price-line",te:e}:null}et({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:r}){if(null===this.qt)return;if(!1===this.qt.It)return;const h=Math.round(this.qt.ut*r);h<0||h>i.height||(t.lineCap="butt",t.strokeStyle=this.qt.R,t.lineWidth=Math.floor(this.qt.ct*n),s(t,this.qt.Zt),e(t,h,0,i.width))}}class rt{constructor(t){this.re={ut:0,R:"rgba(0, 0, 0, 0)",ct:1,Zt:0,It:!1},this.he=new et,this.St=!0,this.ae=t,this.le=t.Qt(),this.he.ht(this.re)}Pt(){this.St=!0}Tt(){return this.ae.It()?(this.St&&(this.oe(),this.St=!1),this.he):null}}class ht extends rt{constructor(t){super(t)}oe(){this.re.It=!1;const t=this.ae.Ft(),i=t._e()._e;if(2!==i&&3!==i)return;const n=this.ae.N();if(!n.baseLineVisible||!this.ae.It())return;const s=this.ae.zt();null!==s&&(this.re.It=!0,this.re.ut=t.Nt(s.Wt,s.Wt),this.re.R=n.baseLineColor,this.re.ct=n.baseLineWidth,this.re.Zt=n.baseLineStyle)}}class at extends y{constructor(){super(...arguments),this.qt=null}ht(t){this.qt=t}ue(){return this.qt}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){const s=this.qt;if(null===s)return;const e=Math.max(1,Math.floor(i)),r=e%2/2,h=Math.round(s.ce.x*i)+r,a=s.ce.y*n;t.fillStyle=s.de,t.beginPath();const l=Math.max(2,1.5*s.fe)*i;t.arc(h,a,l,0,2*Math.PI,!1),t.fill(),t.fillStyle=s.pe,t.beginPath(),t.arc(h,a,s.ft*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=e,t.strokeStyle=s.ve,t.beginPath(),t.arc(h,a,s.ft*i+e/2,0,2*Math.PI,!1),t.stroke()}}const lt=[{me:0,we:.25,ge:4,Me:10,be:.25,xe:0,Se:.4,Ce:.8},{me:.25,we:.525,ge:10,Me:14,be:0,xe:0,Se:.8,Ce:0},{me:.525,we:1,ge:14,Me:14,be:0,xe:0,Se:0,Ce:0}];class ot{constructor(t){this.Xt=new at,this.St=!0,this.ye=!0,this.Pe=performance.now(),this.ke=this.Pe-1,this.Te=t}Re(){this.ke=this.Pe-1,this.Pt()}De(){if(this.Pt(),2===this.Te.N().lastPriceAnimation){const t=performance.now(),i=this.ke-t;if(i>0)return void(i<650&&(this.ke+=2600));this.Pe=t,this.ke=t+2600}}Pt(){this.St=!0}Ie(){this.ye=!0}It(){return 0!==this.Te.N().lastPriceAnimation}Ve(){switch(this.Te.N().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.ke}}Tt(){return this.St?(this.Rt(),this.St=!1,this.ye=!1):this.ye&&(this.Ee(),this.ye=!1),this.Xt}Rt(){this.Xt.ht(null);const t=this.Te.Qt().Bt(),i=t.Be(),n=this.Te.zt();if(null===i||null===n)return;const s=this.Te.Ae(!0);if(s.ze||!i.Oe(s.$n))return;const e={x:t.jt(s.$n),y:this.Te.Ft().Nt(s.gt,n.Wt)},r=s.R,h=this.Te.N().lineWidth,a=this.Le(this.Ne(),r);this.Xt.ht({de:r,fe:h,pe:a.pe,ve:a.ve,ft:a.ft,ce:e})}Ee(){const t=this.Xt.ue();if(null!==t){const i=this.Le(this.Ne(),t.de);t.pe=i.pe,t.ve=i.ve,t.ft=i.ft}}Ne(){return this.Ve()?performance.now()-this.Pe:2599}Fe(t,i,n,s){const e=n+(s-n)*i;return this.Te.Qt().Xi().Y(t,e)}Le(t,i){const n=t%2600/2600;let s;for(const t of lt)if(n>=t.me&&n<=t.we){s=t;break}r(void 0!==s,"Last price animation internal logic error");const e=(n-s.me)/(s.we-s.me);return{pe:this.Fe(i,e,s.be,s.xe),ve:this.Fe(i,e,s.Se,s.Ce),ft:(h=e,a=s.ge,l=s.Me,a+(l-a)*h)};var h,a,l}}class _t extends rt{constructor(t){super(t)}oe(){const t=this.re;t.It=!1;const i=this.ae.N();if(!i.priceLineVisible||!this.ae.It())return;const n=this.ae.Ae(0===i.priceLineSource);n.ze||(t.It=!0,t.ut=n.Bi,t.R=this.ae.We(n.R),t.ct=i.priceLineWidth,t.Zt=i.priceLineStyle)}}class ut extends L{constructor(t){super(),this.Jt=t}Yi(t,i,n){t.It=!1,i.It=!1;const s=this.Jt;if(!s.It())return;const e=s.N(),r=e.lastValueVisible,h=""!==s.He(),a=0===e.seriesLastValueMode,l=s.Ae(!1);if(l.ze)return;r&&(t.ri=this.Ue(l,r,a),t.It=0!==t.ri.length),(h||a)&&(i.ri=this.$e(l,r,h,a),i.It=i.ri.length>0);const o=s.We(l.R),_=this.Jt.Qt().Xi().Z(o);n.G=_.G,n.Bi=l.Bi,i.Ht=s.Qt().Ut(l.Bi/s.Ft().$t()),t.Ht=o,t.R=_.X,i.R=_.X}$e(t,i,n,s){let e="";const r=this.Jt.He();return n&&0!==r.length&&(e+=`${r} `),i&&s&&(e+=this.Jt.Ft().je()?t.qe:t.Ye),e.trim()}Ue(t,i,n){return i?n?this.Jt.Ft().je()?t.Ye:t.qe:t.ri:""}}function ct(t,i,n,s){const e=Number.isFinite(i),r=Number.isFinite(n);return e&&r?t(i,n):e||r?e?i:n:s}class dt{constructor(t,i){this.Ke=t,this.Ze=i}Ge(t){return null!==t&&(this.Ke===t.Ke&&this.Ze===t.Ze)}Xe(){return new dt(this.Ke,this.Ze)}Je(){return this.Ke}Qe(){return this.Ze}tr(){return this.Ze-this.Ke}Gi(){return this.Ze===this.Ke||Number.isNaN(this.Ze)||Number.isNaN(this.Ke)}xs(t){return null===t?this:new dt(ct(Math.min,this.Je(),t.Je(),-1/0),ct(Math.max,this.Qe(),t.Qe(),1/0))}ir(t){if(!u(t))return;if(0===this.Ze-this.Ke)return;const i=.5*(this.Ze+this.Ke);let n=this.Ze-i,s=this.Ke-i;n*=t,s*=t,this.Ze=i+n,this.Ke=i+s}nr(t){u(t)&&(this.Ze+=t,this.Ke+=t)}sr(){return{minValue:this.Ke,maxValue:this.Ze}}static er(t){return null===t?null:new dt(t.minValue,t.maxValue)}}class ft{constructor(t,i){this.rr=t,this.hr=i||null}ar(){return this.rr}lr(){return this.hr}sr(){return{priceRange:null===this.rr?null:this.rr.sr(),margins:this.hr||void 0}}static er(t){return null===t?null:new ft(dt.er(t.priceRange),t.margins)}}const pt=[2,4,8,16,32,64,128,256,512],vt="Custom series with conflation reducer must have a priceValueBuilder method";class mt extends rt{constructor(t,i){super(t),this._r=i}oe(){const t=this.re;t.It=!1;const i=this._r.N();if(!this.ae.It()||!i.lineVisible)return;const n=this._r.ur();null!==n&&(t.It=!0,t.ut=n,t.R=i.color,t.ct=i.lineWidth,t.Zt=i.lineStyle,t.te=this._r.N().id)}}class wt extends L{constructor(t,i){super(),this.Te=t,this._r=i}Yi(t,i,n){t.It=!1,i.It=!1;const s=this._r.N(),e=s.axisLabelVisible,r=""!==s.title,h=this.Te;if(!e||!h.It())return;const a=this._r.ur();if(null===a)return;r&&(i.ri=s.title,i.It=!0),i.Ht=h.Qt().Ut(a/h.Ft().$t()),t.ri=this.cr(s.price),t.It=!0;const l=this.Te.Qt().Xi().Z(s.axisLabelColor||s.color);n.G=l.G;const o=s.axisLabelTextColor||l.X;t.R=o,i.R=o,n.Bi=a}cr(t){const i=this.Te.zt();return null===i?"":this.Te.Ft().Ji(t,i.Wt)}}class gt{constructor(t,i){this.Te=t,this.yn=i,this.dr=new mt(t,this),this.qs=new wt(t,this),this.pr=new st(this.qs,t,t.Qt())}vr(t){_(this.yn,t),this.Pt(),this.Te.Qt().mr()}N(){return this.yn}wr(){return this.dr}gr(){return this.pr}Mr(){return this.qs}Pt(){this.dr.Pt(),this.qs.Pt()}ur(){const t=this.Te,i=t.Ft();if(t.Qt().Bt().Gi()||i.Gi())return null;const n=t.zt();return null===n?null:i.Nt(this.yn.price,n.Wt)}}class Mt{constructor(){this.br=new WeakMap}Sr(t,i,n){const s=1/i*n;if(t>=s)return 1;const e=s/t,r=Math.pow(2,Math.floor(Math.log2(e)));return Math.min(r,512)}Cr(t,i,n,s=!1,e){if(0===t.length||i<=1)return t;const r=this.yr(i);if(r<=1)return t;const h=this.Pr(t);let a=h.kr.get(r);return void 0!==a||(a=this.Tr(t,r,n,s,e,h.kr),h.kr.set(r,a)),a}Rr(t,i,n,s,e=!1,r){if(n<1||0===t.length)return t;const h=this.Pr(t),a=h.kr.get(n);if(!a)return this.Cr(t,n,s,e,r);const l=this.Dr(t,i,n,a,e,s,r);return h.kr.set(n,l),l}yr(t){if(t<=2)return 2;for(const i of pt)if(t<=i)return i;return 512}Ir(t){if(0===t.length)return 0;const i=t[0],n=t[t.length-1];return 31*t.length+17*i.$n+13*n.$n}Tr(t,i,n,s=!1,e,r=new Map){if(2===i)return this.Vr(t,2,n,s,e);const h=i/2;let a=r.get(h);return a||(a=this.Tr(t,h,n,s,e,r),r.set(h,a)),this.Er(a,n,s,e)}Vr(t,i,n,s=!1,e){const r=this.Br(t,i,n,s,e);return this.Ar(r,s)}Er(t,i,n=!1,s){const e=this.Br(t,2,i,n,s);return this.Ar(e,n)}Br(t,i,n,s=!1,e){const r=[];for(let h=0;h=i){const i=this.zr(t[h],t[h+1],n,s,e);i.Or=!1,r.push(i)}else if(0===r.length)r.push(this.Lr(t[h],!0));else{const i=r[r.length-1];r[r.length-1]=this.Nr(i,t[h],n,s,e)}}return r}Fr(t,i){return(t??1)+(i??1)}zr(t,i,n,s=!1,e){if(!s||!n||!e){const n=t.Wt[1]>i.Wt[1]?t.Wt[1]:i.Wt[1],s=t.Wt[2]i.Wt[1]?t.qr:i.Wt[1],Yr:t.Yrthis.th(t,i)))}Dr(t,i,n,s,e=!1,r,h){if(0===s.length)return s;const a=t.length-1,l=Math.floor(a/n)*n;if(Math.min(l+n,t.length)-ln){const s=t.slice();return s[s.length-1]=i,this.Cr(s,n,r,e,h)}if(Math.floor((a-1)/n)===Math.floor(a/n)||1===s.length){const o=Math.min(l+n,t.length),_=o-l;if(_<=0)return s;const u=1===_?this.Lr(l===a?i:t[l],!0):this.Jr(t,l,o,a,i,r,e,h);return s[s.length-1]=this.th(u,e),s}{const s=t.slice();return s[s.length-1]=i,this.Cr(s,n,r,e,h)}}Lr(t,i=!1){return{Wr:t.$n,Hr:t.$n,Ur:t.wt,$r:t.wt,jr:t.Wt[0],qr:t.Wt[1],Yr:t.Wt[2],Kr:t.Wt[3],Zr:t.Zr??1,Gr:t.ue,Or:i}}Pr(t){const i=this.ih(t),n=this.Ir(t);return i.nh!==n&&(i.kr.clear(),i.nh=n),i}ih(t){let i=this.br.get(t);return void 0===i&&(i={nh:this.Ir(t),kr:new Map},this.br.set(t,i)),i}}class bt extends U{constructor(t){super(),this.sn=t}Qt(){return this.sn}}const xt={Bar:(t,i,n,s)=>{const e=i.upColor,r=i.downColor,h=a(t(n,s)),o=l(h.Wt[0])<=l(h.Wt[3]);return{sh:h.R??(o?e:r)}},Candlestick:(t,i,n,s)=>{const e=i.upColor,r=i.downColor,h=i.borderUpColor,o=i.borderDownColor,_=i.wickUpColor,u=i.wickDownColor,c=a(t(n,s)),d=l(c.Wt[0])<=l(c.Wt[3]);return{sh:c.R??(d?e:r),eh:c.Ht??(d?h:o),rh:c.hh??(d?_:u)}},Custom:(t,i,n,s)=>({sh:a(t(n,s)).R??i.color}),Area:(t,i,n,s)=>{const e=a(t(n,s));return{sh:e.vt??i.lineColor,vt:e.vt??i.lineColor,ah:e.ah??i.topColor,oh:e.oh??i.bottomColor}},Baseline:(t,i,n,s)=>{const e=a(t(n,s));return{sh:e.Wt[3]>=i.baseValue.price?i.topLineColor:i.bottomLineColor,_h:e._h??i.topLineColor,uh:e.uh??i.bottomLineColor,dh:e.dh??i.topFillColor1,fh:e.fh??i.topFillColor2,ph:e.ph??i.bottomFillColor1,mh:e.mh??i.bottomFillColor2}},Line:(t,i,n,s)=>{const e=a(t(n,s));return{sh:e.R??i.color,vt:e.R??i.color}},Histogram:(t,i,n,s)=>({sh:a(t(n,s)).R??i.color})};class St{constructor(t){this.wh=(t,i)=>void 0!==i?i.Wt:this.Te.Un().gh(t),this.Te=t,this.Mh=xt[t.bh()]}xh(t,i){return this.Mh(this.wh,this.Te.N(),t,i)}}function Ct(t,i,n,s,e=0,r=i.length){let h=r-e;for(;0>1,a=e+r;s(i[a],n)===t?(e=a+1,h-=r+1):h=r}return e}const yt=Ct.bind(null,!0),Pt=Ct.bind(null,!1);var kt;!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"}(kt||(kt={}));const Tt=30;class Rt{constructor(){this.Sh=[],this.Ch=new Map,this.yh=new Map,this.Ph=[]}kh(){return this.Th()>0?this.Sh[this.Sh.length-1]:null}Rh(){return this.Th()>0?this.Dh(0):null}Qn(){return this.Th()>0?this.Dh(this.Sh.length-1):null}Th(){return this.Sh.length}Gi(){return 0===this.Th()}Oe(t){return null!==this.Ih(t,0)}gh(t){return this.Hn(t)}Hn(t,i=0){const n=this.Ih(t,i);return null===n?null:{...this.Vh(n),$n:this.Dh(n)}}Eh(){return this.Sh}Bh(t,i,n){if(this.Gi())return null;let s=null;for(const e of n){s=Dt(s,this.Ah(t,i,e))}return s}ht(t){this.yh.clear(),this.Ch.clear(),this.Sh=t,this.Ph=t.map((t=>t.$n))}zh(){return this.Ph}Dh(t){return this.Sh[t].$n}Vh(t){return this.Sh[t]}Ih(t,i){const n=this.Oh(t);if(null===n&&0!==i)switch(i){case-1:return this.Lh(t);case 1:return this.Nh(t);default:throw new TypeError("Unknown search mode")}return n}Lh(t){let i=this.Fh(t);return i>0&&(i-=1),i!==this.Sh.length&&this.Dh(i)t.$nt.$n>i))}Hh(t,i,n){let s=null;for(let e=t;es.$h&&(s.$h=t)))}return s}Ah(t,i,n){if(this.Gi())return null;let s=null;const e=a(this.Rh()),r=a(this.Qn()),h=Math.max(t,e),l=Math.min(i,r),o=Math.ceil(h/Tt)*Tt,_=Math.max(o,Math.floor(l/Tt)*Tt);{const t=this.Fh(h),e=this.Wh(Math.min(l,o,i));s=Dt(s,this.Hh(t,e,n))}let u=this.Ch.get(n);void 0===u&&(u=new Map,this.Ch.set(n,u));for(let t=Math.max(o+1,h);t<_;t+=Tt){const i=Math.floor(t/Tt);let e=u.get(i);if(void 0===e){const t=this.Fh(i*Tt),s=this.Wh((i+1)*Tt-1);e=this.Hh(t,s,n),u.set(i,e)}s=Dt(s,e)}{const t=this.Fh(_),i=this.Wh(l);s=Dt(s,this.Hh(t,i,n))}return s}}function Dt(t,i){if(null===t)return i;if(null===i)return t;return{Uh:Math.min(t.Uh,i.Uh),$h:Math.max(t.$h,i.$h)}}function It(){return new Rt}const Vt={setLineStyle:s};class Et{constructor(t){this.jh=t}st(t,i,n){this.jh.draw(t,Vt)}qh(t,i,n){this.jh.drawBackground?.(t,Vt)}}class Bt{constructor(t){this.zs=null,this.Yh=t}Tt(){const t=this.Yh.renderer();if(null===t)return null;if(this.zs?.Kh===t)return this.zs.Zh;const i=new Et(t);return this.zs={Kh:t,Zh:i},i}Gh(){return this.Yh.zOrder?.()??"normal"}}class At{constructor(t){this.Xh=null,this.Jh=t}Qh(){return this.Jh}Nn(){this.Jh.updateAllViews?.()}jn(){const t=this.Jh.paneViews?.()??[];if(this.Xh?.Kh===t)return this.Xh.Zh;const i=t.map((t=>new Bt(t)));return this.Xh={Kh:t,Zh:i},i}Qs(t,i){return this.Jh.hitTest?.(t,i)??null}}let zt=class extends At{cn(){return[]}};class Ot{constructor(t){this.jh=t}st(t,i,n){this.jh.draw(t,Vt)}qh(t,i,n){this.jh.drawBackground?.(t,Vt)}}class Lt{constructor(t){this.zs=null,this.Yh=t}Tt(){const t=this.Yh.renderer();if(null===t)return null;if(this.zs?.Kh===t)return this.zs.Zh;const i=new Ot(t);return this.zs={Kh:t,Zh:i},i}Gh(){return this.Yh.zOrder?.()??"normal"}}function Nt(t){return{ri:t.text(),Bi:t.coordinate(),Vi:t.fixedCoordinate?.(),R:t.textColor(),G:t.backColor(),It:t.visible?.()??!0,pi:t.tickVisible?.()??!0}}class Ft{constructor(t,i){this.Xt=new W,this.ta=t,this.ia=i}Tt(){return this.Xt.ht({nn:this.ia.nn(),...Nt(this.ta)}),this.Xt}}class Wt extends L{constructor(t,i){super(),this.ta=t,this.Ki=i}Yi(t,i,n){const s=Nt(this.ta);n.G=s.G,t.R=s.R;const e=2/12*this.Ki.P();n.Ti=e,n.Ri=e,n.Bi=s.Bi,n.Vi=s.Vi,t.ri=s.ri,t.It=s.It,t.pi=s.pi}}class Ht extends At{constructor(t,i){super(t),this.na=null,this.sa=null,this.ea=null,this.ra=null,this.Te=i}dn(){const t=this.Jh.timeAxisViews?.()??[];if(this.na?.Kh===t)return this.na.Zh;const i=this.Te.Qt().Bt(),n=t.map((t=>new Ft(t,i)));return this.na={Kh:t,Zh:n},n}qn(){const t=this.Jh.priceAxisViews?.()??[];if(this.sa?.Kh===t)return this.sa.Zh;const i=this.Te.Ft(),n=t.map((t=>new Wt(t,i)));return this.sa={Kh:t,Zh:n},n}ha(){const t=this.Jh.priceAxisPaneViews?.()??[];if(this.ea?.Kh===t)return this.ea.Zh;const i=t.map((t=>new Lt(t)));return this.ea={Kh:t,Zh:i},i}aa(){const t=this.Jh.timeAxisPaneViews?.()??[];if(this.ra?.Kh===t)return this.ra.Zh;const i=t.map((t=>new Lt(t)));return this.ra={Kh:t,Zh:i},i}la(t,i){return this.Jh.autoscaleInfo?.(t,i)??null}}function Ut(t,i,n,s){t.forEach((t=>{i(t).forEach((t=>{t.Gh()===n&&s.push(t)}))}))}function $t(t){return t.jn()}function jt(t){return t.ha()}function qt(t){return t.aa()}const Yt=["Area","Line","Baseline"];class Kt extends bt{constructor(t,i,n,s,e){super(t),this.qt=It(),this.dr=new _t(this),this.oa=[],this._a=new ht(this),this.ua=null,this.ca=null,this.da=null,this.fa=[],this.pa=new Mt,this.va=new Map,this.ma=null,this.yn=n,this.wa=i;const r=new ut(this);if(this.mn=[r],this.pr=new st(r,this,t),Yt.includes(this.wa)&&(this.ua=new ot(this)),this.ga(),this.Yh=s(this,this.Qt(),e),"Custom"===this.wa){const t=this.Yh;t.Ma&&this.ba(t.Ma)}}m(){null!==this.da&&clearTimeout(this.da)}We(t){return this.yn.priceLineColor||t}Ae(t){const i={ze:!0},n=this.Ft();if(this.Qt().Bt().Gi()||n.Gi()||this.qt.Gi())return i;const s=this.Qt().Bt().Be(),e=this.zt();if(null===s||null===e)return i;let r,h;if(t){const t=this.qt.kh();if(null===t)return i;r=t,h=t.$n}else{const t=this.qt.Hn(s.bi(),-1);if(null===t)return i;if(r=this.qt.gh(t.$n),null===r)return i;h=t.$n}const a=r.Wt[3],l=this.xa().xh(h,{Wt:r}),o=n.Nt(a,e.Wt);return{ze:!1,gt:a,ri:n.Ji(a,e.Wt),qe:n.Sa(a),Ye:n.Ca(a,e.Wt),R:l.sh,Bi:o,$n:h}}xa(){return null!==this.ca||(this.ca=new St(this)),this.ca}N(){return this.yn}vr(t){const i=this.Qt(),{priceScaleId:n,visible:s,priceFormat:e}=t;void 0!==n&&n!==this.yn.priceScaleId&&i.ya(this,n),void 0!==s&&s!==this.yn.visible&&i.Pa();const r=void 0!==t.conflationThresholdFactor;_(this.yn,t),r&&(this.va.clear(),this.Qt().mr()),void 0!==e&&(this.ga(),i.ka()),i.Ta(this),i.Ra(),this.Yh.Pt("options")}ht(t,i){this.qt.ht(t),this.va.clear();const n=this.Qt().Bt().N();n.enableConflation&&n.precomputeConflationOnInit&&this.Da(n.precomputeConflationPriority),this.Yh.Pt("data"),null!==this.ua&&(i&&i.Ia?this.ua.De():0===t.length&&this.ua.Re());const s=this.Qt().Ks(this);this.Qt().Va(s),this.Qt().Ta(this),this.Qt().Ra(),this.Qt().mr()}Ea(t){const i=new gt(this,t);return this.oa.push(i),this.Qt().Ta(this),i}Ba(t){const i=this.oa.indexOf(t);-1!==i&&this.oa.splice(i,1),this.Qt().Ta(this)}Aa(){return this.oa}bh(){return this.wa}zt(){const t=this.za();return null===t?null:{Wt:t.Wt[3],Oa:t.wt}}za(){const t=this.Qt().Bt().Be();if(null===t)return null;const i=t.La();return this.qt.Hn(i,1)}Un(){return this.qt}ba(t){this.ma=t,this.va.clear()}Na(){return!!this.Qt().Bt().N().enableConflation&&this.Fa()>1}Rr(t){if(!this.Na())return;const i=this.Fa();if(!this.va.has(i))return;const n="Custom"===this.wa,s=n&&this.ma||void 0,e=n&&this.Yh.Wa?t=>{const i=t,n=this.Yh.Wa(i);return Array.isArray(n)?n:["number"==typeof n?n:0]}:void 0,r=this.pa.Rr(this.qt.Eh(),t,i,s,n,e),h=It();h.ht(r),this.va.set(i,h)}Ha(){const t=this.Qt().Bt().N().enableConflation;if("Custom"===this.wa&&null===this.ma)return this.qt;if(!t)return this.qt;const i=this.Fa(),n=this.va.get(i);if(n)return n;this.Ua(i);return this.va.get(i)??this.qt}$a(t){const i=this.qt.gh(t);return null===i?null:"Bar"===this.wa||"Candlestick"===this.wa||"Custom"===this.wa?{jr:i.Wt[0],qr:i.Wt[1],Yr:i.Wt[2],Kr:i.Wt[3]}:i.Wt[3]}ja(t){const i=[];Ut(this.fa,$t,"top",i);const n=this.ua;return null!==n&&n.It()?(null===this.da&&n.Ve()&&(this.da=setTimeout((()=>{this.da=null,this.Qt().qa()}),0)),n.Ie(),i.unshift(n),i):i}jn(){const t=[];this.Ya()||t.push(this._a),t.push(this.Yh,this.dr);const i=this.oa.map((t=>t.wr()));return t.push(...i),Ut(this.fa,$t,"normal",t),t}Ka(){return this.Za($t,"bottom")}Ga(t){return this.Za(jt,t)}Xa(t){return this.Za(qt,t)}Ja(t,i){return this.fa.map((n=>n.Qs(t,i))).filter((t=>null!==t))}cn(){return[this.pr,...this.oa.map((t=>t.gr()))]}qn(t,i){if(i!==this.hn&&!this.Ya())return[];const n=[...this.mn];for(const t of this.oa)n.push(t.Mr());return this.fa.forEach((t=>{n.push(...t.qn())})),n}dn(){const t=[];return this.fa.forEach((i=>{t.push(...i.dn())})),t}la(t,i){if(void 0!==this.yn.autoscaleInfoProvider){const n=this.yn.autoscaleInfoProvider((()=>{const n=this.Qa(t,i);return null===n?null:n.sr()}));return ft.er(n)}return this.Qa(t,i)}Kh(){const t=this.yn.priceFormat;return t.base??1/t.minMove}tl(){return this.il}Nn(){this.Yh.Pt();for(const t of this.mn)t.Pt();for(const t of this.oa)t.Pt();this.dr.Pt(),this._a.Pt(),this.ua?.Pt(),this.fa.forEach((t=>t.Nn()))}Ft(){return a(super.Ft())}At(t){if(!(("Line"===this.wa||"Area"===this.wa||"Baseline"===this.wa)&&this.yn.crosshairMarkerVisible))return null;const i=this.qt.gh(t);if(null===i)return null;return{gt:i.Wt[3],ft:this.nl(),Ht:this.sl(),Lt:this.el(),Ot:this.rl(t)}}He(){return this.yn.title}It(){return this.yn.visible}hl(t){this.fa.push(new Ht(t,this))}al(t){this.fa=this.fa.filter((i=>i.Qh()!==t))}ll(){if("Custom"===this.wa)return t=>this.Yh.Wa(t)}ol(){if("Custom"===this.wa)return t=>this.Yh._l(t)}ul(){return this.qt.zh()}Ya(){return!q(this.Ft().cl())}Qa(t,i){if(!c(t)||!c(i)||this.qt.Gi())return null;const n="Line"===this.wa||"Area"===this.wa||"Baseline"===this.wa||"Histogram"===this.wa?[3]:[2,1],s=this.qt.Bh(t,i,n);let e=null!==s?new dt(s.Uh,s.$h):null,r=null;if("Histogram"===this.bh()){const t=this.yn.base,i=new dt(t,t);e=null!==e?e.xs(i):i}return this.fa.forEach((n=>{const s=n.la(t,i);if(s?.priceRange){const t=new dt(s.priceRange.minValue,s.priceRange.maxValue);e=null!==e?e.xs(t):t}s?.margins&&(r=s.margins)})),new ft(e,r)}nl(){switch(this.wa){case"Line":case"Area":case"Baseline":return this.yn.crosshairMarkerRadius}return 0}sl(){switch(this.wa){case"Line":case"Area":case"Baseline":{const t=this.yn.crosshairMarkerBorderColor;if(0!==t.length)return t}}return null}el(){switch(this.wa){case"Line":case"Area":case"Baseline":return this.yn.crosshairMarkerBorderWidth}return 0}rl(t){switch(this.wa){case"Line":case"Area":case"Baseline":{const t=this.yn.crosshairMarkerBackgroundColor;if(0!==t.length)return t}}return this.xa().xh(t).sh}ga(){switch(this.yn.priceFormat.type){case"custom":{const t=this.yn.priceFormat.formatter;this.il={format:t,formatTickmarks:this.yn.priceFormat.tickmarksFormatter??(i=>i.map(t))};break}case"volume":this.il=new Q(this.yn.priceFormat.precision);break;case"percent":this.il=new J(this.yn.priceFormat.precision);break;default:{const t=Math.pow(10,this.yn.priceFormat.precision);this.il=new X(t,this.yn.priceFormat.minMove*t)}}null!==this.hn&&this.hn.dl()}Za(t,i){const n=[];return Ut(this.fa,t,i,n),n}Fa(){const{fl:t,pl:i,vl:n}=this.ml();return this.pa.Sr(t,i,n)}ml(){const t=this.Qt().Bt(),i=t.fl(),n=window.devicePixelRatio||1,s=t.N().conflationThresholdFactor;return{fl:i,pl:n,vl:this.yn.conflationThresholdFactor??s??1}}wl(t){const i=this.qt.Eh();let n;if("Custom"===this.wa&&null!==this.ma){const s=this.ll();if(!s)throw new Error(vt);n=this.pa.Cr(i,t,this.ma,!0,(t=>s(t)))}else n=this.pa.Cr(i,t);const s=It();return s.ht(n),s}Ua(t){const i=this.wl(t);this.va.set(t,i)}Da(t){if("Custom"===this.wa&&(null===this.ma||!this.ll()))return;this.va.clear();const i=this.Qt().Bt().gl();for(const n of i){const i=()=>{this.Ml(n)},s="object"==typeof window&&window||"object"==typeof self&&self;s?.xl?.bl?s.xl.bl((()=>{i()}),{se:t}):Promise.resolve().then((()=>i()))}}Ml(t){if(this.va.has(t))return;if(0===this.qt.Eh().length)return;const i=this.wl(t);this.va.set(t,i)}}const Zt=[3],Gt=[0,1,2,3];class Xt{constructor(t){this.yn=t}Sl(t,i,n){let s=t;if(0===this.yn.mode)return s;const e=n.kn(),r=e.zt();if(null===r)return s;const h=e.Nt(t,r),a=n.Cl().filter((t=>t instanceof Kt)).reduce(((t,s)=>{if(n.Zs(s)||!s.It())return t;const e=s.Ft(),r=s.Un();if(e.Gi()||!r.Oe(i))return t;const h=r.gh(i);if(null===h)return t;const a=l(s.zt()),o=3===this.yn.mode?Gt:Zt;return t.concat(o.map((t=>e.Nt(h.Wt[t],a.Wt))))}),[]);if(0===a.length)return s;a.sort(((t,i)=>Math.abs(t-h)-Math.abs(i-h)));const o=a[0];return s=e.Tn(o,r),s}}function Jt(t,i,n){return Math.min(Math.max(t,i),n)}function Qt(t,i,n){return i-t<=n}function ti(t){const i=Math.ceil(t);return i%2==0?i-1:i}class ii extends y{constructor(){super(...arguments),this.qt=null}ht(t){this.qt=t}et({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:e}){if(null===this.qt)return;const r=Math.max(1,Math.floor(n));t.lineWidth=r,function(t,i){t.save(),t.lineWidth%2&&t.translate(.5,.5),i(),t.restore()}(t,(()=>{const h=a(this.qt);if(h.yl){t.strokeStyle=h.Pl,s(t,h.kl),t.beginPath();for(const s of h.Tl){const e=Math.round(s.Rl*n);t.moveTo(e,-r),t.lineTo(e,i.height+r)}t.stroke()}if(h.Dl){t.strokeStyle=h.Il,s(t,h.Vl),t.beginPath();for(const n of h.El){const s=Math.round(n.Rl*e);t.moveTo(-r,s),t.lineTo(i.width+r,s)}t.stroke()}}))}}class ni{constructor(t){this.Xt=new ii,this.St=!0,this.yt=t}Pt(){this.St=!0}Tt(){if(this.St){const t=this.yt.Qt().N().grid,i={Dl:t.horzLines.visible,yl:t.vertLines.visible,Il:t.horzLines.color,Pl:t.vertLines.color,Vl:t.horzLines.style,kl:t.vertLines.style,El:this.yt.kn().Bl(),Tl:(this.yt.Qt().Bt().Bl()||[]).map((t=>({Rl:t.coord})))};this.Xt.ht(i),this.St=!1}return this.Xt}}class si{constructor(t){this.Yh=new ni(t)}wr(){return this.Yh}}const ei={Al:4,zl:1e-4};function ri(t,i){const n=100*(t-i)/i;return i<0?-n:n}function hi(t,i){const n=ri(t.Je(),i),s=ri(t.Qe(),i);return new dt(n,s)}function ai(t,i){const n=100*(t-i)/i+100;return i<0?-n:n}function li(t,i){const n=ai(t.Je(),i),s=ai(t.Qe(),i);return new dt(n,s)}function oi(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.log10(n+i.zl)+i.Al;return t<0?-s:s}function _i(t,i){const n=Math.abs(t);if(n<1e-15)return 0;const s=Math.pow(10,n-i.Al)-i.zl;return t<0?-s:s}function ui(t,i){if(null===t)return null;const n=oi(t.Je(),i),s=oi(t.Qe(),i);return new dt(n,s)}function ci(t,i){if(null===t)return null;const n=_i(t.Je(),i),s=_i(t.Qe(),i);return new dt(n,s)}function di(t){if(null===t)return ei;const i=Math.abs(t.Qe()-t.Je());if(i>=1||i<1e-15)return ei;const n=Math.ceil(Math.abs(Math.log10(i))),s=ei.Al+n;return{Al:s,zl:1/Math.pow(10,s)}}class fi{constructor(t,i){if(this.Ol=t,this.Ll=i,function(t){if(t<0)return!1;if(t>1e18)return!0;for(let i=t;i>1;i/=10)if(i%10!=0)return!1;return!0}(this.Ol))this.Nl=[2,2.5,2];else{this.Nl=[];for(let t=this.Ol;1!==t;){if(t%2==0)this.Nl.push(2),t/=2;else{if(t%5!=0)throw new Error("unexpected base");this.Nl.push(2,2.5),t/=5}if(this.Nl.length>100)throw new Error("something wrong with base")}}}Fl(t,i,n){const s=0===this.Ol?0:1/this.Ol;let e=Math.pow(10,Math.max(0,Math.ceil(Math.log10(t-i)))),r=0,h=this.Ll[0];for(;;){const t=Qt(e,s,1e-14)&&e>s+1e-14,i=Qt(e,n*h,1e-14),a=Qt(e,1,1e-14);if(!(t&&i&&a))break;e/=h,h=this.Ll[++r%this.Ll.length]}if(e<=s+1e-14&&(e=s),e=Math.max(1,e),this.Nl.length>0&&(a=e,l=1,o=1e-14,Math.abs(a-l)s+1e-14;)e/=h,h=this.Nl[++r%this.Nl.length];var a,l,o;return e}}class pi{constructor(t,i,n,s){this.Wl=[],this.Ki=t,this.Ol=i,this.Hl=n,this.Ul=s}Fl(t,i){if(tt.Jl)),c=this.Ki.Ql(u);for(let t=0;t=s?1:-1;let _=null,u=0;for(let c=n-l;c>s;c-=i){const n=this.Ul(c,t,!0);null!==_&&Math.abs(n-_)r||(u0&&h[0].Rl-a.Rl0&&l.Rl-h[h.length-1].Rla(t.ln())-a(i.ln())))}var mi;!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"}(mi||(mi={}));const wi=new J,gi=new X(100,1);class Mi{constructor(t,i,n,s,e){this.ho=0,this.ao=null,this.rr=null,this.lo=null,this.oo={_o:!1,uo:null},this.co=!1,this.do=0,this.fo=0,this.po=new o,this.vo=new o,this.mo=[],this.wo=null,this.Mo=null,this.bo=null,this.xo=null,this.So=null,this.il=gi,this.Co=di(null),this.yo=t,this.yn=i,this.Po=n,this.ko=s,this.To=e,this.Ro=new pi(this,100,this.Do.bind(this),this.Io.bind(this))}cl(){return this.yo}N(){return this.yn}vr(t){if(_(this.yn,t),this.dl(),void 0!==t.mode&&this.Vo({_e:t.mode}),void 0!==t.scaleMargins){const i=h(t.scaleMargins.top),n=h(t.scaleMargins.bottom);if(i<0||i>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${i}`);if(n<0||n>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${n}`);if(i+n>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${i+n}`);this.Eo(),this.bo=null}}Bo(){return this.yn.autoScale}Ao(){return this.co}so(){return 1===this.yn.mode}je(){return 2===this.yn.mode}zo(){return 3===this.yn.mode}ro(){return this.Co}_e(){return{hs:this.yn.autoScale,Oo:this.yn.invertScale,_e:this.yn.mode}}Vo(t){const i=this._e();let n=null;void 0!==t.hs&&(this.yn.autoScale=t.hs),void 0!==t._e&&(this.yn.mode=t._e,2!==t._e&&3!==t._e||(this.yn.autoScale=!0),this.oo._o=!1),1===i._e&&t._e!==i._e&&(!function(t,i){if(null===t)return!1;const n=_i(t.Je(),i),s=_i(t.Qe(),i);return isFinite(n)&&isFinite(s)}(this.rr,this.Co)?this.yn.autoScale=!0:(n=ci(this.rr,this.Co),null!==n&&this.Lo(n))),1===t._e&&t._e!==i._e&&(n=ui(this.rr,this.Co),null!==n&&this.Lo(n));const s=i._e!==this.yn.mode;s&&(2===i._e||this.je())&&this.dl(),s&&(3===i._e||this.zo())&&this.dl(),void 0!==t.Oo&&i.Oo!==t.Oo&&(this.yn.invertScale=t.Oo,this.No()),this.vo.p(i,this._e())}Fo(){return this.vo}P(){return this.Po.fontSize}$t(){return this.ho}Wo(t){this.ho!==t&&(this.ho=t,this.Eo(),this.bo=null)}Ho(){if(this.ao)return this.ao;const t=this.$t()-this.Uo()-this.$o();return this.ao=t,t}ar(){return this.jo(),this.rr}Lo(t,i){const n=this.rr;(i||null===n&&null!==t||null!==n&&!n.Ge(t))&&(this.bo=null,this.rr=t)}qo(t){this.Lo(t),this.Yo(null!==t)}Gi(){return this.jo(),0===this.ho||!this.rr||this.rr.Gi()}Ko(t){return this.Oo()?t:this.$t()-1-t}Nt(t,i){return this.je()?t=ri(t,i):this.zo()&&(t=ai(t,i)),this.Io(t,i)}Zo(t,i,n){this.jo();const s=this.$o(),e=a(this.ar()),r=e.Je(),h=e.Qe(),l=this.Ho()-1,o=this.Oo(),_=l/(h-r),u=void 0===n?0:n.from,c=void 0===n?t.length:n.to,d=this.Go();for(let n=u;nt.Nn()))}Kl(){return this.yn.ensureEdgeTickMarksVisible&&this.Bo()}Gl(){return this.P()/2}dl(){this.bo=null;let t=1/0;this.wo=null;for(const i of this.mo)i.ln()oi(t,this.Co):null}b_(t,i,n){return void 0===i?(void 0===n&&(n=this.tl()),n.format(t)):i(t)}x_(t,i,n){return void 0===i?(void 0===n&&(n=this.tl()),n.formatTickmarks(t)):i(t)}cr(t,i){return this.b_(t,this.ko.priceFormatter,i)}v_(t,i){const n=this.ko.priceFormatter;return this.x_(t,this.ko.tickmarksPriceFormatter??(n?t=>t.map(n):void 0),i)}f_(t,i){return this.b_(t,this.ko.percentageFormatter,i)}p_(t,i){const n=this.ko.percentageFormatter;return this.x_(t,this.ko.tickmarksPercentageFormatter??(n?t=>t.map(n):void 0),i)}}function bi(t){return t instanceof Kt}class xi{constructor(t,i){this.mo=[],this.S_=new Map,this.ho=0,this.C_=0,this.y_=1,this.Mo=null,this.P_=null,this.k_=!1,this.T_=new o,this.fa=[],this.ia=t,this.sn=i,this.R_=new si(this);const n=i.N();this.D_=this.I_("left",n.leftPriceScale),this.V_=this.I_("right",n.rightPriceScale),this.D_.Fo().i(this.E_.bind(this,this.D_),this),this.V_.Fo().i(this.E_.bind(this,this.V_),this),this.B_(n)}B_(t){if(t.leftPriceScale&&this.D_.vr(t.leftPriceScale),t.rightPriceScale&&this.V_.vr(t.rightPriceScale),t.localization&&(this.D_.dl(),this.V_.dl()),t.overlayPriceScales){const i=Array.from(this.S_.values());for(const n of i){const i=a(n[0].Ft());i.vr(t.overlayPriceScales),t.localization&&i.dl()}}}A_(t){switch(t){case"left":return this.D_;case"right":return this.V_}return this.S_.has(t)?h(this.S_.get(t))[0].Ft():null}m(){this.Qt().z_().u(this),this.D_.Fo().u(this),this.V_.Fo().u(this),this.mo.forEach((t=>{t.m&&t.m()})),this.fa=this.fa.filter((t=>{const i=t.Qh();return i.detached&&i.detached(),!1})),this.T_.p()}O_(){return this.y_}L_(t){this.y_=t}Qt(){return this.sn}nn(){return this.C_}$t(){return this.ho}N_(t){this.C_=t,this.F_()}Wo(t){this.ho=t,this.D_.Wo(t),this.V_.Wo(t),this.mo.forEach((i=>{if(this.Zs(i)){const n=i.Ft();null!==n&&n.Wo(t)}})),this.F_()}W_(t){this.k_=t}H_(){return this.k_}U_(){return this.mo.filter(bi)}Cl(){return this.mo}Zs(t){const i=t.Ft();return null===i||this.D_!==i&&this.V_!==i}s_(t,i,n){this.j_(t,i,n?t.ln():this.mo.length)}r_(t,i){const n=this.mo.indexOf(t);r(-1!==n,"removeDataSource: invalid data source"),this.mo.splice(n,1),i||this.mo.forEach(((t,i)=>t._n(i)));const s=a(t.Ft()).cl();if(this.S_.has(s)){const i=h(this.S_.get(s)),n=i.indexOf(t);-1!==n&&(i.splice(n,1),0===i.length&&this.S_.delete(s))}const e=t.Ft();e&&e.Cl().indexOf(t)>=0&&(e.r_(t),this.q_(e)),this.Y_()}Xs(t){return t===this.D_?"left":t===this.V_?"right":"overlay"}K_(){return this.D_}Z_(){return this.V_}G_(t,i){t.l_(i)}X_(t,i){t.o_(i),this.F_()}J_(t){t.__()}Q_(t,i){t.u_(i)}tu(t,i){t.c_(i),this.F_()}iu(t){t.d_()}F_(){this.mo.forEach((t=>{t.Nn()}))}kn(){const[t,i]=this.nu();let n=null;return t.N().visible&&0!==t.Cl().length?n=t:i.N().visible&&0!==i.Cl().length?n=i:0!==this.mo.length&&(n=this.mo[0].Ft()),null===n&&(n=this.Gs()??t),n}Gs(){const[t,i]=this.nu();return t.N().visible?t:i.N().visible?i:null}q_(t){null!==t&&t.Bo()&&this.su(t)}eu(t){const i=this.ia.Be();t.Vo({hs:!0}),null!==i&&t.w_(i),this.F_()}ru(){this.su(this.D_),this.su(this.V_)}hu(){this.q_(this.D_),this.q_(this.V_),this.mo.forEach((t=>{this.Zs(t)&&this.q_(t.Ft())})),this.F_(),this.sn.mr()}Dt(){return null===this.Mo&&(this.Mo=vi(this.mo)),this.Mo}au(){const t=this.Dt(),i=this.sn.ou()?.lu,n=this.sn.N().hoveredSeriesOnTop,s=this.P_;if(null!==s&&s.Kh===t&&s._u===i&&s.uu===n)return s.cu;const e=function(t,i,n){if(!n)return t;const s=t.indexOf(i);if(-1===s||s===t.length-1)return t;const e=[];for(let i=0;it._n(i))),this.Y_();for(const t of[this.D_,this.V_])t.e_(),t.dl();this.sn.mr()}Vt(){return this.Dt().filter(bi)}fu(){return this.T_}pu(){return this.R_}hl(t){this.fa.push(new zt(t))}al(t){this.fa=this.fa.filter((i=>i.Qh()!==t)),t.detached&&t.detached(),this.sn.mr()}vu(){return this.fa}Ja(t,i){return this.fa.map((n=>n.Qs(t,i))).filter((t=>null!==t))}su(t){const i=t.m_();if(i&&i.length>0&&!this.ia.Gi()){const i=this.ia.Be();null!==i&&t.w_(i)}t.Nn()}j_(t,i,n){let s=this.A_(i);if(null===s&&(s=this.I_(i,this.sn.N().overlayPriceScales)),this.mo.splice(n,0,t),!q(i)){const n=this.S_.get(i)||[];n.push(t),this.S_.set(i,n)}t._n(n),s.s_(t),t.un(s),this.q_(s),this.Y_()}Y_(){this.Mo=null,this.P_=null}nu(){return"left"===this.sn.N().defaultVisiblePriceScaleId?[this.D_,this.V_]:[this.V_,this.D_]}E_(t,i,n){i._e!==n._e&&this.su(t)}I_(t,i){const n={visible:!0,autoScale:!0,...p(i)},s=new Mi(t,n,this.sn.N().layout,this.sn.N().localization,this.sn.Xi());return s.Wo(this.$t()),s}}function Si(t,i){return null===i||(2===t.se&&2!==i.se||(2!==i.se||2===t.se)&&(t.ne!==i.ne&&t.ne= left"),this.Pu=t,this.ku=i}La(){return this.Pu}bi(){return this.ku}Tu(){return this.ku-this.Pu+1}Oe(t){return this.Pu<=t&&t<=this.ku}Ge(t){return this.Pu===t.La()&&this.ku===t.bi()}}function Vi(t,i){return null===t||null===i?t===i:t.Ge(i)}class Ei{constructor(){this.Ru=new Map,this.zs=null,this.Du=!1}Iu(t){this.Du=t,this.zs=null}Vu(t,i){this.Eu(i),this.zs=null;for(let n=i;n{t<=n[0].index?i.push(s):n.splice(yt(n,t,(i=>i.index!i||n.has(t.index);for(const i of Array.from(this.Ru.keys()).sort(((t,i)=>i-t))){if(!this.Ru.get(i))continue;const n=s;s=[];const r=n.length;let a=0;const l=h(this.Ru.get(i)),o=l.length;let _=1/0,u=-1/0;for(let i=0;i=t&&o-u>=t&&e(h))s.push(h),u=o;else if(this.Du)return n}for(;ai.weight?t:i}class zi{constructor(t,i,n,s){this.C_=0,this.Uu=null,this.$u=[],this.So=null,this.xo=null,this.ju=new Ei,this.qu=new Map,this.Yu=Bi.Hu(),this.Ku=!0,this.Zu=new o,this.Gu=new o,this.Xu=new o,this.Ju=null,this.Qu=null,this.tc=new Map,this.nc=-1,this.sc=[],this.ec=1,this.yn=i,this.ko=n,this.rc=i.rightOffset,this.hc=i.barSpacing,this.sn=t,this.ac(i),this.Su=s,this.lc(),this.ju.Iu(i.uniformDistribution),this.oc(),this._c()}N(){return this.yn}uc(t){_(this.ko,t),this.cc(),this.lc()}vr(t,i){_(this.yn,t),this.yn.fixLeftEdge&&this.dc(),this.yn.fixRightEdge&&this.fc(),void 0!==t.barSpacing&&this.sn.gs(t.barSpacing),void 0!==t.rightOffset&&this.sn.Ms(t.rightOffset),this.ac(t),void 0===t.minBarSpacing&&void 0===t.maxBarSpacing||this.sn.gs(t.barSpacing??this.hc),void 0!==t.ignoreWhitespaceIndices&&t.ignoreWhitespaceIndices!==this.yn.ignoreWhitespaceIndices&&this._c(),this.cc(),this.lc(),void 0===t.enableConflation&&void 0===t.conflationThresholdFactor||this.oc(),this.Xu.p()}Rn(t){return this.$u[t]?.time??null}en(t){return this.$u[t]??null}vc(t,i){if(this.$u.length<1)return null;if(this.Su.key(t)>this.Su.key(this.$u[this.$u.length-1].time))return i?this.$u.length-1:null;const n=yt(this.$u,this.Su.key(t),((t,i)=>this.Su.key(t.time)0}Be(){return this.wc(),this.Yu.Fu()}gc(){return this.wc(),this.Yu.Wu()}Mc(){const t=this.Be();if(null===t)return null;const i={from:t.La(),to:t.bi()};return this.bc(i)}bc(t){const i=Math.round(t.from),n=Math.round(t.to),s=a(this.xc()),e=a(this.Sc());return{from:a(this.en(Math.max(s,i))),to:a(this.en(Math.min(e,n)))}}Cc(t){return{from:a(this.vc(t.from,!0)),to:a(this.vc(t.to,!0))}}nn(){return this.C_}N_(t){if(!isFinite(t)||t<=0)return;if(this.C_===t)return;const i=this.gc(),n=this.C_;if(this.C_=t,this.Ku=!0,this.yn.lockVisibleTimeRangeOnResize&&0!==n){const i=this.hc*t/n;this.hc=i}if(this.yn.fixLeftEdge&&null!==i&&i.La()<=0){const i=n-t;this.rc-=Math.round(i/this.hc)+1,this.Ku=!0}this.yc(),this.Pc()}jt(t){if(this.Gi()||!c(t))return 0;const i=this.kc()+this.rc-t;return this.C_-(i+.5)*this.hc-1}Tc(t,i){const n=this.kc(),s=void 0===i?0:i.from,e=void 0===i?t.length:i.to;for(let i=s;ii/2&&!_?n.needAlignCoordinate=!1:n.needAlignCoordinate=u&&t.index<=l||c&&t.index>=o,d++}return this.sc.length=d,this.Qu=this.sc,this.sc}Lc(){let t;this.Ku=!0,this.gs(this.yn.barSpacing),t=void 0!==this.yn.rightOffsetPixels?this.yn.rightOffsetPixels/this.fl():this.yn.rightOffset,this.Ms(t)}Nc(t){this.Ku=!0,this.Uu=t,this.Pc(),this.dc()}Fc(t,i){const n=this.Dc(t),s=this.fl(),e=s+i*(s/10);this.gs(e),this.yn.rightBarStaysOnScroll||this.Ms(this.Ac()+(n-this.Dc(t)))}l_(t){this.So&&this.d_(),null===this.xo&&null===this.Ju&&(this.Gi()||(this.xo=t,this.Wc()))}o_(t){if(null===this.Ju)return;const i=Jt(this.C_-t,0,this.C_),n=Jt(this.C_-a(this.xo),0,this.C_);0!==i&&0!==n&&this.gs(this.Ju.fl*i/n)}__(){null!==this.xo&&(this.xo=null,this.Hc())}u_(t){null===this.So&&null===this.Ju&&(this.Gi()||(this.So=t,this.Wc()))}c_(t){if(null===this.So)return;const i=(this.So-t)/this.fl();this.rc=a(this.Ju).Ac+i,this.Ku=!0,this.Pc()}d_(){null!==this.So&&(this.So=null,this.Hc())}Uc(){this.$c(this.yn.rightOffset)}$c(t,i=400){if(!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const n=this.rc,s=performance.now();this.sn.ps({jc:t=>(t-s)/i>=1,qc:e=>{const r=(e-s)/i;return r>=1?t:n+(t-n)*r}})}Pt(t,i){this.Ku=!0,this.$u=t,this.ju.Vu(t,i),this.Pc()}Yc(){return this.Zu}Kc(){return this.Gu}Zc(){return this.Xu}kc(){return this.Uu||0}Gc(t,i){const n=t.Tu(),s=i&&this.yn.rightOffsetPixels||0;this.Bc((this.C_-s)/n),this.rc=t.bi()-this.kc(),i&&(this.rc=s?s/this.fl():this.yn.rightOffset),this.Pc(),this.Ku=!0,this.sn.Ec(),this.sn.mr()}Xc(){const t=this.xc(),i=this.Sc();if(null===t||null===i)return;const n=!this.yn.rightOffsetPixels&&this.yn.rightOffset||0;this.Gc(new Ii(t,i+n),!0)}Jc(t){const i=new Ii(t.from,t.to);this.Gc(i)}rn(t){return void 0!==this.ko.timeFormatter?this.ko.timeFormatter(t.originalTime):this.Su.formatHorzItem(t.time)}_c(){if(!this.yn.ignoreWhitespaceIndices)return;this.tc.clear();const t=this.sn.Jn();for(const i of t)for(const t of i.ul())this.tc.set(t,!0);this.nc++}Qc(){return this.ec}gl(){const t=1/(window.devicePixelRatio||1),i=this.yn.minBarSpacing;if(i>=t)return[1];const n=[1];let s=2;for(;s<=512;){i0?this.yn.maxBarSpacing:.5*this.C_}ed(){return this.yn.fixLeftEdge&&this.yn.fixRightEdge&&0!==this.$u.length?this.C_/this.$u.length:this.yn.minBarSpacing}oc(){if(!this.yn.enableConflation)return void(this.ec=1);const t=1/(window.devicePixelRatio||1)*(this.yn.conflationThresholdFactor??1);if(this.hc>=t)return void(this.ec=1);const i=t/this.hc,n=Math.pow(2,Math.floor(Math.log2(i)));this.ec=Math.min(n,512)}Pc(){const t=this.hd();null!==t&&this.rci&&(this.rc=i,this.Ku=!0)}hd(){const t=this.xc(),i=this.Uu;if(null===t||null===i)return null;return t-i-1+(this.yn.fixLeftEdge?this.C_/this.hc:Math.min(2,this.$u.length))}ad(){return this.yn.fixRightEdge?0:this.C_/this.hc-Math.min(2,this.$u.length)}Wc(){this.Ju={fl:this.fl(),Ac:this.Ac()}}Hc(){this.Ju=null}Oc(t){let i=this.qu.get(t.weight);return void 0===i&&(i=new Di((t=>this.ld(t)),this.Su),this.qu.set(t.weight,i)),i.Cu(t)}ld(t){return this.Su.formatTickmark(t,this.ko)}sd(t){const i=this.Yu;this.Yu=t,Vi(i.Fu(),this.Yu.Fu())||this.Zu.p(),Vi(i.Wu(),this.Yu.Wu())||this.Gu.p(),this.nd()}nd(){this.Qu=null}cc(){this.nd(),this.qu.clear()}lc(){this.Su.updateFormatter(this.ko)}dc(){if(!this.yn.fixLeftEdge)return;const t=this.xc();if(null===t)return;const i=this.Be();if(null===i)return;const n=i.La()-t;if(n<0){const t=this.rc-n-1;this.Ms(t)}this.yc()}fc(){this.Pc(),this.yc()}Ic(t){return!this.yn.ignoreWhitespaceIndices||(this.tc.get(t)||!1)}Vc(t){const i=function*(t){const i=Math.round(t),n=in)break}return t}ac(t){if(void 0!==t.rightOffsetPixels){const i=t.rightOffsetPixels/(t.barSpacing||this.hc);this.sn.Ms(i)}}}var Oi,Li,Ni,Fi,Wi;!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"}(Oi||(Oi={}));class Hi{constructor(t,i,n){this.od=[],this._d=[],this.ud=null,this.C_=0,this.dd=null,this.fd=new o,this.pd=new o,this.vd=null,this.md=t,this.yn=i,this.Su=n,this.To=new S(this.yn.layout.colorParsers),this.wd=new M(this),this.ia=new zi(this,i.timeScale,this.yn.localization,n),this.Ct=new j(this,i.crosshair),this.gd=new Xt(i.crosshair),i.addDefaultPane&&(this.Md(0),this.od[0].L_(2)),this.bd=this.xd(0),this.Sd=this.xd(1)}ka(){this.Cd(Y.ys())}mr(){this.Cd(Y.Cs())}qa(){this.Cd(new Y(1))}Ta(t){const i=this.yd(t);this.Cd(i)}ou(){return this.dd}Pd(t){if(this.dd?.lu===t?.lu&&this.dd?.wu?.te===t?.wu?.te&&this.dd?.wu?.ie===t?.wu?.ie&&this.dd?.mu===t?.mu&&this.dd?.ee===t?.ee)return;const i=this.dd;this.dd=t,null!==i&&this.Ta(i.lu),null!==t&&t.lu!==i?.lu&&this.Ta(t.lu)}N(){return this.yn}vr(t){_(this.yn,t),this.od.forEach((i=>i.B_(t))),void 0!==t.timeScale&&this.ia.vr(t.timeScale),void 0!==t.localization&&this.ia.uc(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.fd.p(),this.bd=this.xd(0),this.Sd=this.xd(1),this.ka()}kd(t,i,n=0){const s=this.od[n];if(void 0===s)return;if("left"===t)return _(this.yn,{leftPriceScale:i}),s.B_({leftPriceScale:i}),this.fd.p(),void this.ka();if("right"===t)return _(this.yn,{rightPriceScale:i}),s.B_({rightPriceScale:i}),this.fd.p(),void this.ka();const e=this.Td(t,n);null!==e&&(e.Ft.vr(i),this.fd.p())}Td(t,i){const n=this.od[i];if(void 0===n)return null;const s=n.A_(t);return null!==s?{Kn:n,Ft:s}:null}Bt(){return this.ia}Zn(){return this.od}Rd(){return this.Ct}Dd(){return this.pd}Id(t,i){t.Wo(i),this.Ec()}N_(t){this.C_=t,this.ia.N_(this.C_),this.od.forEach((i=>i.N_(t))),this.Ec()}Vd(t){1!==this.od.length&&(r(t>=0&&t=0&&tt+i.O_()),0),e=this.od.reduce(((t,i)=>t+i.$t()),0),h=e-30*(this.od.length-1);i=Math.min(h,Math.max(30,i));const a=s/e,l=n.$t();n.L_(i*a);let o=i-l,_=this.od.length-1;for(const t of this.od)if(t!==n){const i=Math.min(h,Math.max(30,t.$t()-o/_));o-=t.$t()-i,_-=1;const n=i*a;t.L_(n)}this.ka()}Bd(t,i){r(t>=0&&t=0&&i=0&&t=0&&it.It()))),this.ud}Pa(){this.ud=null}jd(t,i,n,s,e){this.Ct.In(t,i);let r=NaN,h=this.ia.Rc(t,!0);const a=this.ia.Be();null!==a&&(h=Math.min(Math.max(a.La(),h),a.bi())),h=this.Ct.Fn(h);const l=s.kn(),o=l.zt();if(null!==o&&(r=l.Tn(i,o)),r=this.gd.Sl(r,h,s),this.Ct.An(h,r,s),this.qa(),!e){const e=Ri(s,t,i);this.Pd(e&&{lu:e.lu,wu:e.wu,mu:e.mu||null,ee:e.ee}),this.pd.p(this.Ct.Et(),{x:t,y:i},n)}}qd(t,i,n){const s=n.kn(),e=s.zt(),r=s.Nt(t,a(e)),h=this.ia.vc(i,!0),l=this.ia.jt(a(h));this.jd(l,r,null,n,!0)}Yd(t){this.Rd().On(),this.qa(),t||this.pd.p(null,null,null)}Ra(){const t=this.Ct.Kn();if(null!==t){const i=this.Ct.En(),n=this.Ct.Bn();this.jd(i,n,null,t)}this.Ct.Nn()}Kd(t,i,n){const s=this.ia.Rn(0);void 0!==i&&void 0!==n&&this.ia.Pt(i,n);const e=this.ia.Rn(0),r=this.ia.kc(),h=this.ia.Be();if(null!==h&&null!==s&&null!==e){const i=h.Oe(r),a=this.Su.key(s)>this.Su.key(e),l=null!==t&&t>r&&!a,o=this.ia.N().allowShiftVisibleRangeOnWhitespaceReplacement,_=i&&(!(void 0===n)||o)&&this.ia.N().shiftVisibleRangeOnNewBar;if(l&&!_){const i=t-r;this.ia.Ms(this.ia.Ac()-i)}}this.ia.Nc(t)}Va(t){null!==t&&t.hu()}Ks(t){if(function(t){return t instanceof xi}(t))return t;const i=this.od.find((i=>i.Dt().includes(t)));return void 0===i?null:i}Ec(){this.od.forEach((t=>t.hu())),this.Ra()}m(){this.od.forEach((t=>t.m())),this.od.length=0,this.yn.localization.priceFormatter=void 0,this.yn.localization.percentageFormatter=void 0,this.yn.localization.timeFormatter=void 0}Zd(){return this.wd}Js(){return this.wd.N()}z_(){return this.fd}Gd(t,i){const n=this.Md(i);this.Xd(t,n),this._d.push(t),this.Pa(),1===this._d.length?this.ka():this.mr()}Jd(t){const i=this.Ks(t),n=this._d.indexOf(t);r(-1!==n,"Series not found");const s=a(i);this._d.splice(n,1),s.r_(t),t.m&&t.m(),this.Pa(),this.ia._c(),this.Qd(s)}ya(t,i){const n=a(this.Ks(t));n.r_(t,!0),n.s_(t,i,!0)}Xc(){const t=Y.Cs();t.us(),this.Cd(t)}tf(t){const i=Y.Cs();i.fs(t),this.Cd(i)}ws(){const t=Y.Cs();t.ws(),this.Cd(t)}gs(t){const i=Y.Cs();i.gs(t),this.Cd(i)}Ms(t){const i=Y.Cs();i.Ms(t),this.Cd(i)}ps(t){const i=Y.Cs();i.ps(t),this.Cd(i)}cs(){const t=Y.Cs();t.cs(),this.Cd(t)}if(){const t=this.yn.defaultVisiblePriceScaleId,i=this.yn.leftPriceScale.visible;return i!==this.yn.rightPriceScale.visible?i?"left":"right":t}nf(t,i){r(i>=0,"Index should be greater or equal to 0");if(i===this.sf(t))return;const n=a(this.Ks(t));n.r_(t);const s=this.Md(i);this.Xd(t,s);let e=!1;0===n.Cl().length&&(e=this.Qd(n)),e||this.ka()}ef(){return this.Sd}$(){return this.bd}Ut(t){const i=this.Sd,n=this.bd;if(i===n)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.vd||this.vd.ah!==n||this.vd.oh!==i)this.vd={ah:n,oh:i,rf:new Map};else{const i=this.vd.rf.get(t);if(void 0!==i)return i}const s=this.To.tt(n,i,t/100);return this.vd.rf.set(t,s),s}hf(t){return this.od.indexOf(t)}Xi(){return this.To}af(){return this.lf()}lf(t){const i=new xi(this.ia,this);this.od.push(i);const n=t??this.od.length-1,s=Y.ys();return s.es(n,{rs:0,hs:!0}),this.Cd(s),i}Md(t){return r(t>=0,"Index should be greater or equal to 0"),(t=Math.min(this.od.length,t))i.U_().includes(t)))}zd(t,i){const n=new Y(i);if(null!==t){const s=this.od.indexOf(t);n.es(s,{rs:i})}return n}yd(t,i){return void 0===i&&(i=2),this.zd(this.Ks(t),i)}Cd(t){this.md&&this.md(t),this.od.forEach((t=>t.pu().wr().Pt()))}Xd(t,i){const n=t.N().priceScaleId,s=void 0!==n?n:this.if();i.s_(t,s),q(s)||t.vr(t.N())}xd(t){const i=this.yn.layout;return"gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color}Qd(t){return!t.H_()&&0===t.Cl().length&&this.od.length>1&&(this.od.splice(this.hf(t),1),this.ka(),!0)}}function Ui(t){if(t>=1)return 0;let i=0;for(;i<8;i++){const n=Math.round(t);if(Math.abs(n-t)<1e-8)return i;t*=10}return i}function $i(t){return!u(t)&&!d(t)}function ji(t){return u(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"}(Li||(Li={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(Ni||(Ni={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(Fi||(Fi={})),function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds"}(Wi||(Wi={}));const qi=t=>t.getUTCFullYear();function Yi(t,i,n){return i.replace(/yyyy/g,(t=>G(qi(t),4))(t)).replace(/yy/g,(t=>G(qi(t)%100,2))(t)).replace(/MMMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(t,n)).replace(/MMM/g,((t,i)=>new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(t,n)).replace(/MM/g,(t=>G((t=>t.getUTCMonth()+1)(t),2))(t)).replace(/dd/g,(t=>G((t=>t.getUTCDate())(t),2))(t))}class Ki{constructor(t="yyyy-MM-dd",i="default"){this._f=t,this.uf=i}Cu(t){return Yi(t,this._f,this.uf)}}class Zi{constructor(t){this.cf=t||"%h:%m:%s"}Cu(t){return this.cf.replace("%h",G(t.getUTCHours(),2)).replace("%m",G(t.getUTCMinutes(),2)).replace("%s",G(t.getUTCSeconds(),2))}}const Gi={df:"yyyy-MM-dd",ff:"%h:%m:%s",pf:" ",vf:"default"};class Xi{constructor(t={}){const i={...Gi,...t};this.mf=new Ki(i.df,i.vf),this.wf=new Zi(i.ff),this.gf=i.pf}Cu(t){return`${this.mf.Cu(t)}${this.gf}${this.wf.Cu(t)}`}}function Ji(t){return 60*t*60*1e3}function Qi(t){return 60*t*1e3}const tn=[{Mf:(nn=1,1e3*nn),bf:10},{Mf:Qi(1),bf:20},{Mf:Qi(5),bf:21},{Mf:Qi(30),bf:22},{Mf:Ji(1),bf:30},{Mf:Ji(3),bf:31},{Mf:Ji(6),bf:32},{Mf:Ji(12),bf:33}];var nn;function sn(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(let n=tn.length-1;n>=0;--n)if(Math.floor(i.getTime()/tn[n].Mf)!==Math.floor(t.getTime()/tn[n].Mf))return tn[n].bf;return 0}function en(t){let i=t;if(d(t)&&(i=hn(t)),!$i(i))throw new Error("time must be of type BusinessDay");const n=new Date(Date.UTC(i.year,i.month-1,i.day,0,0,0,0));return{xf:Math.round(n.getTime()/1e3),Sf:i}}function rn(t){if(!ji(t))throw new Error("time must be of type isUTCTimestamp");return{xf:t}}function hn(t){const i=new Date(t);if(isNaN(i.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function an(t){d(t.time)&&(t.time=hn(t.time))}class ln{options(){return this.yn}setOptions(t){this.yn=t,this.updateFormatter(t.localization)}preprocessData(t){Array.isArray(t)?function(t){t.forEach(an)}(t):an(t)}createConverterToInternalObj(t){return a(function(t){return 0===t.length?null:$i(t[0].time)||d(t[0].time)?en:rn}(t))}key(t){return"object"==typeof t&&"xf"in t?t.xf:this.key(this.convertHorzItemToInternal(t))}cacheKey(t){const i=t;return void 0===i.Sf?new Date(1e3*i.xf).getTime():new Date(Date.UTC(i.Sf.year,i.Sf.month-1,i.Sf.day)).getTime()}convertHorzItemToInternal(t){return ji(i=t)?rn(i):$i(i)?en(i):en(hn(i));var i}updateFormatter(t){if(!this.yn)return;const i=t.dateFormat;this.yn.timeScale.timeVisible?this.Cf=new Xi({df:i,ff:this.yn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",pf:" ",vf:t.locale}):this.Cf=new Ki(i,t.locale)}formatHorzItem(t){const i=t;return this.Cf.Cu(new Date(1e3*i.xf))}formatTickmark(t,i){const n=function(t,i,n){switch(t){case 0:case 10:return i?n?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(t.weight,this.yn.timeScale.timeVisible,this.yn.timeScale.secondsVisible),s=this.yn.timeScale;if(void 0!==s.tickMarkFormatter){const e=s.tickMarkFormatter(t.originalTime,n,i.locale);if(null!==e)return e}return function(t,i,n){const s={};switch(i){case 0:s.year="numeric";break;case 1:s.month="short";break;case 2:s.day="numeric";break;case 3:s.hour12=!1,s.hour="2-digit",s.minute="2-digit";break;case 4:s.hour12=!1,s.hour="2-digit",s.minute="2-digit",s.second="2-digit"}const e=void 0===t.Sf?new Date(1e3*t.xf):new Date(Date.UTC(t.Sf.year,t.Sf.month-1,t.Sf.day));return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()).toLocaleString(n,s)}(t.time,n,i.locale)}maxTickMarkWeight(t){let i=t.reduce(Ai,t[0]).weight;return i>30&&i<50&&(i=30),i}fillWeightsForPoints(t,i){!function(t,i=0){if(0===t.length)return;let n=0===i?null:t[i-1].time.xf,s=null!==n?new Date(1e3*n):null,e=0;for(let r=i;r1){const i=Math.ceil(e/(t.length-1)),n=new Date(1e3*(t[0].time.xf-i));t[0].timeWeight=sn(new Date(1e3*t[0].time.xf),n)}}(t,i)}static yf(t){return _({localization:{dateFormat:"dd MMM 'yy"}},t??{})}}function on(t){var i=t.width,n=t.height;if(i<0)throw new Error("Negative width is not allowed for Size");if(n<0)throw new Error("Negative height is not allowed for Size");return{width:i,height:n}}function _n(t,i){return t.width===i.width&&t.height===i.height}var un=function(){function t(t){var i=this;this._resolutionListener=function(){return i._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=t,this._installResolutionListener()}return t.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(t.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),t.prototype.subscribe=function(t){var i=this,n={next:t};return this._observers.push(n),{unsubscribe:function(){i._observers=i._observers.filter((function(t){return t!==n}))}}},t.prototype._installResolutionListener=function(){if(null!==this._resolutionMediaQueryList)throw new Error("Resolution listener is already installed");var t=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(t,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},t.prototype._uninstallResolutionListener=function(){null!==this._resolutionMediaQueryList&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},t.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},t.prototype._onResolutionChanged=function(){var t=this;this._observers.forEach((function(i){return i.next(t._window.devicePixelRatio)})),this._reinstallResolutionListener()},t}();var cn=function(){function t(t,i,n){var s;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=t,this._canvasElementClientSize=on({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=null!=i?i:function(t){return t},this._allowResizeObserver=null===(s=null==n?void 0:n.allowResizeObserver)||void 0===s||s,this._chooseAndInitObserver()}return t.prototype.dispose=function(){var t,i;if(null===this._canvasElement)throw new Error("Object is disposed");null===(t=this._canvasElementResizeObserver)||void 0===t||t.disconnect(),this._canvasElementResizeObserver=null,null===(i=this._devicePixelRatioObservable)||void 0===i||i.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(t.prototype,"canvasElement",{get:function(){if(null===this._canvasElement)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bitmapSize",{get:function(){return on({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(t){this._canvasElementClientSize=on(t),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},t.prototype.subscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeBitmapSizeChanged=function(t){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter((function(i){return i!==t}))},Object.defineProperty(t.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),t.prototype.subscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners.push(t)},t.prototype.unsubscribeSuggestedBitmapSizeChanged=function(t){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter((function(i){return i!==t}))},t.prototype.applySuggestedBitmapSize=function(){if(null!==this._suggestedBitmapSize){var t=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(t),this._emitSuggestedBitmapSizeChanged(t,this._suggestedBitmapSize)}},t.prototype._resizeBitmap=function(t){var i=this.bitmapSize;_n(i,t)||(this.canvasElement.width=t.width,this.canvasElement.height=t.height,this._emitBitmapSizeChanged(i,t))},t.prototype._emitBitmapSizeChanged=function(t,i){var n=this;this._bitmapSizeChangedListeners.forEach((function(s){return s.call(n,t,i)}))},t.prototype._suggestNewBitmapSize=function(t){var i=this._suggestedBitmapSize,n=on(this._transformBitmapSize(t,this._canvasElementClientSize)),s=_n(this.bitmapSize,n)?null:n;null===i&&null===s||null!==i&&null!==s&&_n(i,s)||(this._suggestedBitmapSize=s,this._emitSuggestedBitmapSizeChanged(i,s))},t.prototype._emitSuggestedBitmapSizeChanged=function(t,i){var n=this;this._suggestedBitmapSizeChangedListeners.forEach((function(s){return s.call(n,t,i)}))},t.prototype._chooseAndInitObserver=function(){var t=this;this._allowResizeObserver?new Promise((function(t){var i=new ResizeObserver((function(n){t(n.every((function(t){return"devicePixelContentBoxSize"in t}))),i.disconnect()}));i.observe(document.body,{box:"device-pixel-content-box"})})).catch((function(){return!1})).then((function(i){return i?t._initResizeObserver():t._initDevicePixelRatioObservable()})):this._initDevicePixelRatioObservable()},t.prototype._initDevicePixelRatioObservable=function(){var t=this;if(null!==this._canvasElement){var i=dn(this._canvasElement);if(null===i)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=function(t){return new un(t)}(i),this._devicePixelRatioObservable.subscribe((function(){return t._invalidateBitmapSize()})),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){var t,i;if(null!==this._canvasElement){var n=dn(this._canvasElement);if(null!==n){var s=null!==(i=null===(t=this._devicePixelRatioObservable)||void 0===t?void 0:t.value)&&void 0!==i?i:n.devicePixelRatio,e=this._canvasElement.getClientRects(),r=void 0!==e[0]?function(t,i){return on({width:Math.round(t.left*i+t.width*i)-Math.round(t.left*i),height:Math.round(t.top*i+t.height*i)-Math.round(t.top*i)})}(e[0],s):on({width:this._canvasElementClientSize.width*s,height:this._canvasElementClientSize.height*s});this._suggestNewBitmapSize(r)}}},t.prototype._initResizeObserver=function(){var t=this;null!==this._canvasElement&&(this._canvasElementResizeObserver=new ResizeObserver((function(i){var n=i.find((function(i){return i.target===t._canvasElement}));if(n&&n.devicePixelContentBoxSize&&n.devicePixelContentBoxSize[0]){var s=n.devicePixelContentBoxSize[0],e=on({width:s.inlineSize,height:s.blockSize});t._suggestNewBitmapSize(e)}})),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t}();function dn(t){return t.ownerDocument.defaultView}var fn=function(){function t(t,i,n){if(0===i.width||0===i.height)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=i,0===n.width||0===n.height)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=n,this._context=t}return t.prototype.useMediaCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),t({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},t.prototype.useBitmapCoordinateSpace=function(t){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),t({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(t.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),t}();function pn(t,i){var n=t.canvasElementClientSize;if(0===n.width||0===n.height)return null;var s=t.bitmapSize;if(0===s.width||0===s.height)return null;var e=t.canvasElement.getContext("2d",i);return null===e?null:new fn(e,n,s)}const vn="undefined"!=typeof window;function mn(){return!!vn&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function wn(){return!!vn&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function gn(t,i){switch(t){case"custom":return void 0!==i?"custom-object":"series";case"price-line":return"custom-price-line";case"marker":return"series-marker";case"primitive":return"primitive";default:return"series"}}function Mn(t){return t+t%2}function bn(t){vn&&void 0!==window.chrome&&t.addEventListener("mousedown",(t=>{if(1===t.button)return t.preventDefault(),!1}))}class xn{constructor(t,i,n){this.Pf=0,this.kf=null,this.Tf={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.Rf=0,this.Df=null,this.If={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.Vf=null,this.Ef=!1,this.Bf=null,this.Af=null,this.zf=!1,this.Of=!1,this.Lf=!1,this.Nf=null,this.Ff=null,this.Wf=null,this.Hf=null,this.Uf=null,this.$f=null,this.jf=null,this.qf=0,this.Yf=!1,this.Kf=!1,this.Zf=!1,this.Gf=0,this.Xf=null,this.Jf=!wn(),this.Qf=t=>{this.tp(t)},this.ip=t=>{if(this.np(t)){const i=this.sp(t);if(++this.Rf,this.Df&&this.Rf>1){const{ep:n}=this.rp(yn(t),this.If);n<30&&!this.Lf&&this.hp(i,this.lp.ap),this.op()}}else{const i=this.sp(t);if(++this.Pf,this.kf&&this.Pf>1){const{ep:n}=this.rp(yn(t),this.Tf);n<5&&!this.Of&&this._p(i,this.lp.up),this.cp()}}},this.dp=t,this.lp=i,this.yn=n,this.fp()}m(){null!==this.Nf&&(this.Nf(),this.Nf=null),null!==this.Ff&&(this.Ff(),this.Ff=null),null!==this.Hf&&(this.Hf(),this.Hf=null),null!==this.Uf&&(this.Uf(),this.Uf=null),null!==this.$f&&(this.$f(),this.$f=null),null!==this.Wf&&(this.Wf(),this.Wf=null),this.pp(),this.cp()}vp(t){this.Hf&&this.Hf();const i=this.mp.bind(this);if(this.Hf=()=>{this.dp.removeEventListener("mousemove",i)},this.dp.addEventListener("mousemove",i),this.np(t))return;const n=this.sp(t);this._p(n,this.lp.wp),this.Jf=!0}cp(){null!==this.kf&&clearTimeout(this.kf),this.Pf=0,this.kf=null,this.Tf={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}op(){null!==this.Df&&clearTimeout(this.Df),this.Rf=0,this.Df=null,this.If={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}mp(t){if(this.Zf||null!==this.Af)return;if(this.np(t))return;const i=this.sp(t);this._p(i,this.lp.gp),this.Jf=!0}Mp(t){const i=kn(t.changedTouches,a(this.Xf));if(null===i)return;if(this.Gf=Pn(t),null!==this.jf)return;if(this.Kf)return;this.Yf=!0;const n=this.rp(yn(i),a(this.Af)),{bp:s,xp:e,ep:r}=n;if(this.zf||!(r<5)){if(!this.zf){const t=.5*s,i=e>=t&&!this.yn.Sp(),n=t>e&&!this.yn.Cp();i||n||(this.Kf=!0),this.zf=!0,this.Lf=!0,this.pp(),this.op()}if(!this.Kf){const n=this.sp(t,i);this.hp(n,this.lp.yp),Cn(t)}}}Pp(t){if(0!==t.button)return;const i=this.rp(yn(t),a(this.Bf)),{ep:n}=i;if(n>=5&&(this.Of=!0,this.cp()),this.Of){const i=this.sp(t);this._p(i,this.lp.kp)}}rp(t,i){const n=Math.abs(i._t-t._t),s=Math.abs(i.ut-t.ut);return{bp:n,xp:s,ep:n+s}}Tp(t){let i=kn(t.changedTouches,a(this.Xf));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null===i)return;this.Xf=null,this.Gf=Pn(t),this.pp(),this.Af=null,this.$f&&(this.$f(),this.$f=null);const n=this.sp(t,i);if(this.hp(n,this.lp.Rp),++this.Rf,this.Df&&this.Rf>1){const{ep:t}=this.rp(yn(i),this.If);t<30&&!this.Lf&&this.hp(n,this.lp.ap),this.op()}else this.Lf||(this.hp(n,this.lp.Dp),this.lp.Dp&&Cn(t));0===this.Rf&&Cn(t),0===t.touches.length&&this.Ef&&(this.Ef=!1,Cn(t))}tp(t){if(0!==t.button)return;const i=this.sp(t);if(this.Bf=null,this.Zf=!1,this.Uf&&(this.Uf(),this.Uf=null),mn()){this.dp.ownerDocument.documentElement.removeEventListener("mouseleave",this.Qf)}if(!this.np(t))if(this._p(i,this.lp.Ip),++this.Pf,this.kf&&this.Pf>1){const{ep:n}=this.rp(yn(t),this.Tf);n<5&&!this.Of&&this._p(i,this.lp.up),this.cp()}else this.Of||this._p(i,this.lp.Vp)}pp(){null!==this.Vf&&(clearTimeout(this.Vf),this.Vf=null)}Ep(t){if(null!==this.Xf)return;const i=t.changedTouches[0];this.Xf=i.identifier,this.Gf=Pn(t);const n=this.dp.ownerDocument.documentElement;this.Lf=!1,this.zf=!1,this.Kf=!1,this.Af=yn(i),this.$f&&(this.$f(),this.$f=null);{const i=this.Mp.bind(this),s=this.Tp.bind(this);this.$f=()=>{n.removeEventListener("touchmove",i),n.removeEventListener("touchend",s)},n.addEventListener("touchmove",i,{passive:!1}),n.addEventListener("touchend",s,{passive:!1}),this.pp(),this.Vf=setTimeout(this.Bp.bind(this,t),240)}const s=this.sp(t,i);this.hp(s,this.lp.Ap),this.Df||(this.Rf=0,this.Df=setTimeout(this.op.bind(this),500),this.If=yn(i))}zp(t){if(0!==t.button)return;const i=this.dp.ownerDocument.documentElement;mn()&&i.addEventListener("mouseleave",this.Qf),this.Of=!1,this.Bf=yn(t),this.Uf&&(this.Uf(),this.Uf=null);{const t=this.Pp.bind(this),n=this.tp.bind(this);this.Uf=()=>{i.removeEventListener("mousemove",t),i.removeEventListener("mouseup",n)},i.addEventListener("mousemove",t),i.addEventListener("mouseup",n)}if(this.Zf=!0,this.np(t))return;const n=this.sp(t);this._p(n,this.lp.Op),this.kf||(this.Pf=0,this.kf=setTimeout(this.cp.bind(this),500),this.Tf=yn(t))}fp(){this.dp.addEventListener("mouseenter",this.vp.bind(this)),this.dp.addEventListener("touchcancel",this.pp.bind(this));{const t=this.dp.ownerDocument,i=t=>{this.lp.Lp&&(t.composed&&this.dp.contains(t.composedPath()[0])||t.target&&this.dp.contains(t.target)||this.lp.Lp())};this.Ff=()=>{t.removeEventListener("touchstart",i)},this.Nf=()=>{t.removeEventListener("mousedown",i)},t.addEventListener("mousedown",i),t.addEventListener("touchstart",i,{passive:!0})}wn()&&(this.Wf=()=>{this.dp.removeEventListener("dblclick",this.ip)},this.dp.addEventListener("dblclick",this.ip)),this.dp.addEventListener("mouseleave",this.Np.bind(this)),this.dp.addEventListener("touchstart",this.Ep.bind(this),{passive:!0}),bn(this.dp),this.dp.addEventListener("mousedown",this.zp.bind(this)),this.Fp(),this.dp.addEventListener("touchmove",(()=>{}),{passive:!1})}Fp(){void 0===this.lp.Wp&&void 0===this.lp.Hp&&void 0===this.lp.Up||(this.dp.addEventListener("touchstart",(t=>this.$p(t.touches)),{passive:!0}),this.dp.addEventListener("touchmove",(t=>{if(2===t.touches.length&&null!==this.jf&&void 0!==this.lp.Hp){const i=Sn(t.touches[0],t.touches[1])/this.qf;this.lp.Hp(this.jf,i),Cn(t)}}),{passive:!1}),this.dp.addEventListener("touchend",(t=>{this.$p(t.touches)})))}$p(t){1===t.length&&(this.Yf=!1),2!==t.length||this.Yf||this.Ef?this.jp():this.qp(t)}qp(t){const i=this.dp.getBoundingClientRect()||{left:0,top:0};this.jf={_t:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,ut:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.qf=Sn(t[0],t[1]),void 0!==this.lp.Wp&&this.lp.Wp(),this.pp()}jp(){null!==this.jf&&(this.jf=null,void 0!==this.lp.Up&&this.lp.Up())}Np(t){if(this.Hf&&this.Hf(),this.np(t))return;if(!this.Jf)return;const i=this.sp(t);this._p(i,this.lp.Yp),this.Jf=!wn()}Bp(t){const i=kn(t.touches,a(this.Xf));if(null===i)return;const n=this.sp(t,i);this.hp(n,this.lp.Kp),this.Lf=!0,this.Ef=!0}np(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:Pn(t){"touchstart"!==t.type&&Cn(t)}}}}function Sn(t,i){const n=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(n*n+s*s)}function Cn(t){t.cancelable&&t.preventDefault()}function yn(t){return{_t:t.pageX,ut:t.pageY}}function Pn(t){return t.timeStamp||performance.now()}function kn(t,i){for(let n=0;n!1,Cp:()=>!0}),this.Qp={vv:n,pv:t}}ov(){this.lv.style.background=this.sv.N().layout.panes.separatorColor}mv(t){null!==this.Qp&&(this.Qp.vv.style.backgroundColor=this.sv.N().layout.panes.separatorHoverColor)}wv(t){null!==this.Qp&&null===this.nv&&(this.Qp.vv.style.backgroundColor="")}gv(t){if(null===this.Qp)return;const i=this.ev.xv().O_()+this.hv.xv().O_(),n=i/(this.ev.cv().height+this.hv.cv().height),s=30*n;i<=2*s||(this.nv={Sv:t.pageY,Cv:this.ev.xv().O_(),yv:i-s,Pv:i,kv:n,Tv:s},this.Qp.pv.style.display="block")}Mv(t){const i=this.nv;if(null===i)return;const n=(t.pageY-i.Sv)*i.kv,s=Jt(i.Cv+n,i.Tv,i.yv);this.ev.xv().L_(s),this.hv.xv().L_(i.Pv-s),this.sv.Qt().ka()}bv(t){null!==this.nv&&null!==this.Qp&&(this.nv=null,this.Qp.pv.style.display="none")}}function Rn(t,i){return t.Rv-i.Rv}function Dn(t,i,n){const s=(t.Rv-i.Rv)/(t.wt-i.wt);return Math.sign(s)*Math.min(Math.abs(s),n)}class In{constructor(t,i,n,s){this.Dv=null,this.Iv=null,this.Vv=null,this.Ev=null,this.Bv=null,this.Av=0,this.zv=0,this.Ov=t,this.Lv=i,this.Nv=n,this.Ps=s}Fv(t,i){if(null!==this.Dv){if(this.Dv.wt===i)return void(this.Dv.Rv=t);if(Math.abs(this.Dv.Rv-t)50)return;let n=0;const s=Dn(this.Dv,this.Iv,this.Lv),e=Rn(this.Dv,this.Iv),r=[s],h=[e];if(n+=e,null!==this.Vv){const t=Dn(this.Iv,this.Vv,this.Lv);if(Math.sign(t)===Math.sign(s)){const i=Rn(this.Iv,this.Vv);if(r.push(t),h.push(i),n+=i,null!==this.Ev){const t=Dn(this.Vv,this.Ev,this.Lv);if(Math.sign(t)===Math.sign(s)){const i=Rn(this.Vv,this.Ev);r.push(t),h.push(i),n+=i}}}}let a=0;for(let t=0;t160?"dark":"light"}Gv(){return this.qv.N().layout.attributionLogo}Jv(){const t=new URL(location.href);return t.hostname?"&utm_source="+t.hostname+t.pathname:""}Yv(){this.Zv()&&(this.Kv(),this.vn=this.Gv(),this.vn&&(this.$v=this.Xv(),this.Uv=document.createElement("style"),this.Uv.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.Hv=document.createElement("a"),this.Hv.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.Jv()}`,this.Hv.title="Charting by TradingView",this.Hv.id="tv-attr-logo",this.Hv.target="_blank",this.Hv.innerHTML='',this.Hv.toggleAttribute("data-dark","dark"===this.$v),this.jv.appendChild(this.Uv),this.jv.appendChild(this.Hv)))}}function En(t,i){const n=a(t.ownerDocument).createElement("canvas");t.appendChild(n);const s=new cn(n,(e={options:{allowResizeObserver:!0},transform:(t,i)=>({width:Math.max(t.width,i.width),height:Math.max(t.height,i.height)})}).transform,e.options);var e;return s.resizeCanvasElement(i),s}function Bn(t){t.width=1,t.height=1,t.getContext("2d")?.clearRect(0,0,1,1)}function An(t,i,n,s){t.qh&&t.qh(i,n,s)}function zn(t,i,n,s){t.st(i,n,s)}function On(t,i,n,s){const e=t(n,s);for(const t of e){const n=t.Tt(s);null!==n&&i(n)}}function Ln(t,i){return n=>{if(!function(t){return void 0!==t.Ft}(n))return[];return(n.Ft()?.cl()??"")!==i?[]:n.Ga?.(t)??[]}}function Nn(t,i,n,s){if(!t.length)return;let e=0;const r=t[0].$t(s,!0);let h=1===i?n/2-(t[0].Hi()-r/2):t[0].Hi()-r/2-n/2;h=Math.max(0,h);for(let r=1;ru-o:_n)&&h>0){const s=1===i?-1-r:r-n,a=Math.min(s,h);for(let n=e;n{this.rm||this.yt.am().Qt().mr()},this.lm=()=>{this.rm||this.yt.am().Qt().mr()},this.yt=t,this.yn=i,this.Po=i.layout,this.wd=n,this.om="left"===s,this._m=Ln("normal",s),this.um=Ln("top",s),this.dm=Ln("bottom",s),this.lv=document.createElement("div"),this.lv.style.height="100%",this.lv.style.overflow="hidden",this.lv.style.width="25px",this.lv.style.left="0",this.lv.style.position="relative",this.fm=En(this.lv,on({width:16,height:16})),this.fm.subscribeSuggestedBitmapSizeChanged(this.hm);const e=this.fm.canvasElement;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.pm=En(this.lv,on({width:16,height:16})),this.pm.subscribeSuggestedBitmapSizeChanged(this.lm);const r=this.pm.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0";const h={Op:this.gv.bind(this),Ap:this.gv.bind(this),kp:this.Mv.bind(this),yp:this.Mv.bind(this),Lp:this.vm.bind(this),Ip:this.bv.bind(this),Rp:this.bv.bind(this),up:this.wm.bind(this),ap:this.wm.bind(this),wp:this.gm.bind(this),Yp:this.wv.bind(this)};this.tv=new xn(this.pm.canvasElement,h,{Sp:()=>!this.yn.handleScroll.vertTouchDrag,Cp:()=>!0})}m(){this.tv.m(),this.pm.unsubscribeSuggestedBitmapSizeChanged(this.lm),Bn(this.pm.canvasElement),this.pm.dispose(),this.fm.unsubscribeSuggestedBitmapSizeChanged(this.hm),Bn(this.fm.canvasElement),this.fm.dispose(),null!==this.Ki&&this.Ki.a_().u(this),this.Ki=null}uv(){return this.lv}P(){return this.Po.fontSize}Mm(){const t=this.wd.N();return this.nm!==t.k&&(this.im.Ls(),this.nm=t.k),t}bm(){if(null===this.Ki)return 0;let t=0;const i=this.Mm(),n=a(this.fm.canvasElement.getContext("2d",{colorSpace:this.yt.am().N().layout.colorSpace}));n.save();const s=this.Ki.Bl();n.font=this.xm(),s.length>0&&(t=Math.max(this.im.Ii(n,s[0].io),this.im.Ii(n,s[s.length-1].io)));const e=this.Sm();for(let i=e.length;i--;){const s=this.im.Ii(n,e[i].ri());s>t&&(t=s)}const r=this.Ki.zt();if(null!==r&&null!==this.Qv&&(2!==(h=this.yn.crosshair).mode&&h.horzLine.visible&&h.horzLine.labelVisible)){const i=this.Ki.Tn(1,r),s=this.Ki.Tn(this.Qv.height-2,r);t=Math.max(t,this.im.Ii(n,this.Ki.Ji(Math.floor(Math.min(i,s))+.11111111111111,r)),this.im.Ii(n,this.Ki.Ji(Math.ceil(Math.max(i,s))-.11111111111111,r)))}var h;n.restore();const l=t||34;return Mn(Math.ceil(i.S+i.C+i.V+i.B+5+l))}Cm(t){null!==this.Qv&&_n(this.Qv,t)||(this.Qv=t,this.rm=!0,this.fm.resizeCanvasElement(t),this.pm.resizeCanvasElement(t),this.rm=!1,this.lv.style.width=`${t.width}px`,this.lv.style.height=`${t.height}px`)}ym(){return a(this.Qv).width}un(t){this.Ki!==t&&(null!==this.Ki&&this.Ki.a_().u(this),this.Ki=t,t.a_().i(this.po.bind(this),this))}Ft(){return this.Ki}Ls(){const t=this.yt.xv();this.yt.am().Qt().eu(t,a(this.Ft()))}Pm(t){if(null===this.Qv)return;const i={colorSpace:this.yt.am().N().layout.colorSpace};if(1!==t){this.km(),this.fm.applySuggestedBitmapSize();const t=pn(this.fm,i);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.Tm(t),this.Rm(t)})),this.yt.Dm(t,this.dm),this.Im(t),this.yt.Dm(t,this._m),this.Vm(t))}this.pm.applySuggestedBitmapSize();const n=pn(this.pm,i);null!==n&&(n.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.Em(n),this.yt.Dm(n,this.um))}dv(){return this.fm.bitmapSize}fv(t,i,n,s){const e=this.dv();if(e.width>0&&e.height>0&&(t.drawImage(this.fm.canvasElement,i,n),s)){const s=this.pm.canvasElement;t.drawImage(s,i,n)}}Pt(){this.Ki?.Bl()}gv(t){if(null===this.Ki||this.Ki.Gi()||!this.yn.handleScale.axisPressedMouseMove.price)return;const i=this.yt.am().Qt(),n=this.yt.xv();this.tm=!0,i.G_(n,this.Ki,t.localY)}Mv(t){if(null===this.Ki||!this.yn.handleScale.axisPressedMouseMove.price)return;const i=this.yt.am().Qt(),n=this.yt.xv(),s=this.Ki;i.X_(n,s,t.localY)}vm(){if(null===this.Ki||!this.yn.handleScale.axisPressedMouseMove.price)return;const t=this.yt.am().Qt(),i=this.yt.xv(),n=this.Ki;this.tm&&(this.tm=!1,t.J_(i,n))}bv(t){if(null===this.Ki||!this.yn.handleScale.axisPressedMouseMove.price)return;const i=this.yt.am().Qt(),n=this.yt.xv();this.tm=!1,i.J_(n,this.Ki)}wm(t){this.yn.handleScale.axisDoubleClickReset.price&&this.Ls()}gm(t){if(null===this.Ki)return;!this.yt.am().Qt().N().handleScale.axisPressedMouseMove.price||this.Ki.je()||this.Ki.zo()||this.Bm(1)}wv(t){this.Bm(0)}Sm(){const t=[],i=null===this.Ki?void 0:this.Ki;return(n=>{for(let s=0;s{t.fillStyle=n.borderColor;const a=Math.max(1,Math.floor(h)),l=Math.floor(.5*h),o=Math.round(s.C*r);t.beginPath();for(const n of i)t.rect(Math.floor(e*r),Math.round(n.Rl*h)-l,o,a);t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{t.font=this.xm(),t.fillStyle=n.textColor??this.Po.textColor,t.textAlign=this.om?"right":"left",t.textBaseline="middle";const r=this.om?Math.round(e-s.V):Math.round(e+s.C+s.V),h=i.map((i=>this.im.Di(t,i.io)));for(let n=i.length;n--;){const s=i[n];t.fillText(s.io,r,s.Rl+h[n])}}))}km(){if(null===this.Qv||null===this.Ki)return;let t=this.Qv.height/2;const i=[],n=this.Ki.Dt().slice(),s=this.yt.xv(),e=this.Mm();this.Ki===s.Gs()&&this.yt.xv().Dt().forEach((t=>{s.Zs(t)&&n.push(t)}));const r=this.Ki.Cl()[0],h=this.Ki;n.forEach((n=>{const e=n.qn(s,h);e.forEach((t=>{t.$i()&&null===t.Wi()&&(t.Ui(null),i.push(t))})),r===n&&e.length>0&&(t=e[0].Bi())}));this.Ki.N().alignLabels&&this.Am(i,e,t)}Am(t,i,n){if(null===this.Qv)return;const s=t.filter((t=>t.Bi()<=n)),e=t.filter((t=>t.Bi()>n));s.sort(((t,i)=>i.Bi()-t.Bi())),s.length&&e.length&&e.push(s[0]),e.sort(((t,i)=>t.Bi()-i.Bi()));for(const n of t){const t=Math.floor(n.$t(i)/2),s=n.Bi();s>-t&&sthis.Qv.height-t&&s{if(i.ji()){i.Tt(a(this.Ki)).st(t,n,this.im,s)}}))}Em(t){if(null===this.Qv||null===this.Ki)return;const i=this.yt.am().Qt(),n=[],s=this.yt.xv(),e=i.Rd().qn(s,this.Ki);e.length&&n.push(e);const r=this.Mm(),h=this.om?"right":"left";n.forEach((i=>{i.forEach((i=>{i.Tt(a(this.Ki)).st(t,r,this.im,h)}))}))}Bm(t){this.lv.style.cursor=1===t?"ns-resize":"default"}po(){const t=this.bm();this.sm{this.rm||null===this.Zm||this.sn().mr()},this.lm=()=>{this.rm||null===this.Zm||this.sn().mr()},this.qv=t,this.Zm=i,this.Zm.fu().i(this.Gm.bind(this),this,!0),this.Xm=document.createElement("td"),this.Xm.style.padding="0",this.Xm.style.position="relative";const n=document.createElement("div");n.style.width="100%",n.style.height="100%",n.style.position="relative",n.style.overflow="hidden",this.Jm=document.createElement("td"),this.Jm.style.padding="0",this.Qm=document.createElement("td"),this.Qm.style.padding="0",this.Xm.appendChild(n),this.fm=En(n,on({width:16,height:16})),this.fm.subscribeSuggestedBitmapSizeChanged(this.hm);const s=this.fm.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.pm=En(n,on({width:16,height:16})),this.pm.subscribeSuggestedBitmapSizeChanged(this.lm);const e=this.pm.canvasElement;e.style.position="absolute",e.style.zIndex="2",e.style.left="0",e.style.top="0",this.av=document.createElement("tr"),this.av.appendChild(this.Jm),this.av.appendChild(this.Xm),this.av.appendChild(this.Qm),this.tw(),this.tv=new xn(this.pm.canvasElement,this,{Sp:()=>null===this.jm&&!this.qv.N().handleScroll.vertTouchDrag,Cp:()=>null===this.jm&&!this.qv.N().handleScroll.horzTouchDrag})}m(){null!==this.zm&&this.zm.m(),null!==this.Om&&this.Om.m(),this.Lm=null,this.pm.unsubscribeSuggestedBitmapSizeChanged(this.lm),Bn(this.pm.canvasElement),this.pm.dispose(),this.fm.unsubscribeSuggestedBitmapSizeChanged(this.hm),Bn(this.fm.canvasElement),this.fm.dispose(),null!==this.Zm&&(this.Zm.fu().u(this),this.Zm.m()),this.tv.m()}xv(){return a(this.Zm)}iw(t){null!==this.Zm&&this.Zm.fu().u(this),this.Zm=t,null!==this.Zm&&this.Zm.fu().i(jn.prototype.Gm.bind(this),this,!0),this.tw(),this.qv.rv().indexOf(this)===this.qv.rv().length-1?(this.Lm=this.Lm??new Vn(this.Xm,this.qv),this.Lm.Pt()):(this.Lm?.Kv(),this.Lm=null)}am(){return this.qv}uv(){return this.av}tw(){if(null!==this.Zm&&(this.nw(),0!==this.sn().Jn().length)){if(null!==this.zm){const t=this.Zm.K_();this.zm.un(a(t))}if(null!==this.Om){const t=this.Zm.Z_();this.Om.un(a(t))}}}sw(){null!==this.zm&&this.zm.Pt(),null!==this.Om&&this.Om.Pt()}O_(){return null!==this.Zm?this.Zm.O_():0}L_(t){this.Zm&&this.Zm.L_(t)}wp(t){if(!this.Zm)return;this.ew();const i=t.localX,n=t.localY;this.rw(i,n,t)}Op(t){this.ew(),this.hw(),this.rw(t.localX,t.localY,t)}gp(t){if(!this.Zm)return;this.ew();const i=t.localX,n=t.localY;this.rw(i,n,t)}Vp(t){null!==this.Zm&&(this.ew(),this.rw(t.localX,t.localY,t),this.aw(t))}up(t){null!==this.Zm&&this.lw(this.Hm,t)}ap(t){this.up(t)}kp(t){this.ew(),this.ow(t),this.rw(t.localX,t.localY,t)}Ip(t){null!==this.Zm&&(this.ew(),this.$m=!1,this._w(t))}Dp(t){null!==this.Zm&&this.aw(t)}Kp(t){if(this.$m=!0,null===this.jm){const i={x:t.localX,y:t.localY};this.uw(i,i,t)}}Yp(t){null!==this.Zm&&(this.ew(),this.Zm.Qt().Pd(null),this.cw())}dw(){return this.Wm}fw(){return this.Hm}Wp(){this.Um=1,this.sn().cs()}Hp(t,i){if(!this.qv.N().handleScale.pinch)return;const n=5*(i-this.Um);this.Um=i,this.sn().Ld(t._t,n)}Ap(t){this.$m=!1,this.qm=null!==this.jm,this.hw();const i=this.sn().Rd();null!==this.jm&&i.It()&&(this.Ym={x:i.ni(),y:i.si()},this.jm={x:t.localX,y:t.localY})}yp(t){if(null===this.Zm)return;const i=t.localX,n=t.localY;if(null===this.jm)this.ow(t);else{this.qm=!1;const s=a(this.Ym),e=s.x+(i-this.jm.x),r=s.y+(n-this.jm.y);this.rw(e,r,t)}}Rp(t){0===this.am().N().trackingMode.exitMode&&(this.qm=!0),this.pw(),this._w(t)}Qs(t,i){const n=this.Zm;return null===n?null:Ri(n,t,i)}mw(t,i){a("left"===i?this.zm:this.Om).Cm(on({width:t,height:this.Qv.height}))}cv(){return this.Qv}Cm(t){_n(this.Qv,t)||(this.Qv=t,this.rm=!0,this.fm.resizeCanvasElement(t),this.pm.resizeCanvasElement(t),this.rm=!1,this.Xm.style.width=t.width+"px",this.Xm.style.height=t.height+"px")}ww(){const t=a(this.Zm);t.q_(t.K_()),t.q_(t.Z_());for(const i of t.Cl())if(t.Zs(i)){const n=i.Ft();null!==n&&t.q_(n),i.Nn()}for(const i of t.vu())i.Nn()}dv(){return this.fm.bitmapSize}fv(t,i,n,s){const e=this.dv();if(e.width>0&&e.height>0&&(t.drawImage(this.fm.canvasElement,i,n),s)){const s=this.pm.canvasElement;null!==t&&t.drawImage(s,i,n)}}Pm(t){if(0===t)return;if(null===this.Zm)return;t>1&&this.ww(),null!==this.zm&&this.zm.Pm(t),null!==this.Om&&this.Om.Pm(t);const i={colorSpace:this.qv.N().layout.colorSpace};if(1!==t){this.fm.applySuggestedBitmapSize();const t=pn(this.fm,i);null!==t&&(t.useBitmapCoordinateSpace((t=>{this.Tm(t)})),this.Zm&&(this.gw(t,Wn),this.Mw(t),this.gw(t,Hn),this.gw(t,Un)))}this.pm.applySuggestedBitmapSize();const n=pn(this.pm,i);null!==n&&(n.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.bw(n),this.gw(n,$n),this.gw(n,Un))}xw(){return this.zm}Sw(){return this.Om}Dm(t,i){this.gw(t,i)}Gm(){null!==this.Zm&&this.Zm.fu().u(this),this.Zm=null}aw(t){this.lw(this.Wm,t)}lw(t,i){const n=i.localX,s=i.localY;t.v()&&t.p(this.sn().Bt().Rc(n),{x:n,y:s},i)}Tm({context:t,bitmapSize:i}){const{width:n,height:s}=i,e=this.sn(),r=e.$(),h=e.ef();r===h?E(t,0,0,n,s,h):z(t,0,0,n,s,r,h)}Mw(t){const i=a(this.Zm),n=i.pu().wr().Tt(i);null!==n&&n.st(t,!1)}bw(t){this.Cw(t,Hn,zn,this.sn().Rd())}gw(t,i){const n=a(this.Zm),s=n.au(),e=n.vu();for(const n of e)this.Cw(t,i,An,n);for(const n of s)this.Cw(t,i,An,n);for(const n of e)this.Cw(t,i,zn,n);for(const n of s)this.Cw(t,i,zn,n)}Cw(t,i,n,s){const e=a(this.Zm),r=e.Qt().ou(),h=null!==r&&r.lu===s,l=null!==r&&h&&void 0!==r.wu?r.wu.ie:void 0;On(i,(i=>n(i,t,h,l)),s,e)}nw(){if(null===this.Zm)return;const t=this.qv,i=this.Zm.K_().N().visible,n=this.Zm.Z_().N().visible;i||null===this.zm||(this.Jm.removeChild(this.zm.uv()),this.zm.m(),this.zm=null),n||null===this.Om||(this.Qm.removeChild(this.Om.uv()),this.Om.m(),this.Om=null);const s=t.Qt().Zd();i&&null===this.zm&&(this.zm=new Fn(this,t.N(),s,"left"),this.Jm.appendChild(this.zm.uv())),n&&null===this.Om&&(this.Om=new Fn(this,t.N(),s,"right"),this.Qm.appendChild(this.Om.uv()))}yw(t){return t.Zp&&this.$m||null!==this.jm}rw(t,i,n){t=Math.max(0,Math.min(t,this.Qv.width-1)),i=Math.max(0,Math.min(i,this.Qv.height-1)),this.sn().jd(t,i,n,a(this.Zm))}cw(){this.sn().Yd()}pw(){this.qm&&(this.jm=null,this.cw())}uw(t,i,n){this.jm=t,this.qm=!1,this.rw(i.x,i.y,n);const s=this.sn().Rd();this.Ym={x:s.ni(),y:s.si()}}sn(){return this.qv.Qt()}_w(t){if(!this.Fm)return;const i=this.sn(),n=this.xv();if(i.iu(n,n.kn()),this.Nm=null,this.Fm=!1,i.Hd(),null!==this.Km){const t=performance.now(),n=i.Bt();this.Km.me(n.Ac(),t),this.Km.jc(t)||i.ps(this.Km)}}ew(){this.jm=null}hw(){if(!this.Zm)return;if(this.sn().cs(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)a(document.activeElement).blur();else{const t=document.getSelection();null!==t&&t.removeAllRanges()}!this.Zm.kn().Gi()&&this.sn().Bt().Gi()}ow(t){if(null===this.Zm)return;const i=this.sn(),n=i.Bt();if(n.Gi())return;const s=this.qv.N(),e=s.handleScroll,r=s.kineticScroll;if((!e.pressedMouseMove||t.Zp)&&(!e.horzTouchDrag&&!e.vertTouchDrag||!t.Zp))return;const h=this.Zm.kn(),a=performance.now();if(null!==this.Nm||this.yw(t)||(this.Nm={x:t.clientX,y:t.clientY,xf:a,Pw:t.localX,kw:t.localY}),null!==this.Nm&&!this.Fm&&(this.Nm.x!==t.clientX||this.Nm.y!==t.clientY)){if(t.Zp&&r.touch||!t.Zp&&r.mouse){const t=n.fl();this.Km=new In(.2/t,7/t,.997,15/t),this.Km.Fv(n.Ac(),this.Nm.xf)}else this.Km=null;h.Gi()||i.Q_(this.Zm,h,t.localY),i.Fd(t.localX),this.Fm=!0}this.Fm&&(h.Gi()||i.tu(this.Zm,h,t.localY),i.Wd(t.localX),null!==this.Km&&this.Km.Fv(n.Ac(),a))}}class qn{constructor(t,i,n,s,e){this.St=!0,this.Qv=on({width:0,height:0}),this.hm=()=>this.Pm(3),this.om="left"===t,this.wd=n.Zd,this.yn=i,this.Tw=s,this.Rw=e,this.lv=document.createElement("div"),this.lv.style.width="25px",this.lv.style.height="100%",this.lv.style.overflow="hidden",this.fm=En(this.lv,on({width:16,height:16})),this.fm.subscribeSuggestedBitmapSizeChanged(this.hm)}m(){this.fm.unsubscribeSuggestedBitmapSizeChanged(this.hm),Bn(this.fm.canvasElement),this.fm.dispose()}uv(){return this.lv}cv(){return this.Qv}Cm(t){_n(this.Qv,t)||(this.Qv=t,this.fm.resizeCanvasElement(t),this.lv.style.width=`${t.width}px`,this.lv.style.height=`${t.height}px`,this.St=!0)}Pm(t){if(t<3&&!this.St)return;if(0===this.Qv.width||0===this.Qv.height)return;this.St=!1,this.fm.applySuggestedBitmapSize();const i=pn(this.fm,{colorSpace:this.yn.layout.colorSpace});null!==i&&i.useBitmapCoordinateSpace((t=>{this.Tm(t),this.Rm(t)}))}dv(){return this.fm.bitmapSize}fv(t,i,n){const s=this.dv();s.width>0&&s.height>0&&t.drawImage(this.fm.canvasElement,i,n)}Rm({context:t,bitmapSize:i,horizontalPixelRatio:n,verticalPixelRatio:s}){if(!this.Tw())return;t.fillStyle=this.yn.timeScale.borderColor;const e=Math.floor(this.wd.N().S*n),r=Math.floor(this.wd.N().S*s),h=this.om?i.width-e:0;t.fillRect(h,0,e,r)}Tm({context:t,bitmapSize:i}){E(t,0,0,i.width,i.height,this.Rw())}}function Yn(t){return i=>i.Xa?.(t)??[]}const Kn=Yn("normal"),Zn=Yn("top"),Gn=Yn("bottom");class Xn{constructor(t,i){this.Dw=null,this.Iw=null,this.M=null,this.Vw=!1,this.Qv=on({width:0,height:0}),this.Ew=new o,this.im=new it(5),this.rm=!1,this.hm=()=>{this.rm||this.qv.Qt().mr()},this.lm=()=>{this.rm||this.qv.Qt().mr()},this.qv=t,this.Su=i,this.yn=t.N().layout,this.Hv=document.createElement("tr"),this.Bw=document.createElement("td"),this.Bw.style.padding="0",this.Aw=document.createElement("td"),this.Aw.style.padding="0",this.lv=document.createElement("td"),this.lv.style.height="25px",this.lv.style.padding="0",this.zw=document.createElement("div"),this.zw.style.width="100%",this.zw.style.height="100%",this.zw.style.position="relative",this.zw.style.overflow="hidden",this.lv.appendChild(this.zw),this.fm=En(this.zw,on({width:16,height:16})),this.fm.subscribeSuggestedBitmapSizeChanged(this.hm);const n=this.fm.canvasElement;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.pm=En(this.zw,on({width:16,height:16})),this.pm.subscribeSuggestedBitmapSizeChanged(this.lm);const s=this.pm.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.Hv.appendChild(this.Bw),this.Hv.appendChild(this.lv),this.Hv.appendChild(this.Aw),this.Ow(),this.qv.Qt().z_().i(this.Ow.bind(this),this),this.tv=new xn(this.pm.canvasElement,this,{Sp:()=>!0,Cp:()=>!this.qv.N().handleScroll.horzTouchDrag})}m(){this.tv.m(),null!==this.Dw&&this.Dw.m(),null!==this.Iw&&this.Iw.m(),this.pm.unsubscribeSuggestedBitmapSizeChanged(this.lm),Bn(this.pm.canvasElement),this.pm.dispose(),this.fm.unsubscribeSuggestedBitmapSizeChanged(this.hm),Bn(this.fm.canvasElement),this.fm.dispose()}uv(){return this.Hv}Lw(){return this.Dw}Nw(){return this.Iw}Op(t){if(this.Vw)return;this.Vw=!0;const i=this.qv.Qt();!i.Bt().Gi()&&this.qv.N().handleScale.axisPressedMouseMove.time&&i.Od(t.localX)}Ap(t){this.Op(t)}Lp(){const t=this.qv.Qt();!t.Bt().Gi()&&this.Vw&&(this.Vw=!1,this.qv.N().handleScale.axisPressedMouseMove.time&&t.$d())}kp(t){const i=this.qv.Qt();!i.Bt().Gi()&&this.qv.N().handleScale.axisPressedMouseMove.time&&i.Ud(t.localX)}yp(t){this.kp(t)}Ip(){this.Vw=!1;const t=this.qv.Qt();t.Bt().Gi()&&!this.qv.N().handleScale.axisPressedMouseMove.time||t.$d()}Rp(){this.Ip()}up(){this.qv.N().handleScale.axisDoubleClickReset.time&&this.qv.Qt().ws()}ap(){this.up()}wp(){this.qv.Qt().N().handleScale.axisPressedMouseMove.time&&this.Bm(1)}Yp(){this.Bm(0)}cv(){return this.Qv}Fw(){return this.Ew}Ww(t,i,n){_n(this.Qv,t)||(this.Qv=t,this.rm=!0,this.fm.resizeCanvasElement(t),this.pm.resizeCanvasElement(t),this.rm=!1,this.lv.style.width=`${t.width}px`,this.lv.style.height=`${t.height}px`,this.Ew.p(t)),null!==this.Dw&&this.Dw.Cm(on({width:i,height:t.height})),null!==this.Iw&&this.Iw.Cm(on({width:n,height:t.height}))}Hw(){const t=this.Uw();return Math.ceil(t.S+t.C+t.P+t.A+t.I+t.$w)}Pt(){this.qv.Qt().Bt().Bl()}dv(){return this.fm.bitmapSize}fv(t,i,n,s){const e=this.dv();if(e.width>0&&e.height>0&&(t.drawImage(this.fm.canvasElement,i,n),s)){const s=this.pm.canvasElement;t.drawImage(s,i,n)}}Pm(t){if(0===t)return;const i={colorSpace:this.yn.colorSpace};if(1!==t){this.fm.applySuggestedBitmapSize();const n=pn(this.fm,i);null!==n&&(n.useBitmapCoordinateSpace((t=>{this.Tm(t),this.Rm(t),this.jw(n,Gn)})),this.Im(n),this.jw(n,Kn)),null!==this.Dw&&this.Dw.Pm(t),null!==this.Iw&&this.Iw.Pm(t)}this.pm.applySuggestedBitmapSize();const n=pn(this.pm,i);null!==n&&(n.useBitmapCoordinateSpace((({context:t,bitmapSize:i})=>{t.clearRect(0,0,i.width,i.height)})),this.qw([...this.qv.Qt().Jn(),this.qv.Qt().Rd()],n),this.jw(n,Zn))}jw(t,i){const n=this.qv.Qt().Jn();for(const s of n)On(i,(i=>An(i,t,!1,void 0)),s,void 0);for(const s of n)On(i,(i=>zn(i,t,!1,void 0)),s,void 0)}Tm({context:t,bitmapSize:i}){E(t,0,0,i.width,i.height,this.qv.Qt().ef())}Rm({context:t,bitmapSize:i,verticalPixelRatio:n}){if(this.qv.N().timeScale.borderVisible){t.fillStyle=this.Yw();const s=Math.max(1,Math.floor(this.Uw().S*n));t.fillRect(0,0,i.width,s)}}Im(t){const i=this.qv.Qt().Bt(),n=i.Bl();if(!n||0===n.length)return;const s=this.Su.maxTickMarkWeight(n),e=this.Uw(),r=i.N();r.borderVisible&&r.ticksVisible&&t.useBitmapCoordinateSpace((({context:t,horizontalPixelRatio:i,verticalPixelRatio:s})=>{t.strokeStyle=this.Yw(),t.fillStyle=this.Yw();const r=Math.max(1,Math.floor(i)),h=Math.floor(.5*i);t.beginPath();const a=Math.round(e.C*s);for(let s=n.length;s--;){const e=Math.round(n[s].coord*i);t.rect(e-h,0,r,a)}t.fill()})),t.useMediaCoordinateSpace((({context:t})=>{const i=e.S+e.C+e.A+e.P/2;t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.H(),t.font=this.xm();for(const e of n)if(e.weight=s){const n=e.needAlignCoordinate?this.Kw(t,e.coord,e.label):e.coord;t.fillText(e.label,n,i)}}))}Kw(t,i,n){const s=this.im.Ii(t,n),e=s/2,r=Math.floor(i-e)+.5;return r<0?i+=Math.abs(0-r):r+s>this.Qv.width&&(i-=Math.abs(this.Qv.width-(r+s))),i}qw(t,i){const n=this.Uw();for(const s of t)for(const t of s.dn())t.Tt().st(i,n)}Yw(){return this.qv.N().timeScale.borderColor}H(){return this.yn.textColor}F(){return this.yn.fontSize}xm(){return g(this.F(),this.yn.fontFamily)}Zw(){return g(this.F(),this.yn.fontFamily,"bold")}Uw(){null===this.M&&(this.M={S:1,O:NaN,A:NaN,I:NaN,tn:NaN,C:5,P:NaN,k:"",Qi:new it,$w:0});const t=this.M,i=this.xm();if(t.k!==i){const n=this.F();t.P=n,t.k=i,t.A=3*n/12,t.I=3*n/12,t.tn=9*n/12,t.O=0,t.$w=4*n/12,t.Qi.Ls()}return this.M}Bm(t){this.lv.style.cursor=1===t?"ew-resize":"default"}Ow(){const t=this.qv.Qt(),i=t.N();i.leftPriceScale.visible||null===this.Dw||(this.Bw.removeChild(this.Dw.uv()),this.Dw.m(),this.Dw=null),i.rightPriceScale.visible||null===this.Iw||(this.Aw.removeChild(this.Iw.uv()),this.Iw.m(),this.Iw=null);const n={Zd:this.qv.Qt().Zd()},s=()=>i.leftPriceScale.borderVisible&&t.Bt().N().borderVisible,e=()=>t.ef();i.leftPriceScale.visible&&null===this.Dw&&(this.Dw=new qn("left",i,n,s,e),this.Bw.appendChild(this.Dw.uv())),i.rightPriceScale.visible&&null===this.Iw&&(this.Iw=new qn("right",i,n,s,e),this.Aw.appendChild(this.Iw.uv()))}}const Jn=!!vn&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!vn&&(navigator?.userAgentData?.platform?"Windows"===navigator.userAgentData.platform:navigator.userAgent.toLowerCase().indexOf("win")>=0);class Qn{constructor(t,i,n){var s;this.Gw=[],this.Xw=[],this.Jw=0,this.ho=0,this.C_=0,this.Qw=0,this.tg=0,this.ig=null,this.ng=!1,this.Wm=new o,this.Hm=new o,this.pd=new o,this.sg=null,this.eg=null,this.jv=t,this.yn=i,this.Su=n,this.Hv=document.createElement("div"),this.Hv.classList.add("tv-lightweight-charts"),this.Hv.style.overflow="hidden",this.Hv.style.direction="ltr",this.Hv.style.width="100%",this.Hv.style.height="100%",(s=this.Hv).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.rg=document.createElement("table"),this.rg.setAttribute("cellspacing","0"),this.Hv.appendChild(this.rg),this.hg=this.ag.bind(this),ts(this.yn)&&this.lg(!0),this.sn=new Hi(this.md.bind(this),this.yn,n),this.Qt().Dd().i(this.og.bind(this),this),this._g=new Xn(this,this.Su),this.rg.appendChild(this._g.uv());const e=i.autoSize&&this.ug();let r=this.yn.width,h=this.yn.height;if(e||0===r||0===h){const i=t.getBoundingClientRect();r=r||i.width,h=h||i.height}this.cg(r,h),this.dg(),t.appendChild(this.Hv),this.fg(),this.sn.Bt().Zc().i(this.sn.ka.bind(this.sn),this),this.sn.z_().i(this.sn.ka.bind(this.sn),this)}Qt(){return this.sn}N(){return this.yn}rv(){return this.Gw}pg(){return this._g}m(){this.lg(!1),0!==this.Jw&&window.cancelAnimationFrame(this.Jw),this.sn.Dd().u(this),this.sn.Bt().Zc().u(this),this.sn.z_().u(this),this.sn.m();for(const t of this.Gw)this.rg.removeChild(t.uv()),t.dw().u(this),t.fw().u(this),t.m();this.Gw=[];for(const t of this.Xw)this.vg(t);this.Xw=[],a(this._g).m(),null!==this.Hv.parentElement&&this.Hv.parentElement.removeChild(this.Hv),this.pd.m(),this.Wm.m(),this.Hm.m(),this.mg()}cg(t,i,n=!1){if(this.ho===i&&this.C_===t)return;const s=function(t){const i=Math.floor(t.width),n=Math.floor(t.height);return on({width:i-i%2,height:n-n%2})}(on({width:t,height:i}));this.ho=s.height,this.C_=s.width;const e=this.ho+"px",r=this.C_+"px";if(this.wg()||(a(this.Hv).style.height=e,a(this.Hv).style.width=r),this.rg.style.height=e,this.rg.style.width=r,n){0!==this.Jw&&(window.cancelAnimationFrame(this.Jw),this.Jw=0),this.ng=!1;const t=Y.ys();null!==this.ig&&(t.xs(this.ig),this.ig=null),this.gg(t,performance.now())}else this.sn.ka()}Pm(t){void 0===t&&(t=Y.ys());for(let i=0;i{t.Pt()}))}bg(t){(void 0!==t.autoSize||!this.sg||void 0===t.width&&void 0===t.height)&&(t.autoSize&&!this.sg&&this.ug(),!1===t.autoSize&&null!==this.sg&&this.mg(),t.autoSize||void 0===t.width&&void 0===t.height||this.cg(t.width||this.C_,t.height||this.ho))}Sg(t,i){let n=0,s=0;const e=this.Gw[0],r=(n,s)=>{let e=0;for(let r=0;r{a("left"===i?this._g.Lw():this._g.Nw()).fv(a(t),n,s)};if(this.yn.timeScale.visible){const n=this._g.dv();if(null!==t){let r=0;this.yg()&&(h("left",r,s),r=a(e.xw()).dv().width),this._g.fv(t,r,s,i),r+=n.width,this.Pg()&&h("right",r,s)}s+=n.height}return on({width:n,height:s})}Dg(){let t=0,i=0,n=0;for(const s of this.Gw)this.yg()&&(i=Math.max(i,a(s.xw()).bm(),this.yn.leftPriceScale.minimumWidth)),this.Pg()&&(n=Math.max(n,a(s.Sw()).bm(),this.yn.rightPriceScale.minimumWidth)),t+=s.O_();i=Mn(i),n=Mn(n);const s=this.C_,e=this.ho,r=Math.max(s-i-n,0),h=1*this.Xw.length,l=this.yn.timeScale.visible;let o=l?Math.max(this._g.Hw(),this.yn.timeScale.minimumHeight):0;var _;o=(_=o)+_%2;const u=h+o,c=e{t.sw()})),3===this.ig?.ls()&&(this.ig.xs(t),this.Vg(),this.Eg(this.ig),this.Bg(this.ig,i),t=this.ig,this.ig=null)),this.Pm(t)}Bg(t,i){for(const n of t.bs())this.Ss(n,i)}Eg(t){const i=this.sn.Zn();for(let n=0;n{if(this.ng=!1,this.Jw=0,null!==this.ig){const i=this.ig;this.ig=null,this.gg(i,t);for(const n of i.bs())if(5===n.ds&&!n.Wt.jc(t)){this.Qt().ps(n.Wt);break}}})))}Vg(){this.dg()}vg(t){this.rg.removeChild(t.uv()),t.m()}dg(){const t=this.sn.Zn(),i=t.length,n=this.Gw.length;for(let t=i;t0){const t=new Tn(this,s-1,s);this.Xw.push(t),this.rg.insertBefore(t.uv(),this._g.uv())}this.rg.insertBefore(i.uv(),this._g.uv())}for(let n=0;n{const n=i.Un().Hn(t);null!==n&&e.set(i,n)}))}let r;if(null!==t){const i=this.sn.Bt().en(t)?.originalTime;void 0!==i&&(r=i)}const h=this.Qt().ou(),a=this.Lg(s),l=function(t,i){const n=null!==t&&t.lu instanceof Kt?t.lu:void 0,s=t?.wu?.te,e=void 0!==i&&-1!==i?i:void 0;return null===t||void 0===t.ee?{Ng:n,Fg:s}:{Ng:n,Fg:s,Wg:{ds:t.ee,Hg:(r=t.lu,h=t.ee,r instanceof xi?"pane-primitive":"marker"===h||"primitive"===h?"series-primitive":"series"),Ug:gn(t.ee,s),U_:n,$g:s,jg:e}};var r,h}(h,a);return{Qr:r,$n:t??void 0,qg:i??void 0,jg:-1!==a?a:void 0,Ng:l.Ng,Yg:e,Fg:l.Fg,Wg:l.Wg,Kg:n??void 0}}Lg(t){let i=-1;if(t)i=this.Gw.indexOf(t);else{const t=this.Qt().Rd().Kn();null!==t&&(i=this.Qt().Zn().indexOf(t))}return i}Ag(t,i,n,s){this.Wm.p((()=>this.Og(i,n,s,t)))}zg(t,i,n,s){this.Hm.p((()=>this.Og(i,n,s,t)))}og(t,i,n){this.kg(this.Qt().ou()?.mu??null),this.pd.p((()=>this.Og(t,i,n)))}fg(){const t=this.yn.timeScale.visible?"":"none";this._g.uv().style.display=t}yg(){return this.Gw[0].xv().K_().N().visible}Pg(){return this.Gw[0].xv().Z_().N().visible}ug(){return"ResizeObserver"in window&&(this.sg=new ResizeObserver((t=>{const i=t[t.length-1];if(!i)return;const n=i.contentRect.width,s=i.contentRect.height;this.cg(n,s,!0)})),this.sg.observe(this.jv,{box:"border-box"}),!0)}mg(){null!==this.sg&&this.sg.disconnect(),this.sg=null}}function ts(t){return Boolean(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function is(t){return void 0===t.open&&void 0===t.value}function ns(t){return function(t){return void 0!==t.open}(t)||function(t){return void 0!==t.value}(t)}function ss(t,i,n,s){const e=n.value,r={$n:i,wt:t,Wt:[e,e,e,e],Qr:s};return void 0!==n.color&&(r.R=n.color),r}function es(t,i,n,s){const e=n.value,r={$n:i,wt:t,Wt:[e,e,e,e],Qr:s};return void 0!==n.lineColor&&(r.vt=n.lineColor),void 0!==n.topColor&&(r.ah=n.topColor),void 0!==n.bottomColor&&(r.oh=n.bottomColor),r}function rs(t,i,n,s){const e=n.value,r={$n:i,wt:t,Wt:[e,e,e,e],Qr:s};return void 0!==n.topLineColor&&(r._h=n.topLineColor),void 0!==n.bottomLineColor&&(r.uh=n.bottomLineColor),void 0!==n.topFillColor1&&(r.dh=n.topFillColor1),void 0!==n.topFillColor2&&(r.fh=n.topFillColor2),void 0!==n.bottomFillColor1&&(r.ph=n.bottomFillColor1),void 0!==n.bottomFillColor2&&(r.mh=n.bottomFillColor2),r}function hs(t,i,n,s){const e={$n:i,wt:t,Wt:[n.open,n.high,n.low,n.close],Qr:s};return void 0!==n.color&&(e.R=n.color),e}function as(t,i,n,s){const e={$n:i,wt:t,Wt:[n.open,n.high,n.low,n.close],Qr:s};return void 0!==n.color&&(e.R=n.color),void 0!==n.borderColor&&(e.Ht=n.borderColor),void 0!==n.wickColor&&(e.hh=n.wickColor),e}function ls(t,i,n,s,e){const r=h(e)(n),a=Math.max(...r),l=Math.min(...r),o=r[r.length-1],_=[o,a,l,o],{time:u,color:c,...d}=n;return{$n:i,wt:t,Wt:_,Qr:s,ue:d,R:c}}function os(t){return void 0!==t.Wt}function _s(t,i){return void 0!==i.customValues&&(t.Zg=i.customValues),t}function us(t){return(i,n,s,e,r,h)=>function(t,i){return i?i(t):is(t)}(s,h)?_s({wt:i,$n:n,Qr:e},s):_s(t(i,n,s,e,r),s)}function cs(t){return{Candlestick:us(as),Bar:us(hs),Area:us(es),Baseline:us(rs),Histogram:us(ss),Line:us(ss),Custom:us(ls)}[t]}function ds(t){return{$n:0,Gg:new Map,Oa:t}}function fs(t,i){if(void 0!==t&&0!==t.length)return{Xg:i.key(t[0].wt),Jg:i.key(t[t.length-1].wt)}}function ps(t){let i;return t.forEach((t=>{void 0===i&&(i=t.Qr)})),h(i)}class vs{constructor(t){this.Qg=new Map,this.tM=new Map,this.iM=new Map,this.nM=[],this.Su=t}m(){this.Qg.clear(),this.tM.clear(),this.iM.clear(),this.nM=[]}sM(t,i){let n=0!==this.Qg.size,s=!1;const e=this.tM.get(t);if(void 0!==e)if(1===this.tM.size)n=!1,s=!0,this.Qg.clear();else for(const i of this.nM)i.pointData.Gg.delete(t)&&(s=!0);let r=[];if(0!==i.length){const n=i.map((t=>t.time)),e=this.Su.createConverterToInternalObj(i),h=cs(t.bh()),a=t.ll(),l=t.ol();r=i.map(((i,r)=>{const o=e(i.time),_=this.Su.key(o);let u=this.Qg.get(_);void 0===u&&(u=ds(o),this.Qg.set(_,u),s=!0);const c=h(o,u.$n,i,n[r],a,l);return u.Gg.set(t,c),c}))}n&&this.eM(),this.rM(t,r);let h=-1;if(s){const t=[];this.Qg.forEach((i=>{t.push({timeWeight:0,time:i.Oa,pointData:i,originalTime:ps(i.Gg)})})),t.sort(((t,i)=>this.Su.key(t.time)-this.Su.key(i.time))),h=this.hM(t)}return this.aM(t,h,function(t,i,n){const s=fs(t,n),e=fs(i,n);if(void 0!==s&&void 0!==e)return{lM:!1,Ia:s.Jg>=e.Jg&&s.Xg>=e.Xg}}(this.tM.get(t),e,this.Su))}Jd(t){return this.sM(t,[])}oM(t,i,n){if(n&&t.Na())throw new Error("Historical updates are not supported when conflation is enabled. Conflation requires data to be processed in order.");const s=i;!function(t){void 0===t.Qr&&(t.Qr=t.time)}(s),this.Su.preprocessData(i);const e=this.Su.createConverterToInternalObj([i])(i.time),r=this.iM.get(t);if(!n&&void 0!==r&&this.Su.key(e)this.Su.key(t.time)this.Su.key(s.wt)?os(i)&&n.push(i):os(i)?n[n.length-1]=i:n.splice(-1,1),this.iM.set(t,i.wt)}_M(t,i,n){const s=this.tM.get(t);if(void 0===s)return;const e=yt(s,n,((t,i)=>t.$n{0!==i.length&&(t=Math.max(t,i[i.length-1].$n))})),t}aM(t,i,n){const s=this.dM();if(-1!==i)this.tM.forEach(((i,e)=>{s.U_.set(e,{ue:i,pM:e===t?n:void 0})})),this.tM.has(t)||s.U_.set(t,{ue:[],pM:n}),s.Bt.vM=this.nM,s.Bt.mM=i;else{const i=this.tM.get(t);s.U_.set(t,{ue:i||[],pM:n})}return s}dM(){return{U_:new Map,Bt:{kc:this.fM()}}}}function ms(t,i){t.$n=i,t.Gg.forEach((t=>{t.$n=i}))}function ws(t,i){return t._t=i-s&&t<=n+s}function Cs(t,i,n,s,e,r){const h=e-n,a=r-s;if(0===h&&0===a)return Math.hypot(t-n,i-s);const l=((t-n)*h+(i-s)*a)/(h*h+a*a),o=Math.max(0,Math.min(1,l)),_=n+h*o,u=s+a*o;return Math.hypot(t-_,i-u)}const ys=[0,0];function Ps(t,i,n){return void 0===i||i.wt!==t.wt-1?t._t-n/2:(i._t+t._t)/2}function ks(t,i,n){return void 0===i||i.wt!==t.wt+1?t._t+n/2:(t._t+i._t)/2}function Ts(t,i,n,s,e,r,h){if(null===i||i.from>=i.to||0===t.length)return null;const a=e/2+r,l=Ms(t,n-a,i.from,i.to),o=bs(t,n+a,l,i.to);if(l>=o)return null;let _=Number.POSITIVE_INFINITY;for(let a=l;ai.from?t[a-1]:void 0,u=ad)continue;h(l,ys);const f=ys[0],p=ys[1],v=Math.min(f,p),m=Math.max(f,p),w=v-r,g=m+r;if(s>=v&&s<=m)_=Math.min(_,0);else if(s>=w&&s<=g){const t=Math.min(Math.abs(s-v),Math.abs(m-s));_=Math.min(_,t)}}return Number.isFinite(_)?xs(_,0,"series-range"):null}function Rs(t,i){return t.wt0&&r=s&&(a=r-1),h>0&&h({...t,...this.ae.xa().xh(t.wt)})))}RM(){this.xM=null}yM(){const t=this.le.Bt(),i=t.N().enableConflation?t.Qc():0;i!==this.SM&&(this.gM=!0,this.SM=i),this.gM&&(this.DM(),this.gM=!1),this.MM&&(this.TM(),this.MM=!1),this.wM&&(this.IM(),this.wM=!1)}IM(){const t=this.ae.Ft(),i=this.le.Bt();if(this.RM(),i.Gi()||t.Gi())return;const n=i.Be();if(null===n)return;if(0===this.ae.Un().Th())return;const s=this.ae.zt();null!==s&&(this.xM=Is(this.bM,n,this.CM),this.VM(t,i,s.Wt),this.EM())}}class Es{constructor(t,i){this.BM=t,this.Ki=i}st(t,i,n){this.BM.draw(t,this.Ki,i,n)}}function Bs(t){switch(t){case"point":return 2;case"range":return 0;default:return 1}}class As extends Vs{constructor(t,i,n){super(t,i,!1),this.Yh=n,this.BM=this.Yh.renderer(),this.PM=new Es(this.BM,(t=>this.AM(t)))}get Ma(){return this.Yh.conflationReducer}Wa(t){return this.Yh.priceValueBuilder(t)}_l(t){return this.Yh.isWhitespace(t)}kM(t,i){const n=this.BM.hitTest?.(t,i,(t=>this.AM(t)));if(null!=n)return{ne:(s=n).distance,se:Bs(s.type),ee:"custom",mu:s.cursorStyle,te:s.objectId,ie:s.hitTestData};var s;const e=Ts(this.bM,this.xM,t,i,this.le.Bt().fl(),this.ae.N().hitTestTolerance,((t,i)=>{const n=t.zM;let s=NaN,e=NaN;if(void 0!==n&&!this.Yh.isWhitespace(n))for(const t of this.Yh.priceValueBuilder(n)){const i=this.AM(t);null!==i&&(s=Number.isNaN(s)?i:Math.min(s,i),e=Number.isNaN(e)?i:Math.max(e,i))}i[0]=s,i[1]=e}));return null===e?null:{...e,ee:"custom"}}DM(){const t=this.ae.xa();this.bM=this.ae.Ha().Eh().map((i=>({wt:i.$n,_t:NaN,...t.xh(i.$n),zM:i.ue})))}VM(t,i){i.Tc(this.bM,m(this.xM))}EM(){this.Yh.update({bars:this.bM.map(zs),barSpacing:this.le.Bt().fl(),visibleRange:this.xM,conflationFactor:this.le.Bt().Qc()},this.ae.N())}AM(t){const i=this.ae.zt();return null===i?null:this.ae.Ft().Nt(t,i.Wt)}}function zs(t){return{x:t._t,time:t.wt,originalData:t.zM,barColor:t.sh}}const Os={color:"#2196f3"},Ls=(t,i,n)=>{const s=l(n);return new As(t,i,s)};function Ns(t){const i={value:t.Wt[3],time:t.Qr};return void 0!==t.Zg&&(i.customValues=t.Zg),i}function Fs(t){const i=Ns(t);return void 0!==t.R&&(i.color=t.R),i}function Ws(t){const i=Ns(t);return void 0!==t.vt&&(i.lineColor=t.vt),void 0!==t.ah&&(i.topColor=t.ah),void 0!==t.oh&&(i.bottomColor=t.oh),i}function Hs(t){const i=Ns(t);return void 0!==t._h&&(i.topLineColor=t._h),void 0!==t.uh&&(i.bottomLineColor=t.uh),void 0!==t.dh&&(i.topFillColor1=t.dh),void 0!==t.fh&&(i.topFillColor2=t.fh),void 0!==t.ph&&(i.bottomFillColor1=t.ph),void 0!==t.mh&&(i.bottomFillColor2=t.mh),i}function Us(t){const i={open:t.Wt[0],high:t.Wt[1],low:t.Wt[2],close:t.Wt[3],time:t.Qr};return void 0!==t.Zg&&(i.customValues=t.Zg),i}function $s(t){const i=Us(t);return void 0!==t.R&&(i.color=t.R),i}function js(t){const i=Us(t),{R:n,Ht:s,hh:e}=t;return void 0!==n&&(i.color=n),void 0!==s&&(i.borderColor=s),void 0!==e&&(i.wickColor=e),i}function qs(t){return{Area:Ws,Line:Fs,Baseline:Hs,Histogram:Fs,Bar:$s,Candlestick:js,Custom:Ys}[t]}function Ys(t){const i=t.Qr;return{...t.ue,time:i}}const Ks={vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1,doNotSnapToHiddenSeriesIndices:!1},Zs={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},Gs={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:w,panes:{enableResize:!0,separatorColor:"#E0E3EB",separatorHoverColor:"rgba(178, 181, 189, 0.2)"},attributionLogo:!0,colorSpace:"srgb",colorParsers:[]},Xs={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2},minimumWidth:0,ensureEdgeTickMarksVisible:!1,tickMarkDensity:2.5},Js={rightOffset:0,barSpacing:6,minBarSpacing:.5,maxBarSpacing:0,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,allowShiftVisibleRangeOnWhitespaceReplacement:!1,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0,allowBoldLabels:!0,ignoreWhitespaceIndices:!1,enableConflation:!1,conflationThresholdFactor:1,precomputeConflationOnInit:!1,precomputeConflationPriority:"background"};function Qs(){return{addDefaultPane:!0,hoveredSeriesOnTop:!0,width:0,height:0,autoSize:!1,layout:Gs,crosshair:Ks,grid:Zs,overlayPriceScales:{...Xs},leftPriceScale:{...Xs,visible:!1},rightPriceScale:{...Xs,visible:!0},defaultVisiblePriceScaleId:"right",timeScale:Js,localization:{locale:vn?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class te{constructor(t,i,n){this.sv=t,this.OM=i,this.LM=n??0}applyOptions(t){this.sv.Qt().kd(this.OM,t,this.LM)}options(){return this.Ki().N()}width(){return q(this.OM)?this.sv.Cg(this.OM):0}setVisibleRange(t){this.setAutoScale(!1),this.Ki().qo(new dt(t.from,t.to))}getVisibleRange(){let t,i,n=this.Ki().ar();if(null===n)return null;if(this.Ki().so()){const s=this.Ki().g_(),e=Ui(s);n=ci(n,this.Ki().ro()),t=Number((Math.round(n.Je()/s)*s).toFixed(e)),i=Number((Math.round(n.Qe()/s)*s).toFixed(e))}else t=n.Je(),i=n.Qe();return{from:t,to:i}}setAutoScale(t){this.applyOptions({autoScale:t})}Ki(){return a(this.sv.Qt().Td(this.OM,this.LM)).Ft}}class ie{constructor(t,i,n,s){this.sv=t,this.yt=n,this.NM=i,this.FM=s}getHeight(){return this.yt.$t()}setHeight(t){const i=this.sv.Qt(),n=i.hf(this.yt);i.Ed(n,t)}getStretchFactor(){return this.yt.O_()}setStretchFactor(t){this.yt.L_(t),this.sv.Qt().ka()}paneIndex(){return this.sv.Qt().hf(this.yt)}moveTo(t){const i=this.paneIndex();i!==t&&(r(t>=0&&tthis.NM(t)))??[]}getHTMLElement(){const t=this.sv.rv();return t&&0!==t.length&&t[this.paneIndex()]?t[this.paneIndex()].uv():null}attachPrimitive(t){this.yt.hl(t),t.attached&&t.attached({chart:this.FM,requestUpdate:()=>this.yt.Qt().ka()})}detachPrimitive(t){this.yt.al(t)}priceScale(t){if(null===this.yt.A_(t))throw new Error(`Cannot find price scale with id: ${t}`);return new te(this.sv,t,this.paneIndex())}setPreserveEmptyPane(t){this.yt.W_(t)}preserveEmptyPane(){return this.yt.H_()}addCustomSeries(t,i={},n=0){return this.FM.addCustomSeries(t,i,n)}addSeries(t,i={}){return this.FM.addSeries(t,i,this.paneIndex())}}const ne={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class se{constructor(t){this._r=t}applyOptions(t){this._r.vr(t)}options(){return this._r.N()}WM(){return this._r}}class ee{constructor(t,i,n,s,e,r){this.HM=new o,this.ae=t,this.UM=i,this.$M=n,this.Su=e,this.FM=s,this.jM=r}m(){this.HM.m()}priceFormatter(){return this.ae.tl()}priceToCoordinate(t){const i=this.ae.zt();return null===i?null:this.ae.Ft().Nt(t,i.Wt)}coordinateToPrice(t){const i=this.ae.zt();return null===i?null:this.ae.Ft().Tn(t,i.Wt)}barsInLogicalRange(t){if(null===t)return null;const i=new Bi(new Ii(t.from,t.to)).Fu(),n=this.ae.Un();if(n.Gi())return null;const s=n.Hn(i.La(),1),e=n.Hn(i.bi(),-1),r=a(n.Rh()),h=a(n.Qn());if(null!==s&&null!==e&&s.$n>e.$n)return{barsBefore:t.from-r,barsAfter:h-t.to};const l={barsBefore:null===s||s.$n===r?t.from-r:s.$n-r,barsAfter:null===e||e.$n===h?h-t.to:h-e.$n};return null!==s&&null!==e&&(l.from=s.Qr,l.to=e.Qr),l}setData(t){this.Su,this.ae.bh(),this.UM.qM(this.ae,t),this.YM("full")}update(t,i=!1){this.ae.bh(),this.UM.KM(this.ae,t,i),this.YM("update")}pop(t=1){const i=this.UM.ZM(this.ae,t);0!==i.length&&this.YM("update");const n=qs(this.seriesType());return i.map((t=>n(t)))}dataByIndex(t,i){const n=this.ae.Un().Hn(t,i);if(null===n)return null;return qs(this.seriesType())(n)}data(){const t=qs(this.seriesType());return this.ae.Un().Eh().map((i=>t(i)))}subscribeDataChanged(t){this.HM.i(t)}unsubscribeDataChanged(t){this.HM._(t)}applyOptions(t){this.ae.vr(t)}options(){return p(this.ae.N())}priceScale(){return this.$M.priceScale(this.ae.Ft().cl(),this.getPane().paneIndex())}createPriceLine(t){const i=_(p(ne),t),n=this.ae.Ea(i);return new se(n)}removePriceLine(t){this.ae.Ba(t.WM())}priceLines(){return this.ae.Aa().map((t=>new se(t)))}seriesType(){return this.ae.bh()}lastValueData(t){const i=this.ae.Ae(t);return i.ze?{noData:!0}:{noData:!1,price:i.gt,color:i.R}}attachPrimitive(t){this.ae.hl(t),t.attached&&t.attached({chart:this.FM,series:this,requestUpdate:()=>this.ae.Qt().ka(),horzScaleBehavior:this.Su})}detachPrimitive(t){this.ae.al(t),t.detached&&t.detached(),this.ae.Qt().ka()}getPane(){const t=this.ae,i=a(this.ae.Qt().Ks(t));return this.jM(i)}moveToPane(t){this.ae.Qt().nf(this.ae,t)}seriesOrder(){const t=this.ae.Qt().Ks(this.ae);return null===t?-1:t.U_().indexOf(this.ae)}setSeriesOrder(t){const i=this.ae.Qt().Ks(this.ae);null!==i&&i.du(this.ae,t)}YM(t){this.HM.v()&&this.HM.p(t)}}class re{constructor(t,i,n){this.GM=new o,this.Gu=new o,this.Ew=new o,this.sn=t,this.ia=t.Bt(),this._g=i,this.ia.Yc().i(this.XM.bind(this)),this.ia.Kc().i(this.JM.bind(this)),this._g.Fw().i(this.QM.bind(this)),this.Su=n}m(){this.ia.Yc().u(this),this.ia.Kc().u(this),this._g.Fw().u(this),this.GM.m(),this.Gu.m(),this.Ew.m()}scrollPosition(){return this.ia.Ac()}scrollToPosition(t,i){i?this.ia.$c(t,1e3):this.sn.Ms(t)}scrollToRealTime(){this.ia.Uc()}getVisibleRange(){const t=this.ia.Mc();return null===t?null:{from:t.from.originalTime,to:t.to.originalTime}}setVisibleRange(t){const i={from:this.Su.convertHorzItemToInternal(t.from),to:this.Su.convertHorzItemToInternal(t.to)},n=this.ia.Cc(i);this.sn.tf(n)}getVisibleLogicalRange(){const t=this.ia.gc();return null===t?null:{from:t.La(),to:t.bi()}}setVisibleLogicalRange(t){r(t.from<=t.to,"The from index cannot be after the to index."),this.sn.tf(t)}resetTimeScale(){this.sn.ws()}fitContent(){this.sn.Xc()}logicalToCoordinate(t){const i=this.sn.Bt();return i.Gi()?null:i.jt(t)}coordinateToLogical(t){return this.ia.Gi()?null:this.ia.Rc(t)}timeToIndex(t,i){const n=this.Su.convertHorzItemToInternal(t);return this.ia.vc(n,i)}timeToCoordinate(t){const i=this.timeToIndex(t,!1);return null===i?null:this.ia.jt(i)}coordinateToTime(t){const i=this.sn.Bt(),n=i.Rc(t),s=i.en(n);return null===s?null:s.originalTime}width(){return this._g.cv().width}height(){return this._g.cv().height}subscribeVisibleTimeRangeChange(t){this.GM.i(t)}unsubscribeVisibleTimeRangeChange(t){this.GM._(t)}subscribeVisibleLogicalRangeChange(t){this.Gu.i(t)}unsubscribeVisibleLogicalRangeChange(t){this.Gu._(t)}subscribeSizeChange(t){this.Ew.i(t)}unsubscribeSizeChange(t){this.Ew._(t)}applyOptions(t){this.ia.vr(t)}options(){return{...p(this.ia.N()),barSpacing:this.ia.fl()}}XM(){this.GM.v()&&this.GM.p(this.getVisibleRange())}JM(){this.Gu.v()&&this.Gu.p(this.getVisibleLogicalRange())}QM(t){this.Ew.p(t.width,t.height)}}function he(t){return function(t){if(f(t.handleScale)){const i=t.handleScale;t.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(void 0!==t.handleScale){const{axisPressedMouseMove:i,axisDoubleClickReset:n}=t.handleScale;f(i)&&(t.handleScale.axisPressedMouseMove={time:i,price:i}),f(n)&&(t.handleScale.axisDoubleClickReset={time:n,price:n})}const i=t.handleScroll;f(i)&&(t.handleScroll={horzTouchDrag:i,vertTouchDrag:i,mouseWheel:i,pressedMouseMove:i})}(t),t}class ae{constructor(t,i,n){this.tb=new Map,this.ib=new Map,this.nb=new o,this.sb=new o,this.eb=new o,this.od=new WeakMap,this.rb=new vs(i);const s=void 0===n?p(Qs()):_(p(Qs()),he(n));this.hb=i,this.sv=new Qn(t,s,i),this.sv.dw().i((t=>{this.nb.v()&&this.nb.p(this.ab(t()))}),this),this.sv.fw().i((t=>{this.sb.v()&&this.sb.p(this.ab(t()))}),this),this.sv.Dd().i((t=>{this.eb.v()&&this.eb.p(this.ab(t()))}),this);const e=this.sv.Qt();this.lb=new re(e,this.sv.pg(),this.hb)}remove(){this.sv.dw().u(this),this.sv.fw().u(this),this.sv.Dd().u(this),this.lb.m(),this.sv.m(),this.tb.clear(),this.ib.clear(),this.nb.m(),this.sb.m(),this.eb.m(),this.rb.m()}resize(t,i,n){this.autoSizeActive()||this.sv.cg(t,i,n)}addCustomSeries(t,i={},n=0){const s=(t=>({type:"Custom",isBuiltIn:!1,defaultOptions:{...Os,...t.defaultOptions()},ob:Ls,_b:t}))(l(t));return this.ub(s,i,n)}addSeries(t,i={},n=0){return this.ub(t,i,n)}removeSeries(t){const i=h(this.tb.get(t)),n=this.rb.Jd(i);this.sv.Qt().Jd(i),this.cb(n),this.tb.delete(t),this.ib.delete(i)}qM(t,i){this.cb(this.rb.sM(t,i))}KM(t,i,n){this.cb(this.rb.oM(t,i,n))}ZM(t,i){const[n,s]=this.rb.cM(t,i);return 0!==n.length&&this.cb(s),n}subscribeClick(t){this.nb.i(t)}unsubscribeClick(t){this.nb._(t)}subscribeCrosshairMove(t){this.eb.i(t)}unsubscribeCrosshairMove(t){this.eb._(t)}subscribeDblClick(t){this.sb.i(t)}unsubscribeDblClick(t){this.sb._(t)}priceScale(t,i=0){return new te(this.sv,t,i)}timeScale(){return this.lb}applyOptions(t){this.sv.vr(he(t))}options(){return this.sv.N()}takeScreenshot(t=!1,i=!1){let n,s;try{i||(n=this.sv.Qt().N().crosshair.mode,this.sv.vr({crosshair:{mode:2}})),s=this.sv.xg(t)}finally{i||void 0===n||this.sv.Qt().vr({crosshair:{mode:n}})}return s}addPane(t=!1){const i=this.sv.Qt().af();return i.W_(t),this.fb(i)}removePane(t){this.sv.Qt().Vd(t)}swapPanes(t,i){this.sv.Qt().Bd(t,i)}autoSizeActive(){return this.sv.wg()}chartElement(){return this.sv.vv()}panes(){return this.sv.Qt().Zn().map((t=>this.fb(t)))}paneSize(t=0){const i=this.sv.Rg(t);return{height:i.height,width:i.width}}setCrosshairPosition(t,i,n){const s=this.tb.get(n);if(void 0===s)return;const e=this.sv.Qt().Ks(s);null!==e&&this.sv.Qt().qd(t,i,e)}clearCrosshairPosition(){this.sv.Qt().Yd(!0)}horzBehaviour(){return this.hb}ub(i,n={},s=0){r(void 0!==i.ob),function(t){if(void 0===t||"custom"===t.type)return;const i=t;void 0!==i.minMove&&void 0===i.precision&&(i.precision=Ui(i.minMove))}(n.priceFormat),"Candlestick"===i.type&&function(t){void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)}(n);const e=_(p(t),p(i.defaultOptions),n),h=i.ob,a=new Kt(this.sv.Qt(),i.type,e,h,i._b);this.sv.Qt().Gd(a,s);const l=new ee(a,this,this,this,this.hb,(t=>this.fb(t)));return this.tb.set(l,a),this.ib.set(a,l),l}cb(t){const i=this.sv.Qt();i.Kd(t.Bt.kc,t.Bt.vM,t.Bt.mM),t.U_.forEach(((t,i)=>i.ht(t.ue,t.pM))),i.Bt()._c(),i.Ec()}pb(t){return h(this.ib.get(t))}mb(t){return void 0!==t&&this.ib.has(t)?this.pb(t):void 0}ab(t){const i=new Map;t.Yg.forEach(((t,n)=>{const s=n.bh(),e=qs(s)(t);if("Custom"!==s)r(ns(e));else{const t=n.ol();r(!t||!1===t(e))}i.set(this.pb(n),e)}));const n=this.mb(t.Ng),s=void 0===t.Wg?void 0:{type:t.Wg.ds,sourceKind:t.Wg.Hg,objectKind:t.Wg.Ug,series:this.mb(t.Wg.U_),objectId:t.Wg.$g,paneIndex:t.Wg.jg};return{time:t.Qr,logical:t.$n,point:t.qg,paneIndex:t.jg,hoveredInfo:s,hoveredSeries:n,hoveredObjectId:t.Fg,seriesData:i,sourceEvent:t.Kg}}fb(t){let i=this.od.get(t);return i||(i=new ie(this.sv,(t=>this.pb(t)),t,this),this.od.set(t,i)),i}}function le(t){if(d(t)){const i=document.getElementById(t);return r(null!==i,`Cannot find element in DOM with id=${t}`),i}return t}function oe(t,i,n){const s=le(t),e=new ae(s,i,n);return i.setOptions(e.options()),e}function _e(t,i){return oe(t,new ln,ln.yf(i))}function ue(){return ln}function ce(t,i,n,s){return Math.hypot(n-t,s-i)}function de(t,i,n,s,e,r,h,a=0){if(0===i.length||s.from>=i.length||s.to<=0)return;const{context:l,horizontalPixelRatio:o,verticalPixelRatio:_}=t,u=i[s.from];let c=r(t,u),d=u;if(s.to-s.from<2){const i=e/2;l.beginPath();const n={_t:u._t-i,ut:u.ut},s={_t:u._t+i,ut:u.ut};l.moveTo(n._t*o,n.ut*_),l.lineTo(s._t*o,s.ut*_),h(t,c,n,s)}else{const e=a>0;let f=0;const p=(i,n)=>{if(h(t,c,d,n),l.beginPath(),c=i,d=n,e){const t=f%a;l.lineDashOffset=t,f=t}};let v=d;l.beginPath(),l.moveTo(u._t*o,u.ut*_);for(let h=s.from+1;ht+i),0)}(_);void 0!==r&&de(t,i,r,n,e,u,we,c),l&&function(t,i,n,s,e){if(s.to-s.from<=0)return;const{horizontalPixelRatio:r,verticalPixelRatio:h,context:a}=t;let l=null;const o=Math.max(1,Math.floor(r))%2/2,_=n*h+o;for(let n=s.to-1;n>=s.from;--n){const s=i[n];if(s){const i=e(t,s);i!==l&&(null!==l&&a.fill(),a.beginPath(),a.fillStyle=i,l=i);const n=Math.round(s._t*r)+o,u=s.ut*h;a.moveTo(n,u),a.arc(n,u,_,0,2*Math.PI)}}a.fill()}(t,i,l,n,u)}}class Me extends ge{bb(t,i){return i.vt}}function be(t,i,n,s,e){const r=1-e;return r*r*r*t+3*r*r*e*i+3*r*e*e*n+e*e*e*s}function xe(t,i,n,s,e){if(2===n){const[n,r]=me(s,e-1,e);return[Math.min(t._t,i._t,n._t,r._t),Math.max(t._t,i._t,n._t,r._t)]}return[Math.min(t._t,i._t),Math.max(t._t,i._t)]}function Se(t,i,n,s,e,r,h,a){switch(e){case 1:{const e=Cs(t,i,n._t,n.ut,s._t,n.ut),r=Cs(t,i,s._t,n.ut,s._t,s.ut),h=Math.min(e,r);return h<=a?h:null}case 2:{const[e,l]=me(r,h-1,h),o=function(t,i,n){let s=Number.POSITIVE_INFINITY,e=n[0];for(let r=1;r<=12;r++){const h=r/12,a={_t:be(n[0]._t,n[1]._t,n[2]._t,n[3]._t,h),ut:be(n[0].ut,n[1].ut,n[2].ut,n[3].ut,h)};s=Math.min(s,Cs(t,i,e._t,e.ut,a._t,a.ut)),e=a}return s}(t,i,[n,e,l,s]);return o<=a?o:null}default:{const e=Cs(t,i,n._t,n.ut,s._t,s.ut);return e<=a?e:null}}}class Ce extends Vs{constructor(t,i){super(t,i,!0)}VM(t,i,n){i.Tc(this.bM,m(this.xM)),t.Zo(this.bM,n,m(this.xM))}xb(t,i){return{wt:t,gt:i,_t:NaN,ut:NaN}}DM(){const t=this.ae.xa();this.bM=this.ae.Ha().Eh().map((i=>{let n;if((i.Zr??1)>1){const t=i.Wt[1],s=i.Wt[2],e=i.Wt[3];n=Math.abs(t-e)>Math.abs(s-e)?t:s}else n=i.Wt[3];return this.Sb(i.$n,n,t)}))}}class ye extends Ce{kM(t,i){const n=this.ae.N();return function(t,i,n,s,e,r,h,a=0,l=0){if(null===i||i.from>=i.to||0===t.length)return null;const o=Math.max(r/2,h??0)+l;let _=Number.POSITIVE_INFINITY;if(void 0!==h){const e=h+l,r=Ms(t,n-e,i.from,i.to),a=bs(t,n+e,r,i.to);for(let i=r;inew Pe(t,i)};function Te(t,i){return t.weight>i.weight?t:i}class Re{constructor(){this.Cb=new o,this.yb=function(t){let i=!1;return function(...n){i||(i=!0,queueMicrotask((()=>{t(...n),i=!1})))}}((()=>this.Cb.p(this.Pb))),this.Pb=0}kb(){return this.Cb}m(){this.Cb.m()}options(){return this.yn}setOptions(t){this.yn=t}preprocessData(t){}updateFormatter(t){this.yn&&(this.yn.localization=t)}createConverterToInternalObj(t){return this.yb(),t=>(t>this.Pb&&(this.Pb=t),t)}key(t){return t}cacheKey(t){return t}convertHorzItemToInternal(t){return t}formatHorzItem(t){return this.Tb(t)}formatTickmark(t){return this.Tb(t.time)}maxTickMarkWeight(t){return t.reduce(Te,t[0]).weight}fillWeightsForPoints(t,i){for(let s=i;st.toFixed(3)+"%"}},Ie={lastValueVisible:!1,priceLineVisible:!1};class Ve extends ae{constructor(t,i){const n=_(De,i||{}),s=new Re;super(t,s,n),s.setOptions(this.options()),this._initWhitespaceSeries()}addSeries(t,i={},n=0){if(t.isBuiltIn&&!1===["Area","Line"].includes(t.type))throw new Error("Yield curve only support Area and Line series");const s={...Ie,...i};return super.addSeries(t,s,n)}_initWhitespaceSeries(){const t=this.horzBehaviour(),i=this.addSeries(ke);let n;function s(s){const e=function(t,i){return{me:Math.max(0,t.startTimeRange),we:Math.max(0,t.minimumTimeRange,i||0),Rb:Math.max(1,t.baseResolution)}}(t.options().yieldCurve,s),r=(({me:t,we:i,Rb:n})=>`${t}~${i}~${n}`)(e);r!==n&&(n=r,i.setData(function({me:t,we:i,Rb:n}){return Array.from({length:Math.floor((i-t)/n)+1},((i,s)=>({time:t+s*n})))}(e)))}s(0),t.kb().i(s)}}function Ee(t,i){const n=le(t);return new Ve(n,i)}function Be(t,i){return t.weight>i.weight?t:i}class Ae{options(){return this.yn}setOptions(t){this.yn=t}preprocessData(t){}updateFormatter(t){this.yn&&(this.yn.localization=t)}createConverterToInternalObj(t){return t=>t}key(t){return t}cacheKey(t){return t}convertHorzItemToInternal(t){return t}formatHorzItem(t){return t.toFixed(this.Ds())}formatTickmark(t,i){return t.time.toFixed(this.Ds())}maxTickMarkWeight(t){return t.reduce(Be,t[0]).weight}fillWeightsForPoints(t,i){for(let s=i;s0?n:1,u=l*_,c=o===t.bitmapSize.height?o:o*_,d=(a??0)*_,f=t.context.createLinearGradient(0,u,0,c);if(f.addColorStop(0,s),null!=a){const t=Jt((d-u)/(c-u),0,1);f.addColorStop(t,e),f.addColorStop(t,r)}f.addColorStop(1,h),this.Wb=f,this.Bb=i}return this.Wb}}class Fe extends Le{constructor(){super(...arguments),this.Hb=new Ne}Vb(t,i){const n=this.rt;return this.Hb.Eb(t,{Ab:i.dh,zb:i.fh,Ob:i.ph,Lb:i.mh,Db:n.Db,Nb:n.Nb??0,Fb:n.Fb??t.bitmapSize.height})}}class We extends ge{constructor(){super(...arguments),this.Ub=new Ne}bb(t,i){const n=this.rt;return this.Ub.Eb(t,{Ab:i._h,zb:i._h,Ob:i.uh,Lb:i.uh,Db:n.Db,Nb:n.Nb??0,Fb:n.Fb??t.bitmapSize.height})}}class He extends ye{constructor(t,i){super(t,i),this.PM=new C,this.$b=new Fe,this.jb=new We,this.PM.nt([this.$b,this.jb])}Sb(t,i,n){return{...this.xb(t,i),...n.xh(t)}}EM(){const t=this.ae.zt();if(null===t)return;const i=this.ae.N(),n=this.ae.Ft().Nt(i.baseValue.price,t.Wt),s=this.le.Bt().fl();if(null===this.xM||0===this.bM.length)return;let e,r;if(i.relativeGradient){e=this.bM[this.xM.from].ut,r=this.bM[this.xM.from].ut;for(let t=this.xM.from;tr&&(r=i.ut)}}this.$b.ht({ot:this.bM,ct:i.lineWidth,Zt:i.lineStyle,gb:i.lineType,Db:n,Nb:e,Fb:r,Ib:!1,lt:this.xM,wb:s}),this.jb.ht({ot:this.bM,ct:i.lineWidth,Zt:i.lineStyle,gb:i.lineVisible?i.lineType:void 0,Mb:i.pointMarkersVisible?i.pointMarkersRadius||i.lineWidth/2+2:void 0,Db:n,Nb:e,Fb:r,lt:this.xM,wb:s})}}const Ue={type:"Baseline",isBuiltIn:!0,defaultOptions:{baseValue:{type:"price",price:0},relativeGradient:!1,topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},ob:(t,i)=>new He(t,i)};class $e extends Le{constructor(){super(...arguments),this.Hb=new Ne}Vb(t,i){return this.Hb.Eb(t,{Ab:i.ah,zb:"",Ob:"",Lb:i.oh,Nb:this.rt?.Nb??0,Fb:t.bitmapSize.height})}}class je extends ye{constructor(t,i){super(t,i),this.PM=new C,this.qb=new $e,this.Yb=new Me,this.PM.nt([this.qb,this.Yb])}Sb(t,i,n){return{...this.xb(t,i),...n.xh(t)}}EM(){const t=this.ae.N();if(null===this.xM||0===this.bM.length)return;let i;if(t.relativeGradient){i=this.bM[this.xM.from].ut;for(let t=this.xM.from;tnew je(t,i)};class Ye extends y{constructor(){super(...arguments),this.qt=null,this.Kb=0,this.Zb=0}ht(t){this.qt=t}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.qt||0===this.qt.Un.length||null===this.qt.lt)return;if(this.Kb=this.Gb(i),this.Kb>=2){Math.max(1,Math.floor(i))%2!=this.Kb%2&&this.Kb--}this.Zb=this.qt.Xb?Math.min(this.Kb,Math.floor(i)):this.Kb;let s=null;const e=this.Zb<=this.Kb&&this.qt.fl>=Math.floor(1.5*i);for(let r=this.qt.lt.from;rf+v-1&&(e=f+v-1,s=e-_+1),t.fillRect(i,s,o-i,e-s+1)}const i=l+m;let s=Math.max(f,Math.round(h.i_*n)-a),e=s+_-1;e>f+v-1&&(e=f+v-1,s=e-_+1),t.fillRect(u+1,s,i-u,e-s+1)}}}Gb(t){const i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(a(this.qt).fl,t)))}}class Ke extends Vs{constructor(t,i){super(t,i,!1)}kM(t,i){return Ts(this.bM,this.xM,t,i,this.le.Bt().fl(),this.ae.N().hitTestTolerance,((t,i)=>{i[0]=t.Qo,i[1]=t.t_}))}VM(t,i,n){i.Tc(this.bM,m(this.xM)),t.Xo(this.bM,n,m(this.xM))}Qb(t,i,n){return{wt:t,jr:i.Wt[0],qr:i.Wt[1],Yr:i.Wt[2],Kr:i.Wt[3],_t:NaN,Jo:NaN,Qo:NaN,t_:NaN,i_:NaN}}DM(){const t=this.ae.xa();this.bM=this.ae.Ha().Eh().map((i=>this.Sb(i.$n,i,t)))}}class Ze extends Ke{constructor(){super(...arguments),this.PM=new Ye}Sb(t,i,n){return{...this.Qb(t,i,n),...n.xh(t)}}EM(){const t=this.ae.N();this.PM.ht({Un:this.bM,fl:this.le.Bt().fl(),Jb:t.openVisible,Xb:t.thinBars,lt:this.xM})}}const Ge={type:"Bar",isBuiltIn:!0,defaultOptions:{upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},ob:(t,i)=>new Ze(t,i)};class Xe extends y{constructor(){super(...arguments),this.qt=null,this.Kb=0}ht(t){this.qt=t}et(t){if(null===this.qt||0===this.qt.Un.length||null===this.qt.lt)return;const{horizontalPixelRatio:i}=t;if(this.Kb=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);const n=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),s=Math.floor(t*n*i),e=Math.floor(t*i),r=Math.min(s,e);return Math.max(Math.floor(i),r)}(this.qt.fl,i),this.Kb>=2){Math.floor(i)%2!=this.Kb%2&&this.Kb--}const n=this.qt.Un;this.qt.tx&&this.ix(t,n,this.qt.lt),this.qt.Mi&&this.Rm(t,n,this.qt.lt);const s=this.nx(i);(!this.qt.Mi||this.Kb>2*s)&&this.sx(t,n,this.qt.lt)}ix(t,i,n){if(null===this.qt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="",a=Math.min(Math.floor(e),Math.floor(this.qt.fl*e));a=Math.max(Math.floor(e),Math.min(a,this.Kb));const l=Math.floor(.5*a);let o=null;for(let t=n.from;t2*a)V(s,o,u,_-o+1,c-u+1,a);else{const t=_-o+1;s.fillRect(o,u,t,c-u+1)}l=_}}sx(t,i,n){if(null===this.qt)return;const{context:s,horizontalPixelRatio:e,verticalPixelRatio:r}=t;let h="";const a=this.nx(e);for(let t=n.from;to||s.fillRect(_,l,u-_+1,o-l+1)}}}class Je extends Ke{constructor(){super(...arguments),this.PM=new Xe}Sb(t,i,n){return{...this.Qb(t,i,n),...n.xh(t)}}EM(){const t=this.ae.N();this.PM.ht({Un:this.bM,fl:this.le.Bt().fl(),tx:t.wickVisible,Mi:t.borderVisible,lt:this.xM})}}const Qe={type:"Candlestick",isBuiltIn:!0,defaultOptions:{upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},ob:(t,i)=>new Je(t,i)};class tr extends y{constructor(){super(...arguments),this.qt=null,this.hx=[]}ht(t){this.qt=t,this.hx=[]}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null===this.qt||0===this.qt.ot.length||null===this.qt.lt)return;this.hx.length||this.lx(i);const s=Math.max(1,Math.floor(n)),e=Math.round(this.qt.ox*n)-Math.floor(s/2),r=e+s;for(let i=this.qt.lt.from;is.ce?s.bi=n.La-i-1:n.La=s.bi+i+1))}let s=Math.ceil(this.qt.fl*t);for(let t=this.qt.lt.from;t0&&s<4)for(let t=this.qt.lt.from;ts&&(i._x>i.ce?i.bi-=1:i.La+=1)}}}class ir extends Ce{constructor(){super(...arguments),this.PM=new tr}kM(t,i){const n=this.ae.Ft().Nt(this.ae.N().base,a(this.ae.zt()).Wt);return null===n?null:Ts(this.bM,this.xM,t,i,this.le.Bt().fl(),this.ae.N().hitTestTolerance,((t,i)=>{i[0]=t.ut,i[1]=n}))}Sb(t,i,n){return{...this.xb(t,i),...n.xh(t)}}EM(){const t={ot:this.bM,fl:this.le.Bt().fl(),lt:this.xM,ox:this.ae.Ft().Nt(this.ae.N().base,a(this.ae.zt()).Wt)};this.PM.ht(t)}}const nr={type:"Histogram",isBuiltIn:!0,defaultOptions:{color:"#26a69a",base:0},ob:(t,i)=>new ir(t,i)};class sr{constructor(t,i){this.yt=t,this.ux=i,this.vx()}detach(){this.yt.detachPrimitive(this.ux)}getPane(){return this.yt}applyOptions(t){this.ux.vr?.(t)}vx(){this.yt.attachPrimitive(this.ux)}}const er={visible:!0,horzAlign:"center",vertAlign:"center",lines:[]},rr={color:"rgba(0, 0, 0, 0.5)",fontSize:48,fontFamily:w,fontStyle:"",text:""};class hr{constructor(t){this.mx=new Map,this.qt=t}draw(t){t.useMediaCoordinateSpace((t=>{if(!this.qt.visible)return;const{context:i,mediaSize:n}=t;let s=0;for(const t of this.qt.lines){if(0===t.text.length)continue;i.font=t.k;const e=this.wx(i,t.text);e>n.width?t.Fc=n.width/e:t.Fc=1,s+=t.lineHeight*t.Fc}let e=0;switch(this.qt.vertAlign){case"top":e=0;break;case"center":e=Math.max((n.height-s)/2,0);break;case"bottom":e=Math.max(n.height-s,0)}for(const t of this.qt.lines){i.save(),i.fillStyle=t.color;let s=0;switch(this.qt.horzAlign){case"left":i.textAlign="left",s=t.lineHeight/2;break;case"center":i.textAlign="center",s=n.width/2;break;case"right":i.textAlign="right",s=n.width-1-t.lineHeight/2}i.translate(s,e),i.textBaseline="top",i.font=t.k,i.scale(t.Fc,t.Fc),i.fillText(t.text,0,t.gx),i.restore(),e+=t.lineHeight*t.Fc}}))}wx(t,i){const n=this.Mx(t.font);let s=n.get(i);return void 0===s&&(s=t.measureText(i).width,n.set(i,s)),s}Mx(t){let i=this.mx.get(t);return void 0===i&&(i=new Map,this.mx.set(t,i)),i}}class ar{constructor(t){this.yn=or(t)}Pt(t){this.yn=or(t)}renderer(){return new hr(this.yn)}}function lr(t){return{...t,k:g(t.fontSize,t.fontFamily,t.fontStyle),lineHeight:t.lineHeight||1.2*t.fontSize,gx:0,Fc:0}}function or(t){return{...t,lines:t.lines.map(lr)}}function _r(t){return{...rr,...t}}function ur(t){return{...er,...t,lines:t.lines?.map(_r)??[]}}class cr{constructor(t){this.yn=ur(t),this.bx=[new ar(this.yn)]}updateAllViews(){this.bx.forEach((t=>t.Pt(this.yn)))}paneViews(){return this.bx}attached({requestUpdate:t}){this.xx=t}detached(){this.xx=void 0}vr(t){this.yn=ur({...this.yn,...t}),this.xx&&this.xx()}}function dr(t,i){return new sr(t,new cr(i))}const fr={alpha:1,padding:0};class pr{constructor(t){this.qt=t}draw(t){t.useMediaCoordinateSpace((t=>{const i=t.context,n=this.Sx(this.qt,t.mediaSize);n&&this.qt.Cx&&(i.globalAlpha=this.qt.alpha??1,i.drawImage(this.qt.Cx,n._t,n.ut,n.nn,n.$t))}))}Sx(t,i){const{maxHeight:n,maxWidth:s,yx:e,Px:r,padding:h}=t,a=Math.round(i.width/2),l=Math.round(i.height/2),o=h??0;let _=i.width-2*o,u=i.height-2*o;n&&(u=Math.min(u,n)),s&&(_=Math.min(_,s));const c=_/r,d=u/e,f=Math.min(c,d),p=r*f,v=e*f;return{_t:a-.5*p,ut:l-.5*v,$t:v,nn:p}}}class vr{constructor(t){this.kx=null,this.Tx=0,this.Rx=0,this.yn=t,this.M=mr(this.yn,this.kx,this.Tx,this.Rx)}Dx(t){void 0!==t.Ix&&(this.Tx=t.Ix),void 0!==t.Vx&&(this.Rx=t.Vx),void 0!==t.Ex&&(this.kx=t.Ex),this.Pt()}Bx(t){this.yn=t,this.Pt()}zOrder(){return"bottom"}Pt(){this.M=mr(this.yn,this.kx,this.Tx,this.Rx)}renderer(){return new pr(this.M)}}function mr(t,i,n,s){return{...t,Cx:i,Px:n,yx:s}}function wr(t){return{...fr,...t}}class gr{constructor(t,i){this.Ax=null,this.zx=t,this.yn=wr(i),this.bx=[new vr(this.yn)]}updateAllViews(){this.bx.forEach((t=>t.Pt()))}paneViews(){return this.bx}attached(t){const{requestUpdate:i}=t;this.Ox=i,this.Ax=new Image,this.Ax.onload=()=>{const t=this.Ax?.naturalHeight??1,i=this.Ax?.naturalWidth??1;this.bx.forEach((n=>n.Dx({Vx:t,Ix:i,Ex:this.Ax}))),this.Ox&&this.Ox()},this.Ax.src=this.zx}detached(){this.Ox=void 0,this.Ax=null}vr(t){this.yn=wr({...this.yn,...t}),this.Lx(),this.xx&&this.xx()}xx(){this.Ox&&this.Ox()}Lx(){this.bx.forEach((t=>t.Bx(this.yn)))}}function Mr(t,i,n){return new sr(t,new gr(i,n))}class br{constructor(t,i){this.ae=t,this.Jh=i,this.vx()}detach(){this.ae.detachPrimitive(this.Jh)}getSeries(){return this.ae}applyOptions(t){this.Jh&&this.Jh.vr&&this.Jh.vr(t)}vx(){this.ae.attachPrimitive(this.Jh)}}const xr={autoScale:!0,zOrder:"normal"};function Sr(t,i){return ti(Math.min(Math.max(t,12),30)*i)}function Cr(t,i){switch(t){case"arrowDown":case"arrowUp":return Sr(i,1);case"circle":return Sr(i,.8);case"square":return Sr(i,.7)}}function yr(t){return function(t){const i=Math.ceil(t);return i%2!=0?i-1:i}(Sr(t,1))}function Pr(t){return Math.max(Sr(t,.1),3)}function kr(t,i,n){return i?t:n?Math.ceil(t/2):0}function Tr(t,i,n,s){const e=(Cr("arrowUp",s)-1)/2*n.Nx,r=(ti(s/2)-1)/2*n.Nx;i.beginPath(),t?(i.moveTo(n._t-e,n.ut),i.lineTo(n._t,n.ut-e),i.lineTo(n._t+e,n.ut),i.lineTo(n._t+r,n.ut),i.lineTo(n._t+r,n.ut+e),i.lineTo(n._t-r,n.ut+e),i.lineTo(n._t-r,n.ut)):(i.moveTo(n._t-e,n.ut),i.lineTo(n._t,n.ut+e),i.lineTo(n._t+e,n.ut),i.lineTo(n._t+r,n.ut),i.lineTo(n._t+r,n.ut-e),i.lineTo(n._t-r,n.ut-e),i.lineTo(n._t-r,n.ut)),i.fill()}function Rr(t,i,n,s,e,r){const h=(Cr("arrowUp",s)-1)/2,a=(ti(s/2)-1)/2;if(e>=i-a-2&&e<=i+a+2&&r>=(t?n:n-h)-2&&r<=(t?n+h:n)+2)return!0;return(()=>{if(ei+h+3||r<(t?n-h-3:n)||r>(t?n:n+h+3))return!1;const s=Math.abs(e-i);return Math.abs(r-n)+3>=s/2})()}class Dr{constructor(){this.qt=null,this.$s=new it,this.F=-1,this.W="",this.nm="",this.Fx="normal"}ht(t){this.qt=t}js(t,i,n){this.F===t&&this.W===i||(this.F=t,this.W=i,this.nm=g(t,i),this.$s.Ls()),this.Fx=n}Qs(t,i){if(null===this.qt||null===this.qt.lt)return null;for(let n=this.qt.lt.from;n{this.et(t)}))}drawBackground(t){"aboveSeries"===this.Fx&&t.useBitmapCoordinateSpace((t=>{this.et(t)}))}et({context:t,horizontalPixelRatio:i,verticalPixelRatio:n}){if(null!==this.qt&&null!==this.qt.lt){t.textBaseline="middle",t.font=this.nm;for(let s=this.qt.lt.from;s=t&&e<=t+n&&r>=i-h&&r<=i+h}(t.ri._t,t.ri.ut,t.ri.nn,t.ri.$t,i,n))||function(t,i,n){if(0===t.Th)return!1;switch(t.Hx){case"arrowDown":return Rr(!0,t._t,t.ut,t.Th,i,n);case"arrowUp":return Rr(!1,t._t,t.ut,t.Th,i,n);case"circle":return function(t,i,n,s,e){const r=2+Cr("circle",n)/2,h=t-s,a=i-e;return Math.sqrt(h*h+a*a)<=r}(t._t,t.ut,t.Th,i,n);case"square":return function(t,i,n,s,e){const r=Cr("square",n),h=(r-1)/2,a=t-h,l=i-h;return s>=a&&s<=a+r&&e>=l&&e<=l+r}(t._t,t.ut,t.Th,i,n)}}(t,i,n)}function Er(t){return"atPriceTop"===t||"atPriceBottom"===t||"atPriceMiddle"===t}function Br(t,i,n,s,e,r,h,l){const o=function(t,i,n){if(Er(i.position)&&void 0!==i.price)return i.price;if("value"in(s=t)&&"number"==typeof s.value)return t.value;var s;if(function(t){return"open"in t&&"high"in t&&"low"in t&&"close"in t}(t)){if("inBar"===i.position)return t.close;if("aboveBar"===i.position)return n?t.low:t.high;if("belowBar"===i.position)return n?t.high:t.low}}(n,i,h.priceScale().options().invertScale);if(void 0===o)return;const _=Er(i.position),c=l.timeScale(),d=u(i.size)?Math.max(i.size,0):1,f=yr(c.options().barSpacing)*d,p=f/2;t.Th=f;switch(i.position){case"inBar":case"atPriceMiddle":return t.ut=a(h.priceToCoordinate(o)),void(void 0!==t.ri&&(t.ri.ut=t.ut+p+r+.6*e));case"aboveBar":case"atPriceTop":{const i=_?0:s.Ux;return t.ut=a(h.priceToCoordinate(o))-p-i,void 0!==t.ri&&(t.ri.ut=t.ut-p-.6*e,s.Ux+=1.2*e),void(_||(s.Ux+=f+r))}case"belowBar":case"atPriceBottom":{const i=_?0:s.$x;return t.ut=a(h.priceToCoordinate(o))+p+i,void 0!==t.ri&&(t.ri.ut=t.ut+p+r+.6*e,s.$x+=1.2*e),void(_||(s.$x+=f+r))}}}class Ar{constructor(t,i,n){this.jx=[],this.St=!0,this.qx=!0,this.Xt=new Dr,this.Te=t,this.qv=i,this.qt={ot:[],lt:null},this.yn=n}renderer(){if(!this.Te.options().visible)return null;this.St&&this.yM();const t=this.qv.options().layout;return this.Xt.js(t.fontSize,t.fontFamily,this.yn.zOrder),this.Xt.ht(this.qt),this.Xt}Yx(t){this.jx=t,this.Pt("data")}Pt(t){this.St=!0,"data"===t&&(this.qx=!0)}Kx(t){this.St=!0,this.yn=t}zOrder(){return"aboveSeries"===this.yn.zOrder?"top":this.yn.zOrder}yM(){const t=this.qv.timeScale(),i=this.jx;this.qx&&(this.qt.ot=i.map((t=>({wt:t.time,_t:0,ut:0,Th:0,Hx:t.shape,R:t.color,te:t.id,Zx:t.Zx,ri:void 0}))),this.qx=!1);const n=this.qv.options().layout;this.qt.lt=null;const s=t.getVisibleLogicalRange();if(null===s)return;const e=new Ii(Math.floor(s.from),Math.ceil(s.to));if(null===this.Te.data()[0])return;if(0===this.qt.ot.length)return;let r=NaN;const h=Pr(t.options().barSpacing),l={Ux:h,$x:h};this.qt.lt=Is(this.qt.ot,e,!0);for(let s=this.qt.lt.from;s0&&(o.ri={Wx:e.text,_t:0,ut:0,nn:0,$t:0});const _=this.Te.dataByIndex(e.time,0);null!==_&&Br(o,e,_,l,n.fontSize,h,this.Te,this.qv)}this.St=!1}}function zr(t){return{...xr,...t}}class Or{constructor(t){this.Yh=null,this.jx=[],this.Gx=[],this.Xx=null,this.Te=null,this.qv=null,this.Jx=!0,this.Qx=null,this.tS=null,this.iS=null,this.nS=!0,this.yn=zr(t)}attached(t){this.sS(),this.qv=t.chart,this.Te=t.series,this.Yh=new Ar(this.Te,a(this.qv),this.yn),this.Ox=t.requestUpdate,this.Te.subscribeDataChanged((t=>this.YM(t))),this.nS=!0,this.xx()}xx(){this.Ox&&this.Ox()}detached(){this.Te&&this.Xx&&this.Te.unsubscribeDataChanged(this.Xx),this.qv=null,this.Te=null,this.Yh=null,this.Xx=null}Yx(t){this.nS=!0,this.jx=t,this.sS(),this.Jx=!0,this.tS=null,this.xx()}eS(){return this.jx}paneViews(){return this.Yh?[this.Yh]:[]}updateAllViews(){this.rS()}hitTest(t,i){return this.Yh?this.Yh.renderer()?.Qs(t,i)??null:null}autoscaleInfo(t,i){if(this.yn.autoScale&&this.Yh){const t=this.hS();if(t)return{priceRange:null,margins:t}}return null}vr(t){this.yn=zr({...this.yn,...t}),this.xx&&this.xx()}hS(){const t=a(this.qv).timeScale().options().barSpacing;if(this.Jx||t!==this.iS){if(this.iS=t,this.jx.length>0){const i=Pr(t),n=1.5*yr(t)+2*i,s=this.aS();this.Qx={above:kr(n,s.aboveBar,s.inBar),below:kr(n,s.belowBar,s.inBar)}}else this.Qx=null;this.Jx=!1}return this.Qx}aS(){return null===this.tS&&(this.tS=this.jx.reduce(((t,i)=>(t[i.position]||(t[i.position]=!0),t)),{inBar:!1,aboveBar:!1,belowBar:!1,atPriceTop:!1,atPriceBottom:!1,atPriceMiddle:!1})),this.tS}sS(){if(!this.nS||!this.qv||!this.Te)return;const t=this.qv.timeScale(),i=this.Te?.data();if(null==t.getVisibleLogicalRange()||!this.Te||0===i.length)return void(this.Gx=[]);const n=t.timeToIndex(a(i[0].time),!0);this.Gx=this.jx.map(((i,s)=>{const e=t.timeToIndex(i.time,!0),r=e{this.jx.delete(i),this.uS()}),n),e={...t,cS:s,dS:Date.now()+n};this.jx.set(i,e)}else this.jx.set(i,{...t,cS:void 0,dS:void 0});this.uS()}_S(t){const i=this.jx.get(t);i&&void 0!==i.cS&&window.clearTimeout(i.cS),this.jx.delete(t),this.uS()}fS(){for(const[t]of this.jx)this._S(t)}pS(){const t=Date.now(),i=[];for(const[n,s]of this.jx)!s.dS||s.dS>t?i.push({time:s.time,sign:s.sign,value:s.value}):this._S(n);return i}vS(t){this.lS=t}uS(){this.lS&&this.lS()}}const Wr={positiveColor:"#22AB94",negativeColor:"#F7525F",updateVisibilityDuration:5e3};class Hr{constructor(t,i,n,s){this.qt=t,this.mS=i,this.wS=n,this.gS=s}draw(t){t.useBitmapCoordinateSpace((t=>{const i=t.context,n=Math.max(1,Math.floor(t.horizontalPixelRatio))%2/2,s=4*t.verticalPixelRatio+n;this.qt.forEach((e=>{const r=Math.round(e._t*t.horizontalPixelRatio)+n;i.beginPath();const h=this.MS(e.bS);i.fillStyle=h,i.arc(r,e.ut*t.verticalPixelRatio,s,0,2*Math.PI,!1),i.fill(),e.bS&&(i.strokeStyle=h,i.lineWidth=Math.floor(2*t.horizontalPixelRatio),i.beginPath(),i.moveTo((e._t-4.7)*t.horizontalPixelRatio+n,(e.ut-7*e.bS)*t.verticalPixelRatio),i.lineTo(e._t*t.horizontalPixelRatio+n,(e.ut-7*e.bS-7*e.bS*.5)*t.verticalPixelRatio),i.lineTo((e._t+4.7)*t.horizontalPixelRatio+n,(e.ut-7*e.bS)*t.verticalPixelRatio),i.stroke())}))}))}MS(t){return 0===t?this.mS:t>0?this.gS:this.wS}}class Ur{constructor(t,i,n){this.qt=[],this.Te=t,this.ia=i,this.yn=n}Pt(t){this.qt=t.map((t=>{const i=this.Te.priceToCoordinate(t.value);if(null===i)return null;return{_t:a(this.ia.timeToCoordinate(t.time)),ut:i,bS:t.sign}})).filter(v)}renderer(){const t=function(t,i){return function(t,i){return"Area"===i}(0,i)?t.lineColor:t.color}(this.Te.options(),this.Te.seriesType());return new Hr(this.qt,t,this.yn.negativeColor,this.yn.positiveColor)}}function $r(t,i){return"Line"===i||"Area"===i}class jr{constructor(t){this.qv=void 0,this.Te=void 0,this.bx=[],this.Su=null,this.xS=new Map,this.SS=new Fr((()=>this.xx())),this.yn={...Wr,...t}}vr(t){this.yn={...this.yn,...t},this.xx()}Yx(t){this.SS.fS();const i=this.Su;i&&t.forEach((t=>{this.SS.oS(t,i.key(t.time))}))}eS(){return this.SS.pS()}xx(){this.Ox?.()}attached(t){const{chart:i,series:n,requestUpdate:s,horzScaleBehavior:e}=t;this.qv=i,this.Te=n,this.Su=e;const r=this.Te.seriesType();if("Area"!==r&&"Line"!==r)throw new Error("UpDownMarkersPrimitive is only supported for Area and Line series types");this.bx=[new Ur(this.Te,this.qv.timeScale(),this.yn)],this.Ox=s,this.xx()}detached(){this.qv=void 0,this.Te=void 0,this.Ox=void 0}am(){return h(this.qv)}U_(){return h(this.Te)}updateAllViews(){this.bx.forEach((t=>t.Pt(this.eS())))}paneViews(){return this.bx}ht(t){if(!this.Te)throw new Error("Primitive not attached to series");const i=this.Te.seriesType();this.xS.clear();const n=this.Su;n&&t.forEach((t=>{ns(t)&&$r(0,i)&&this.xS.set(n.key(t.time),t.value)})),h(this.Te).setData(t)}Pt(t,i){if(!this.Te||!this.Su)throw new Error("Primitive not attached to series");const n=this.Te.seriesType(),s=this.Su.key(t.time);if(is(t)&&this.xS.delete(s),ns(t)&&$r(0,n)){const i=this.xS.get(s);i&&this.SS.oS({time:t.time,value:t.value,sign:qr(t.value,i)},s,this.yn.updateVisibilityDuration)}h(this.Te).update(t,i)}CS(){this.SS.fS()}}function qr(t,i){return t===i?0:t-i>0?1:-1}class Yr extends br{setData(t){return this.Jh.ht(t)}update(t,i){return this.Jh.Pt(t,i)}markers(){return this.Jh.eS()}setMarkers(t){return this.Jh.Yx(t)}clearMarkers(){return this.Jh.CS()}}function Kr(t,i={}){return new Yr(t,new jr(i))}const Zr={...t,color:"#2196f3"};function Gr(){return"5.2.0"}export{qe as AreaSeries,Ge as BarSeries,Ue as BaselineSeries,Qe as CandlestickSeries,Fi as ColorType,$ as CrosshairMode,nr as HistogramSeries,Li as LastPriceAnimationMode,ke as LineSeries,n as LineStyle,i as LineType,kt as MismatchDirection,Ni as PriceLineSource,mi as PriceScaleMode,Wi as TickMarkType,Oi as TrackingModeExitMode,_e as createChart,oe as createChartEx,Mr as createImageWatermark,ze as createOptionsChart,Nr as createSeriesMarkers,dr as createTextWatermark,Kr as createUpDownMarkers,Ee as createYieldCurveChart,Zr as customSeriesDefaultOptions,ue as defaultHorzScaleBehavior,$i as isBusinessDay,ji as isUTCTimestamp,Gr as version}; diff --git a/website/scripts/modules/lightweight-charts/5.2.0/dist/typings.d.ts b/website/scripts/modules/lightweight-charts/5.2.0/dist/typings.d.ts deleted file mode 100644 index 8a27894f9..000000000 --- a/website/scripts/modules/lightweight-charts/5.2.0/dist/typings.d.ts +++ /dev/null @@ -1,5041 +0,0 @@ -// Generated by dts-bundle-generator v9.5.1 - -import { CanvasRenderingTarget2D } from 'fancy-canvas'; - -declare const areaSeries: SeriesDefinition<"Area">; -declare const barSeries: SeriesDefinition<"Bar">; -declare const baselineSeries: SeriesDefinition<"Baseline">; -declare const candlestickSeries: SeriesDefinition<"Candlestick">; -declare const histogramSeries: SeriesDefinition<"Histogram">; -declare const lineSeries: SeriesDefinition<"Line">; -export declare const customSeriesDefaultOptions: CustomSeriesOptions; -/** - * Enumeration representing the sign of a marker. - */ -export declare const enum MarkerSign { - /** Represents a negative change (-1) */ - Negative = -1, - /** Represents no change (0) */ - Neutral = 0, - /** Represents a positive change (1) */ - Positive = 1 -} -/** - * Represents a type of color. - */ -export declare enum ColorType { - /** Solid color */ - Solid = "solid", - /** Vertical gradient color */ - VerticalGradient = "gradient" -} -/** - * Represents the crosshair mode. - */ -export declare enum CrosshairMode { - /** - * This mode allows crosshair to move freely on the chart. - */ - Normal = 0, - /** - * This mode sticks crosshair's horizontal line to the price value of a single-value series or to the close price of OHLC-based series. - */ - Magnet = 1, - /** - * This mode disables rendering of the crosshair. - */ - Hidden = 2, - /** - * This mode sticks crosshair's horizontal line to the price value of a single-value series or to the open/high/low/close price of OHLC-based series. - */ - MagnetOHLC = 3 -} -/** - * Represents the type of the last price animation for series such as area or line. - */ -export declare enum LastPriceAnimationMode { - /** - * Animation is always disabled - */ - Disabled = 0, - /** - * Animation is always enabled. - */ - Continuous = 1, - /** - * Animation is active after new data. - */ - OnDataUpdate = 2 -} -/** - * Represents the possible line styles. - */ -export declare enum LineStyle { - /** - * A solid line. - */ - Solid = 0, - /** - * A dotted line. - */ - Dotted = 1, - /** - * A dashed line. - */ - Dashed = 2, - /** - * A dashed line with bigger dashes. - */ - LargeDashed = 3, - /** - * A dotted line with more space between dots. - */ - SparseDotted = 4 -} -/** - * Represents the possible line types. - */ -export declare enum LineType { - /** - * A line. - */ - Simple = 0, - /** - * A stepped line. - */ - WithSteps = 1, - /** - * A curved line. - */ - Curved = 2 -} -/** - * Search direction if no data found at provided index - */ -export declare enum MismatchDirection { - /** - * Search the nearest left item - */ - NearestLeft = -1, - /** - * Do not search - */ - None = 0, - /** - * Search the nearest right item - */ - NearestRight = 1 -} -/** - * Represents the source of data to be used for the horizontal price line. - */ -export declare enum PriceLineSource { - /** - * Use the last bar data. - */ - LastBar = 0, - /** - * Use the last visible data of the chart viewport. - */ - LastVisible = 1 -} -/** - * Represents the price scale mode. - */ -export declare enum PriceScaleMode { - /** - * Price scale shows prices. Price range changes linearly. - */ - Normal = 0, - /** - * Price scale shows prices. Price range changes logarithmically. - */ - Logarithmic = 1, - /** - * Price scale shows percentage values according the first visible value of the price scale. - * The first visible value is 0% in this mode. - */ - Percentage = 2, - /** - * The same as percentage mode, but the first value is moved to 100. - */ - IndexedTo100 = 3 -} -/** - * Represents the type of a tick mark on the time axis. - */ -export declare enum TickMarkType { - /** - * The start of the year (e.g. it's the first tick mark in a year). - */ - Year = 0, - /** - * The start of the month (e.g. it's the first tick mark in a month). - */ - Month = 1, - /** - * A day of the month. - */ - DayOfMonth = 2, - /** - * A time without seconds. - */ - Time = 3, - /** - * A time with seconds. - */ - TimeWithSeconds = 4 -} -/** - * Determine how to exit the tracking mode. - * - * By default, mobile users will long press to deactivate the scroll and have the ability to check values and dates. - * Another press is required to activate the scroll, be able to move left/right, zoom, etc. - */ -export declare enum TrackingModeExitMode { - /** - * Tracking Mode will be deactivated on touch end event. - */ - OnTouchEnd = 0, - /** - * Tracking Mode will be deactivated on the next tap event. - */ - OnNextTap = 1 -} -/** - * This function is the simplified main entry point of the Lightweight Charting Library with time points for the horizontal scale. - * - * @param container - ID of HTML element or element itself - * @param options - Any subset of options to be applied at start. - * @returns An interface to the created chart - */ -export declare function createChart(container: string | HTMLElement, options?: DeepPartial): IChartApi; -/** - * This function is the main entry point of the Lightweight Charting Library. If you are using time values - * for the horizontal scale then it is recommended that you rather use the {@link createChart} function. - * - * @template HorzScaleItem - type of points on the horizontal scale - * @template THorzScaleBehavior - type of horizontal axis strategy that encapsulate all the specific behaviors of the horizontal scale type - * - * @param container - ID of HTML element or element itself - * @param horzScaleBehavior - Horizontal scale behavior - * @param options - Any subset of options to be applied at start. - * @returns An interface to the created chart - */ -export declare function createChartEx>(container: string | HTMLElement, horzScaleBehavior: THorzScaleBehavior, options?: DeepPartial>): IChartApiBase; -/** - * Creates an image watermark. - * - * @param pane - Target pane. - * @param imageUrl - Image URL. - * @param options - Watermark options. - * - * @returns Image watermark wrapper. - * - * @example - * ```js - * import { createImageWatermark } from 'lightweight-charts'; - * - * const firstPane = chart.panes()[0]; - * const imageWatermark = createImageWatermark(firstPane, '/images/my-image.png', { - * alpha: 0.5, - * padding: 20, - * }); - * // to change options - * imageWatermark.applyOptions({ padding: 10 }); - * // to remove watermark from the pane - * imageWatermark.detach(); - * ``` - */ -export declare function createImageWatermark(pane: IPaneApi, imageUrl: string, options: DeepPartial): IImageWatermarkPluginApi; -/** - * Creates an 'options' chart with price values on the horizontal scale. - * - * This function is used to create a specialized chart type where the horizontal scale - * represents price values instead of time. It's particularly useful for visualizing - * option chains, price distributions, or any data where price is the primary x-axis metric. - * - * @param container - The DOM element or its id where the chart will be rendered. - * @param options - Optional configuration options for the price chart. - * @returns An instance of IChartApiBase configured for price-based horizontal scaling. - */ -export declare function createOptionsChart(container: string | HTMLElement, options?: DeepPartial): IChartApiBase; -/** - * A function to create a series markers primitive. - * - * @param series - The series to which the primitive will be attached. - * - * @param markers - An array of markers to be displayed on the series. - * - * @param options - Options for the series markers plugin. - * - * @example - * ```js - * import { createSeriesMarkers } from 'lightweight-charts'; - * - * const seriesMarkers = createSeriesMarkers( - * series, - * [ - * { - * color: 'green', - * position: 'inBar', - * shape: 'arrowDown', - * time: 1556880900, - * }, - * ] - * ); - * // and then you can modify the markers - * // set it to empty array to remove all markers - * seriesMarkers.setMarkers([]); - * - * // `seriesMarkers.markers()` returns current markers - * ``` - */ -export declare function createSeriesMarkers(series: ISeriesApi, markers?: SeriesMarker[], options?: DeepPartial): ISeriesMarkersPluginApi; -/** - * Creates an image watermark. - * - * @param pane - Target pane. - * @param options - Watermark options. - * - * @returns Image watermark wrapper. - * - * @example - * ```js - * import { createTextWatermark } from 'lightweight-charts'; - * - * const firstPane = chart.panes()[0]; - * const textWatermark = createTextWatermark(firstPane, { - * horzAlign: 'center', - * vertAlign: 'center', - * lines: [ - * { - * text: 'Hello', - * color: 'rgba(255,0,0,0.5)', - * fontSize: 100, - * fontStyle: 'bold', - * }, - * { - * text: 'This is a text watermark', - * color: 'rgba(0,0,255,0.5)', - * fontSize: 50, - * fontStyle: 'italic', - * fontFamily: 'monospace', - * }, - * ], - * }); - * // to change options - * textWatermark.applyOptions({ horzAlign: 'left' }); - * // to remove watermark from the pane - * textWatermark.detach(); - * ``` - */ -export declare function createTextWatermark(pane: IPaneApi, options: DeepPartial): ITextWatermarkPluginApi; -/** - * Creates and attaches the Series Up Down Markers Plugin. - * - * @param series - Series to which attach the Up Down Markers Plugin - * @param options - options for the Up Down Markers Plugin - * - * @returns Api for Series Up Down Marker Plugin. {@link ISeriesUpDownMarkerPluginApi} - * - * @example - * ```js - * import { createUpDownMarkers, createChart, LineSeries } from 'lightweight-charts'; - * - * const chart = createChart('container'); - * const lineSeries = chart.addSeries(LineSeries); - * const upDownMarkers = createUpDownMarkers(lineSeries, { - * positiveColor: '#22AB94', - * negativeColor: '#F7525F', - * updateVisibilityDuration: 5000, - * }); - * // to add some data - * upDownMarkers.setData( - * [ - * { time: '2020-02-02', value: 12.34 }, - * //... more line series data - * ] - * ); - * // ... Update some values - * upDownMarkers.update({ time: '2020-02-02', value: 13.54 }, true); - * // to remove plugin from the series - * upDownMarkers.detach(); - * ``` - */ -export declare function createUpDownMarkers(series: ISeriesApi, options?: Partial): ISeriesUpDownMarkerPluginApi; -/** - * Creates a yield curve chart with the specified options. - * - * A yield curve chart differs from the default chart type - * in the following ways: - * - Horizontal scale is linearly spaced, and defined in monthly - * time duration units - * - Whitespace is ignored for the crosshair and grid lines - * - * @param container - ID of HTML element or element itself - * @param options - The yield chart options. - * @returns An interface to the created chart - */ -export declare function createYieldCurveChart(container: string | HTMLElement, options?: DeepPartial): IYieldCurveChartApi; -/** - * Provides the default implementation of the horizontal scale (time-based) that can be used as a base for extending the horizontal scale with custom behavior. - * This allows for the introduction of custom functionality without re-implementing the entire {@link IHorzScaleBehavior}<{@link Time}> interface. - * - * For further details, refer to the {@link createChartEx} chart constructor method. - * - * @returns An uninitialized class implementing the {@link IHorzScaleBehavior}<{@link Time}> interface - */ -export declare function defaultHorzScaleBehavior(): new () => IHorzScaleBehavior