global: snapshot

This commit is contained in:
nym21
2025-08-24 16:45:20 +02:00
parent da1ff2cacc
commit 61f960de28
19 changed files with 2563 additions and 2032 deletions
Generated
+116 -91
View File
@@ -166,11 +166,13 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "async-compression"
version = "0.4.27"
version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddb939d66e4ae03cee6091612804ba446b12878410cfa17f785f4dd67d4014e8"
checksum = "6448dfb3960f0b038e88c781ead1e7eb7929dfc3a71a1336ec9086c00f6d1e75"
dependencies = [
"brotli",
"compression-codecs",
"compression-core",
"flate2",
"futures-core",
"memchr",
@@ -454,9 +456,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.9.2"
version = "2.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29"
checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d"
dependencies = [
"serde",
]
@@ -675,7 +677,7 @@ dependencies = [
"serde",
"serde_json",
"sse-stream",
"thiserror 2.0.15",
"thiserror 2.0.16",
"tokio",
"tokio-stream",
"tokio-util",
@@ -690,7 +692,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b49ac541e14b18e43696144176faeabc547ce198cb10d575c13fcc6245d337c"
dependencies = [
"darling 0.21.2",
"darling 0.21.3",
"proc-macro2",
"quote",
"serde_json",
@@ -706,7 +708,7 @@ dependencies = [
"anyhow",
"append-only-vec",
"arcstr",
"bitflags 2.9.2",
"bitflags 2.9.3",
"brk_rolldown_common",
"brk_rolldown_debug",
"brk_rolldown_ecmascript",
@@ -727,7 +729,7 @@ dependencies = [
"css-module-lexer",
"dunce",
"futures",
"indexmap 2.10.0",
"indexmap 2.11.0",
"itertools",
"itoa",
"memchr",
@@ -755,7 +757,7 @@ checksum = "23cd66173b33436aaec126f64e8f1d0938539d2eb934e88c633cf6181f7e4c53"
dependencies = [
"anyhow",
"arcstr",
"bitflags 2.9.2",
"bitflags 2.9.3",
"brk_rolldown_ecmascript",
"brk_rolldown_error",
"brk_rolldown_fs",
@@ -837,7 +839,7 @@ checksum = "9fd007c612609bcf46e3dca4f9f3c79d16dc1f0bdf7cd0047bfe752fbc6fbecc"
dependencies = [
"anyhow",
"arcstr",
"bitflags 2.9.2",
"bitflags 2.9.3",
"brk_rolldown_utils",
"derive_more",
"heck",
@@ -868,7 +870,7 @@ dependencies = [
"anyhow",
"arcstr",
"async-trait",
"bitflags 2.9.2",
"bitflags 2.9.3",
"brk_rolldown_common",
"brk_rolldown_debug",
"brk_rolldown_ecmascript",
@@ -996,7 +998,7 @@ dependencies = [
"fast-glob",
"form_urlencoded",
"futures",
"indexmap 2.10.0",
"indexmap 2.11.0",
"infer",
"itoa",
"memchr",
@@ -1147,9 +1149,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.33"
version = "1.2.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ee0f8803222ba5a7e2777dd72ca451868909b1ac410621b676adf07280e9b5f"
checksum = "42bc4aea80032b7bf409b0bc7ccad88853858911b7713a8062fdc0623867bedc"
dependencies = [
"jobserver",
"libc",
@@ -1169,9 +1171,9 @@ dependencies = [
[[package]]
name = "cfg-if"
version = "1.0.1"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
[[package]]
name = "cfg_aliases"
@@ -1302,6 +1304,28 @@ version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0095f6103c2a8b44acd6fd15960c801dafebf02e21940360833e0673f48ba7"
[[package]]
name = "compression-codecs"
version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46cc6539bf1c592cff488b9f253b30bc0ec50d15407c2cf45e27bd8f308d5905"
dependencies = [
"brotli",
"compression-core",
"flate2",
"futures-core",
"memchr",
"pin-project-lite",
"zstd",
"zstd-safe",
]
[[package]]
name = "compression-core"
version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2957e823c15bde7ecf1e8b64e537aa03a6be5fda0e2334e99887669e75b12e01"
[[package]]
name = "concurrent_lru"
version = "0.2.0"
@@ -1460,12 +1484,12 @@ dependencies = [
[[package]]
name = "darling"
version = "0.21.2"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08440b3dd222c3d0433e63e097463969485f112baff337dfdaca043a0d760570"
checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0"
dependencies = [
"darling_core 0.21.2",
"darling_macro 0.21.2",
"darling_core 0.21.3",
"darling_macro 0.21.3",
]
[[package]]
@@ -1484,9 +1508,9 @@ dependencies = [
[[package]]
name = "darling_core"
version = "0.21.2"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d25b7912bc28a04ab1b7715a68ea03aaa15662b43a1a4b2c480531fd19f8bf7e"
checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4"
dependencies = [
"fnv",
"ident_case",
@@ -1509,11 +1533,11 @@ dependencies = [
[[package]]
name = "darling_macro"
version = "0.21.2"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce154b9bea7fb0c8e8326e62d00354000c36e79770ff21b8c84e3aa267d9d531"
checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81"
dependencies = [
"darling_core 0.21.2",
"darling_core 0.21.3",
"quote",
"syn 2.0.106",
]
@@ -1737,14 +1761,14 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "filetime"
version = "0.2.25"
version = "0.2.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586"
checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed"
dependencies = [
"cfg-if",
"libc",
"libredox",
"windows-sys 0.59.0",
"windows-sys 0.60.2",
]
[[package]]
@@ -1795,9 +1819,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "form_urlencoded"
version = "1.2.1"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
dependencies = [
"percent-encoding",
]
@@ -2206,9 +2230,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "1.0.3"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e"
checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
dependencies = [
"idna_adapter",
"smallvec",
@@ -2244,9 +2268,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.10.0"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9"
dependencies = [
"equivalent",
"hashbrown 0.15.5",
@@ -2268,7 +2292,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"inotify-sys",
"libc",
]
@@ -2293,11 +2317,11 @@ dependencies = [
[[package]]
name = "io-uring"
version = "0.7.9"
version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4"
checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"cfg-if",
"libc",
]
@@ -2443,7 +2467,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"libc",
"redox_syscall",
]
@@ -2529,9 +2553,9 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
[[package]]
name = "memmap2"
version = "0.9.7"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "483758ad303d734cec05e5c12b41d7e93e6a6390c5e9dae6bdeb7c1259012d28"
checksum = "843a98750cd611cc2965a8213b53b43e715f13c37a9e096c6408e69990961db7"
dependencies = [
"libc",
]
@@ -2592,7 +2616,7 @@ version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"cfg-if",
"cfg_aliases",
"libc",
@@ -2619,7 +2643,7 @@ version = "8.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"fsevent-sys",
"inotify",
"kqueue",
@@ -2756,7 +2780,7 @@ dependencies = [
"rustc-hash",
"serde",
"serde_json",
"thiserror 2.0.15",
"thiserror 2.0.16",
"time",
]
@@ -2770,7 +2794,7 @@ dependencies = [
"owo-colors",
"oxc-miette-derive",
"textwrap",
"thiserror 2.0.15",
"thiserror 2.0.16",
"unicode-width",
]
@@ -2806,7 +2830,7 @@ version = "0.81.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "989b81258ce151e23adee6f1393f7c0fb7e10e3a6c6c001f71bbaff4081c72a4"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"oxc_allocator",
"oxc_ast_macros",
"oxc_data_structures",
@@ -2847,7 +2871,7 @@ version = "0.81.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5361ef66f38635d9671596d83abf44bcdbc3e39dbff303f3517828b86ad60e8f"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"itertools",
"nonmax",
"oxc_index",
@@ -2862,7 +2886,7 @@ version = "0.81.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fde8fc6f7337632fce3e9e51c150f57fb0ef234524c6947f63e8009e1ea613cf"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"cow-utils",
"dragonbox_ecma",
"nonmax",
@@ -2940,7 +2964,7 @@ version = "0.81.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83d8c311d64fa0bf8cab1bde3f7760cd828e71ed483ca0878799f1f72542cb4d"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"oxc_allocator",
"oxc_ast",
"oxc_ast_visit",
@@ -2995,7 +3019,7 @@ version = "0.81.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70253728183a5a92d1ba964d9952201e0269ebd07c4917c4553283d564225bab"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"cow-utils",
"memchr",
"num-bigint",
@@ -3018,7 +3042,7 @@ version = "0.81.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de5bb2ed6646bb7815126e0f36787c349e13561fed2c05f95b27a1f82dd066c4"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"oxc_allocator",
"oxc_ast_macros",
"oxc_diagnostics",
@@ -3030,12 +3054,12 @@ dependencies = [
[[package]]
name = "oxc_resolver"
version = "11.6.1"
version = "11.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94b0efb2038cc4e9d12f0fd32aedcfd594f8879866b38bd4becf5e87fa283cc0"
checksum = "3d84cdcd778d15db5b21cc61baf79ac55cee97e7feb725b2664453979ba3cd76"
dependencies = [
"cfg-if",
"indexmap 2.10.0",
"indexmap 2.11.0",
"json-strip-comments",
"once_cell",
"papaya",
@@ -3044,7 +3068,7 @@ dependencies = [
"serde",
"serde_json",
"simdutf8",
"thiserror 2.0.15",
"thiserror 2.0.16",
"tracing",
"url",
]
@@ -3103,7 +3127,7 @@ version = "0.81.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72d9d80d47d2eee5c1e6dbcdf1841b42afc4f1cd1f63701fc346162616dac52f"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"cow-utils",
"dragonbox_ecma",
"nonmax",
@@ -3128,7 +3152,7 @@ dependencies = [
"base64 0.22.1",
"compact_str",
"cow-utils",
"indexmap 2.10.0",
"indexmap 2.11.0",
"itoa",
"memchr",
"oxc-browserslist",
@@ -3284,9 +3308,9 @@ dependencies = [
[[package]]
name = "percent-encoding"
version = "2.3.1"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "petgraph"
@@ -3296,7 +3320,7 @@ checksum = "54acf3a685220b533e437e264e4d932cfbdc4cc7ec0cd232ed73c08d03b8a7ca"
dependencies = [
"fixedbitset",
"hashbrown 0.15.5",
"indexmap 2.10.0",
"indexmap 2.11.0",
"serde",
]
@@ -3398,7 +3422,7 @@ dependencies = [
"rustc-hash",
"serde",
"serde_json",
"thiserror 2.0.15",
"thiserror 2.0.16",
]
[[package]]
@@ -3608,7 +3632,7 @@ version = "0.5.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
]
[[package]]
@@ -3686,9 +3710,9 @@ dependencies = [
[[package]]
name = "rolldown-ariadne"
version = "0.5.2"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "324d1b9754f0cb535f4032a6a654d3a56047a500f557c16060f12f70b0089c57"
checksum = "77dff57c9de498bb1eb5b1ce682c2e3a0ae956b266fa0933c3e151b87b078967"
dependencies = [
"unicode-width",
"yansi",
@@ -3722,7 +3746,7 @@ version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
"errno",
"libc",
"linux-raw-sys",
@@ -3926,11 +3950,11 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.142"
version = "1.0.143"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7"
checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a"
dependencies = [
"indexmap 2.10.0",
"indexmap 2.11.0",
"itoa",
"memchr",
"ryu",
@@ -3978,7 +4002,7 @@ dependencies = [
"chrono",
"hex",
"indexmap 1.9.3",
"indexmap 2.10.0",
"indexmap 2.11.0",
"schemars 0.9.0",
"schemars 1.0.4",
"serde",
@@ -4186,15 +4210,15 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.20.0"
version = "3.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e"
dependencies = [
"fastrand",
"getrandom 0.3.3",
"once_cell",
"rustix",
"windows-sys 0.59.0",
"windows-sys 0.60.2",
]
[[package]]
@@ -4237,11 +4261,11 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.15"
version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d76d3f064b981389ecb4b6b7f45a0bf9fdac1d5b9204c7bd6714fecc302850"
checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
dependencies = [
"thiserror-impl 2.0.15",
"thiserror-impl 2.0.16",
]
[[package]]
@@ -4257,9 +4281,9 @@ dependencies = [
[[package]]
name = "thiserror-impl"
version = "2.0.15"
version = "2.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d29feb33e986b6ea906bd9c3559a856983f92371b3eaa5e83782a351623de0"
checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
dependencies = [
"proc-macro2",
"quote",
@@ -4375,7 +4399,7 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8"
dependencies = [
"indexmap 2.10.0",
"indexmap 2.11.0",
"serde",
"serde_spanned",
"toml_datetime",
@@ -4431,7 +4455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
dependencies = [
"async-compression",
"bitflags 2.9.2",
"bitflags 2.9.3",
"bytes",
"futures-core",
"http",
@@ -4554,7 +4578,7 @@ version = "11.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ef1b7a6d914a34127ed8e1fa927eb7088903787bcded4fa3eef8f85ee1568be"
dependencies = [
"thiserror 2.0.15",
"thiserror 2.0.16",
"ts-rs-macros",
]
@@ -4629,13 +4653,14 @@ checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae"
[[package]]
name = "url"
version = "2.5.4"
version = "2.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
]
[[package]]
@@ -4860,11 +4885,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.9"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
checksum = "0978bf7171b3d90bac376700cb56d606feb40f251a475a5d6634613564460b22"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.60.2",
]
[[package]]
@@ -5090,9 +5115,9 @@ checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
[[package]]
name = "winnow"
version = "0.7.12"
version = "0.7.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"
checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
[[package]]
name = "wit-bindgen-rt"
@@ -5100,7 +5125,7 @@ version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
dependencies = [
"bitflags 2.9.2",
"bitflags 2.9.3",
]
[[package]]
@@ -5221,14 +5246,14 @@ dependencies = [
[[package]]
name = "zip"
version = "4.3.0"
version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aed4ac33e8eb078c89e6cbb1d5c4c7703ec6d299fc3e7c3695af8f8b423468b"
checksum = "8835eb39822904d39cb19465de1159e05d371973f0c6df3a365ad50565ddc8b9"
dependencies = [
"arbitrary",
"crc32fast",
"flate2",
"indexmap 2.10.0",
"indexmap 2.11.0",
"memchr",
"zopfli",
]
+1 -1
View File
@@ -50,7 +50,7 @@ rayon = "1.11.0"
serde = "1.0.219"
serde_bytes = "0.11.17"
serde_derive = "1.0.219"
serde_json = { version = "1.0.142", features = ["float_roundtrip"] }
serde_json = { version = "1.0.143", features = ["float_roundtrip"] }
tokio = { version = "1.47.1", features = ["rt-multi-thread"] }
# vecdb = { path = "../seqdb/crates/vecdb", features = ["derive"]}
vecdb = { version = "0.2.4", features = ["derive"]}
+1 -1
View File
@@ -28,7 +28,7 @@ minreq = { workspace = true }
serde = { workspace = true }
tokio = { workspace = true }
toml = "0.9.5"
zip = { version = "4.3.0", default-features = false, features = ["deflate"] }
zip = { version = "4.5.0", default-features = false, features = ["deflate"] }
[[bin]]
name = "brk"
+190 -1
View File
@@ -2,7 +2,7 @@ use std::path::Path;
use brk_error::Result;
use brk_indexer::Indexer;
use brk_structs::{StoredU16, Version};
use brk_structs::{StoredI16, StoredU16, Version};
use vecdb::{AnyCollectableVec, AnyVec, Database, Exit};
use crate::grouped::Source;
@@ -21,8 +21,15 @@ pub struct Vecs {
pub constant_0: ComputedVecsFromHeight<StoredU16>,
pub constant_1: ComputedVecsFromHeight<StoredU16>,
pub constant_2: ComputedVecsFromHeight<StoredU16>,
pub constant_3: ComputedVecsFromHeight<StoredU16>,
pub constant_4: ComputedVecsFromHeight<StoredU16>,
pub constant_50: ComputedVecsFromHeight<StoredU16>,
pub constant_100: ComputedVecsFromHeight<StoredU16>,
pub constant_minus_1: ComputedVecsFromHeight<StoredI16>,
pub constant_minus_2: ComputedVecsFromHeight<StoredI16>,
pub constant_minus_3: ComputedVecsFromHeight<StoredI16>,
pub constant_minus_4: ComputedVecsFromHeight<StoredI16>,
}
impl Vecs {
@@ -46,6 +53,30 @@ impl Vecs {
indexes,
VecBuilderOptions::default().add_last(),
)?,
constant_2: ComputedVecsFromHeight::forced_import(
&db,
"constant_2",
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
VecBuilderOptions::default().add_last(),
)?,
constant_3: ComputedVecsFromHeight::forced_import(
&db,
"constant_3",
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
VecBuilderOptions::default().add_last(),
)?,
constant_4: ComputedVecsFromHeight::forced_import(
&db,
"constant_4",
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
VecBuilderOptions::default().add_last(),
)?,
constant_50: ComputedVecsFromHeight::forced_import(
&db,
"constant_50",
@@ -62,6 +93,38 @@ impl Vecs {
indexes,
VecBuilderOptions::default().add_last(),
)?,
constant_minus_1: ComputedVecsFromHeight::forced_import(
&db,
"constant_minus_1",
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
VecBuilderOptions::default().add_last(),
)?,
constant_minus_2: ComputedVecsFromHeight::forced_import(
&db,
"constant_minus_2",
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
VecBuilderOptions::default().add_last(),
)?,
constant_minus_3: ComputedVecsFromHeight::forced_import(
&db,
"constant_minus_3",
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
VecBuilderOptions::default().add_last(),
)?,
constant_minus_4: ComputedVecsFromHeight::forced_import(
&db,
"constant_minus_4",
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
VecBuilderOptions::default().add_last(),
)?,
db,
})
@@ -120,6 +183,57 @@ impl Vecs {
},
)?;
self.constant_2.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|vec, _, indexes, starting_indexes, exit| {
vec.compute_to(
starting_indexes.height,
indexes.height_to_date.len(),
indexes.height_to_date.version(),
|i| (i, StoredU16::new(2)),
exit,
)?;
Ok(())
},
)?;
self.constant_3.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|vec, _, indexes, starting_indexes, exit| {
vec.compute_to(
starting_indexes.height,
indexes.height_to_date.len(),
indexes.height_to_date.version(),
|i| (i, StoredU16::new(3)),
exit,
)?;
Ok(())
},
)?;
self.constant_4.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|vec, _, indexes, starting_indexes, exit| {
vec.compute_to(
starting_indexes.height,
indexes.height_to_date.len(),
indexes.height_to_date.version(),
|i| (i, StoredU16::new(4)),
exit,
)?;
Ok(())
},
)?;
self.constant_50.compute_all(
indexer,
indexes,
@@ -154,6 +268,74 @@ impl Vecs {
},
)?;
self.constant_minus_1.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|vec, _, indexes, starting_indexes, exit| {
vec.compute_to(
starting_indexes.height,
indexes.height_to_date.len(),
indexes.height_to_date.version(),
|i| (i, StoredI16::new(-1)),
exit,
)?;
Ok(())
},
)?;
self.constant_minus_2.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|vec, _, indexes, starting_indexes, exit| {
vec.compute_to(
starting_indexes.height,
indexes.height_to_date.len(),
indexes.height_to_date.version(),
|i| (i, StoredI16::new(-2)),
exit,
)?;
Ok(())
},
)?;
self.constant_minus_3.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|vec, _, indexes, starting_indexes, exit| {
vec.compute_to(
starting_indexes.height,
indexes.height_to_date.len(),
indexes.height_to_date.version(),
|i| (i, StoredI16::new(-3)),
exit,
)?;
Ok(())
},
)?;
self.constant_minus_4.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|vec, _, indexes, starting_indexes, exit| {
vec.compute_to(
starting_indexes.height,
indexes.height_to_date.len(),
indexes.height_to_date.version(),
|i| (i, StoredI16::new(-4)),
exit,
)?;
Ok(())
},
)?;
Ok(())
}
@@ -161,8 +343,15 @@ impl Vecs {
[
self.constant_0.vecs(),
self.constant_1.vecs(),
self.constant_2.vecs(),
self.constant_3.vecs(),
self.constant_4.vecs(),
self.constant_50.vecs(),
self.constant_100.vecs(),
self.constant_minus_1.vecs(),
self.constant_minus_2.vecs(),
self.constant_minus_3.vecs(),
self.constant_minus_4.vecs(),
]
.into_iter()
.flatten()
+2
View File
@@ -6,6 +6,7 @@ mod from_height;
mod from_height_strict;
mod from_txindex;
mod ratio_from_dateindex;
mod sd_from_dateindex;
mod source;
mod value_from_dateindex;
mod value_from_height;
@@ -20,6 +21,7 @@ pub use from_height::*;
pub use from_height_strict::*;
pub use from_txindex::*;
pub use ratio_from_dateindex::*;
pub use sd_from_dateindex::*;
pub use source::*;
pub use value_from_dateindex::*;
pub use value_from_height::*;
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,707 @@
use brk_error::Result;
use brk_indexer::Indexer;
use brk_structs::{CheckedSub, Date, DateIndex, Dollars, StoredF32, Version};
use vecdb::{
AnyCollectableVec, AnyIterableVec, AnyStoredVec, AnyVec, BoxedVecIterator, CollectableVec,
Database, EagerVec, Exit, GenericStoredVec, StoredIndex,
};
use crate::{Indexes, grouped::source::Source, indexes};
use super::{ComputedVecsFromDateIndex, VecBuilderOptions};
#[derive(Clone)]
pub struct ComputedStandardDeviationVecsFromDateIndex {
days: usize,
pub sma: Option<ComputedVecsFromDateIndex<StoredF32>>,
pub sd: ComputedVecsFromDateIndex<StoredF32>,
pub _0sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub p0_5sd: ComputedVecsFromDateIndex<StoredF32>,
pub p1sd: ComputedVecsFromDateIndex<StoredF32>,
pub p1_5sd: ComputedVecsFromDateIndex<StoredF32>,
pub p2sd: ComputedVecsFromDateIndex<StoredF32>,
pub p2_5sd: ComputedVecsFromDateIndex<StoredF32>,
pub p3sd: ComputedVecsFromDateIndex<StoredF32>,
pub m0_5sd: ComputedVecsFromDateIndex<StoredF32>,
pub m1sd: ComputedVecsFromDateIndex<StoredF32>,
pub m1_5sd: ComputedVecsFromDateIndex<StoredF32>,
pub m2sd: ComputedVecsFromDateIndex<StoredF32>,
pub m2_5sd: ComputedVecsFromDateIndex<StoredF32>,
pub m3sd: ComputedVecsFromDateIndex<StoredF32>,
pub p0_5sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub p1sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub p1_5sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub p2sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub p2_5sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub p3sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub m0_5sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub m1sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub m1_5sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub m2sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub m2_5sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub m3sd_as_price: ComputedVecsFromDateIndex<Dollars>,
pub zscore: ComputedVecsFromDateIndex<StoredF32>,
}
const VERSION: Version = Version::ONE;
impl ComputedStandardDeviationVecsFromDateIndex {
#[allow(clippy::too_many_arguments)]
pub fn forced_import(
db: &Database,
name: &str,
days: usize,
source: Source<DateIndex, StoredF32>,
version: Version,
indexes: &indexes::Vecs,
) -> Result<Self> {
let options = VecBuilderOptions::default().add_last();
Ok(Self {
days,
sma: source.is_compute().then(|| {
ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_sma"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)
.unwrap()
}),
sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p0_5sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p0_5sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p1sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p1sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p1_5sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p1_5sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p2sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p2sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p2_5sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p2_5sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p3sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p3sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m0_5sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m0_5sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m1sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m1sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m1_5sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m1_5sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m2sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m2sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m2_5sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m2_5sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m3sd: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m3sd"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
_0sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_0sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p0_5sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p0_5sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p1sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p1sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p1_5sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p1_5sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p2sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p2sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p2_5sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p2_5sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
p3sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_p3sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m0_5sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m0_5sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m1sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m1sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m1_5sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m1_5sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m2sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m2sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m2_5sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m2_5sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
m3sd_as_price: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_m3sd_as_price"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
zscore: ComputedVecsFromDateIndex::forced_import(
db,
&format!("{name}_zscore"),
Source::Compute,
version + VERSION + Version::ZERO,
indexes,
options,
)?,
})
}
pub fn compute_all(
&mut self,
indexer: &Indexer,
indexes: &indexes::Vecs,
starting_indexes: &Indexes,
exit: &Exit,
source: &impl CollectableVec<DateIndex, StoredF32>,
source_as_price: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
) -> Result<()> {
let min_date = DateIndex::try_from(Date::MIN_RATIO).unwrap();
self.sma.as_mut().unwrap().compute_all(
indexer,
indexes,
starting_indexes,
exit,
|v, _, _, starting_indexes, exit| {
v.compute_sma_(
starting_indexes.dateindex,
source,
self.days,
exit,
Some(min_date),
)?;
Ok(())
},
)?;
let sma_opt: Option<&EagerVec<DateIndex, StoredF32>> = None;
self.compute_rest(
indexer,
indexes,
starting_indexes,
exit,
sma_opt,
source,
source_as_price,
)
}
#[allow(clippy::too_many_arguments)]
pub fn compute_rest(
&mut self,
indexer: &Indexer,
indexes: &indexes::Vecs,
starting_indexes: &Indexes,
exit: &Exit,
sma_opt: Option<&impl AnyIterableVec<DateIndex, StoredF32>>,
source: &impl CollectableVec<DateIndex, StoredF32>,
source_as_price: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
) -> Result<()> {
let sma = sma_opt.unwrap_or_else(|| unsafe {
std::mem::transmute(&self.sma.as_ref().unwrap().dateindex)
});
let min_date = DateIndex::try_from(Date::MIN_RATIO).unwrap();
let source_version = source.version();
self.mut_vecs().iter_mut().try_for_each(|v| -> Result<()> {
v.validate_computed_version_or_reset(
Version::ZERO + v.inner_version() + source_version,
)?;
Ok(())
})?;
let starting_dateindex = self
.mut_vecs()
.iter()
.map(|v| DateIndex::from(v.len()))
.min()
.unwrap()
.min(starting_indexes.dateindex);
let mut sorted = source.collect_range(
Some(min_date.unwrap_to_usize()),
Some(starting_dateindex.unwrap_to_usize()),
)?;
sorted.sort_unstable();
let mut sma_iter = sma.iter();
source
.iter_at(starting_dateindex)
.try_for_each(|(index, ratio)| -> Result<()> {
if index < min_date {
self.sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.p0_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.p1sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.p1_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.p2sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.p2_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.p3sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.m0_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.m1sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.m1_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.m2sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.m2_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
self.m3sd.dateindex.as_mut().unwrap().forced_push_at(
index,
StoredF32::NAN,
exit,
)?;
} else {
let ratio = ratio.into_owned();
let pos = sorted.binary_search(&ratio).unwrap_or_else(|pos| pos);
sorted.insert(pos, ratio);
let avg = sma_iter.unwrap_get_inner(index);
let population =
index.checked_sub(min_date).unwrap().unwrap_to_usize() as f32 + 1.0;
let sd = StoredF32::from(
(sorted.iter().map(|v| (**v - *avg).powi(2)).sum::<f32>() / population)
.sqrt(),
);
self.sd
.dateindex
.as_mut()
.unwrap()
.forced_push_at(index, sd, exit)?;
self.p0_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg + StoredF32::from(0.5 * *sd),
exit,
)?;
self.p1sd
.dateindex
.as_mut()
.unwrap()
.forced_push_at(index, avg + sd, exit)?;
self.p1_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg + StoredF32::from(1.5 * *sd),
exit,
)?;
self.p2sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg + 2 * sd,
exit,
)?;
self.p2_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg + StoredF32::from(2.5 * *sd),
exit,
)?;
self.p3sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg + 3 * sd,
exit,
)?;
self.m0_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg - StoredF32::from(0.5 * *sd),
exit,
)?;
self.m1sd
.dateindex
.as_mut()
.unwrap()
.forced_push_at(index, avg - sd, exit)?;
self.m1_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg - StoredF32::from(1.5 * *sd),
exit,
)?;
self.m2sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg - 2 * sd,
exit,
)?;
self.m2_5sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg - StoredF32::from(2.5 * *sd),
exit,
)?;
self.m3sd.dateindex.as_mut().unwrap().forced_push_at(
index,
avg - 3 * sd,
exit,
)?;
}
Ok(())
})?;
drop(sma_iter);
self.mut_vecs()
.into_iter()
.try_for_each(|v| v.safe_flush(exit))?;
[
&mut self.sd,
&mut self.p0_5sd,
&mut self.p1sd,
&mut self.p1_5sd,
&mut self.p2sd,
&mut self.p2_5sd,
&mut self.p3sd,
&mut self.m0_5sd,
&mut self.m1sd,
&mut self.m1_5sd,
&mut self.m2sd,
&mut self.m2_5sd,
&mut self.m3sd,
]
.into_iter()
.try_for_each(|v| {
v.compute_rest(starting_indexes, exit, None as Option<&EagerVec<_, _>>)
})?;
self.zscore.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|vec, _, _, starting_indexes, exit| {
vec.compute_zscore(
starting_indexes.dateindex,
source,
sma,
self.sd.dateindex.as_ref().unwrap(),
exit,
)?;
Ok(())
},
)?;
let Some(price) = source_as_price else {
return Ok(());
};
let compute_as_price =
|as_price: &mut ComputedVecsFromDateIndex<Dollars>,
mut iter: BoxedVecIterator<DateIndex, StoredF32>| {
as_price.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|vec, _, _, starting_indexes, exit| {
vec.compute_transform(
starting_indexes.dateindex,
price,
|(i, price, ..)| {
let multiplier = iter.unwrap_get_inner(i);
(i, price * multiplier)
},
exit,
)?;
Ok(())
},
)
};
compute_as_price(&mut self._0sd_as_price, sma.iter())?;
compute_as_price(
&mut self.p0_5sd_as_price,
self.p0_5sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.p1sd_as_price,
self.p1sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.p1_5sd_as_price,
self.p1_5sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.p2sd_as_price,
self.p2sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.p2_5sd_as_price,
self.p2_5sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.p3sd_as_price,
self.p3sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.m0_5sd_as_price,
self.m0_5sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.m1sd_as_price,
self.m1sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.m1_5sd_as_price,
self.m1_5sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.m2sd_as_price,
self.m2sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.m2_5sd_as_price,
self.m2_5sd.dateindex.as_ref().unwrap().iter(),
)?;
compute_as_price(
&mut self.m3sd_as_price,
self.m3sd.dateindex.as_ref().unwrap().iter(),
)?;
Ok(())
}
fn mut_vecs(&mut self) -> [&mut EagerVec<DateIndex, StoredF32>; 13] {
[
self.sd.dateindex.as_mut().unwrap(),
self.p0_5sd.dateindex.as_mut().unwrap(),
self.p1sd.dateindex.as_mut().unwrap(),
self.p1_5sd.dateindex.as_mut().unwrap(),
self.p2sd.dateindex.as_mut().unwrap(),
self.p2_5sd.dateindex.as_mut().unwrap(),
self.p3sd.dateindex.as_mut().unwrap(),
self.m0_5sd.dateindex.as_mut().unwrap(),
self.m1sd.dateindex.as_mut().unwrap(),
self.m1_5sd.dateindex.as_mut().unwrap(),
self.m2sd.dateindex.as_mut().unwrap(),
self.m2_5sd.dateindex.as_mut().unwrap(),
self.m3sd.dateindex.as_mut().unwrap(),
]
}
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[
self.sma.as_ref().map_or(vec![], |v| v.vecs()),
self.sd.vecs(),
self.p0_5sd.vecs(),
self.p1sd.vecs(),
self.p1_5sd.vecs(),
self.p2sd.vecs(),
self.p2_5sd.vecs(),
self.p3sd.vecs(),
self.m0_5sd.vecs(),
self.m1sd.vecs(),
self.m1_5sd.vecs(),
self.m2sd.vecs(),
self.m2_5sd.vecs(),
self.m3sd.vecs(),
self._0sd_as_price.vecs(),
self.p0_5sd_as_price.vecs(),
self.p1sd_as_price.vecs(),
self.p1_5sd_as_price.vecs(),
self.p2sd_as_price.vecs(),
self.p2_5sd_as_price.vecs(),
self.p3sd_as_price.vecs(),
self.m0_5sd_as_price.vecs(),
self.m1sd_as_price.vecs(),
self.m1_5sd_as_price.vecs(),
self.m2sd_as_price.vecs(),
self.m2_5sd_as_price.vecs(),
self.m3sd_as_price.vecs(),
self.zscore.vecs(),
]
.into_iter()
.flatten()
.collect::<Vec<_>>()
}
}
+52 -40
View File
@@ -597,24 +597,52 @@ impl Vecs {
Ordering::Less => Height::ZERO,
};
// dbg!(stateful_starting_height);
// info!("stateful_starting_height = {stateful_starting_height}");
// let stateful_starting_height = stateful_starting_height
// .checked_sub(Height::new(1))
// .unwrap_or_default();
// dbg!(stateful_starting_height);
// info!("stateful_starting_height = {stateful_starting_height}");
let starting_height = starting_indexes.height.min(stateful_starting_height);
// dbg!(starting_height);
info!("starting_height = {starting_height}");
let last_height = Height::from(indexer.vecs.height_to_blockhash.stamp());
// dbg!(last_height);
info!("last_height = {last_height}");
if starting_height <= last_height {
// dbg!(starting_height);
info!("starting_height = {starting_height}");
let starting_height = if starting_height.is_not_zero() {
let mut set = separate_utxo_vecs
.iter_mut()
.map(|(_, v)| v.import_state(starting_height).unwrap_or_default())
.collect::<BTreeSet<Height>>();
let mut set = [
self.chain_state.rollback_before(starting_height.into())?,
self.p2pk33addressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2pk65addressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2pkhaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2shaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2traddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2wpkhaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2wshaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2aaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.loadedaddressindex_to_loadedaddressdata
.rollback_before(starting_height.into())?,
self.emptyaddressindex_to_emptyaddressdata
.rollback_before(starting_height.into())?,
]
.into_iter()
.enumerate()
.map(|(i, s)| {
let h = Height::from(s).incremented();
dbg!((i, s, h));
h
})
.collect::<BTreeSet<Height>>();
if set.len() == 1 {
set.pop_first().unwrap()
} else {
@@ -623,40 +651,23 @@ impl Vecs {
} else {
Height::ZERO
};
// dbg!(starting_height);
let starting_height = if starting_height.is_not_zero()
&& separate_utxo_vecs
.iter_mut()
.map(|(_, v)| v.import_state(starting_height).unwrap_or_default())
.all(|h| h == starting_height)
{
starting_height
} else {
Height::ZERO
};
info!("starting_height = {starting_height}");
let starting_height = if starting_height.is_not_zero()
&& separate_address_vecs
.iter_mut()
.map(|(_, v)| v.import_state(starting_height).unwrap_or_default())
.chain(
[
self.chain_state.rollback_before(starting_height.into())?,
self.p2pk33addressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2pk65addressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2pkhaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2shaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2traddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2wpkhaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2wshaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.p2aaddressindex_to_anyaddressindex
.rollback_before(starting_height.into())?,
self.loadedaddressindex_to_loadedaddressdata
.rollback_before(starting_height.into())?,
self.emptyaddressindex_to_emptyaddressdata
.rollback_before(starting_height.into())?,
]
.into_iter()
.map(Height::from)
.map(Height::incremented),
)
.all(|h| h == starting_height)
{
starting_height
@@ -664,8 +675,7 @@ impl Vecs {
Height::ZERO
};
// dbg!(starting_height);
// std::process::exit(0);
info!("starting_height = {starting_height}");
let mut chain_state: Vec<BlockState>;
if starting_height.is_not_zero() {
@@ -690,6 +700,8 @@ impl Vecs {
} else {
info!("Starting processing utxos from the start");
// std::process::exit(0);
chain_state = vec![];
self.p2pk33addressindex_to_anyaddressindex.reset()?;
@@ -67,7 +67,7 @@ impl PriceToAmount {
self.state.as_mut().unwrap().remove(&price);
}
} else {
dbg!(&self.state, price, &self.pathbuf);
dbg!(price, &self.pathbuf);
unreachable!();
}
}
+2
View File
@@ -42,6 +42,7 @@ mod semesterindex;
mod stored_bool;
mod stored_f32;
mod stored_f64;
mod stored_i16;
mod stored_u16;
mod stored_u32;
mod stored_u64;
@@ -103,6 +104,7 @@ pub use semesterindex::*;
pub use stored_bool::*;
pub use stored_f32::*;
pub use stored_f64::*;
pub use stored_i16::*;
pub use stored_u8::*;
pub use stored_u16::*;
pub use stored_u32::*;
@@ -1,6 +1,7 @@
use core::panic;
use std::{
cmp::Ordering,
f32,
ops::{Add, AddAssign, Div, Mul, Sub},
};
@@ -26,6 +27,10 @@ use super::{Dollars, StoredF64};
)]
pub struct StoredF32(f32);
impl StoredF32 {
pub const NAN: Self = StoredF32(f32::NAN);
}
impl From<f32> for StoredF32 {
fn from(value: f32) -> Self {
Self(value)
@@ -0,0 +1,105 @@
use std::ops::{Add, AddAssign, Div};
use derive_deref::Deref;
use serde::Serialize;
use vecdb::{CheckedSub, Printable, StoredCompressed};
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
#[derive(
Debug,
Deref,
Clone,
Default,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
StoredCompressed,
)]
pub struct StoredI16(i16);
impl StoredI16 {
pub const ZERO: Self = Self(0);
pub fn new(v: i16) -> Self {
Self(v)
}
}
impl From<i16> for StoredI16 {
fn from(value: i16) -> Self {
Self(value)
}
}
impl From<usize> for StoredI16 {
fn from(value: usize) -> Self {
if value > i16::MAX as usize {
panic!("usize too big (value = {value})")
}
Self(value as i16)
}
}
impl CheckedSub<StoredI16> for StoredI16 {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Div<usize> for StoredI16 {
type Output = Self;
fn div(self, rhs: usize) -> Self::Output {
Self(self.0 / rhs as i16)
}
}
impl Add for StoredI16 {
type Output = Self;
fn add(self, rhs: Self) -> Self::Output {
Self(self.0 + rhs.0)
}
}
impl AddAssign for StoredI16 {
fn add_assign(&mut self, rhs: Self) {
*self = *self + rhs
}
}
impl From<f64> for StoredI16 {
fn from(value: f64) -> Self {
if value < 0.0 || value > i16::MAX as f64 {
panic!()
}
Self(value as i16)
}
}
impl From<StoredI16> for f64 {
fn from(value: StoredI16) -> Self {
value.0 as f64
}
}
impl From<StoredI16> for usize {
fn from(value: StoredI16) -> Self {
value.0 as usize
}
}
impl Printable for StoredI16 {
fn to_string() -> &'static str {
"i16"
}
fn to_possible_strings() -> &'static [&'static str] {
&["i16"]
}
}
+3 -3
View File
@@ -1,8 +1,8 @@
use std::ops::{Add, AddAssign, Div};
use vecdb::{CheckedSub, Printable, StoredCompressed};
use derive_deref::Deref;
use serde::Serialize;
use vecdb::{CheckedSub, Printable, StoredCompressed};
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use super::{
@@ -33,8 +33,8 @@ pub struct StoredU16(u16);
impl StoredU16 {
pub const ZERO: Self = Self(0);
pub fn new(counter: u16) -> Self {
Self(counter)
pub fn new(v: u16) -> Self {
Self(v)
}
}
+229 -24
View File
@@ -1,31 +1,236 @@
<!doctype html>
<html lang="en">
<html lang="en" style="height: 100%">
<head>
<meta charset="utf-8" />
<title>Custom</title>
</head>
<body>
<h1>Infinite Code: A Digital Symphony</h1>
<p>
Unleash the inner coder within you and weave a tapestry of innovation in a
digital realm where every line of code becomes your palette. Picture an
endless HTML canvas, each tag an invitation to dream, every element a
window to possibilities. Let your JavaScript spirit soar like a dynamic
function—fluid yet unforgivingly creative—transforming mere logic into
animated expressions of art. And as you style your thoughts with CSS, each
hex color shines like a beacon of brilliance, every property a stroke of
imaginative genius.
</p>
<p>
In this universe of web development, the DOM is your poetic playground,
where algorithms dance with beauty and creativity is written in the syntax
of tomorrow. Create without boundaries, let your code be as rich and
expansive as an infinite loop of passion, where every variable holds the
whisper of your inspiration, and every function unveils a new horizon of
digital artistry. The web is your canvas; the sky, a limitless expanse of
code.
</p>
<body
style="
background-color: black;
color: white;
font-family: monospace;
height: 100%;
margin: 0;
"
>
<div id="chart" style="height: 100%; width: 100%"></div>
</body>
<script type="module">
import * as lc from "https://unpkg.com/lightweight-charts@5.0.8/dist/lightweight-charts.standalone.development.mjs";
const chartOptions = {
layout: {
textColor: "white",
background: "transparent",
fontFamily: "monospace",
attributionLogo: false,
},
grid: {
vertLines: { visible: false },
horzLines: { visible: false },
},
};
const chart = lc.createChart(
document.getElementById("chart"),
chartOptions,
);
const minDate = "2022-11-09";
// const minDate = "2023-11-09";
let dates = await (
await fetch(
"https://next.bitray.xyz/api/vecs/dateindex-to-date?from=-10000",
)
).json();
let i = 0;
console.log(
dates.find((d, _i) => {
i = _i;
return d == minDate;
}),
);
dates = dates.splice(i);
const from = dates.length;
const ohlcs = await (
await fetch(
`https://next.bitray.xyz/api/vecs/dateindex-to-ohlc?from=-${from}`,
)
).json();
chart.addSeries(lc.CandlestickSeries, {}, 0).setData(
ohlcs.map(([open, high, low, close], i) => ({
open,
high,
low,
close,
time: dates[i],
})),
);
const cohort = "5m";
const sopr = (
await (
await fetch(
`https://next.bitray.xyz/api/vecs/dateindex-to-utxos-up-to-${cohort}-old-spent-output-profit-ratio?from=-${from}`,
)
).json()
).map((v) => v - 1);
chart
.addSeries(
lc.BaselineSeries,
{
// color: "green",
lineWidth: 1.25,
lastValueVisible: false,
priceLineVisible: false,
},
2,
)
.setData(
sopr.map((value, i) => ({
value,
time: dates[i],
})),
);
const investedDollarsData = [];
const normalDCAData = [];
const customDCAData = [];
const bitcoinValueData = [];
const bitcoinData = [];
const resultData = [];
const dollarsLeftData = [];
const investmentData = [];
const bitcoinAddedData = [];
const averagePricePaidData = [];
const buyCountData = [];
const sellCountData = [];
const initialDollarAmount = 10_000;
const dca = 1000;
const baseRatio = 0.01;
let bitcoin = initialDollarAmount / 2 / ohlcs[0][3];
let dollars = initialDollarAmount / 2;
let investedAmount = initialDollarAmount;
let buyCount = 0;
let sellCount = 0;
let bitcoinNormalDca = initialDollarAmount / ohlcs[0][3];
dates.forEach((serDate, i) => {
const date = new Date(serDate);
const price = ohlcs[i][3];
if (date.getUTCDate() == 15) {
const addedBitcoin = dca / price;
investedAmount += dca;
bitcoin += addedBitcoin;
bitcoinNormalDca += addedBitcoin;
}
const valueInDollars = dollars + bitcoin * price;
const valueInBitcoin = dollars / price + bitcoin;
// const ratio = baseRatio * (shouldBuy ? buyRatio : sellRatio);
let ratio = sopr[i];
const shouldBuy = ratio <= 0.0;
ratio = Math.abs(ratio);
// console.log({ asopr, ratio });
if (shouldBuy) {
// const buyAmount = dollars * ratio;
const buyAmount = Math.min(dollars, valueInDollars * (ratio * 2));
dollars -= buyAmount;
bitcoin += buyAmount / price;
} else {
// const sellAmount = bitcoin * (ratio / 2);
const sellAmount = Math.min(bitcoin, valueInBitcoin * (ratio / 2));
bitcoin -= sellAmount;
dollars += sellAmount * price;
}
dollarsLeftData.push(dollars);
customDCAData.push(dollars + bitcoin * price);
normalDCAData.push(bitcoinNormalDca * price);
investedDollarsData.push(investedAmount);
});
chart
.addSeries(
lc.LineSeries,
{
color: "green",
lineWidth: 1.25,
lastValueVisible: false,
priceLineVisible: false,
},
3,
)
.setData(
investedDollarsData.map((value, i) => ({
value,
time: dates[i],
})),
);
chart
.addSeries(
lc.LineSeries,
{
color: "gray",
lineWidth: 1.25,
lastValueVisible: false,
priceLineVisible: false,
},
2,
)
.setData(
normalDCAData.map((value, i) => ({
value,
time: dates[i],
})),
);
chart
.addSeries(
lc.LineSeries,
{
color: "yellow",
lineWidth: 1.25,
lastValueVisible: false,
priceLineVisible: false,
},
2,
)
.setData(
dollarsLeftData.map((value, i) => ({
value,
time: dates[i],
})),
);
chart
.addSeries(
lc.LineSeries,
{
color: "white",
lineWidth: 1.25,
lastValueVisible: false,
priceLineVisible: false,
},
2,
)
.setData(
customDCAData.map((value, i) => ({
value,
time: dates[i],
})),
);
chart.timeScale().fitContent();
</script>
</html>
+1 -4
View File
@@ -2,10 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="description"
content="An open source Bitcoin Core data extractor and visualizer"
/>
<meta name="description" content="Bitcoin with X-ray vision" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
@@ -1,6 +1,6 @@
// @ts-check
/** @import { IChartApi, ISeriesApi as _ISeriesApi, SeriesDefinition, SingleValueData as _SingleValueData, CandlestickData as _CandlestickData, BaselineData as _BaselineData, SeriesType, IPaneApi, LineSeriesPartialOptions, BaselineSeriesPartialOptions, CandlestickSeriesPartialOptions, WhitespaceData, DeepPartial, ChartOptions, Time, LineData as _LineData } from './5.0.8/dist/typings' */
/** @import { IChartApi, ISeriesApi as _ISeriesApi, SeriesDefinition, SingleValueData as _SingleValueData, CandlestickData as _CandlestickData, BaselineData as _BaselineData, HistogramData as _HistogramData, SeriesType, IPaneApi, LineSeriesPartialOptions as _LineSeriesPartialOptions, HistogramSeriesPartialOptions as _HistogramSeriesPartialOptions, BaselineSeriesPartialOptions as _BaselineSeriesPartialOptions, CandlestickSeriesPartialOptions as _CandlestickSeriesPartialOptions, WhitespaceData, DeepPartial, ChartOptions, Time, LineData as _LineData } from './5.0.8/dist/typings' */
/**
* @typedef {[number, number, number, number]} OHLCTuple
@@ -13,9 +13,15 @@
*
* @typedef {_ISeriesApi<SeriesType, number>} ISeries
* @typedef {_ISeriesApi<'Candlestick', number>} CandlestickISeries
* @typedef {_ISeriesApi<'Histogram', number>} HistogramISeries
* @typedef {_ISeriesApi<'Line', number>} LineISeries
* @typedef {_ISeriesApi<'Baseline', number>} BaselineISeries
*
* @typedef {_LineSeriesPartialOptions} LineSeriesPartialOptions
* @typedef {_HistogramSeriesPartialOptions} HistogramSeriesPartialOptions
* @typedef {_BaselineSeriesPartialOptions} BaselineSeriesPartialOptions
* @typedef {_CandlestickSeriesPartialOptions} CandlestickSeriesPartialOptions
*
* @typedef {Object} Series
* @property {ISeries} inner
* @property {string} id
@@ -28,27 +34,18 @@
* @typedef {_CandlestickData<number>} CandlestickData
* @typedef {_LineData<number>} LineData
* @typedef {_BaselineData<number>} BaselineData
* @typedef {_HistogramData<number>} HistogramData
*
* @typedef {function({ iseries: ISeries; unit: Unit; index: Index }): void} SetDataCallback
*
* @typedef {Object} CreatePriceLine
* @property {number} value
*
* @typedef {Object} CreatePriceLineOptions
* @property {CreatePriceLine} createPriceLine
*
* @typedef {Partial<CreatePriceLineOptions>} PartialCreatePriceLineOptions
*
* @typedef {LineSeriesPartialOptions & PartialCreatePriceLineOptions} PartialLineStyleOptions
* @typedef {CandlestickSeriesPartialOptions & PartialCreatePriceLineOptions} PartialCandlestickStyleOptions
* @typedef {BaselineSeriesPartialOptions & PartialCreatePriceLineOptions} PartialBaselineStyleOptions
*/
import {
createChart,
CandlestickSeries,
HistogramSeries,
LineSeries,
BaselineSeries,
// } from "./5.0.8/dist/lightweight-charts.standalone.development.mjs";
} from "./5.0.8/dist/lightweight-charts.standalone.production.mjs";
const oklchToRGBA = createOklchToRGBA();
@@ -561,7 +558,7 @@ function createChartElement({
* @param {boolean} [args.defaultActive]
* @param {boolean} [args.inverse]
* @param {SetDataCallback} [args.setDataCallback]
* @param {PartialCandlestickStyleOptions} [args.options]
* @param {CandlestickSeriesPartialOptions} [args.options]
*/
addCandlestickSeries({
vecId,
@@ -573,6 +570,7 @@ function createChartElement({
setDataCallback,
data,
inverse,
options,
}) {
const green = inverse ? colors.red : colors.green;
const red = inverse ? colors.green : colors.red;
@@ -588,6 +586,7 @@ function createChartElement({
wickDownColor: red(),
borderVisible: false,
visible: defaultActive !== false,
...options,
},
paneIndex,
)
@@ -607,6 +606,58 @@ function createChartElement({
vecId,
});
},
/**
* @param {Object} args
* @param {string} args.name
* @param {Unit} args.unit
* @param {number} args.order
* @param {Color} args.color
* @param {VecId} [args.vecId]
* @param {Accessor<HistogramData[]>} [args.data]
* @param {number} [args.paneIndex]
* @param {boolean} [args.defaultActive]
* @param {SetDataCallback} [args.setDataCallback]
* @param {HistogramSeriesPartialOptions} [args.options]
*/
addHistogramSeries({
vecId,
name,
unit,
color,
order,
paneIndex = 0,
defaultActive,
setDataCallback,
data,
options,
}) {
/** @type {HistogramISeries} */
const iseries = /** @type {any} */ (
ichart.addSeries(
/** @type {SeriesDefinition<'Histogram'>} */ (HistogramSeries),
{
color: color(),
visible: defaultActive !== false,
priceLineVisible: false,
},
paneIndex,
)
);
return addSeries({
colors: [color],
iseries,
name,
order,
paneIndex,
seriesType: "Bar",
unit,
data,
setDataCallback,
defaultActive,
vecId,
});
},
/**
* @param {Object} args
* @param {string} args.name
@@ -618,7 +669,7 @@ function createChartElement({
* @param {SetDataCallback} [args.setDataCallback]
* @param {number} [args.paneIndex]
* @param {boolean} [args.defaultActive]
* @param {PartialLineStyleOptions} [args.options]
* @param {LineSeriesPartialOptions} [args.options]
*/
addLineSeries({
vecId,
@@ -649,11 +700,6 @@ function createChartElement({
)
);
const priceLineOptions = options?.createPriceLine;
if (priceLineOptions) {
createPriceLine(iseries, priceLineOptions, colors);
}
return addSeries({
colors: [color],
iseries,
@@ -678,7 +724,7 @@ function createChartElement({
* @param {SetDataCallback} [args.setDataCallback]
* @param {number} [args.paneIndex]
* @param {boolean} [args.defaultActive]
* @param {PartialBaselineStyleOptions} [args.options]
* @param {BaselineSeriesPartialOptions} [args.options]
*/
addBaselineSeries({
vecId,
@@ -701,7 +747,7 @@ function createChartElement({
lineWidth: /** @type {any} */ (1.5),
visible: defaultActive !== false,
baseValue: {
price: options?.createPriceLine?.value ?? 0,
price: options?.baseValue?.price ?? 0,
},
...options,
topLineColor: options?.topLineColor ?? colors.green(),
@@ -717,11 +763,6 @@ function createChartElement({
)
);
const priceLineOptions = options?.createPriceLine;
if (priceLineOptions) {
createPriceLine(iseries, priceLineOptions, colors);
}
return addSeries({
colors: [
() => options?.topLineColor ?? colors.green(),
@@ -761,6 +802,16 @@ function createChartElement({
paneIndex,
order,
});
} else if (blueprint.type === "Histogram") {
chart.addHistogramSeries({
name: blueprint.title,
unit,
color: blueprint.color,
data: blueprint.data,
defaultActive: blueprint.defaultActive,
paneIndex,
order,
});
} else {
chart.addLineSeries({
name: blueprint.title,
@@ -927,21 +978,6 @@ function createLegend({ signals, utils }) {
};
}
/**
* @param {ISeries} series
* @param {DeepPartial<CreatePriceLine>} options
* @param {Colors} colors
*/
function createPriceLine(series, options, colors) {
series.createPriceLine({
price: options.value || 0,
color: colors.gray(),
axisLabelVisible: false,
lineWidth: 1,
lineStyle: 4,
});
}
/**
* @param {number} value
* @param {0 | 2} [digits]
+17 -1
View File
@@ -425,10 +425,26 @@ export function init({
);
break;
}
case "Histogram": {
seriesList.push(
chart.addHistogramSeries({
vecId: blueprint.key,
name: blueprint.title,
unit,
color: blueprint.color,
defaultActive: blueprint.defaultActive,
paneIndex,
options: blueprint.options,
order,
}),
);
break;
}
case "Candlestick": {
throw Error("TODO");
}
default:
case "Line":
case undefined:
seriesList.push(
chart.addLineSeries({
vecId: blueprint.key,
+20 -14
View File
@@ -2,7 +2,7 @@
/**
* @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, AnySeriesBlueprint, SeriesType } from "./options"
* @import { Valued, SingleValueData, CandlestickData, OHLCTuple, Series, ISeries, LineData, BaselineData, PartialLineStyleOptions, PartialBaselineStyleOptions, PartialCandlestickStyleOptions } from "../packages/lightweight-charts/wrapper"
* @import { Valued, SingleValueData, CandlestickData, OHLCTuple, Series, ISeries, HistogramData, LineData, BaselineData, LineSeriesPartialOptions, BaselineSeriesPartialOptions, HistogramSeriesPartialOptions, CandlestickSeriesPartialOptions } from "../packages/lightweight-charts/wrapper"
* @import * as _ from "../packages/leeoniya-ufuzzy/1.0.18/dist/uFuzzy.d.ts"
* @import { SerializedChartableIndex } from "./chart";
* @import { Signal, Signals, Accessor } from "../packages/solidjs-signals/wrapper";
@@ -45,6 +45,7 @@
* "Years" |
* "Locktime" |
* "sat/vB" |
* "%pnl" |
* "constant" |
* "cagr" |
* "vB" |
@@ -53,7 +54,6 @@
* "Epoch" |
* "Height" |
* "Type" |
* "zscore" |
* "Bytes"
* } Unit
*/
@@ -196,12 +196,12 @@ function createUtils() {
createSpanName(name) {
const spanName = window.document.createElement("span");
spanName.classList.add("name");
const [first, second, third] = name.split("-");
const [first, second, third] = name.split(" - ");
spanName.innerHTML = first;
if (second) {
const smallRest = window.document.createElement("small");
smallRest.innerHTML = `${second}`;
smallRest.innerHTML = ` ${second}`;
spanName.append(smallRest);
if (third) {
@@ -776,16 +776,18 @@ function createUtils() {
if (
((!unit || thoroughUnitCheck) &&
(id.endsWith("ratio") ||
(id.includes("ratio") && id.endsWith("sma")) ||
(id.includes("ratio") &&
(id.endsWith("sma") || id.endsWith("zscore"))) ||
id.endsWith("_5sd") ||
id.endsWith("1sd") ||
id.endsWith("2sd") ||
id.endsWith("3sd") ||
id.endsWith("p0_1") ||
id.endsWith("p0_5") ||
id.endsWith("p1") ||
id.endsWith("p99") ||
id.endsWith("p99_5") ||
id.endsWith("p99_9"))) ||
id.endsWith("p2") ||
id.endsWith("p5") ||
id.endsWith("p95") ||
id.endsWith("p98") ||
id.endsWith("p99"))) ||
id.includes("liveliness") ||
id.includes("vaultedness")
) {
@@ -828,10 +830,6 @@ function createUtils() {
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
unit = "performance";
}
if ((!unit || thoroughUnitCheck) && id.endsWith("zscore")) {
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
unit = "zscore";
}
if ((!unit || thoroughUnitCheck) && id.endsWith("locktime")) {
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
unit = "Locktime";
@@ -934,6 +932,14 @@ function createUtils() {
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
unit = "%all";
}
if (
(!unit || thoroughUnitCheck) &&
(id.includes("relative_to_realized_profit") ||
id.includes("relative_to_realized_loss"))
) {
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
unit = "%pnl";
}
if ((!unit || thoroughUnitCheck) && id.endsWith("relative_to_own_supply")) {
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
unit = "%self";
File diff suppressed because it is too large Load Diff