diff --git a/ta_lib/Cargo.lock b/ta_lib/Cargo.lock index 38312d90..e6add65b 100644 --- a/ta_lib/Cargo.lock +++ b/ta_lib/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -19,15 +19,15 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "base" @@ -65,17 +65,11 @@ dependencies = [ "volume", ] -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" - [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "candlestick" @@ -99,9 +93,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "ciborium" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" dependencies = [ "ciborium-io", "ciborium-ll", @@ -110,15 +104,15 @@ dependencies = [ [[package]] name = "ciborium-io" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" [[package]] name = "ciborium-ll" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", "half", @@ -126,18 +120,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstyle", "clap_lex", @@ -145,9 +139,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "confirm" @@ -202,51 +196,40 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.16" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", ] [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] -name = "either" -version = "1.9.0" +name = "crunchy" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "errno" -version = "0.3.8" +name = "either" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "exit" @@ -263,15 +246,19 @@ dependencies = [ [[package]] name = "half" -version = "1.8.2" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "indicator" @@ -285,13 +272,13 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", - "windows-sys 0.48.0", + "libc", + "windows-sys", ] [[package]] @@ -305,51 +292,36 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.151" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" - -[[package]] -name = "linux-raw-sys" -version = "0.4.12" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "momentum" @@ -362,9 +334,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -418,9 +390,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -439,18 +411,18 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "rayon" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -458,9 +430,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -468,9 +440,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -480,9 +452,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -491,28 +463,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "rustix" -version = "0.38.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "same-file" @@ -525,18 +484,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.193" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" dependencies = [ "proc-macro2", "quote", @@ -545,9 +504,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", @@ -579,9 +538,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -648,9 +607,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -658,9 +617,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -668,9 +627,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", @@ -683,9 +642,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -693,9 +652,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", @@ -706,15 +665,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -751,134 +710,75 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.5" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" [[package]] -name = "windows_i686_msvc" -version = "0.48.5" +name = "windows_i686_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/ta_lib/core/src/lib.rs b/ta_lib/core/src/lib.rs index 35327c79..8dd187ff 100644 --- a/ta_lib/core/src/lib.rs +++ b/ta_lib/core/src/lib.rs @@ -13,10 +13,10 @@ mod traits; pub mod prelude { pub use crate::constants::*; - pub use crate::iff; pub use crate::series::Series; pub use crate::smoothing::Smooth; pub use crate::traits::*; + pub use crate::{iff, nz}; } pub use prelude::*; diff --git a/ta_lib/core/src/macros.rs b/ta_lib/core/src/macros.rs index 0898474e..bd442c0a 100644 --- a/ta_lib/core/src/macros.rs +++ b/ta_lib/core/src/macros.rs @@ -13,6 +13,20 @@ macro_rules! iff { }}; } +#[macro_export] +macro_rules! nz { + ($source:expr, $fill:expr) => {{ + $source + .iter() + .zip($fill.iter()) + .map(|(source, fill)| match source { + Some(val) => Some(*val), + _ => *fill, + }) + .collect::>() + }}; +} + #[cfg(test)] mod tests { use crate::{Comparator, Series}; @@ -31,4 +45,16 @@ mod tests { assert_eq!(result, expected); } + + #[test] + fn test_nz() { + let source = Series::from([f32::NAN, 5.0, 4.0, 3.0, 5.0]); + let fill = Series::from([1.0, 0.5, 5.0, 2.0, 8.0]); + + let expected = Series::from([1.0, 5.0, 4.0, 3.0, 5.0]); + + let result = nz!(source, fill); + + assert_eq!(result, expected); + } } diff --git a/ta_lib/core/src/smoothing.rs b/ta_lib/core/src/smoothing.rs index b608dfbb..0e0f7989 100644 --- a/ta_lib/core/src/smoothing.rs +++ b/ta_lib/core/src/smoothing.rs @@ -1,5 +1,5 @@ -use crate::iff; use crate::series::Series; +use crate::{iff, nz}; #[derive(Copy, Clone)] pub enum Smooth { @@ -16,7 +16,7 @@ pub enum Smooth { impl Series { pub fn ew(&self, alpha: &Series, seed: &Series) -> Self { let len = self.len(); - let mut sum = Series::empty(len); + let mut sum = Series::zero(len); for _ in 0..len { let prev = sum.shift(1); @@ -24,7 +24,7 @@ impl Series { sum = iff!( prev.na(), seed, - alpha * self + (1. - alpha) * prev.nz(Some(0.)) + alpha * self + (1. - alpha) * nz!(prev, sum) ) } @@ -56,8 +56,9 @@ impl Series { fn smma(&self, period: usize) -> Self { let alpha = Series::fill(1. / (period as f32), self.len()); + let seed = self.ma(period); - self.ew(&alpha, &self.ma(period)) + self.ew(&alpha, &seed) } fn wma(&self, period: usize) -> Self { diff --git a/ta_lib/indicators/trend/src/ema.rs b/ta_lib/indicators/trend/src/ema.rs index 74227f42..16de440b 100644 --- a/ta_lib/indicators/trend/src/ema.rs +++ b/ta_lib/indicators/trend/src/ema.rs @@ -11,13 +11,12 @@ mod tests { #[test] fn test_ema() { let source = Series::from([ - 6.8575, 6.855, 6.858, 6.86, 6.8480, 6.8575, 6.864, 6.8565, 6.8455, 6.8450, 6.8365, - 6.8310, 6.8355, 6.8360, 6.8345, 6.8285, 6.8395, + 6.5232, 6.5474, 6.5541, 6.5942, 6.5348, 6.4950, 6.5298, 6.5616, 6.5223, 6.5300, 6.5452, + 6.5254, 6.5038, 6.4614, 6.4854, 6.4966, ]); let expected = vec![ - 6.8575, 6.85625, 6.857125, 6.8585625, 6.853281, 6.8553905, 6.8596954, 6.858098, - 6.851799, 6.848399, 6.8424497, 6.8367248, 6.836112, 6.8360558, 6.8352776, 6.8318887, - 6.8356943, + 6.5232, 6.5353003, 6.5447, 6.5694504, 6.552125, 6.5235624, 6.526681, 6.544141, + 6.5332203, 6.5316105, 6.5384054, 6.531903, 6.5178514, 6.489626, 6.487513, 6.492057, ]; let result: Vec = ema(&source, 3).into(); diff --git a/ta_lib/indicators/trend/src/supertrend.rs b/ta_lib/indicators/trend/src/supertrend.rs index 0cee4522..110dfd8b 100644 --- a/ta_lib/indicators/trend/src/supertrend.rs +++ b/ta_lib/indicators/trend/src/supertrend.rs @@ -1,28 +1,37 @@ use core::prelude::*; pub fn supertrend( - hl2: &Series, + source: &Series, close: &Series, atr: &Series, factor: f32, ) -> (Series, Series) { let atr_mul = atr * factor; + let prev_close = close.shift(1); + let len = close.len(); - let mut up = hl2 - &atr_mul; - let mut dn = hl2 + &atr_mul; + let basic_up = source - &atr_mul; + let mut up = Series::zero(len); - let len = hl2.len(); + for _ in 0..len { + let prev_up = nz!(up.shift(1), basic_up); + up = iff!( + basic_up.sgt(&prev_up) | prev_close.slt(&prev_up), + basic_up, + prev_up + ); + } - let mut prev_up = up.shift(1); - let mut prev_dn = dn.shift(1); - - prev_up = iff!(prev_up.na(), up, prev_up); - prev_dn = iff!(prev_dn.na(), dn, prev_dn); + let basic_dn = source + &atr_mul; + let mut dn = Series::zero(len); for _ in 0..len { - let prev_close = close.shift(1); - up = iff!(prev_close.sgt(&prev_up), up.max(&prev_up), up); - dn = iff!(prev_close.slt(&prev_dn), dn.min(&prev_dn), dn); + let prev_dn = nz!(dn.shift(1), basic_dn); + dn = iff!( + basic_dn.slt(&prev_dn) | prev_close.sgt(&prev_dn), + basic_dn, + prev_dn + ); } let mut direction = Series::one(len); @@ -30,24 +39,23 @@ pub fn supertrend( let trend_bear = trend_bull.negate(); for _ in 0..len { - let prev_direction = direction.shift(1); + direction = nz!(direction.shift(1), direction); - direction = iff!(prev_direction.na(), direction, prev_direction); + let cond_bull = direction.seq(&MINUS_ONE) & close.sgt(&dn.shift(1)); + let cond_bear = direction.seq(&ONE) & close.slt(&up.shift(1)); direction = iff!( - direction.seq(&ONE) & close.slt(&prev_up), - trend_bear, - direction - ); - direction = iff!( - direction.seq(&MINUS_ONE) & close.sgt(&prev_dn), + cond_bull, trend_bull, - direction + iff!(cond_bear, trend_bear, direction) ); } - let mut supertrend = iff!(direction.seq(&MINUS_ONE), dn, Series::zero(len)); - supertrend = iff!(direction.seq(&ONE), up, supertrend); + let supertrend = iff!( + direction.seq(&MINUS_ONE), + dn, + iff!(direction.seq(&ONE), up, Series::zero(len)) + ); (direction, supertrend) } @@ -60,19 +68,31 @@ mod tests { #[test] fn test_supertrend() { - let high = Series::from([6.5600, 6.6049, 6.5942, 6.5541, 6.5300, 6.5700, 6.5630]); - let low = Series::from([6.5418, 6.5394, 6.5301, 6.4782, 6.4882, 6.5131, 6.5126]); - let close = Series::from([6.5541, 6.5942, 6.5348, 6.4950, 6.5298, 6.5616, 6.5223]); + let high = Series::from([ + 6.5425, 6.5527, 6.5600, 6.6049, 6.5942, 6.5541, 6.5300, 6.5700, 6.5630, 6.5362, 6.5497, + 6.5480, 6.5325, 6.5065, 6.4866, 6.5536, 6.5142, 6.5294, 6.5543, 6.5563, + ]); + let low = Series::from([ + 6.5156, 6.5195, 6.5418, 6.5394, 6.5301, 6.4782, 6.4882, 6.5131, 6.5126, 6.5184, 6.5206, + 6.5229, 6.4982, 6.4560, 6.4614, 6.4798, 6.4903, 6.5066, 6.5231, 6.5222, + ]); + let close = Series::from([ + 6.5232, 6.5474, 6.5541, 6.5942, 6.5348, 6.4950, 6.5298, 6.5616, 6.5223, 6.5300, 6.5452, + 6.5254, 6.5038, 6.4614, 6.4854, 6.4966, 6.5117, 6.5270, 6.5527, 6.5316, + ]); let hl2 = median_price(&high, &low); - let atr_period = 2; + let atr_period = 3; let atr = atr(&high, &low, &close, Smooth::SMMA, atr_period); let factor = 3.0; let expected_supertrend = vec![ - 6.4963, 6.4963, 6.446601, 6.403225, 6.3497434, 6.376522, 6.3796854, + 6.4483504, 6.4491, 6.4747, 6.4747, 6.4747, 6.4747, 6.4747, 6.4747, 6.4747, 6.4747, + 6.4747, 6.4747, 6.4747, 6.5986347, 6.5774565, 6.5774565, 6.5774565, 6.5774565, + 6.5774565, 6.5774565, ]; let expected_direction = vec![ - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, + -1.0, -1.0, -1.0, -1.0, ]; let (direction, supertrend) = supertrend(&hl2, &close, &atr, factor); @@ -81,7 +101,7 @@ mod tests { assert_eq!(high.len(), low.len()); assert_eq!(high.len(), close.len()); - assert_eq!(result_supertrend, expected_supertrend); assert_eq!(result_direction, expected_direction); + assert_eq!(result_supertrend, expected_supertrend); } } diff --git a/ta_lib/indicators/trend/src/wma.rs b/ta_lib/indicators/trend/src/wma.rs index 8e30e534..f748f778 100644 --- a/ta_lib/indicators/trend/src/wma.rs +++ b/ta_lib/indicators/trend/src/wma.rs @@ -10,21 +10,19 @@ mod tests { #[test] fn test_wma() { - let source = Series::from([1.0, 2.0, 3.0, 4.0, 5.0]); + let source = Series::from([ + 6.5232, 6.5474, 6.5541, 6.5942, 6.5348, 6.4950, 6.5298, 6.5616, 6.5223, 6.5300, 6.5452, + 6.5254, 6.5038, 6.4614, 6.4854, 6.4966, 6.5117, 6.5270, 6.5527, 6.5316, + ]); let period = 3; - let epsilon = 0.001; - let expected = [0.0, 0.0, 2.333333, 3.333333, 4.333333]; + let expected = [ + 0.0, 0.0, 6.5467167, 6.573034, 6.557817, 6.5248, 6.5190334, 6.5399, 6.5366497, + 6.5326996, 6.5363164, 6.5327663, 6.5179005, 6.4862, 6.4804664, 6.487, 6.5022836, + 6.516834, 6.5373, 6.5378666, + ]; let result: Vec = wma(&source, period).into(); - for i in 0..source.len() { - assert!( - (result[i] - expected[i]).abs() < epsilon, - "at position {}: {} != {}", - i, - result[i], - expected[i] - ) - } + assert_eq!(result, expected); } } diff --git a/ta_lib/indicators/volatility/src/atr.rs b/ta_lib/indicators/volatility/src/atr.rs index 547d0fc9..fc7cfd6f 100644 --- a/ta_lib/indicators/volatility/src/atr.rs +++ b/ta_lib/indicators/volatility/src/atr.rs @@ -18,48 +18,35 @@ mod tests { #[test] fn test_atr_smma() { let high = Series::from([ - 6.8430, 6.8660, 6.8685, 6.8690, 6.865, 6.8595, 6.8565, 6.862, 6.859, 6.86, 6.8580, - 6.8605, 6.8620, 6.86, 6.859, 6.8670, 6.8640, 6.8575, 6.8485, 6.8450, 6.8365, 6.84, - 6.8385, 6.8365, 6.8345, 6.8395, + 6.5600, 6.6049, 6.5942, 6.5541, 6.5300, 6.5700, 6.5630, 6.5362, 6.5497, 6.5480, 6.5325, + 6.5065, 6.4866, 6.5536, 6.5142, 6.5294, ]); let low = Series::from([ - 6.8380, 6.8430, 6.8595, 6.8640, 6.8435, 6.8445, 6.8510, 6.8560, 6.8520, 6.8530, 6.8550, - 6.8550, 6.8565, 6.8475, 6.8480, 6.8535, 6.8565, 6.8455, 6.8445, 6.8365, 6.8310, 6.8310, - 6.8345, 6.8325, 6.8275, 6.8285, + 6.5418, 6.5394, 6.5301, 6.4782, 6.4882, 6.5131, 6.5126, 6.5184, 6.5206, 6.5229, 6.4982, + 6.4560, 6.4614, 6.4798, 6.4903, 6.5066, ]); let close = Series::from([ - 6.6430, 6.8595, 6.8680, 6.8650, 6.8445, 6.8560, 6.8565, 6.8590, 6.8530, 6.8575, 6.855, - 6.858, 6.86, 6.8480, 6.8575, 6.864, 6.8565, 6.8455, 6.8450, 6.8365, 6.8310, 6.8355, - 6.8360, 6.8345, 6.8285, 6.8395, + 6.5541, 6.5942, 6.5348, 6.4950, 6.5298, 6.5616, 6.5223, 6.5300, 6.5452, 6.5254, 6.5038, + 6.4614, 6.4854, 6.4966, 6.5117, 6.5270, ]); let period = 3; let expected = [ - 0.0050001144, - 0.07766677, - 0.054777943, - 0.038185332, - 0.032623433, - 0.02674891, - 0.019666044, - 0.01511071, - 0.01240713, - 0.010604743, - 0.0080697555, - 0.0072131166, - 0.006642024, - 0.008594777, - 0.00939657, - 0.010764452, - 0.009676199, - 0.010450827, - 0.008300454, - 0.008366844, - 0.007411334, - 0.00794099, - 0.0066273883, - 0.0057516545, - 0.006167759, - 0.007778558, + 0.01819992, + 0.03396654, + 0.044011116, + 0.05464077, + 0.05036052, + 0.05254035, + 0.051826984, + 0.040484603, + 0.036689714, + 0.032826394, + 0.033317544, + 0.039045, + 0.03442996, + 0.047553174, + 0.03966879, + 0.03404585, ]; let result: Vec = atr(&high, &low, &close, Smooth::SMMA, period).into(); diff --git a/ta_lib/indicators/volatility/src/tr.rs b/ta_lib/indicators/volatility/src/tr.rs index 50bd14a9..9e499a50 100644 --- a/ta_lib/indicators/volatility/src/tr.rs +++ b/ta_lib/indicators/volatility/src/tr.rs @@ -8,7 +8,7 @@ pub fn tr(high: &Series, low: &Series, close: &Series) -> Series< high.shift(1).na(), diff, diff.max(&(high - &prev_close).abs()) - .max(&(low.negate() + &prev_close).abs()) + .max(&(low - &prev_close).abs()) ) } @@ -18,10 +18,36 @@ mod tests { #[test] fn test_true_range() { - let high = Series::from([50.0, 60.0, 55.0, 70.0]); - let low = Series::from([40.0, 50.0, 45.0, 60.0]); - let close = Series::from([45.0, 55.0, 50.0, 65.0]); - let expected = vec![10.0, 15.0, 10.0, 20.0]; + let high = Series::from([ + 6.5600, 6.6049, 6.5942, 6.5541, 6.5300, 6.5700, 6.5630, 6.5362, 6.5497, 6.5480, 6.5325, + 6.5065, 6.4866, 6.5536, 6.5142, 6.5294, + ]); + let low = Series::from([ + 6.5418, 6.5394, 6.5301, 6.4782, 6.4882, 6.5131, 6.5126, 6.5184, 6.5206, 6.5229, 6.4982, + 6.4560, 6.4614, 6.4798, 6.4903, 6.5066, + ]); + let close = Series::from([ + 6.5541, 6.5942, 6.5348, 6.4950, 6.5298, 6.5616, 6.5223, 6.5300, 6.5452, 6.5254, 6.5038, + 6.4614, 6.4854, 6.4966, 6.5117, 6.5270, + ]); + let expected = vec![ + 0.01819992, + 0.06549978, + 0.064100266, + 0.07590008, + 0.041800022, + 0.056900024, + 0.050400257, + 0.017799854, + 0.029099941, + 0.025099754, + 0.03429985, + 0.050499916, + 0.02519989, + 0.07379961, + 0.023900032, + 0.022799969, + ]; let result: Vec = tr(&high, &low, &close).into(); diff --git a/ta_lib/strategies/signal/src/flip/supertrend_flip.rs b/ta_lib/strategies/signal/src/flip/supertrend_flip.rs index be9a11c9..dc5686d1 100644 --- a/ta_lib/strategies/signal/src/flip/supertrend_flip.rs +++ b/ta_lib/strategies/signal/src/flip/supertrend_flip.rs @@ -29,6 +29,6 @@ impl Signal for SupertrendFlipSignal { self.factor, ); - (direction.cross_under(&ZERO), direction.cross_over(&ZERO)) + (direction.cross_over(&ZERO), direction.cross_under(&ZERO)) } }